Commit 2c246bf4 authored by Johannes Zellner's avatar Johannes Zellner

Use supervisor to better control apache and bitwarden

parent b50ebf04
...@@ -31,6 +31,10 @@ COPY --from=bitwarden /web-vault /app/code/web-vault ...@@ -31,6 +31,10 @@ COPY --from=bitwarden /web-vault /app/code/web-vault
COPY --from=bitwarden /bitwarden_rs /app/code/ COPY --from=bitwarden /bitwarden_rs /app/code/
COPY --from=bitwarden /Rocket.toml /app/code/ COPY --from=bitwarden /Rocket.toml /app/code/
# configure supervisor
ADD supervisor/ /etc/supervisor/conf.d/
RUN sed -e 's,^logfile=.*$,logfile=/run/supervisord.log,' -i /etc/supervisor/supervisord.conf
WORKDIR /app/code WORKDIR /app/code
COPY start.sh /app/code/start.sh COPY start.sh /app/code/start.sh
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
set -eu set -eu
echo "=> exporting env vars expected by Bitwarden"
export DOMAIN=$CLOUDRON_APP_ORIGIN export DOMAIN=$CLOUDRON_APP_ORIGIN
export SMTP_HOST=$CLOUDRON_MAIL_SMTP_SERVER export SMTP_HOST=$CLOUDRON_MAIL_SMTP_SERVER
export SMTP_FROM=$CLOUDRON_MAIL_FROM export SMTP_FROM=$CLOUDRON_MAIL_FROM
...@@ -11,10 +12,5 @@ export SMTP_SSL=true ...@@ -11,10 +12,5 @@ export SMTP_SSL=true
export SMTP_USERNAME=$CLOUDRON_MAIL_SMTP_USERNAME export SMTP_USERNAME=$CLOUDRON_MAIL_SMTP_USERNAME
export SMTP_PASSWORD=$CLOUDRON_MAIL_SMTP_PASSWORD export SMTP_PASSWORD=$CLOUDRON_MAIL_SMTP_PASSWORD
echo "=> Starting apache" echo "=> Starting supervisord"
APACHE_CONFDIR="" source /etc/apache2/envvars exec /usr/bin/supervisord --configuration /etc/supervisor/supervisord.conf --nodaemon -i Bitwarden
rm -f "${APACHE_PID_FILE}"
/usr/sbin/apache2 -DFOREGROUND &
echo "=> Starting bitwarden_rs"
exec /app/code/bitwarden_rs
[program:apache2]
autorestart=true
autostart=true
command=/usr/bin/pidproxy /run/apache2/apache2.pid /bin/bash -c "source /etc/apache2/envvars && /usr/sbin/apache2 -DFOREGROUND"
environment=APACHE_CONFDIR=""
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
stopasgroup=true
killasgroup=true
[program:core]
directory=/app/code/
command=/app/code/bitwarden_rs
user=root
autostart=true
autorestart=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment