From fcf7cfa584896e11683508b9dd372acf9aea96ad Mon Sep 17 00:00:00 2001 From: Leonid Nikitin Date: Wed, 28 Jun 2023 21:43:39 +0600 Subject: [PATCH] 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. --- docker-compose.yml | 22 +++++++++++++++++++++- docker/dev/.gitignore | 2 ++ docker/dev/my.cnf | 9 +++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 docker/dev/.gitignore create mode 100644 docker/dev/my.cnf diff --git a/docker-compose.yml b/docker-compose.yml index 16ef840..eff1f1f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,8 +9,9 @@ services: - ${DOCKER_ANGIE_PORT}:80 #restart: always depends_on: - - app + - db - redis + - app app: image: service-captcha-laravel container_name: service-captcha-laravel-www @@ -25,3 +26,22 @@ services: - "9000" redis: 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 diff --git a/docker/dev/.gitignore b/docker/dev/.gitignore new file mode 100644 index 0000000..2f526f2 --- /dev/null +++ b/docker/dev/.gitignore @@ -0,0 +1,2 @@ +db/* +!db/.gitignore diff --git a/docker/dev/my.cnf b/docker/dev/my.cnf new file mode 100644 index 0000000..c56e049 --- /dev/null +++ b/docker/dev/my.cnf @@ -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