Skip to content

Commit

Permalink
ci: update rabbit. set celery loglevel info (#3671)
Browse files Browse the repository at this point in the history
  • Loading branch information
rpcross authored Jan 12, 2024
1 parent 6ac8179 commit 7d99599
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 111 deletions.
2 changes: 1 addition & 1 deletion compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ services:
# (Adding the "ports" property to this file will not forward from a Codespace.)

rabbit:
image: rabbitmq:3.10
image: rabbitmq:3.12-alpine
restart: always
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)
2 changes: 1 addition & 1 deletion compose-sandbox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ services:
- app-assets:/assets

rabbit:
image: rabbitmq:3.10
image: rabbitmq:3.12-alpine
restart: always

celery:
Expand Down
21 changes: 7 additions & 14 deletions docker/app-sandbox.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,12 @@ RUN bash /tmp/library-scripts/python-debian.sh "none" "/usr/local" "${PIPX_HOME}
# Remove library scripts for final image
RUN rm -rf /tmp/library-scripts

# Copy the startup file
COPY docker/scripts/app-init-sandbox.sh /docker-init.sh
RUN sed -i 's/\r$//' /docker-init.sh && \
chmod +x /docker-init.sh

COPY docker/scripts/docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
RUN sed -i 's/\r$//' /usr/local/bin/docker-entrypoint.sh && \
chmod +x /usr/local/bin/docker-entrypoint.sh

COPY docker/configs/gunicorn.conf.py /gunicorn.conf.py

# Fix user UID / GID to match host
RUN groupmod --gid $USER_GID $USERNAME \
&& usermod --uid $USER_UID --gid $USER_GID $USERNAME \
&& chown -R $USER_UID:$USER_GID /home/$USERNAME \
|| exit 0

# Switch to local dev user
USER dev:dev

Expand All @@ -57,12 +47,15 @@ RUN sudo rm -rf /tmp/pip-tmp
# Copy app files
COPY . .

# Copy configuration files
COPY /workspace/docker/configs/docker_env /workspace/.env
COPY /workspace/docker/configs/settings_docker.py \
/workspace/backend/mlarchive/settings/settings_docker.py

ENTRYPOINT ["docker-entrypoint.sh"]

# runserver
CMD ["./backend/manage.py", "runserver", "0.0.0.0:8000"]

# gunicorn
# CMD ["gunicorn", "-c", "/gunicorn.conf.py", "backend.mlarchive.wsgi:application"]

# VOLUME [ "/assets" ]
4 changes: 2 additions & 2 deletions docker/configs/settings_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
from .base import *

AUTHENTICATION_BACKENDS = ["django.contrib.auth.backends.ModelBackend"]
ELASTICSEARCH_SIGNAL_PROCESSOR = 'mlarchive.archive.signals.RealtimeSignalProcessor'

# ELASTICSEARCH_SIGNAL_PROCESSOR = 'mlarchive.archive.signals.RealtimeSignalProcessor'
ELASTICSEARCH_SIGNAL_PROCESSOR = 'mlarchive.archive.signals.CelerySignalProcessor'
72 changes: 0 additions & 72 deletions docker/scripts/app-init-sandbox.sh

This file was deleted.

2 changes: 2 additions & 0 deletions docker/scripts/celery-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#
WORKSPACEDIR="/workspace"
CELERY_ROLE="${CELERY_ROLE:-worker}"
CELERY_LOG_LEVEL="${CELERY_LOG_LEVEL:-info}"

cd "$WORKSPACEDIR" || exit 255

Expand All @@ -33,6 +34,7 @@ if [[ -n "${UPDATE_REQUIREMENTS_FROM}" ]]; then
fi

CELERY_OPTS=( "${CELERY_ROLE}" )
CELERY_OPTS+=("--loglevel=${CELERY_LOG_LEVEL}")
if [[ -n "${CELERY_UID}" ]]; then
# ensure that a user with the necessary UID exists in container
if ! id "${CELERY_UID}" ; then
Expand Down
21 changes: 0 additions & 21 deletions docker/scripts/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,6 @@ sudo chown dev:dev "/data"
echo "Fix chromedriver /dev/shm permissions..."
sudo chmod 1777 /dev/shm

# Copy config files if needed

if [ ! -f "$WORKSPACEDIR/.env" ]; then
echo "Setting up a default .env ..."
cp $WORKSPACEDIR/docker/configs/docker_env $WORKSPACEDIR/.env
else
echo "Using existing .env file"
if ! cmp -s $WORKSPACEDIR/docker/configs/docker_env $WORKSPACEDIR/.env; then
echo "NOTE: Differences detected compared to docker/configs/docker_env!"
echo "We'll assume you made these deliberately."
fi
fi

if [ ! -f "$WORKSPACEDIR/backend/mlarchive/settings/settings_docker.py" ]; then
echo "Setting up a default settings_docker.py ..."
else
echo "Renaming existing backend/mlarchive/settings/settings_docker.py to backend/mlarchive/settings/settings_docker.py.bak"
mv -f $WORKSPACEDIR/backend/mlarchive/settings/settings_docker.py $WORKSPACEDIR/backend/mlarchive/settings/settings_docker.py.bak
fi
cp $WORKSPACEDIR/docker/configs/settings_docker.py $WORKSPACEDIR/backend/mlarchive/settings/settings_docker.py

# Create data directories
echo "Creating data directories..."
for sub in \
Expand Down

0 comments on commit 7d99599

Please sign in to comment.