From 8564ea6b6d60e776e3e9750ef8c8a2289710fd26 Mon Sep 17 00:00:00 2001 From: Vasili Kachalko Date: Tue, 26 Sep 2023 15:33:52 +0200 Subject: [PATCH] allow to monitor both running processes --- Dockerfile | 10 +++++++--- docker/puma.sh | 3 +++ docker/workers.sh | 3 +++ web-entrypoint.sh | 13 ------------- 4 files changed, 13 insertions(+), 16 deletions(-) create mode 100644 docker/puma.sh create mode 100644 docker/workers.sh delete mode 100644 web-entrypoint.sh diff --git a/Dockerfile b/Dockerfile index c52d06944..348e63096 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,8 +4,6 @@ FROM phusion/passenger-ruby31:latest ENV HOME /home/app/deploy -CMD ["/sbin/my_init"] - # Install common dependencies RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ --mount=type=cache,target=/var/lib/apt,sharing=locked \ @@ -87,4 +85,10 @@ RUN SKIP_SALESFORCE_INIT=true SKIP_FLIPPER_INIT=true SECRET_KEY_BASE=dummyvalue EXPOSE 3000 -ENTRYPOINT sh ./web-entrypoint.sh +RUN mkdir -p /etc/my_init.d +COPY docker/puma.sh /etc/my_init.d/puma.sh +COPY docker/workers.sh /etc/my_init.d/workers.sh + + +CMD ["/sbin/my_init"] +EXPOSE 3000 diff --git a/docker/puma.sh b/docker/puma.sh new file mode 100644 index 000000000..bfc8f2149 --- /dev/null +++ b/docker/puma.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +cd /home/app/deploy && exec bundle exec rails server -b 0.0.0.0 -p 3000 >>/var/log/puma.log 2>&1 diff --git a/docker/workers.sh b/docker/workers.sh new file mode 100644 index 000000000..4aea5d71f --- /dev/null +++ b/docker/workers.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +cd /home/app/deploy && exec bundle exec rake jobs:work >>/var/log/workers.log 2>&1 diff --git a/web-entrypoint.sh b/web-entrypoint.sh deleted file mode 100644 index 1f1b81f9c..000000000 --- a/web-entrypoint.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -# Database migration - -echo 'prepping database' - -bin/rails db:migrate - -# Runs rails server - -echo 'running server' - -bundle exec rails server -b 0.0.0.0 -p 3000 & rake jobs:work