-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Version 2.0
- Loading branch information
Showing
25 changed files
with
480 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.idea | ||
*~ | ||
venv | ||
venv | ||
.docker_data | ||
__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,18 @@ | ||
FROM haproxy:1.9-alpine | ||
FROM haproxy:2.0.2-alpine | ||
|
||
RUN apk add --no-cache bash python3 py-yaml | ||
WORKDIR /scripts | ||
|
||
COPY entrypoint.* / | ||
COPY conf.d /etc/haproxy/conf.d | ||
COPY assets/errors-custom/* /etc/haproxy/errors-custom/ | ||
RUN apk add --no-cache bash python3 py-yaml supervisor docker | ||
|
||
ENTRYPOINT [ "/entrypoint.sh" ] | ||
CMD ["haproxy", "-f", "/etc/haproxy/haproxy.cfg"] | ||
COPY requirements.txt /scripts | ||
RUN pip3 install --upgrade pip \ | ||
&& pip install -r requirements.txt | ||
|
||
COPY swarm.* /scripts/ | ||
COPY static.* /scripts/ | ||
COPY templates /scripts/templates/ | ||
COPY easymapping /scripts/easymapping/ | ||
|
||
COPY assets / | ||
|
||
CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisord.conf" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# do daily/weekly/monthly maintenance | ||
# min hour day month weekday command | ||
*/15 * * * * run-parts /etc/periodic/15min | ||
0 * * * * run-parts /etc/periodic/hourly | ||
0 2 * * * run-parts /etc/periodic/daily | ||
0 3 * * 6 run-parts /etc/periodic/weekly | ||
0 5 1 * * run-parts /etc/periodic/monthly | ||
* * * * * /scripts/haproxy-reload.sh | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Certs Folder | ||
|
||
Docker Easy HAProxy will save the SSL Certs here. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
[unix_http_server] | ||
file=/dev/shm/supervisor.sock ; (the path to the socket file) | ||
|
||
[supervisord] | ||
logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log) | ||
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB) | ||
logfile_backups=10 ; (num of main logfile rotation backups;default 10) | ||
loglevel=info ; (log level;default info; others: debug,warn,trace) | ||
pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid) | ||
nodaemon=false ; (start in foreground if true;default false) | ||
minfds=1024 ; (min. avail startup file descriptors;default 1024) | ||
minprocs=200 ; (min. avail process descriptors;default 200) | ||
user=root ; | ||
|
||
; the below section must remain in the config file for RPC | ||
; (supervisorctl/web interface) to work, additional interfaces may be | ||
; added by defining them in separate rpcinterface: sections | ||
[rpcinterface:supervisor] | ||
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface | ||
|
||
[supervisorctl] | ||
serverurl=unix:///dev/shm/supervisor.sock ; use a unix:// URL for a unix socket | ||
|
||
[program:haproxy] | ||
command = /scripts/haproxy.sh | ||
autostart=true | ||
autorestart=false | ||
priority=5 | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
|
||
[program:crond] | ||
command=/usr/sbin/crond -f | ||
autostart=true | ||
autorestart=false | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
|
||
[eventlistener:exit_on_any_fatal] | ||
command=/scripts/exit-event-listener.py | ||
events=PROCESS_STATE_FATAL,PROCESS_STATE_EXITED,PROCESS_STATE_STOPPED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env python | ||
|
||
import os | ||
import signal | ||
|
||
from supervisor import childutils | ||
|
||
def main(): | ||
while True: | ||
headers, payload = childutils.listener.wait() | ||
childutils.listener.ok() | ||
events = ['PROCESS_STATE_FATAL', 'PROCESS_STATE_EXITED', 'PROCESS_STATE_STOPPED'] | ||
if not (headers['eventname'] in events): | ||
continue | ||
os.kill(os.getppid(), signal.SIGTERM) | ||
|
||
if __name__ == "__main__": | ||
main() |
Oops, something went wrong.