Добрый день.
Я занимаюсь автоматизацией тестирования и решил использовать cs cart как мишень для своих тестов.
Я скачал бесплатную версию для разработчиков и развернул локально без каких-либо проблем, но позже решил упаковать всё в докер и разворачивать в контейнере (не спрашивайте) и вот тут у меня возникли проблемы: при открытии главной страницы после установки получаю 500 ошибку, а в логах апача следующее:
error.log
[Sun Feb 05 23:32:08.342916 2023] [php:warn] [pid 644] [client 172.17.0.1:60734] PHP Warning: mysqli::__construct(): (HY000/2002): Permission denied in /var/www/cms/app/Tygh/Backend/Database/Mysqli.php on line 48
[Sun Feb 05 23:32:08.343328 2023] [php:notice] [pid 644] [client 172.17.0.1:60734] Tygh\\Exceptions\\DatabaseException: Cannot connect to the database server in /var/www/cms/app/Tygh/Providers/DatabaseProvider.php:49\nStack trace:\n#0 /var/www/cms/app/lib/vendor/pimple/pimple/src/Pimple/Container.php(118): Tygh\\Providers\\DatabaseProvider->Tygh\\Providers\\{closure}()\n#1 /var/www/cms/app/Tygh/Application.php(135): Pimple\\Container->offsetGet()\n#2 /var/www/cms/app/functions/fn.database.php(85): Tygh\\Application->offsetGet()\n#3 /var/www/cms/app/functions/fn.init.php(1147): db_get_fields()\n#4 /var/www/cms/app/Tygh/Registry.php(800): {closure}()\n#5 /var/www/cms/app/functions/fn.init.php(1149): Tygh\\Registry::getOrSetCache()\n#6 /var/www/cms/app/functions/fn.init.php(1221): fn_init_unmanaged_addons()\n#7 /var/www/cms/init.php(189): fn_init()\n#8 /var/www/cms/index.php(24): require('...')\n#9 {main}
Запускаю установку через консоль с помощью php index.php. При этом база данных успешно создается и наполняется тестовыми данными. Так что доступ к базе есть. config.php выглядит так:
config.php
<?php
/***************************************************************************
* *
* (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev *
* *
* This is commercial software, only users who have purchased a valid *
* license and accept to the terms of the License Agreement can install *
* and use this program. *
* *
****************************************************************************
* PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
****************************************************************************/
return array(
// Add-on names to be installed
// If empty will be installed only addons included by default
'addons' => array(),
'cart_settings' => array (
'email' => 'example@gmail.com',
'password' => 'admin',
'secret_key' => 'YOURVERYSECRETCEY',
'languages' => array (
'en',
),
'main_language' => 'en',
'demo_catalog' => true,
'theme_name' => 'bright_theme',
'license_number' => 'CART-1111-1111-1111-1111'
),
'database_settings' => array(
'host' => 'localhost',
'name' => 'cms',
'user' => 'root',
'password' => '',
'table_prefix' => 'cscart_',
'database_backend' => 'mysqli',
'notify' => false,
'allow_override' => 'Y',
),
'server_settings' => array (
'http_host' => 'localhost',
'http_path' => '',
'https_host' => 'localhost',
'https_path' => '',
'correct_permissions' => true,
),
);
При сборке открываю только 80 порт. Прикладываю содержимое Dockerfile и моего файла cms.conf для настройки апача - может быть у кого-то есть идеи почему так может происходить. По идее все права на все папки в /var/www/ я выдал.
И заранее извиняюсь если вопрос глупый, но как я и написал - я не разработчик.
Dockerfile
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get -y update && \
apt-get -y upgrade && \
apt-get -y install sudo tzdata systemctl php mysql-server apache2 mc && \
apt-get -y install libapache2-mod-php php-soap php-mysqli php-curl php-redis \
php-sockets php-imagick php-xml php-mbstring php-zip && \
useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo
COPY data /var/www/cms
COPY confs/cms.conf /etc/apache2/sites-available
RUN sudo chown -R $USER:$USER /var/www/cms && \
sudo chmod -R 777 /var/www/* && \
sudo a2ensite cms.conf && \
sudo a2dissite 000-default.conf && \
sudo service mysql restart && sudo systemctl restart apache2
EXPOSE 80
cms.conf
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName localhost
ServerAdmin kozlovevgenii93@gmail.com
DocumentRoot /var/www/cms
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet