├── .env.example ├── README.md ├── containers ├── mysql │ ├── Dockerfile │ ├── drop_all_tables.sql │ └── my.cnf ├── nginx │ ├── Dockerfile │ └── conf │ │ ├── conf.d │ │ ├── default.conf │ │ ├── rtc-im.conf │ │ └── upstream.conf │ │ ├── nginx.conf │ │ └── push_site.conf ├── php │ ├── Dockerfile │ └── conf │ │ ├── bitrix.ini │ │ └── www.conf └── push │ ├── Dockerfile │ └── push_config.toml ├── data ├── mysql │ └── .gitignore └── sessions │ └── .gitignore ├── dctl.sh ├── docker-compose.yml ├── down.sh ├── logs ├── .gitkeep ├── mysql │ └── .gitignore ├── nginx │ └── .gitignore └── php │ └── .gitignore ├── rebuild.sh ├── src └── example.mp4 ├── up.sh └── www ├── bitrix └── php_interface │ └── dbconn.php ├── index.php └── restore.php /.env.example: -------------------------------------------------------------------------------- 1 | PROJECT_PREFIX=project 2 | APP_ENV=test 3 | HTTP_PORT=80 4 | 5 | # MySQL settings 6 | MYSQL_HOST=mysql 7 | MYSQL_DATABASE=dev 8 | MYSQL_USER=dev 9 | MYSQL_PASSWORD=dev 10 | 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # docker-bitrix24 2 | 3 | Набор __docker__ контейнеров и утилит для работы с __bitrix24__. 4 | 5 | ## Getting started 6 | 7 | ### 1. Клонирование репозитория в директорию с проектами 8 | 9 | ```bash 10 | $ cd ~/projects 11 | $ git clone https://github.com/aclips/bitrix24-docker 12 | 13 | # Переименование директории проекта 14 | $ mv ./bitrix24-docker project_name 15 | 16 | # Альтернативный вариант (чтобы не делать каждый раз git clone): 17 | $ cp -R ./bitrix24-docker project_name 18 | ``` 19 | 20 | ### 2. Настройка 21 | 22 | После копирования проекта дополнительно нужно сконфигурировать: `.env`-файл проекта и настройки push-сервера. 23 | 24 | #### 2.1 .env файл 25 | 26 | Перед стартом проекта необходимо выполнить команду `./dctl.sh make:env`, который создаст `.env`-файл по шаблону. 27 | Можно не пользоваться этой утилитой, а вручную скопировать `.env.example` в `.env` и отредактировать его 28 | 29 | #### 2.2 push-сервер 30 | 31 | Для того чтобы подключить в своем проекте локальный push-сервер на технологии websocket при развороте сконифгурировать необходимые параметры в конфигурационном файле. 32 | Конфигурационный файл находится в `./containers/push/push_config.toml`. 33 | 34 | Нужно сконфигурировать `security`-раздел: 35 | Либо __выключить__ проверку подписи (`enabled = false`) 36 | Либо в `key` задать ключ, который в последствии будет использоваться в настройка модуля "Push'n'pull" Битрикс24. 37 | Дополнительные настройки см в п.7 инструкции. 38 | 39 | https://github.com/gromdron/bitrix-push-workspace 40 | 41 | ### 3. Запуск контейнеров 42 | 43 | Для запуска сборки необходимо использовать один из следующих вариантов запуска: 44 | 45 | Вместо стандартного запуска контейнеров через ```docker-compose up``` можно исполнять файл ```up.sh``` 46 | 47 | ```bash 48 | $ sudo ./up.sh 49 | ``` 50 | 51 | Альтернативный вариант: использовать команду `sudo ./dctl.sh up silent` 52 | 53 | После успешного запуска по адресу __project.localhost__, указанному в *[пт 2.2] docker-compose.yml*, будет отображаться 54 | содержимое директории *./www* 55 | 56 | > Перед запуском нужно убедиться что выключены другие контейнеры и службы, слушающие порт 80 57 | 58 | ![](./src/example.mp4) 59 | 60 | ### 4. Остановка контейнеров 61 | 62 | Для остановки контейнеров можно выполнить файл ```down.sh```. 63 | 64 | ```bash 65 | $ sudo ./down.sh 66 | ``` 67 | Альтернативный вариант: использовать команду `sudo ./dctl.sh down` 68 | 69 | 70 | ### 5. Контроллер dctl.sh 71 | __dctl.sh__ - скрипт предоставляющий доступ к часто используемым сценариям. 72 | 73 | #### 5.1 Список команд 74 | 75 | ``` 76 | make env - copy .env.example to .env 77 | make db - load init bitrix database dump to mysql 78 | db import FILE - load FILE to mysql 79 | db renew - load dump from repo, fresh db and apply 80 | db - run db cli 81 | db export > file.sql - export db to file 82 | build - make docker build 83 | up - docker up in console 84 | up silent - docker up daemon 85 | down - docker down 86 | run - run in php container from project root 87 | test - run tests 88 | cli some_command - run scripts/cli.php some_command (migration, etc) 89 | cept some_command (cept generate:cept acceptance Test) - run codeception with params 90 | ``` 91 | 92 | ### 6. Проблемы совместимости 93 | 94 | > При использовании продукции от Apple на M1 Chip __mysql:5.7__ нужно заменить на __mariadb:10.5__ 95 | > 96 | > __Файл__ *./containers/mysql/Dockerfile* FROM mysql:5.7 > FROM mariadb:10.5 97 | 98 | ### 7. Настройки push-сервера 99 | 100 | После запуска проекта необходимо закончить настройку push-сервера. 101 | 102 | `На сервер установлена: Виртуальная машина 7.3 и новее (Bitrix Push server 2.0) ` 103 | `Путь для публикации команд: http://push:9099/bitrix/pub/` 104 | `Код-подпись для взаимодействия с сервером: <из push_config.toml>` 105 | 106 | >В случае если в `push_config.toml` в разделе `[security]` указано `enabled = false` то не важно что указано к "код-подпись" - все равно не проверяется. 107 | 108 | ### 8. Настройки Xdebug 109 | 110 | Перед запуском проекта необходимо выполнить настройку PHPStorm. 111 | 112 | #### 8.1 Установка плагинов 113 | 114 | В настройках PHPStorm (File -> Settings) перейти в раздел Plugins. Проверить, что плагины `Docker` и `PHP Docker` 115 | установлены и активированы. 116 | 117 | #### 8.2 Добавление Docker сервера 118 | 119 | В настройках PHPStorm перейти в раздел Build, Execution, Deployment -> Docker. Добавить 120 | подключение к Docker нажав `+`. Оставить настройки по умолчанию. 121 | 122 | #### 8.3 Добавление внешнего интерпретатора 123 | 124 | В настройках перейти в раздел PHP, нажать `...` справа от настройки CLI Interpreter. В открывшемся окне CLI 125 | Interpreters нажать `+`, (выбрать `From Docker, Vagrant...`). В разделе `Lifecycle` выбрать 126 | пункт `Connect to existing container`. Сохранить и выбрать созданный интерпретатор. 127 | 128 | #### 8.4 Добавление PHP сервера 129 | 130 | В настройках перейти в раздел PHP -> Servers, нажать `+` для добавления сервера. В настройках сервера указать 131 | хост `127.0.0.1`, порт `80`. Выбрать пункт `Use path mappings`, установить соответствие папок `www` 132 | и `/home/bitrix/www`. После создания сервера открыть `docker-compose.yml`. заменить serverName в 133 | строке `PHP_IDE_CONFIG: serverName=serverName` на имя созданного сервера. 134 | 135 | #### 8.5 Настройка Xdebug. 136 | 137 | В настройках перейти в раздел PHP -> Debug. Во вкладке Xdebug указать порт `9001`. 138 | 139 | #### 8.6 Добавление конфигурации. 140 | 141 | В настройках конфигураций (Run -> Edit configurations) нажать `+`. В открывшемся списке выбрать `PHP Remote Debug`. 142 | Отметить пункт `Filter debug connection by IDE key`. При создании конфигурации выбрать ранее созданный 143 | сервер (п. 3), в поле `IDE key` указать `PHPSTORM`. 144 | 145 | #### 8.7 Установка расширения 146 | 147 | Установить 148 | расширение ([пример для Firefox](https://addons.mozilla.org/ru/firefox/addon/xdebug-helper-for-firefox/?utm_source=addons.mozilla.org&utm_medium=referral&utm_content=search)). 149 | Перейти в настройки расширения, в разделе `IDE key` выбрать `PHPSTORM`. Включить расширение. 150 | 151 | #### 8.8 Отладка 152 | 153 | В правом верхнем углу запустить прослушивание (Start listening for PHP Debug Connections), расставить брейкпоинты, 154 | открыть страницу в браузере. 155 | 156 | #### 8.9 Проблемы совместимости 157 | 158 | > При установленном PHP версии меньше 8.0 заменить `xdebug` в Dockerfile на `xdebug-3.1.6`. 159 | 160 | > Посмотреть ошибки подключения можно вызвав функцию `xdebug_info()`. 161 | 162 | > Если после выполнения всех пунктов дебаг не работает, возможно Firewall блокирует соединение. В таком случае, можно открыть порт (`sudo ufw allow 9001` в Ubuntu). -------------------------------------------------------------------------------- /containers/mysql/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mysql:5.7 2 | 3 | ARG USER_ID='1000' 4 | ARG USER_ID=${USER_ID} 5 | ENV USER_ID ${USER_ID} 6 | 7 | ARG GROUP_ID='1000' 8 | ARG GROUP_ID=${GROUP_ID} 9 | ENV GROUP_ID ${GROUP_ID} 10 | 11 | 12 | ADD my.cnf /etc/mysql/conf.d/my.cnf 13 | 14 | RUN groupmod -g $USER_ID mysql 15 | RUN usermod -u $USER_ID mysql 16 | 17 | CMD ["mysqld", "--character-set-server=utf8", "--collation-server=utf8_unicode_ci"] 18 | 19 | EXPOSE 3306 20 | -------------------------------------------------------------------------------- /containers/mysql/drop_all_tables.sql: -------------------------------------------------------------------------------- 1 | SET FOREIGN_KEY_CHECKS = 0; 2 | SET GROUP_CONCAT_MAX_LEN=32768; 3 | SET @tables = NULL; 4 | SELECT GROUP_CONCAT('`', table_name, '`') INTO @tables 5 | FROM information_schema.tables 6 | WHERE table_schema = (SELECT DATABASE()); 7 | SELECT IFNULL(@tables,'dummy') INTO @tables; 8 | 9 | SET @tables = CONCAT('DROP TABLE IF EXISTS ', @tables); 10 | PREPARE stmt FROM @tables; 11 | EXECUTE stmt; 12 | DEALLOCATE PREPARE stmt; 13 | SET FOREIGN_KEY_CHECKS = 1; 14 | -------------------------------------------------------------------------------- /containers/mysql/my.cnf: -------------------------------------------------------------------------------- 1 | [mysqld] 2 | default-time-zone="+03:00" 3 | innodb_file_per_table=1 4 | innodb_log_file_size=512M 5 | innodb_flush_log_at_trx_commit=2 6 | innodb_strict_mode=0 7 | sync_binlog=0 8 | # Try to replace O_DIRECT by O_DSYNC if you have "Operating system error number 22" 9 | innodb_flush_method=O_DIRECT 10 | transaction-isolation=READ-COMMITTED 11 | binlog_cache_size=0 12 | sql_mode="" 13 | #socket=/var/run/mysqld/mysqld.sock 14 | #skip-networking 15 | max_allowed_packet=512M 16 | -------------------------------------------------------------------------------- /containers/nginx/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginx:1.23.3-alpine-slim 2 | 3 | ARG APP_ENV='prod' 4 | ENV APP_ENV ${APP_ENV} 5 | 6 | ARG USER_ID='1000' 7 | ENV USER_ID ${USER_ID} 8 | 9 | ARG GROUP_ID='1000' 10 | ENV GROUP_ID ${GROUP_ID} 11 | 12 | ARG PROJECT_PREFIX='project' 13 | ENV PROJECT_PREFIX=${PROJECT_PREFIX} 14 | 15 | RUN apk --no-cache add shadow \ 16 | && groupmod -g $USER_ID nginx \ 17 | && usermod -u $USER_ID nginx 18 | 19 | COPY ["conf/nginx.conf", "conf/push_site.conf", "/etc/nginx/"] 20 | COPY conf/conf.d/* /etc/nginx/conf.d/ 21 | 22 | RUN sed -i "s/#PROJECT_PREFIX#/${PROJECT_PREFIX}/g" /etc/nginx/conf.d/default.conf 23 | 24 | EXPOSE 80 25 | 26 | STOPSIGNAL SIGTERM 27 | 28 | CMD ["nginx", "-g", "daemon off;"] 29 | -------------------------------------------------------------------------------- /containers/nginx/conf/conf.d/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | 3 | listen 80 default; 4 | server_name #PROJECT_PREFIX#.localhost; 5 | server_name_in_redirect off; 6 | 7 | access_log /var/log/nginx/bitrix-access.log; 8 | error_log /var/log/nginx/bitrix-error.log; 9 | 10 | proxy_set_header X-Real-IP $remote_addr; 11 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 12 | proxy_set_header Host $host:80; 13 | 14 | set $proxyserver "http://push-upstream"; 15 | set $docroot "/home/bitrix/www"; 16 | 17 | index index.php; 18 | root /home/bitrix/www; 19 | 20 | # Include push-config 21 | include push_site.conf; 22 | 23 | if (!-e $request_filename) { 24 | rewrite ^(.*)$ /bitrix/urlrewrite.php last; 25 | } 26 | 27 | # Player options, disable no-sniff 28 | location ~* ^/bitrix/components/bitrix/player/mediaplayer/player$ { 29 | add_header Access-Control-Allow-Origin *; 30 | } 31 | 32 | location ~ \.php$ { 33 | include fastcgi_params; 34 | fastcgi_pass php-upstream; 35 | fastcgi_index index.php; 36 | fastcgi_intercept_errors on; 37 | fastcgi_send_timeout 21600; 38 | fastcgi_read_timeout 21600; 39 | fastcgi_param SERVER_PORT 80; 40 | fastcgi_param HTTPS Off; 41 | fastcgi_param DOCUMENT_ROOT $document_root; 42 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 43 | } 44 | 45 | location = /favicon.png { 46 | log_not_found off; 47 | access_log off; 48 | } 49 | 50 | location = /robots.txt { 51 | log_not_found off; 52 | access_log off; 53 | } 54 | 55 | location ~* ^.+\.(jpe?g|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|eot|otf|ttf|woff|woff2)$ { 56 | log_not_found off; 57 | access_log off; 58 | expires 30d; 59 | add_header Cache-Control public; 60 | } 61 | 62 | location ~ (/.git/|/bitrix/modules|/upload/support/not_image|/bitrix/php_interface|local/modules|local/php_interface) { 63 | deny all; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /containers/nginx/conf/conf.d/rtc-im.conf: -------------------------------------------------------------------------------- 1 | log_format simple '$time_local $status $request'; 2 | 3 | # if connection ti not set 4 | map $http_upgrade $connection_upgrade { 5 | default upgrade; 6 | '' 'close'; 7 | } 8 | 9 | map $http_upgrade $replace_upgrade { 10 | default $http_upgrade; 11 | '' "websocket"; 12 | } 13 | 14 | upstream push-upstream { 15 | ip_hash; 16 | keepalive 1024; 17 | server push:9099; 18 | } -------------------------------------------------------------------------------- /containers/nginx/conf/conf.d/upstream.conf: -------------------------------------------------------------------------------- 1 | upstream php-upstream { 2 | server php:9000; 3 | } -------------------------------------------------------------------------------- /containers/nginx/conf/nginx.conf: -------------------------------------------------------------------------------- 1 | user nginx; 2 | worker_processes auto; 3 | error_log /var/log/nginx/error.log warn; 4 | pid /var/run/nginx.pid; 5 | 6 | events { 7 | use epoll; 8 | multi_accept on; 9 | worker_connections 2048; 10 | } 11 | 12 | http { 13 | 14 | include /etc/nginx/mime.types; 15 | default_type application/force-download; 16 | 17 | # Supported log formats 18 | log_format postdata '$remote_addr - $remote_user [$time_local] "$request" $status $bytes_sent "$http_referer" "$http_user_agent" "$request_body"'; 19 | 20 | proxy_redirect ~^http://([^:]+):443(/.+)$ https://$1$2; 21 | 22 | # settings files 23 | 24 | server_tokens off; 25 | 26 | # Disable request logging in nginx by default 27 | #access_log /var/log/nginx/access.log postdata; 28 | access_log off; 29 | error_log on; 30 | 31 | sendfile on; 32 | tcp_nopush on; 33 | tcp_nodelay on; 34 | 35 | client_max_body_size 1024m; 36 | client_body_buffer_size 4m; 37 | 38 | 39 | # Content compression parameters 40 | gzip on; 41 | gzip_proxied any; 42 | gzip_static on; 43 | gzip_http_version 1.0; 44 | gzip_types application/x-javascript application/javascript text/css; 45 | 46 | add_header "X-Content-Type-Options" "nosniff"; 47 | add_header X-Frame-Options SAMEORIGIN; 48 | 49 | open_file_cache max=1000 inactive=30s; 50 | 51 | include /etc/nginx/conf.d/*.conf; 52 | } 53 | -------------------------------------------------------------------------------- /containers/nginx/conf/push_site.conf: -------------------------------------------------------------------------------- 1 | location ~* ^/bitrix/subws/ { 2 | error_log /var/log/nginx/im_error.log warn; 3 | 4 | proxy_pass http://push-upstream; 5 | # http://blog.martinfjordvald.com/2013/02/websockets-in-nginx/ 6 | # 12h+0.5 7 | proxy_max_temp_file_size 0; 8 | proxy_read_timeout 43800; 9 | proxy_http_version 1.1; 10 | proxy_set_header Upgrade $replace_upgrade; 11 | proxy_set_header Connection $connection_upgrade; 12 | } 13 | 14 | location ~* ^/bitrix/sub/ { 15 | error_log /var/log/nginx/im_error.log warn; 16 | 17 | rewrite ^/bitrix/sub/(.*)$ /bitrix/subws/$1 break; 18 | proxy_pass http://push-upstream; 19 | proxy_max_temp_file_size 0; 20 | proxy_read_timeout 43800; 21 | } 22 | 23 | location ~* ^/bitrix/rest/ { 24 | error_log /var/log/nginx/im_error.log warn; 25 | 26 | proxy_pass http://push-upstream; 27 | proxy_max_temp_file_size 0; 28 | proxy_read_timeout 43800; 29 | } -------------------------------------------------------------------------------- /containers/php/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.1-fpm 2 | 3 | ARG USER='1000' 4 | ARG USER=${USER_ID} 5 | ENV USER ${USER_ID} 6 | 7 | ARG GROUP='1000' 8 | ARG GROUP=${GROUP_ID} 9 | ENV GROUP ${GROUP_ID} 10 | 11 | ARG PROJECT_PREFIX='develop' 12 | ARG PROJECT_PREFIX=${PROJECT_PREFIX} 13 | ENV PROJECT_PREFIX=${PROJECT_PREFIX} 14 | 15 | COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/ 16 | 17 | RUN pecl install xdebug && docker-php-ext-enable xdebug 18 | 19 | RUN apt-get update && apt-get install -y --no-install-recommends \ 20 | libfreetype6-dev \ 21 | libjpeg62-turbo-dev \ 22 | libpng-dev \ 23 | curl \ 24 | bash \ 25 | && install-php-extensions memcache \ 26 | && docker-php-ext-enable memcache \ 27 | && docker-php-ext-configure gd --with-freetype --with-jpeg \ 28 | && docker-php-ext-install -j$(nproc) gd \ 29 | && docker-php-ext-configure opcache --enable-opcache \ 30 | && docker-php-ext-install opcache \ 31 | && docker-php-ext-install mysqli \ 32 | && install-php-extensions ldap \ 33 | && install-php-extensions zip \ 34 | && install-php-extensions exif \ 35 | && install-php-extensions soap 36 | 37 | ADD ./conf/bitrix.ini "/usr/local/etc/php/conf.d/bitrix.ini" 38 | ADD ./conf/www.conf "/usr/local/etc/php-fpm.d/www.conf" 39 | 40 | WORKDIR /home/bitrix/www 41 | 42 | EXPOSE 9000 -------------------------------------------------------------------------------- /containers/php/conf/bitrix.ini: -------------------------------------------------------------------------------- 1 | [php] 2 | short_open_tag = On 3 | display_errors = On 4 | error_log = "/var/log/php/error.log" 5 | error_reporting = E_ALL 6 | log_errors = On 7 | display_startup_errors = On 8 | cgi.fix_pathinfo = 0 9 | date.timezone = "Europe/Moscow" 10 | max_input_vars = 10000 11 | post_max_size = 1024M 12 | upload_max_filesize = 1024M 13 | memory_limit = 5G 14 | upload_tmp_dir = /tmp 15 | [session] 16 | session.save_handler = memcache 17 | session.save_path = "tcp://memcached:11211" 18 | [opcache] 19 | opcache.revalidate_freq = 0 20 | opcache.validate_timestamps = 1 21 | opcache.max_accelerated_files = 100000 22 | opcache.memory_consumption = 512 23 | opcache.interned_strings_buffer = 64 24 | opcache.fast_shutdown = 1 25 | opcache.error_log = "/var/log/php/opcache.log" 26 | [xdebug] 27 | xdebug.client_port = 9001 28 | xdebug.mode = debug 29 | xdebug.remote_handler = dbgp 30 | xdebug.max_nesting_level = 250 31 | xdebug.discover_client_host = 1 32 | xdebug.idekey = PHPSTORM 33 | xdebug.client_host = host.docker.internal 34 | 35 | ;[MySQL] 36 | ;mysql.default_socket=/var/run/mysqld/mysqld.sock 37 | ;[MySQLi] 38 | ;mysqli.default_socket=/var/run/mysqld/mysqld.sock 39 | ;[Pdo_mysql] 40 | ;pdo_mysql.default_socket=/var/run/mysqld/mysqld.sock -------------------------------------------------------------------------------- /containers/php/conf/www.conf: -------------------------------------------------------------------------------- 1 | [global] 2 | ; Override default pid file 3 | pid = /run/php-fpm.pid 4 | 5 | ; Avoid logs being sent to syslog 6 | error_log = /proc/self/fd/2 7 | 8 | 9 | ; Start a new pool named 'www'. 10 | ; the variable $pool can be used in any directive and will be replaced by the 11 | ; pool name ('www' here) 12 | [www] 13 | 14 | ; Redirect logs to stdout - FPM closes /dev/std* on startup 15 | access.log = /proc/self/fd/2 16 | catch_workers_output = yes 17 | 18 | ; Required to allow config-by-environment 19 | clear_env = no 20 | 21 | 22 | 23 | ; Per pool prefix 24 | ; It only applies on the following directives: 25 | ; - 'access.log' 26 | ; - 'slowlog' 27 | ; - 'listen' (unixsocket) 28 | ; - 'chroot' 29 | ; - 'chdir' 30 | ; - 'php_values' 31 | ; - 'php_admin_values' 32 | ; When not set, the global prefix (or /usr) applies instead. 33 | ; Note: This directive can also be relative to the global prefix. 34 | ; Default Value: none 35 | ;prefix = /path/to/pools/$pool 36 | 37 | ; Unix user/group of processes 38 | ; Note: The user is mandatory. If the group is not set, the default user's group 39 | ; will be used. 40 | user = 1000 41 | group = 1000 42 | 43 | ; The address on which to accept FastCGI requests. 44 | ; Valid syntaxes are: 45 | ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on 46 | ; a specific port; 47 | ; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on 48 | ; a specific port; 49 | ; 'port' - to listen on a TCP socket to all addresses 50 | ; (IPv6 and IPv4-mapped) on a specific port; 51 | ; '/path/to/unix/socket' - to listen on a unix socket. 52 | ; Note: This value is mandatory. 53 | listen = 9000 54 | 55 | ; Set listen(2) backlog. 56 | ; Default Value: 511 (-1 on FreeBSD and OpenBSD) 57 | ;listen.backlog = 511 58 | 59 | ; Set permissions for unix socket, if one is used. In Linux, read/write 60 | ; permissions must be set in order to allow connections from a web server. Many 61 | ; BSD-derived systems allow connections regardless of permissions. 62 | ; Default Values: user and group are set as the running user 63 | ; mode is set to 0660 64 | listen.owner = #USER# 65 | listen.group = #USER# 66 | ;listen.mode = 0660 67 | ; When POSIX Access Control Lists are supported you can set them using 68 | ; these options, value is a comma separated list of user/group names. 69 | ; When set, listen.owner and listen.group are ignored 70 | ;listen.acl_users = 71 | ;listen.acl_groups = 72 | 73 | ; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect. 74 | ; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original 75 | ; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address 76 | ; must be separated by a comma. If this value is left blank, connections will be 77 | ; accepted from any ip address. 78 | ; Default Value: any 79 | ;listen.allowed_clients = 127.0.0.1 80 | 81 | ; Specify the nice(2) priority to apply to the pool processes (only if set) 82 | ; The value can vary from -19 (highest priority) to 20 (lower priority) 83 | ; Note: - It will only work if the FPM master process is launched as root 84 | ; - The pool processes will inherit the master process priority 85 | ; unless it specified otherwise 86 | ; Default Value: no set 87 | ; process.priority = -19 88 | 89 | ; Set the process dumpable flag (PR_SET_DUMPABLE prctl) even if the process user 90 | ; or group is differrent than the master process user. It allows to create process 91 | ; core dump and ptrace the process for the pool user. 92 | ; Default Value: no 93 | ; process.dumpable = yes 94 | 95 | ; Choose how the process manager will control the number of child processes. 96 | ; Possible Values: 97 | ; static - a fixed number (pm.max_children) of child processes; 98 | ; dynamic - the number of child processes are set dynamically based on the 99 | ; following directives. With this process management, there will be 100 | ; always at least 1 children. 101 | ; pm.max_children - the maximum number of children that can 102 | ; be alive at the same time. 103 | ; pm.start_servers - the number of children created on startup. 104 | ; pm.min_spare_servers - the minimum number of children in 'idle' 105 | ; state (waiting to process). If the number 106 | ; of 'idle' processes is less than this 107 | ; number then some children will be created. 108 | ; pm.max_spare_servers - the maximum number of children in 'idle' 109 | ; state (waiting to process). If the number 110 | ; of 'idle' processes is greater than this 111 | ; number then some children will be killed. 112 | ; ondemand - no children are created at startup. Children will be forked when 113 | ; new requests will connect. The following parameter are used: 114 | ; pm.max_children - the maximum number of children that 115 | ; can be alive at the same time. 116 | ; pm.process_idle_timeout - The number of seconds after which 117 | ; an idle process will be killed. 118 | ; Note: This value is mandatory. 119 | pm = dynamic 120 | 121 | ; The number of child processes to be created when pm is set to 'static' and the 122 | ; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. 123 | ; This value sets the limit on the number of simultaneous requests that will be 124 | ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. 125 | ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP 126 | ; CGI. The below defaults are based on a server without much resources. Don't 127 | ; forget to tweak pm.* to fit your needs. 128 | ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' 129 | ; Note: This value is mandatory. 130 | pm.max_children = 5 131 | 132 | ; The number of child processes created on startup. 133 | ; Note: Used only when pm is set to 'dynamic' 134 | ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 135 | pm.start_servers = 2 136 | 137 | ; The desired minimum number of idle server processes. 138 | ; Note: Used only when pm is set to 'dynamic' 139 | ; Note: Mandatory when pm is set to 'dynamic' 140 | pm.min_spare_servers = 1 141 | 142 | ; The desired maximum number of idle server processes. 143 | ; Note: Used only when pm is set to 'dynamic' 144 | ; Note: Mandatory when pm is set to 'dynamic' 145 | pm.max_spare_servers = 3 146 | 147 | ; The number of seconds after which an idle process will be killed. 148 | ; Note: Used only when pm is set to 'ondemand' 149 | ; Default Value: 10s 150 | ;pm.process_idle_timeout = 10s; 151 | 152 | ; The number of requests each child process should execute before respawning. 153 | ; This can be useful to work around memory leaks in 3rd party libraries. For 154 | ; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. 155 | ; Default Value: 0 156 | ;pm.max_requests = 500 157 | 158 | ; The URI to view the FPM status page. If this value is not set, no URI will be 159 | ; recognized as a status page. It shows the following informations: 160 | ; pool - the name of the pool; 161 | ; process manager - static, dynamic or ondemand; 162 | ; start time - the date and time FPM has started; 163 | ; start since - number of seconds since FPM has started; 164 | ; accepted conn - the number of request accepted by the pool; 165 | ; listen queue - the number of request in the queue of pending 166 | ; connections (see backlog in listen(2)); 167 | ; max listen queue - the maximum number of requests in the queue 168 | ; of pending connections since FPM has started; 169 | ; listen queue len - the size of the socket queue of pending connections; 170 | ; idle processes - the number of idle processes; 171 | ; active processes - the number of active processes; 172 | ; total processes - the number of idle + active processes; 173 | ; max active processes - the maximum number of active processes since FPM 174 | ; has started; 175 | ; max children reached - number of times, the process limit has been reached, 176 | ; when pm tries to start more children (works only for 177 | ; pm 'dynamic' and 'ondemand'); 178 | ; Value are updated in real time. 179 | ; Example output: 180 | ; pool: www 181 | ; process manager: static 182 | ; start time: 01/Jul/2011:17:53:49 +0200 183 | ; start since: 62636 184 | ; accepted conn: 190460 185 | ; listen queue: 0 186 | ; max listen queue: 1 187 | ; listen queue len: 42 188 | ; idle processes: 4 189 | ; active processes: 11 190 | ; total processes: 15 191 | ; max active processes: 12 192 | ; max children reached: 0 193 | ; 194 | ; By default the status page output is formatted as text/plain. Passing either 195 | ; 'html', 'xml' or 'json' in the query string will return the corresponding 196 | ; output syntax. Example: 197 | ; http://www.foo.bar/status 198 | ; http://www.foo.bar/status?json 199 | ; http://www.foo.bar/status?html 200 | ; http://www.foo.bar/status?xml 201 | ; 202 | ; By default the status page only outputs short status. Passing 'full' in the 203 | ; query string will also return status for each pool process. 204 | ; Example: 205 | ; http://www.foo.bar/status?full 206 | ; http://www.foo.bar/status?json&full 207 | ; http://www.foo.bar/status?html&full 208 | ; http://www.foo.bar/status?xml&full 209 | ; The Full status returns for each process: 210 | ; pid - the PID of the process; 211 | ; state - the state of the process (Idle, Running, ...); 212 | ; start time - the date and time the process has started; 213 | ; start since - the number of seconds since the process has started; 214 | ; requests - the number of requests the process has served; 215 | ; request duration - the duration in µs of the requests; 216 | ; request method - the request method (GET, POST, ...); 217 | ; request URI - the request URI with the query string; 218 | ; content length - the content length of the request (only with POST); 219 | ; user - the user (PHP_AUTH_USER) (or '-' if not set); 220 | ; script - the main script called (or '-' if not set); 221 | ; last request cpu - the %cpu the last request consumed 222 | ; it's always 0 if the process is not in Idle state 223 | ; because CPU calculation is done when the request 224 | ; processing has terminated; 225 | ; last request memory - the max amount of memory the last request consumed 226 | ; it's always 0 if the process is not in Idle state 227 | ; because memory calculation is done when the request 228 | ; processing has terminated; 229 | ; If the process is in Idle state, then informations are related to the 230 | ; last request the process has served. Otherwise informations are related to 231 | ; the current request being served. 232 | ; Example output: 233 | ; ************************ 234 | ; pid: 31330 235 | ; state: Running 236 | ; start time: 01/Jul/2011:17:53:49 +0200 237 | ; start since: 63087 238 | ; requests: 12808 239 | ; request duration: 1250261 240 | ; request method: GET 241 | ; request URI: /test_mem.php?N=10000 242 | ; content length: 0 243 | ; user: - 244 | ; script: /home/fat/web/docs/php/test_mem.php 245 | ; last request cpu: 0.00 246 | ; last request memory: 0 247 | ; 248 | ; Note: There is a real-time FPM status monitoring sample web page available 249 | ; It's available in: /usr/share/php/7.1/fpm/status.html 250 | ; 251 | ; Note: The value must start with a leading slash (/). The value can be 252 | ; anything, but it may not be a good idea to use the .php extension or it 253 | ; may conflict with a real PHP file. 254 | ; Default Value: not set 255 | ;pm.status_path = /status 256 | 257 | ; The ping URI to call the monitoring page of FPM. If this value is not set, no 258 | ; URI will be recognized as a ping page. This could be used to test from outside 259 | ; that FPM is alive and responding, or to 260 | ; - create a graph of FPM availability (rrd or such); 261 | ; - remove a server from a group if it is not responding (load balancing); 262 | ; - trigger alerts for the operating team (24/7). 263 | ; Note: The value must start with a leading slash (/). The value can be 264 | ; anything, but it may not be a good idea to use the .php extension or it 265 | ; may conflict with a real PHP file. 266 | ; Default Value: not set 267 | ;ping.path = /ping 268 | 269 | ; This directive may be used to customize the response of a ping request. The 270 | ; response is formatted as text/plain with a 200 response code. 271 | ; Default Value: pong 272 | ;ping.response = pong 273 | 274 | ; The access log file 275 | ; Default: not set 276 | ;access.log = log/$pool.access.log 277 | 278 | ; The access log format. 279 | ; The following syntax is allowed 280 | ; %%: the '%' character 281 | ; %C: %CPU used by the request 282 | ; it can accept the following format: 283 | ; - %{user}C for user CPU only 284 | ; - %{system}C for system CPU only 285 | ; - %{total}C for user + system CPU (default) 286 | ; %d: time taken to serve the request 287 | ; it can accept the following format: 288 | ; - %{seconds}d (default) 289 | ; - %{miliseconds}d 290 | ; - %{mili}d 291 | ; - %{microseconds}d 292 | ; - %{micro}d 293 | ; %e: an environment variable (same as $_ENV or $_SERVER) 294 | ; it must be associated with embraces to specify the name of the env 295 | ; variable. Some exemples: 296 | ; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e 297 | ; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e 298 | ; %f: script filename 299 | ; %l: content-length of the request (for POST request only) 300 | ; %m: request method 301 | ; %M: peak of memory allocated by PHP 302 | ; it can accept the following format: 303 | ; - %{bytes}M (default) 304 | ; - %{kilobytes}M 305 | ; - %{kilo}M 306 | ; - %{megabytes}M 307 | ; - %{mega}M 308 | ; %n: pool name 309 | ; %o: output header 310 | ; it must be associated with embraces to specify the name of the header: 311 | ; - %{Content-Type}o 312 | ; - %{X-Powered-By}o 313 | ; - %{Transfert-Encoding}o 314 | ; - .... 315 | ; %p: PID of the child that serviced the request 316 | ; %P: PID of the parent of the child that serviced the request 317 | ; %q: the query string 318 | ; %Q: the '?' character if query string exists 319 | ; %r: the request URI (without the query string, see %q and %Q) 320 | ; %R: remote IP address 321 | ; %s: status (response code) 322 | ; %t: server time the request was received 323 | ; it can accept a strftime(3) format: 324 | ; %d/%b/%Y:%H:%M:%S %z (default) 325 | ; The strftime(3) format must be encapsuled in a %{}t tag 326 | ; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t 327 | ; %T: time the log has been written (the request has finished) 328 | ; it can accept a strftime(3) format: 329 | ; %d/%b/%Y:%H:%M:%S %z (default) 330 | ; The strftime(3) format must be encapsuled in a %{}t tag 331 | ; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t 332 | ; %u: remote user 333 | ; 334 | ; Default: "%R - %u %t \"%m %r\" %s" 335 | ;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" 336 | 337 | ; The log file for slow requests 338 | ; Default Value: not set 339 | ; Note: slowlog is mandatory if request_slowlog_timeout is set 340 | ;slowlog = log/$pool.log.slow 341 | 342 | ; The timeout for serving a single request after which a PHP backtrace will be 343 | ; dumped to the 'slowlog' file. A value of '0s' means 'off'. 344 | ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) 345 | ; Default Value: 0 346 | ;request_slowlog_timeout = 0 347 | 348 | ; The timeout for serving a single request after which the worker process will 349 | ; be killed. This option should be used when the 'max_execution_time' ini option 350 | ; does not stop script execution for some reason. A value of '0' means 'off'. 351 | ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) 352 | ; Default Value: 0 353 | ;request_terminate_timeout = 0 354 | 355 | ; Set open file descriptor rlimit. 356 | ; Default Value: system defined value 357 | ;rlimit_files = 1024 358 | 359 | ; Set max core size rlimit. 360 | ; Possible Values: 'unlimited' or an integer greater or equal to 0 361 | ; Default Value: system defined value 362 | ;rlimit_core = 0 363 | 364 | ; Chroot to this directory at the start. This value must be defined as an 365 | ; absolute path. When this value is not set, chroot is not used. 366 | ; Note: you can prefix with '$prefix' to chroot to the pool prefix or one 367 | ; of its subdirectories. If the pool prefix is not set, the global prefix 368 | ; will be used instead. 369 | ; Note: chrooting is a great security feature and should be used whenever 370 | ; possible. However, all PHP paths will be relative to the chroot 371 | ; (error_log, sessions.save_path, ...). 372 | ; Default Value: not set 373 | ;chroot = 374 | 375 | ; Chdir to this directory at the start. 376 | ; Note: relative path can be used. 377 | ; Default Value: current directory or / when chroot 378 | ;chdir = /var/www 379 | 380 | ; Redirect worker stdout and stderr into main error log. If not set, stdout and 381 | ; stderr will be redirected to /dev/null according to FastCGI specs. 382 | ; Note: on highloaded environement, this can cause some delay in the page 383 | ; process time (several ms). 384 | ; Default Value: no 385 | ;catch_workers_output = yes 386 | 387 | ; Clear environment in FPM workers 388 | ; Prevents arbitrary environment variables from reaching FPM worker processes 389 | ; by clearing the environment in workers before env vars specified in this 390 | ; pool configuration are added. 391 | ; Setting to "no" will make all environment variables available to PHP code 392 | ; via getenv(), $_ENV and $_SERVER. 393 | ; Default Value: yes 394 | ;clear_env = no 395 | 396 | ; Limits the extensions of the main script FPM will allow to parse. This can 397 | ; prevent configuration mistakes on the web server side. You should only limit 398 | ; FPM to .php extensions to prevent malicious users to use other extensions to 399 | ; execute php code. 400 | ; Note: set an empty value to allow all extensions. 401 | ; Default Value: .php 402 | ;security.limit_extensions = .php .php3 .php4 .php5 .php7 403 | 404 | ; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from 405 | ; the current environment. 406 | ; Default Value: clean env 407 | ;env[HOSTNAME] = $HOSTNAME 408 | ;env[PATH] = /usr/local/bin:/usr/bin:/bin 409 | ;env[TMP] = /tmp 410 | ;env[TMPDIR] = /tmp 411 | ;env[TEMP] = /tmp 412 | 413 | ; Additional php.ini defines, specific to this pool of workers. These settings 414 | ; overwrite the values previously defined in the php.ini. The directives are the 415 | ; same as the PHP SAPI: 416 | ; php_value/php_flag - you can set classic ini defines which can 417 | ; be overwritten from PHP call 'ini_set'. 418 | ; php_admin_value/php_admin_flag - these directives won't be overwritten by 419 | ; PHP call 'ini_set' 420 | ; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. 421 | 422 | ; Defining 'extension' will load the corresponding shared extension from 423 | ; extension_dir. Defining 'disable_functions' or 'disable_classes' will not 424 | ; overwrite previously defined php.ini values, but will append the new value 425 | ; instead. 426 | 427 | ; Note: path INI options can be relative and will be expanded with the prefix 428 | ; (pool, global or /usr) 429 | 430 | ; Default Value: nothing is defined by default except the values in php.ini and 431 | ; specified at startup with the -d argument 432 | ;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com 433 | ;php_flag[display_errors] = off 434 | ;php_admin_value[error_log] = /var/log/fpm-php.www.log 435 | ;php_admin_flag[log_errors] = on 436 | ;php_admin_value[memory_limit] = 32M 437 | -------------------------------------------------------------------------------- /containers/push/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM gromdron/bitrix-push-workspace:v1.0 2 | 3 | WORKDIR /opt/push-server 4 | 5 | EXPOSE 9099 6 | 7 | COPY push_config.toml . 8 | 9 | ENV CONFIG_FILE=/opt/push-server/push_config.toml 10 | 11 | STOPSIGNAL SIGKILL 12 | 13 | CMD ["push-server"] 14 | -------------------------------------------------------------------------------- /containers/push/push_config.toml: -------------------------------------------------------------------------------- 1 | [general] 2 | port = 9099 3 | workers = 2 4 | 5 | [security] 6 | enabled = false 7 | key = "CkRkXJYp1zpaHrVavjF6mN5tJNksa5Oh70MjpoPsXcN5haGJgN9J2CnkKGPQLj7jOyADgDrRVWe32PsGL6uWcIRcBiCPyBiCpR6NNKBwdCorDRMaPFUJNHWlcjNcHK9Q" 8 | 9 | [log] 10 | level = "error" 11 | -------------------------------------------------------------------------------- /data/mysql/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | */ 3 | !.gitignore 4 | 5 | -------------------------------------------------------------------------------- /data/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | */ 3 | !.gitignore 4 | 5 | -------------------------------------------------------------------------------- /dctl.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | #first cd current dir 4 | cd "$(dirname "${BASH_SOURCE[0]}")" 5 | 6 | export DEFAULT_USER="1000"; 7 | export DEFAULT_GROUP="1000"; 8 | 9 | export USER_ID=`id -u` 10 | export GROUP_ID=`id -g` 11 | export USER=$USER 12 | 13 | 14 | if [ "$USER_ID" == "0" ]; then 15 | export USER_ID=$DEFAULT_USER; 16 | fi 17 | 18 | if [ "$GROUP_ID" == "0" ]; then 19 | export GROUP_ID=$DEFAULT_GROUP; 20 | fi 21 | 22 | 23 | export DOCKER_COMPOSE_CMD="docker-compose"; 24 | 25 | if ! command -v docker-compose &> /dev/null 26 | then 27 | export DOCKER_COMPOSE_CMD="docker compose"; 28 | fi 29 | 30 | test -e "./.env" || { cp .env.example .env; }; 31 | #load .env 32 | export $(egrep -v '^#' .env | xargs) 33 | 34 | if [ $# -eq 0 ]; then 35 | echo "HELP:" 36 | echo "make env - copy .env.example to .env" 37 | echo "make db - load init bitrix database dump to mysql" 38 | echo "db import FILE - load FILE to mysql" 39 | echo "db renew - load dump from repo, fresh db and apply" 40 | echo "db - run db cli" 41 | echo "db export > file.sql - export db to file" 42 | echo "build - make docker build" 43 | echo "up - docker up in console" 44 | echo "up silent - docker up daemon" 45 | echo "down - docker down" 46 | echo "run - run in php container from project root" 47 | echo "test - run tests" 48 | echo "cli some_command - run scripts/cli.php some_command (migration, etc)" 49 | echo "cept some_command (cept generate:cept acceptance Test) - run codeception with params" 50 | fi 51 | 52 | function applyDump { 53 | cat $1 | docker exec -i ${PROJECT_PREFIX}_mysql mysql -u $MYSQL_USER -p"$MYSQL_PASSWORD" $MYSQL_DATABASE; 54 | return $? 55 | } 56 | 57 | function runInMySql { 58 | local command=$@ 59 | docker exec -i ${PROJECT_PREFIX}_mysql su mysql -c "$command" 60 | return $? 61 | } 62 | 63 | function runInPhp { 64 | local command=$@ 65 | echo $command; 66 | docker exec -i ${PROJECT_PREFIX}_php su www-data -c "$command" 67 | return $? 68 | } 69 | 70 | function enterInPhp { 71 | docker exec -it ${PROJECT_PREFIX}_php su www-data 72 | return $? 73 | } 74 | 75 | function enterInPhpAdmin { 76 | docker exec -it ${PROJECT_PREFIX}_php bash 77 | return $? 78 | } 79 | 80 | function makeDump { 81 | runInMySql "export MYSQL_PWD='$MYSQL_PASSWORD'; mysqldump -u $MYSQL_USER $MYSQL_DATABASE" > $1 82 | return $? 83 | } 84 | 85 | if [ "$1" == "make" ]; then 86 | if [ "$2" == "env" ]; then 87 | cp .env.example .env 88 | fi 89 | if [ "$2" == "db" ]; then 90 | applyDump database.sql; 91 | fi 92 | 93 | if [ "$2" == "dump" ]; then 94 | makeDump database.sql 95 | fi 96 | fi 97 | 98 | if [ "$1" == "db" ]; then 99 | if [ "$2" == "" ]; then 100 | docker exec -it ${PROJECT_PREFIX}_mysql mysql -u $MYSQL_USER -p"$MYSQL_PASSWORD" $MYSQL_DATABASE; 101 | fi 102 | 103 | if [ "$2" == "export" ]; then 104 | runInMySql "export MYSQL_PWD='$MYSQL_PASSWORD'; mysqldump -u $MYSQL_USER $MYSQL_DATABASE" 105 | fi 106 | 107 | if [ "$2" == "import" ]; then 108 | applyDump $3 109 | fi 110 | 111 | if [ "$2" == "renew" ]; then 112 | if [ -f containers/mysql/drop_all_tables.sql ]; then 113 | applyDump containers/mysql/drop_all_tables.sql 114 | fi 115 | if [ -f database.sql ]; then 116 | applyDump database.sql 117 | fi 118 | fi 119 | fi 120 | 121 | if [ "$1" == "build" ]; then 122 | ${DOCKER_COMPOSE_CMD} -p ${PROJECT_PREFIX} build 123 | fi 124 | 125 | if [ "$1" == "up" ]; then 126 | ${DOCKER_COMPOSE_CMD} -p ${PROJECT_PREFIX} build 127 | if [ "$2" == "silent" ]; then 128 | ${DOCKER_COMPOSE_CMD} -p ${PROJECT_PREFIX} up -d 129 | else 130 | ${DOCKER_COMPOSE_CMD} -p ${PROJECT_PREFIX} up 131 | fi 132 | fi 133 | 134 | if [ "$1" == "down" ]; then 135 | ${DOCKER_COMPOSE_CMD} -p ${PROJECT_PREFIX} down 136 | fi 137 | 138 | if [ "$1" == "cli" -o "$1" == "mg" ]; then 139 | runInPhp php ${PROJECT_PREFIX}/local/modules/ds.migrate/tools/migrate.php "${@:2}" 140 | fi 141 | 142 | if [ "$1" == "run" ]; then 143 | runInPhp "${@:2}" 144 | fi 145 | 146 | if [ "$1" == "in" ]; then 147 | enterInPhp "${@:2}" 148 | fi 149 | if [ "$1" == "in-admin" ]; then 150 | enterInPhpAdmin "${@:2}" 151 | fi 152 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | services: 4 | nginx: 5 | ports: 6 | - "${HTTP_PORT}:80" 7 | build: 8 | context: ./containers/nginx 9 | dockerfile: ./Dockerfile 10 | args: 11 | USER_ID: "$USER_ID" 12 | GROUP_ID: "$GROUP_ID" 13 | PROJECT_PREFIX: "$PROJECT_PREFIX" 14 | container_name: ${PROJECT_PREFIX}_webserver 15 | depends_on: 16 | - mysql 17 | - push 18 | volumes: 19 | - ./www:/home/bitrix/www 20 | - ./logs/nginx:/var/log/nginx 21 | links: 22 | - php 23 | restart: unless-stopped 24 | environment: 25 | - APP_ENV=${APP_ENV} 26 | - PROJECT_PREFIX=${PROJECT_PREFIX} 27 | networks: 28 | default: 29 | aliases: 30 | - ${PROJECT_PREFIX}.localhost 31 | 32 | php: 33 | build: 34 | context: ./containers/php 35 | dockerfile: ./Dockerfile 36 | args: 37 | USER_ID: "$USER_ID" 38 | GROUP_ID: "$GROUP_ID" 39 | container_name: ${PROJECT_PREFIX}_php 40 | volumes: 41 | - ./www:/home/bitrix/www 42 | - ./logs/php:/var/log/php 43 | links: 44 | - mysql 45 | restart: unless-stopped 46 | environment: 47 | APP_ENV: ${APP_ENV} 48 | MYSQL_DATABASE: ${MYSQL_DATABASE} 49 | MYSQL_USER: ${MYSQL_USER} 50 | MYSQL_PASSWORD: ${MYSQL_PASSWORD} 51 | MYSQL_HOST: ${MYSQL_HOST} 52 | PROJECT_PREFIX: ${PROJECT_PREFIX} 53 | PHP_IDE_CONFIG: serverName=serverName 54 | extra_hosts: 55 | - "host.docker.internal:host-gateway" 56 | 57 | mysql: 58 | ports: 59 | - "33060:3306" 60 | build: 61 | context: ./containers/mysql 62 | dockerfile: ./Dockerfile 63 | args: 64 | USER_ID: "$USER_ID" 65 | GROUP_ID: "$GROUP_ID" 66 | container_name: ${PROJECT_PREFIX}_mysql 67 | environment: 68 | MYSQL_DATABASE: ${MYSQL_DATABASE} 69 | MYSQL_USER: ${MYSQL_USER} 70 | MYSQL_PASSWORD: ${MYSQL_PASSWORD} 71 | MYSQL_ROOT_PASSWORD: password 72 | volumes: 73 | - ./logs/mysql:/var/log/mysql 74 | - ./data/mysql:/var/lib/mysql 75 | 76 | restart: unless-stopped 77 | 78 | memcached: 79 | image: memcached:latest 80 | container_name: ${PROJECT_PREFIX}_memcached 81 | restart: unless-stopped 82 | 83 | push: 84 | build: 85 | context: ./containers/push 86 | dockerfile: ./Dockerfile 87 | restart: unless-stopped 88 | container_name: ${PROJECT_PREFIX}_push 89 | -------------------------------------------------------------------------------- /down.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cd "$(dirname "${BASH_SOURCE[0]}")" 3 | ./dctl.sh down 4 | -------------------------------------------------------------------------------- /logs/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aclips/bitrix24-docker/81452d4b7c8cb4f763b9d9216026e075642027af/logs/.gitkeep -------------------------------------------------------------------------------- /logs/mysql/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | */ 3 | !.gitignore 4 | 5 | -------------------------------------------------------------------------------- /logs/nginx/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | */ 3 | !.gitignore 4 | 5 | -------------------------------------------------------------------------------- /logs/php/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | */ 3 | !.gitignore 4 | 5 | -------------------------------------------------------------------------------- /rebuild.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cd "$(dirname "${BASH_SOURCE[0]}")" 3 | ./down.sh 4 | ./up.sh -------------------------------------------------------------------------------- /src/example.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aclips/bitrix24-docker/81452d4b7c8cb4f763b9d9216026e075642027af/src/example.mp4 -------------------------------------------------------------------------------- /up.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cd "$(dirname "${BASH_SOURCE[0]}")" 3 | ./dctl.sh up silent 4 | -------------------------------------------------------------------------------- /www/bitrix/php_interface/dbconn.php: -------------------------------------------------------------------------------- 1 | 13 | -------------------------------------------------------------------------------- /www/index.php: -------------------------------------------------------------------------------- 1 | 2 | --------------------------------------------------------------------------------