Skip to content

Commit

Permalink
OBS-361: Remove tini and set up stop signals. (#6771)
Browse files Browse the repository at this point in the history
  • Loading branch information
smarnach authored Oct 29, 2024
1 parent d1de5fc commit 2141236
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 27 deletions.
16 changes: 8 additions & 8 deletions bin/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,28 @@ shift

case ${SERVICE} in
processor) ## Run processor service
/app/bin/run_service_processor.sh "$@"
exec /app/bin/run_service_processor.sh "$@"
;;
crontabber) ## Run crontabber service
/app/bin/run_service_crontabber.sh "$@"
exec /app/bin/run_service_crontabber.sh "$@"
;;
webapp) ## Run webapp service
/app/bin/run_service_webapp.sh "$@"
exec /app/bin/run_service_webapp.sh "$@"
;;
stage_submitter) ## Runs the stage submitter
/app/bin/run_service_stage_submitter.sh
exec /app/bin/run_service_stage_submitter.sh
;;
fakecollector) ## Runs a local fake collector
/app/bin/run_fakecollector.sh
exec /app/bin/run_fakecollector.sh
;;
symbolsserver) ## Runs a local symbols server
/app/bin/run_symbolsserver.sh
exec /app/bin/run_symbolsserver.sh
;;
shell) ## Open a shell or run something else
if [ -z "$*" ]; then
bash
exec bash
else
"$@"
exec "$@"
fi
;;
*)
Expand Down
2 changes: 1 addition & 1 deletion bin/run_cache_manager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ set -euo pipefail
export PROCESS_NAME=cache_manager

# Run the processor
python socorro/processor/cache_manager.py
exec python socorro/processor/cache_manager.py
2 changes: 1 addition & 1 deletion bin/run_fakecollector.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ set -euxo pipefail

PORT=8000

python fakecollector/collector.py --port=${PORT}
exec python fakecollector/collector.py --port=${PORT}
2 changes: 1 addition & 1 deletion bin/run_processor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ set -euo pipefail
export PROCESS_NAME=processor

# Run the processor
python socorro/processor/processor_app.py
exec python socorro/processor/processor_app.py
2 changes: 1 addition & 1 deletion bin/run_service_processor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ set -euo pipefail
PROCESSOR_WORKERS=${PROCESSOR_WORKERS:-"1"}

# Run honcho with PROCESSOR_WORKERS number of processor worker processes
honcho \
exec honcho \
--procfile /app/processor/Procfile \
--app-root /app \
--no-prefix \
Expand Down
2 changes: 1 addition & 1 deletion bin/run_service_stage_submitter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ set -euo pipefail
export PROCESS_NAME=stage_submitter

# Run the stage_submitter
python socorro/stage_submitter/submitter.py
exec python socorro/stage_submitter/submitter.py
4 changes: 2 additions & 2 deletions bin/run_service_webapp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ if [ "${1:-}" == "--dev" ]; then
echo "Running webapp in local dev environment."
echo "Connect with your browser using: http://localhost:8000/ "
echo "******************************************************************"
cd /app/webapp/ && ${CMDPREFIX} python manage.py runserver 0.0.0.0:8000
cd /app/webapp/ && exec ${CMDPREFIX} python manage.py runserver 0.0.0.0:8000

else
${CMDPREFIX} gunicorn \
exec ${CMDPREFIX} gunicorn \
--pythonpath /app/webapp/ \
--timeout "${GUNICORN_TIMEOUT}" \
--workers="${GUNICORN_WORKERS}" \
Expand Down
2 changes: 1 addition & 1 deletion bin/run_symbolsserver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ then
fi

echo "Running local symbols server at ${SYMBOLS_PATH} ..."
python -m http.server --directory "${SYMBOLS_PATH}" --bind 0.0.0.0 "${PORT}"
exec python -m http.server --directory "${SYMBOLS_PATH}" --bind 0.0.0.0 "${PORT}"
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ services:
ports:
- "8090:8090"
command: run --host 0.0.0.0 --port 8090
stop_signal: SIGINT

# https://hub.docker.com/r/mozilla/oidc-testprovider
oidcprovider:
Expand All @@ -160,6 +161,9 @@ services:
image: local/socorro_oidcprovider
ports:
- "8080:8080"
# The next line can be removed if this PR is included in the image we use:
# https://github.com/mozilla/docker-test-mozilla-django-oidc/pull/84
stop_signal: SIGKILL

# -----------------------------
# External services
Expand Down Expand Up @@ -204,6 +208,7 @@ services:
- docker/config/local_dev.env
- my.env
command: ["symbolsserver"]
stop_signal: SIGINT
ports:
- "8070:8070"
volumes:
Expand Down Expand Up @@ -261,6 +266,7 @@ services:
- --host-port=0.0.0.0:${PUBSUB_PORT:-5010}
ports:
- 5010:5010
stop_signal: SIGINT

# https://hub.docker.com/_/memcached/
memcached:
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ RUN cd /app/webapp/ && TOOL_ENV=True python manage.py collectstatic --noinput

# Set entrypoint for this image. The entrypoint script takes a service
# to run as the first argument. See the script for available arguments.
ENTRYPOINT ["/usr/bin/tini", "--", "/app/bin/entrypoint.sh"]
ENTRYPOINT ["/app/bin/entrypoint.sh"]
4 changes: 2 additions & 2 deletions docker/Dockerfile.fakesentry
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ WORKDIR /app/
RUN groupadd -r kent && useradd --no-log-init -r -g kent kent

RUN apt-get update && \
apt-get install -y --no-install-recommends curl tini && \
apt-get install -y --no-install-recommends curl && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
Expand All @@ -21,5 +21,5 @@ RUN pip install -U 'pip>=20' && \

USER kent

ENTRYPOINT ["tini", "--", "/usr/local/bin/kent-server"]
ENTRYPOINT ["/usr/local/bin/kent-server"]
CMD ["run"]
6 changes: 1 addition & 5 deletions docker/Dockerfile.oidcprovider
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
FROM mozilla/oidc-testprovider:oidc_testprovider-v0.10.9

RUN apt-get update && \
apt install tini && \
rm -rf /var/lib/apt/lists/*

# Modify redirect_urls specified in "fixtures.json" to fit our needs.
COPY ./docker/config/oidcprovider-fixtures.json /code/fixtures.json

CMD ["/usr/bin/tini", "--", "./bin/run.sh"]
CMD ["./bin/run.sh"]
3 changes: 0 additions & 3 deletions docker/set_up_ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ PACKAGES_TO_INSTALL=(
# For scripts
git

# For running services
tini

# For nodejs and npm
curl

Expand Down

0 comments on commit 2141236

Please sign in to comment.