Skip to content

Commit e058a9f

Browse files
committed
update mysql to 8.4 with config; added examples for additional services redis and rabbitmq; changed php base image; separated compose config to common
1 parent 304ea1b commit e058a9f

17 files changed

+446
-66
lines changed

Diff for: .docker/mysql/Dockerfile

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
ARG MYSQL_IMAGE_VERSION
22

3-
FROM mysql:${MYSQL_IMAGE_VERSION}
3+
FROM mysql:${MYSQL_IMAGE_VERSION:-8.4}
44

5-
RUN mkdir -p /var/log/mysql && chmod 777 /var/log/mysql
5+
RUN <<EOT sh
6+
mkdir -p /var/log/mysql
7+
chown -R mysql:mysql /var/log/mysql
8+
EOT
69

710
COPY ./config/custom.cnf /etc/mysql/conf.d/custom.cnf

Diff for: .docker/mysql/config/custom.cnf

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
[mysqld]
2-
default_authentication_plugin=caching_sha2_password
2+
; The default_authentication_plugin=caching_sha2_password is default in 8.4 and should be removed
33
character_set_server=utf8mb4
44
collation_server=utf8mb4_0900_as_cs
55
innodb_lock_wait_timeout=60
66
innodb_rollback_on_timeout=ON
7+
innodb_buffer_pool_size=1024M
78
sort_buffer_size=1024K
89
max_connections=15
910
max_allowed_packet=128M
10-
performance_schema=off
11+
performance_schema=OFF
12+
log_bin=ON
13+
binlog_expire_logs_seconds=864000
1114
log_output=FILE
12-
log_queries_not_using_indexes=1
13-
log_slow_admin_statements=1
14-
log_error=/var/log/mysql/error.log
15-
general_log_file=/var/log/mysql/mysql.log
1615
general_log=1
16+
general_log_file=/var/log/mysql/mysql.log
17+
log_error=/var/log/mysql/error.log
1718
slow_query_log=1
1819
slow_query_log_file=/var/log/mysql/mysql-slow.log
19-
long_query_time=1
20+
long_query_time=1
21+
log_queries_not_using_indexes=ON
22+
log_slow_admin_statements=ON

Diff for: .docker/mysql/init/.gitkeep

Whitespace-only changes.

Diff for: .docker/nginx/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ARG NGINX_IMAGE_VERSION
22

3-
FROM nginx:${NGINX_IMAGE_VERSION}
3+
FROM nginx:${NGINX_IMAGE_VERSION:-1.27}
44

55
COPY ./config/default.conf /etc/nginx/conf.d/default.conf

Diff for: .docker/php/Dockerfile

-24
This file was deleted.

Diff for: .docker/rabbitmq/enabled_plugins

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[rabbitmq_management,rabbitmq_management_agent,rabbitmq_shovel,rabbitmq_shovel_management].

Diff for: .docker/rabbitmq/rabbitmq.conf

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
vm_memory_high_watermark.relative = 0.7
2+
vm_memory_high_watermark_paging_ratio = 0.8
3+
log.file = rabbit.log
4+
log.dir = /var/log/rabbitmq
5+
log.default.level = error
6+
log.file.level = debug
7+
log.connection.level = info
8+
# rotate when the file reaches 10 MiB
9+
log.file.rotation.size = 10485760
10+
# keep up to 5 archived log files in addition to the current one
11+
log.file.rotation.count = 5

