Skip to content

Commit

Permalink
chore:run container script run through CLI args
Browse files Browse the repository at this point in the history
  • Loading branch information
codedsun committed Dec 23, 2019
1 parent 6a71e47 commit ae17595
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ WORKDIR /data/app
ADD . .

EXPOSE 8080
CMD ["sh", "scripts/container_start.sh"]
ENTRYPOINT ["scripts/container_start.sh"]
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ services:
container_name: opev-celery
environment:
<<: *environment-vars
DEPLOYMENT: celery
C_FORCE_ROOT: "true"
command: celery

volumes:
pg:
Expand Down
7 changes: 4 additions & 3 deletions scripts/container_start.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/sh
export DEPLOYMENT=${DEPLOYMENT:-api}
export DEPLOYMENT=${1:-api}

echo "[LOG] Deploying ${DEPLOYMENT}"
echo "[LOG] Using database: ${DATABASE_URL}"
echo "[LOG] Using redis: ${REDIS_URL}"

if [ "$DEPLOYMENT" == "api" ]
then
then
echo "[LOG] Waiting for Database" && ./scripts/wait-for.sh ${POSTGRES_HOST}:5432 --timeout=60 -- echo "[LOG] Database Up"
echo "[LOG] Preparing database"
python manage.py prepare_kubernetes_db
Expand All @@ -18,8 +18,9 @@ then
echo "[LOG] Starting gunicorn on port ${PORT}"
gunicorn -b 0.0.0.0:${PORT} app:app -w $GUNICORN_WORKERS --enable-stdio-inheritance --log-level $GUNICORN_LOG_LEVEL --proxy-protocol --preload $GUNICORN_EXTRA_ARGS
fi

if [ "$DEPLOYMENT" == "celery" ]
then
then
echo "[LOG] Starting celery worker"
export INTEGRATE_SOCKETIO=false
export CELERY_LOG_LEVEL=${CELERY_LOG_LEVEL:-info}
Expand Down

0 comments on commit ae17595

Please sign in to comment.