@@ -48,12 +48,12 @@ services:
48
48
- "3308:3306" #for external connection
49
49
restart: always
50
50
volumes:
51
- - ../mysql-proxy/main.lua :/opt/main.lua
51
+ - ../mysql-proxy-conf :/opt/mysql-proxy/conf
52
52
environment:
53
53
PROXY_DB_PORT: 3306
54
54
REMOTE_DB_HOST: mysql
55
55
REMOTE_DB_PORT: 3306
56
- PROXY_LUA_SCRIPT: "/opt/main.lua"
56
+ PROXY_LUA_SCRIPT: "/opt/mysql-proxy/conf/ main.lua"
57
57
depends_on:
58
58
- mysql
59
59
```
73
73
```
74
74
...
75
75
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
78
78
environment:
79
79
PROXY_DB_PORT: 3306
80
80
REMOTE_DB_HOST: mysql
81
81
REMOTE_DB_PORT: 3306
82
- PROXY_LUA_SCRIPT: "/opt/log.lua"
82
+ PROXY_LUA_SCRIPT: "/opt/mysql-proxy/conf/ log.lua"
83
83
...
84
84
```
85
85
86
86
` /mysql-proxy/log.lua ` https://gist.github.com/simonw/1039751
87
87
```
88
- local log_file = '/opt/mysql-proxy/mysql.log'
88
+ local log_file = '/opt/mysql-proxy/logs/ mysql.log'
89
89
90
90
local fh = io.open(log_file, "a+")
91
91
@@ -105,14 +105,29 @@ end
105
105
https://hub.docker.com/r/zwxajh/mysql-proxy
106
106
https://hub.docker.com/r/gediminaspuksmys/mysqlproxy/
107
107
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
+
108
127
# troubleshooting
109
128
If you can't create the chain ` mysql ` -> ` mysql-proxy ` -> ` external client liten 0.0.0.0:3308 `
110
129
check extends ports on the ` mysql ` service and/or add ` expose ` directly
111
130
```
112
131
expose:
113
132
- "3306" #for service mysql-proxy
114
133
```
115
-
116
- You can create
117
- ``` touch mysql-proxy/mysql.log ```
118
- before run the suite
0 commit comments