Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ PHP limits in `docker/php/php.ini` (oriented toward large Bitrix backups). Timez
- `memory_limit = 512M`
- `upload_max_filesize = 1024M`
- `post_max_size = 1024M`
- `max_execution_time = 300`
- `max_execution_time = 3600`

nginx in `docker/nginx/templates/default.conf.template`:

Expand All @@ -280,7 +280,7 @@ On first start with an empty volume, `docker/mysql/initdb/01-bitrix-user.sh`:
- uses `mysql_native_password` when the plugin is available
- falls back to the default MySQL authentication plugin otherwise

`docker/mysql/my.cnf` sets `utf8mb4`, increased `max_allowed_packet`, and Bitrix-friendly InnoDB options.
`docker/mysql/my.cnf` sets `utf8mb4` and a **dev-only** performance profile (fast bulk import, `innodb_flush_log_at_trx_commit=0`, `skip-log-bin`). Do not reuse these settings on production.

## Optional Extensions

Expand Down Expand Up @@ -316,7 +316,7 @@ GitHub Actions workflow (`.github/workflows/ci.yml`) runs on push and pull reque
| Domain does not open | Hosts file entry for `DOMAIN`; run `make doctor` |
| SSL warning in browser | `mkcert -install`, then `make cert`, then `docker compose restart nginx` |
| MySQL connection fails in restore wizard | Host must be `mysql`, not `localhost` |
| `make restore` — no archive found | Put `.tar.gz`, `.zip`, or other supported archive into `./www/` |
| Restore unpack is very slow or stalls | On Windows, keep the project inside WSL2 (`~/projects/...`), not on `C:\`. Then run `docker compose build php && docker compose restart` after config changes |
| File permission issues on Linux/macOS | Set `UID` and `GID` in `.env` to output of `id -u` / `id -g` |
| Shell scripts fail on Windows | Use Git Bash or WSL; ensure LF line endings (`.gitattributes`) |
| PHP extension missing | Add it to `PHP_EXTRA_EXTENSIONS` and run `docker compose build php` |
Expand Down
6 changes: 4 additions & 2 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ services:
start_period: 10s

mysql:
image: ${MYSQL_IMAGE:-mysql:8.0.36}
build:
context: ./docker/mysql
args:
MYSQL_IMAGE: ${MYSQL_IMAGE:-mysql:8.0.36}
container_name: ${PROJECT_NAME:-bitrix-local}-mysql
restart: unless-stopped
environment:
Expand All @@ -68,7 +71,6 @@ services:
start_period: 30s
volumes:
- mysql-data:/var/lib/mysql
- ./docker/mysql/my.cnf:/etc/mysql/conf.d/bitrix.cnf:ro
- ./docker/mysql/initdb:/docker-entrypoint-initdb.d:ro

volumes:
Expand Down
5 changes: 5 additions & 0 deletions docker/mysql/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ARG MYSQL_IMAGE=mysql:8.0.36
FROM ${MYSQL_IMAGE}

COPY my.cnf /etc/mysql/conf.d/bitrix.cnf
RUN chmod 644 /etc/mysql/conf.d/bitrix.cnf
38 changes: 30 additions & 8 deletions docker/mysql/my.cnf
Original file line number Diff line number Diff line change
@@ -1,22 +1,44 @@
[mysqld]
default-authentication-plugin = mysql_native_password

character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
init-connect = 'SET NAMES utf8mb4'

sql_mode = ""
innodb_strict_mode = OFF

max_allowed_packet = 512M
table_open_cache = 4096
thread_cache_size = 64
tmp_table_size = 256M
max_heap_table_size = 256M
# Memory
innodb_buffer_pool_size = 1G
innodb_buffer_pool_instances = 1
innodb_log_file_size = 512M
innodb_log_buffer_size = 16M

innodb_buffer_pool_size = 512M
innodb_log_file_size = 256M
innodb_flush_log_at_trx_commit = 2
# Speed (dev only — not for production)
innodb_flush_log_at_trx_commit = 0
innodb_flush_method = O_DIRECT
sync_binlog = 0
skip-log-bin
performance_schema = OFF

# Bitrix query buffers
join_buffer_size = 2M
sort_buffer_size = 4M
key_buffer_size = 256M
tmp_table_size = 128M
max_heap_table_size = 128M
max_allowed_packet = 128M

# Cache
table_open_cache = 2048
thread_cache_size = 8
transaction-isolation = READ-COMMITTED

# I/O
innodb_read_io_threads = 8
innodb_write_io_threads = 8

tmpdir = /tmp
log_bin_trust_function_creators = 1
skip-name-resolve

Expand Down
8 changes: 4 additions & 4 deletions docker/nginx/templates/default.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ server {

charset utf-8;
client_max_body_size 1024M;
client_body_timeout 300s;
send_timeout 300s;
client_body_timeout 3600s;
send_timeout 3600s;

ssl_certificate /etc/nginx/certs/${DOMAIN}.pem;
ssl_certificate_key /etc/nginx/certs/${DOMAIN}-key.pem;
Expand Down Expand Up @@ -59,8 +59,8 @@ server {

fastcgi_pass php:9000;
fastcgi_index index.php;
fastcgi_read_timeout 300s;
fastcgi_send_timeout 300s;
fastcgi_read_timeout 3600s;
fastcgi_send_timeout 3600s;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 16k;
fastcgi_busy_buffers_size 256k;
Expand Down
4 changes: 2 additions & 2 deletions docker/php/php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ short_open_tag = On
expose_php = Off

memory_limit = 512M
max_execution_time = 300
max_input_time = 300
max_execution_time = 3600
max_input_time = 3600
max_input_vars = 10000

post_max_size = 1024M
Expand Down
11 changes: 11 additions & 0 deletions scripts/download-restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,19 @@ set -euo pipefail
RESTORE_URL="https://www.1c-bitrix.ru/download/scripts/restore.php"
RESTORE_FILE="www/restore.php"

patch_restore_php() {
if grep -q 'ini_get("max_execution_time")' "$RESTORE_FILE"; then
return 0
fi
sed -i.bak 's/define("STEP_TIME", defined('\''VMBITRIX'\'') ? 30 : 15);/define("STEP_TIME", (int) ini_get("max_execution_time") ?: 3600);/' "$RESTORE_FILE"
rm -f "${RESTORE_FILE}.bak"
echo "Patched STEP_TIME in ${RESTORE_FILE}"
}

mkdir -p www

if [ -s "$RESTORE_FILE" ]; then
patch_restore_php
echo "restore.php already exists: ${RESTORE_FILE}"
exit 0
fi
Expand All @@ -22,4 +32,5 @@ else
exit 1
fi

patch_restore_php
echo "Downloaded: ${RESTORE_FILE}"
Loading