Skip to content

Commit

Permalink
fix: use supervisor to fix zombie process #101 #98
Browse files Browse the repository at this point in the history
  • Loading branch information
Ravinou committed Nov 20, 2023
1 parent 0ff450c commit 80cbc82
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
4 changes: 1 addition & 3 deletions docker-bw-init.sh → .github/docker/docker-bw-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,4 @@ create_authorized_keys_file
check_repos_directory
get_SSH_fingerprints

sudo service ssh restart

exec "$@"
exec supervisord -c /home/borgwarehouse/app/supervisord.conf
10 changes: 10 additions & 0 deletions .github/docker/supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[supervisord]
nodaemon=true
logfile=/home/borgwarehouse/supervisord.log
pidfile=/home/borgwarehouse/supervisord.pid

[program:sshd]
command=/usr/sbin/sshd -D

[program:borgwarehouse]
command=/usr/local/bin/node server.js
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ FROM base AS runner
ENV NODE_ENV production

RUN apt-get update && apt-get install -y \
curl jq jc borgbackup openssh-server sudo && \
supervisor \
curl jq jc borgbackup openssh-server sudo cron && \
apt-get clean && rm -rf /var/lib/apt/lists/*

RUN echo "borgwarehouse ALL=(ALL) NOPASSWD: /usr/sbin/service ssh restart" >> /etc/sudoers

RUN groupadd borgwarehouse

RUN useradd -m -g borgwarehouse borgwarehouse
Expand All @@ -45,11 +44,12 @@ COPY --from=builder --chown=borgwarehouse:borgwarehouse /app/helpers/shells ./he
COPY --from=builder --chown=borgwarehouse:borgwarehouse /app/.next/standalone ./
COPY --from=builder --chown=borgwarehouse:borgwarehouse /app/public ./public
COPY --from=builder --chown=borgwarehouse:borgwarehouse /app/.next/static ./.next/static
COPY --from=builder --chown=borgwarehouse:borgwarehouse /app/docker/supervisord.conf ./

USER borgwarehouse

EXPOSE 3000 22

ENTRYPOINT ["./docker-bw-init.sh"]
ENTRYPOINT ["./docker/docker-bw-init.sh"]

CMD ["node", "server.js"]

0 comments on commit 80cbc82

Please sign in to comment.