@@ -48,12 +48,12 @@ services:
4848 - "3308:3306" #for external connection
4949 restart: always
5050 volumes:
51- - ../mysql-proxy/main.lua :/opt/main.lua
51+ - ../mysql-proxy-conf :/opt/mysql-proxy/conf
5252 environment:
5353 PROXY_DB_PORT: 3306
5454 REMOTE_DB_HOST: mysql
5555 REMOTE_DB_PORT: 3306
56- PROXY_LUA_SCRIPT: "/opt/main.lua"
56+ PROXY_LUA_SCRIPT: "/opt/mysql-proxy/conf/ main.lua"
5757 depends_on:
5858 - mysql
5959```
7373```
7474...
7575 volumes:
76- - ../mysql-proxy/log.lua :/opt/log.lua
77- - ../mysql-proxy/mysql.log :/opt/mysql-proxy/mysql.log
76+ - ../mysql-proxy-conf :/opt/mysql-proxy/conf
77+ - ../mysql-proxy-logs :/opt/mysql-proxy/logs
7878 environment:
7979 PROXY_DB_PORT: 3306
8080 REMOTE_DB_HOST: mysql
8181 REMOTE_DB_PORT: 3306
82- PROXY_LUA_SCRIPT: "/opt/log.lua"
82+ PROXY_LUA_SCRIPT: "/opt/mysql-proxy/conf/ log.lua"
8383...
8484```
8585
8686` /mysql-proxy/log.lua ` https://gist.github.com/simonw/1039751
8787```
88- local log_file = '/opt/mysql-proxy/mysql.log'
88+ local log_file = '/opt/mysql-proxy/logs/ mysql.log'
8989
9090local fh = io.open(log_file, "a+")
9191
@@ -105,14 +105,29 @@ end
105105https://hub.docker.com/r/zwxajh/mysql-proxy
106106https://hub.docker.com/r/gediminaspuksmys/mysqlproxy/
107107
108+ # logrotate
109+ The image can be expand with ` logrotate `
110+ Config file ` /etc/logrotate.d/mysql-proxy ` (approximate)
111+
112+ ```
113+ /opt/mysql-proxy/mysql.log {
114+ weekly
115+ missingok
116+ rotate 35600
117+ compress
118+ delaycompress
119+ notifempty
120+ create 666 root root
121+ postrotate
122+ /etc/init.d/mysql-proxy reload > /dev/null
123+ endscript
124+ }
125+ ```
126+
108127# troubleshooting
109128If you can't create the chain ` mysql ` -> ` mysql-proxy ` -> ` external client liten 0.0.0.0:3308 `
110129check extends ports on the ` mysql ` service and/or add ` expose ` directly
111130```
112131 expose:
113132 - "3306" #for service mysql-proxy
114133```
115-
116- You can create
117- ``` touch mysql-proxy/mysql.log ```
118- before run the suite
0 commit comments