Diff for: .docker/redis/README.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Redis
2+
3+
## Configure overcommit on host
4+
5+
For Linux kernel set [overcommit memory](https://redis.io/docs/manual/admin/#linux) setting to 1.
6+
7+
As sudo/root user:
8+
```shell
9+
echo "vm.overcommit_memory = 1" >> /etc/sysctl.conf
10+
```
11+
12+
Activate setting
13+
14+
```shell
15+
sysctl vm.overcommit_memory=1
16+
```

Diff for: .docker/redis/redis.conf

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
appendonly yes
2+
maxmemory 5000mb
3+
maxmemory-policy allkeys-lru

Diff for: .env

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
1515

1616
###> IMAGE VERSIONS ###
17-
NGINX_IMAGE_VERSION="1.25-alpine"
18-
MYSQL_IMAGE_VERSION="8.2"
17+
NGINX_IMAGE_VERSION="1.27-alpine"
18+
MYSQL_IMAGE_VERSION="8.4"
1919
NODE_IMAGE_VERSION="20"
2020
###< IMAGE VERSIONS ###
2121

Diff for: .gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
###< mysql ###
1919
###> docker ###
2020
/docker-compose.override.yml
21+
/docker-compose.override.yaml
22+
/compose.override.yml
23+
/compose.override.yaml
2124
###< docker ###
2225
###> friendsofphp/php-cs-fixer ###
2326
/.php-cs-fixer.php

Diff for: .tasks/redis/Taskfile.yml

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
version: '3'
2+
3+
tasks:
4+
default:
5+
cmds:
6+
- task --list
7+
8+
shell:
9+
desc: Login
10+
aliases:
11+
- s
12+
cmds:
13+
- docker compose exec redis {{.CLI_ARGS | default "/bin/bash"}}
14+
15+
cli:
16+
desc: Login with CLI
17+
aliases:
18+
- cli
19+
vars:
20+
DATABASE: '{{.d | default "0"}}'
21+
cmds:
22+
- docker compose exec redis redis-cli -n {{.DATABASE}}
23+
24+
get:key:
25+
desc: Get value for key
26+
aliases:
27+
- g:k
28+
vars:
29+
KEY: '{{.k}}'
30+
DATABASE: '{{.d | default "0"}}'
31+
cmds:
32+
- docker compose exec redis redis-cli -n {{.DATABASE}} GET {{.KEY}}
33+
34+
get:keys:
35+
desc: Show all keys
36+
aliases:
37+
- g:ks
38+
cmds:
39+
- docker compose exec redis redis-cli KEYS "*"
40+
41+
get:keys:db:
42+
desc: Show keys for specific database
43+
aliases:
44+
- g:ks:db
45+
vars:
46+
DATABASE: '{{.d | default "0"}}'
47+
cmds:
48+
- docker compose exec redis redis-cli -n {{.DATABASE}} KEYS "*"
49+
50+
get:keys:db:pattern:
51+
desc: Show keys by search
52+
aliases:
53+
- g:ks:db:p
54+
summary: |
55+
Supported glob-style patterns:
56+
57+
- h?llo matches hello, hallo and hxllo
58+
- h*llo matches hllo and heeeello
59+
- h[ae]llo matches hello and hallo, but not hillo
60+
- h[^e]llo matches hallo, hbllo, ... but not hello
61+
- h[a-b]llo matches hallo and hbllo
62+
vars:
63+
DATABASE: '{{.d | default "0"}}'
64+
PATTERN: '{{.p | default "*"}}'
65+
cmds:
66+
- docker compose exec redis redis-cli -n {{.DATABASE}} KEYS "{{.PATTERN}}"
67+
68+
delete:keys:db:pattern:
69+
desc: Delete by specified pattern; task delete:pattern db=4 p=*aniList_image*
70+
aliases:
71+
- d:ks:db:p
72+
vars:
73+
DATABASE: '{{.d | default "0"}}'
74+
PATTERN: '{{.p}}'
75+
cmds:
76+
- docker compose exec redis redis-cli -n {{.DATABASE}} EVAL "for _,k in ipairs(redis.call('keys','{{.PATTERN}}')) do redis.call('del',k) end" 0
77+
78+
flush:
79+
desc: Flush everything, for every database
80+
aliases:
81+
- f
82+
cmds:
83+
- docker compose exec redis redis-cli FLUSHALL ASYNC
84+
85+
flush:db:
86+
desc: Flush specified database
87+
aliases:
88+
- f:db
89+
vars:
90+
DATABASE: '{{.d | default "0"}}'
91+
cmds:
92+
- docker compose exec redis redis-cli -n {{.DATABASE}} FLUSHDB ASYNC
93+
94+
benchmark:
95+
desc: Benchmark redis; with password use `-a password` for CLI args.
96+
aliases:
97+
- b
98+
vars:
99+
TESTS: '{{.n | default "set,get"}}'
100+
RANDOM_KEYS: '{{.r | default "100000"}}'
101+
REQUEST_AMOUNT: '{{.n | default "1000000"}}'
102+
KEY_SIZE: '{{.d | default "50"}}'
103+
cmds:
104+
- docker compose exec redis redis-benchmark -t {{.TESTS}} -r {{.RANDOM_KEYS}} -n {{.REQUEST_AMOUNT}} -d {{.KEY_SIZE}} {{.CLI_ARGS}}
105+
106+
benchmark:latency:
107+
desc: Check latency
108+
aliases:
109+
- b:l
110+
cmds:
111+
- docker compose exec redis redis-cli --latency
112+
113+
benchmark:latency:system:
114+
desc: Check (system) intrinsic latency
115+
aliases:
116+
- b:l:s
117+
vars:
118+
TIME: '{{.t | default "30"}}'
119+
cmds:
120+
- docker compose exec redis redis-cli --intrinsic-latency {{.TIME}}

Diff for: Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM t0shy/phpfpm-bookworm:8.3 AS local
1+
FROM ghcr.io/toshy/php:8.3-fpm-bookworm AS local
22

33
ARG UID=${UID:-10000}
44
ARG GID=${GID:-10001}

0 commit comments

Comments
 (0)