This commit introduces a MySQL container and an Adminer container to the docker-compose.yml file. The dependencies list was also updated, swapping the 'app' and 'db' listings to ensure the correct start-up order. An additional MySQL configuration file was added to mitigate heavy CPU usage. A new .gitignore file is also introduced to avoid unintended inclusion of database files in version control.

This commit is contained in:
Leonid Nikitin 2023-06-28 21:43:39 +06:00
parent a35b8db281
commit fcf7cfa584
Signed by: kor-elf
GPG Key ID: 7DE8F80C5CEC2C0D
3 changed files with 32 additions and 1 deletions

View File

@ -9,8 +9,9 @@ services:
- ${DOCKER_ANGIE_PORT}:80 - ${DOCKER_ANGIE_PORT}:80
#restart: always #restart: always
depends_on: depends_on:
- app - db
- redis - redis
- app
app: app:
image: service-captcha-laravel image: service-captcha-laravel
container_name: service-captcha-laravel-www container_name: service-captcha-laravel-www
@ -25,3 +26,22 @@ services:
- "9000" - "9000"
redis: redis:
image: redis:3.0-alpine image: redis:3.0-alpine
db:
image: mysql:8.0.33
command: --default-authentication-plugin=mysql_native_password
#restart: always
ports:
- ${DOCKER_DB_PORT}:3306
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${DB_DATABASE}
MYSQL_USER: ${DB_USERNAME}
MYSQL_PASSWORD: ${DB_PASSWORD}
volumes:
- ./docker/dev/db:/var/lib/mysql
- ./docker/dev/my.cnf:/etc/mysql/conf.d/my.cnf
adminer:
image: adminer
#restart: always
ports:
- ${DOCKER_ADMINER_PORT}:8080

2
docker/dev/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
db/*
!db/.gitignore

9
docker/dev/my.cnf Normal file
View File

@ -0,0 +1,9 @@
[mysqld]
innodb_lru_scan_depth=100 # from 1024 to conserve 90% CPU cycles used for function
innodb_io_capacity=1900 # from 200 to allow more IOPSecond to your storage device
innodb_flush_neighbors=2 # from 0 to expedite writing to current extent
innodb_max_dirty_pages_pct_lwm=1 # from 10 percent to expedite writes
innodb_max_dirty_pages_pct=1 # from 90 percent to reduce innodb_buffer_pool_pages_dirty count
innodb_change_buffer_max_size=50 # from 25 percent to expedite your high volume activity
innodb_flush_log_at_trx_commit=0
skip_log_bin=1