Update to 0.4.5 and replace supervisor with minit

This commit is contained in:
Daniel Berteaud 2024-02-01 11:33:53 +01:00
parent 8df5891d54
commit 69de6b0967
19 changed files with 76 additions and 89 deletions

View File

@ -70,6 +70,8 @@ BOUNCA_DB_PORT=[[ $c.postgres.port ]]
[[- end ]]
_EOT
destination = "secrets/.db.env"
env = true
perms = 400
}
[[ template "common/resources.tpl" $c.resources ]]
@ -100,6 +102,23 @@ _EOT
[[ template "common/file_env.tpl" $c.env ]]
template {
data =<<_EOT
[[- if ne $c.postgres.pooler.engine "none" ]]
BOUNCA_DB_USER=[[ .instance ]]
BOUNCA_DB_PASSWORD={{ env "NOMAD_ALLOC_ID" }}
BOUNCA_DB_PORT=[[ $c.postgres.pooler.port ]]
[[- else ]]
BOUNCA_DB_USER=[[ $c.postgres.user ]]
BOUNCA_DB_PASSWORD=[[ $c.postgres.password ]]
BOUNCA_DB_PORT=[[ $c.postgres.port ]]
[[- end ]]
_EOT
destination = "secrets/.db.env"
env = true
perms = 400
}
resources {
cpu = 10
memory = 10

View File

@ -72,7 +72,7 @@ job "bounca" {
user = 1053
config {
image = "danielberteaud/wait-for:24.1-1"
image = "danielberteaud/wait-for:24.2-1"
readonly_rootfs = true
pids_limit = 20
}
@ -194,6 +194,8 @@ BOUNCA_DB_PASSWORD={{ with secret "//database/creds/bounca" }}{{ .Data.password
BOUNCA_DB_PORT=5432
_EOT
destination = "secrets/.db.env"
env = true
perms = 400
}
@ -254,6 +256,17 @@ _EOT
}
template {
data = <<_EOT
BOUNCA_DB_USER={{ with secret "//database/creds/bounca" }}{{ .Data.username }}{{ end }}
BOUNCA_DB_PASSWORD={{ with secret "//database/creds/bounca" }}{{ .Data.password }}{{ end }}
BOUNCA_DB_PORT=5432
_EOT
destination = "secrets/.db.env"
env = true
perms = 400
}
resources {
cpu = 10
memory = 10

View File

@ -2,7 +2,7 @@
FROM python:3.11-alpine AS builder
ARG BOUNCA_VERSION=0.4.4
ARG BOUNCA_VERSION=0.4.5
workdir /opt
RUN set -euxo pipefail &&\
@ -72,9 +72,9 @@ RUN set -euxo pipefail &&\
gettext \
openssl \
nginx \
supervisor \
postgresql15-client
postgresql16-client
COPY --from=danielberteaud/alpine:24.2-1 /usr/local/bin/minit /usr/local/bin/minit
COPY root/ /
WORKDIR /opt/bounca

View File

@ -0,0 +1,16 @@
---
kind: daemon
name: gunicorn
command: ["sh", "-c", "source /opt/bounca/venv/bin/activate && gunicorn --bind=unix:${BOUNCA_UNIX_SOCKET} --threads=4 --max-requests=10000 bounca.wsgi:applicatio"]
---
kind: daemon
name: nginx
command: ["nginx", "-c", "/tmp/nginx.conf"]
---
kind: cron
name: pu-export
command: ["/usr/local/bin/bounca-pub-export"]
cron: '*/15 * * * *'

View File

@ -1,8 +0,0 @@
[supervisord]
pidfile=/tmp/supervisord.pi
nodaemon=true
logfile=/dev/stdout
logfile_maxbytes=0
[include]
files = supervisord.d/*.ini

View File

@ -1,10 +0,0 @@
[program:gunicorn]
command=sh -c "source /opt/bounca/venv/bin/activate && gunicorn --bind=unix:${BOUNCA_UNIX_SOCKET} --threads=4 --max-requests=10000 bounca.wsgi:application"
stdout_logfile=/proc/self/fd/1
stdout_logfile_backups=0
stdout_logfile_maxbytes=0
stderr_logfile=/proc/self/fd/2
stderr_logfile_backups=0
stderr_logfile_maxbytes=0
autostart=true
autorestart=true

View File

@ -1,10 +0,0 @@
[program:nginx]
command=/usr/sbin/nginx -c /tmp/nginx.conf
stdout_logfile=/proc/self/fd/1
stdout_logfile_backups=0
stdout_logfile_maxbytes=0
stderr_logfile=/proc/self/fd/2
stderr_logfile_backups=0
stderr_logfile_maxbytes=0
autostart=true
autorestart=true

View File

@ -1,10 +0,0 @@
[program:pub-export]
command=/usr/local/bin/bounca-pub-export 300
stdout_logfile=/proc/self/fd/1
stdout_logfile_backups=0
stdout_logfile_maxbytes=0
stderr_logfile=/proc/self/fd/2
stderr_logfile_backups=0
stderr_logfile_maxbytes=0
autostart=true
autorestart=true

View File

@ -1,2 +0,0 @@
[group:bounca]
programs=gunicorn,nginx,pub-export

View File

@ -5,7 +5,7 @@ set -euo pipefail
source /opt/bounca/venv/bin/activate
if [ "${BOUNCA_MODE}" = "all-in-one" ]; then
exec supervisor -c /etc/supervisord.conf -n
exec minit
elif [ "${BOUNCA_MODE}" = "server" ]; then
exec gunicorn \
--bind=unix:/alloc/data/bounca.sock \

View File

@ -2,7 +2,7 @@
FROM python:3.11-alpine AS builder
ARG BOUNCA_VERSION=0.4.4
ARG BOUNCA_VERSION=[[ .bounca.version ]]
workdir /opt
RUN set -euxo pipefail &&\
@ -72,9 +72,9 @@ RUN set -euxo pipefail &&\
gettext \
openssl \
nginx \
supervisor \
postgresql15-client
postgresql16-client
COPY --from=[[ .docker.repo ]][[ .docker.base_images.alpine.image ]] /usr/local/bin/minit /usr/local/bin/minit
COPY root/ /
WORKDIR /opt/bounca

View File

@ -0,0 +1,16 @@
---
kind: daemon
name: gunicorn
command: ["sh", "-c", "source /opt/bounca/venv/bin/activate && gunicorn --bind=unix:${BOUNCA_UNIX_SOCKET} --threads=4 --max-requests=10000 bounca.wsgi:applicatio"]
---
kind: daemon
name: nginx
command: ["nginx", "-c", "/tmp/nginx.conf"]
---
kind: cron
name: pu-export
command: ["/usr/local/bin/bounca-pub-export"]
cron: '*/15 * * * *'

View File

@ -1,8 +0,0 @@
[supervisord]
pidfile=/tmp/supervisord.pi
nodaemon=true
logfile=/dev/stdout
logfile_maxbytes=0
[include]
files = supervisord.d/*.ini

View File

@ -1,10 +0,0 @@
[program:gunicorn]
command=sh -c "source /opt/bounca/venv/bin/activate && gunicorn --bind=unix:${BOUNCA_UNIX_SOCKET} --threads=4 --max-requests=10000 bounca.wsgi:application"
stdout_logfile=/proc/self/fd/1
stdout_logfile_backups=0
stdout_logfile_maxbytes=0
stderr_logfile=/proc/self/fd/2
stderr_logfile_backups=0
stderr_logfile_maxbytes=0
autostart=true
autorestart=true

View File

@ -1,10 +0,0 @@
[program:nginx]
command=/usr/sbin/nginx -c /tmp/nginx.conf
stdout_logfile=/proc/self/fd/1
stdout_logfile_backups=0
stdout_logfile_maxbytes=0
stderr_logfile=/proc/self/fd/2
stderr_logfile_backups=0
stderr_logfile_maxbytes=0
autostart=true
autorestart=true

View File

@ -1,10 +0,0 @@
[program:pub-export]
command=/usr/local/bin/bounca-pub-export 300
stdout_logfile=/proc/self/fd/1
stdout_logfile_backups=0
stdout_logfile_maxbytes=0
stderr_logfile=/proc/self/fd/2
stderr_logfile_backups=0
stderr_logfile_maxbytes=0
autostart=true
autorestart=true

View File

@ -1,2 +0,0 @@
[group:bounca]
programs=gunicorn,nginx,pub-export

View File

@ -5,7 +5,7 @@ set -euo pipefail
source /opt/bounca/venv/bin/activate
if [ "${BOUNCA_MODE}" = "all-in-one" ]; then
exec supervisor -c /etc/supervisord.conf -n
exec minit
elif [ "${BOUNCA_MODE}" = "server" ]; then
exec gunicorn \
--bind=unix:/alloc/data/bounca.sock \

View File

@ -5,6 +5,9 @@ instance: bounca
bounca:
# Version of BounCA
version: 0.4.5
# The image to use
image: danielberteaud/bounca:latest