Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use celery concurrency 1 and allow --scale containers #61

Merged
merged 2 commits into from
Jun 8, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions dockerfiles/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
version: '3'

volumes:
build-user-builds:
build-default-user-builds:
build-large-user-builds:
storage_data:
postgres_data:
postgres_backups_data:
Expand Down Expand Up @@ -87,7 +88,7 @@ services:
readthedocs:
command: ["../../docker/celery.sh"]

build:
build-default: &build
volumes:
- ${PWD}/common/dockerfiles/entrypoints/common.sh:/usr/src/app/docker/common.sh
- ${PWD}/common/dockerfiles/entrypoints/build.sh:/usr/src/app/docker/build.sh
Expand All @@ -98,7 +99,7 @@ services:
# between the build container (git commands), and the container that
# is created inside the build container (sphinx commands).
# Because of this, we need to use a shared volume between them
- build-user-builds:/usr/src/app/checkouts/readthedocs.org/user_builds
- build-default-user-builds:/usr/src/app/checkouts/readthedocs.org/user_builds

# Docker in Docker
- /var/run/docker.sock:/var/run/docker.sock
Expand All @@ -108,12 +109,35 @@ services:
- cache
environment:
- DOCKER_NO_RELOAD
- BUILD_USER_BUILDS_VOLUME=build-default-user-builds
- CELERY_QUEUE=build:default
stdin_open: true
tty: true
networks:
readthedocs:
command: ["../../docker/build.sh"]

build-large:
humitos marked this conversation as resolved.
Show resolved Hide resolved
<<: *build
environment:
- DOCKER_NO_RELOAD
- BUILD_USER_BUILDS_VOLUME=build-large-user-builds
- CELERY_QUEUE=build:large
volumes:
- ${PWD}/common/dockerfiles/entrypoints/common.sh:/usr/src/app/docker/common.sh
- ${PWD}/common/dockerfiles/entrypoints/build.sh:/usr/src/app/docker/build.sh
- ${PWD}/../readthedocs-ext:/usr/src/app/checkouts/readthedocs-ext

# The python code at readthedocs/doc_builder/environments.py
# mounts `self.project.doc_path`. We need to share this path
# between the build container (git commands), and the container that
# is created inside the build container (sphinx commands).
# Because of this, we need to use a shared volume between them
- build-large-user-builds:/usr/src/app/checkouts/readthedocs.org/user_builds

# Docker in Docker
- /var/run/docker.sock:/var/run/docker.sock

cache:
image: redis:3.2.7
networks:
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/entrypoints/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

../../docker/common.sh

CMD="python3 -m celery worker -A ${CELERY_APP_NAME}.worker -Ofair -c 2 -Q builder,celery,default,build01 -l DEBUG"
CMD="python3 -m celery worker -A ${CELERY_APP_NAME}.worker -Ofair -c 1 -Q builder,celery,default,build01,{CELERY_QUEUE} -l DEBUG"

if [ -n "${DOCKER_NO_RELOAD}" ]; then
echo "Running Docker with no reload"
Expand Down