-
Notifications
You must be signed in to change notification settings - Fork 280
Configuration to deploy using compose #583
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
Open
lunika
wants to merge
5
commits into
main
Choose a base branch
from
compose-production
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9179fdb
🔧(compose) rename legacy docker-compose.yml in compose.yaml
lunika 24328b5
♻️(compose) remove usage of dockerize
lunika 6f62d8e
✨(compose) a config to deploy docs in production using compose
lunika 350643a
📝(doc) add documentation to install using compose
lunika fed3ad6
fixup! 📝(doc) add documentation to install using compose
lunika File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/sh | ||
set -o errexit | ||
|
||
# The script is pretty simple. It downloads the latest cacert.pem file from the certifi package and appends the root certificate from mkcert to it. Then it copies the updated cacert.pem file to the container. | ||
# The script is executed with the following command: | ||
# $ bin/update_app_cacert.sh docs-production-backend-1 | ||
|
||
CONTAINER_NAME=${1:-"docs-production-backend-1"} | ||
|
||
echo "updating cacert.pem for certifi package in ${CONTAINER_NAME}" | ||
|
||
|
||
curl --create-dirs https://raw.githubusercontent.com/certifi/python-certifi/refs/heads/master/certifi/cacert.pem -o /tmp/certifi/cacert.pem | ||
cat "$(mkcert -CAROOT)/rootCA.pem" >> /tmp/certifi/cacert.pem | ||
docker cp /tmp/certifi/cacert.pem ${CONTAINER_NAME}:/usr/local/lib/python3.12/site-packages/certifi/cacert.pem | ||
|
||
echo "end patching cacert.pem in ${CONTAINER_NAME}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
name: docs-production | ||
|
||
services: | ||
postgresql: | ||
image: postgres:16 | ||
healthcheck: | ||
test: ["CMD", "pg_isready", "-q", "-U", "docs", "-d", "docs"] | ||
interval: 1s | ||
timeout: 2s | ||
retries: 300 | ||
env_file: | ||
- env.d/production/postgresql | ||
environment: | ||
- PGDATA=/var/lib/postgresql/data/pgdata | ||
volumes: | ||
- ./data/production/databases/backend:/var/lib/postgresql/data/pgdata | ||
|
||
redis: | ||
image: redis:5 | ||
|
||
backend-migration: | ||
image: lasuite/impress-backend:latest | ||
user: ${DOCKER_USER:-1000} | ||
command: ["python", "manage.py", "migrate", "--noinput"] | ||
environment: | ||
- DJANGO_CONFIGURATION=Production | ||
env_file: | ||
- env.d/production/backend | ||
- env.d/production/postgresql | ||
- env.d/production/yprovider | ||
depends_on: | ||
postgresql: | ||
condition: service_healthy | ||
restart: true | ||
redis: | ||
condition: service_started | ||
minio: | ||
condition: service_started | ||
|
||
backend: | ||
image: lasuite/impress-backend:latest | ||
user: ${DOCKER_USER:-1000} | ||
restart: always | ||
environment: | ||
- DJANGO_CONFIGURATION=Production | ||
env_file: | ||
- env.d/production/backend | ||
- env.d/production/postgresql | ||
- env.d/production/yprovider | ||
healthcheck: | ||
test: ["CMD", "python", "manage.py", "check"] | ||
interval: 15s | ||
timeout: 30s | ||
retries: 20 | ||
start_period: 10s | ||
depends_on: | ||
postgresql: | ||
condition: service_healthy | ||
restart: true | ||
backend-migration: | ||
condition: service_completed_successfully | ||
redis: | ||
condition: service_started | ||
minio: | ||
condition: service_started | ||
minio-bootstrap: | ||
condition: service_completed_successfully | ||
|
||
celery: | ||
user: ${DOCKER_USER:-1000} | ||
image: lasuite/impress-backend:latest | ||
command: ["celery", "-A", "impress.celery_app", "worker", "-l", "INFO"] | ||
environment: | ||
- DJANGO_CONFIGURATION=Production | ||
env_file: | ||
- env.d/production/backend | ||
- env.d/production/postgresql | ||
- env.d/production/yprovider | ||
depends_on: | ||
- backend | ||
|
||
frontend: | ||
image: lasuite/impress-frontend:latest | ||
user: ${DOCKER_USER:-1000} | ||
|
||
y-provider: | ||
image: lasuite/impress-y-provider:latest | ||
user: ${DOCKER_USER:-1000} | ||
env_file: | ||
- env.d/production/yprovider | ||
|
||
kc_postgresql: | ||
image: postgres:16 | ||
healthcheck: | ||
test: ["CMD", "pg_isready", "-q", "-U", "keycloak", "-d", "keycloak"] | ||
interval: 1s | ||
timeout: 2s | ||
retries: 300 | ||
env_file: | ||
- env.d/production/kc_postgresql | ||
environment: | ||
- PGDATA=/var/lib/postgresql/data/pgdata | ||
volumes: | ||
- ./data/production/databases/keycloak:/var/lib/postgresql/data/pgdata | ||
|
||
keycloak: | ||
image: quay.io/keycloak/keycloak:26.1.0 | ||
command: ["start"] | ||
env_file: | ||
- env.d/production/keycloak | ||
- env.d/production/kc_postgresql | ||
ports: | ||
- "8443:8443" | ||
volumes: | ||
- ${DOCS_PROD_KEYCLOAK_CERT_FOLDER:-./data/production/certs}:/etc/ssl/certs:ro | ||
depends_on: | ||
kc_postgresql: | ||
condition: service_healthy | ||
restart: true | ||
|
||
minio-bootstrap: | ||
image: minio/mc | ||
env_file: | ||
- env.d/production/minio | ||
depends_on: | ||
minio: | ||
condition: service_healthy | ||
restart: true | ||
entrypoint: > | ||
sh -c " | ||
/usr/bin/mc alias set docs http://minio:9000 $${MINIO_ROOT_USER} $${MINIO_ROOT_PASSWORD} && \ | ||
/usr/bin/mc mb --ignore-existing docs/docs-media-storage && \ | ||
/usr/bin/mc version enable docs/docs-media-storage && \ | ||
exit 0;" | ||
|
||
minio: | ||
user: ${DOCKER_USER:-1000} | ||
image: minio/minio | ||
env_file: | ||
- env.d/production/minio | ||
healthcheck: | ||
test: ["CMD", "mc", "ready", "local"] | ||
interval: 1s | ||
timeout: 20s | ||
retries: 300 | ||
entrypoint: "" | ||
command: minio server /data | ||
volumes: | ||
- ./data/production/media:/data | ||
|
||
ingress: | ||
image: nginx:1.27 | ||
ports: | ||
- "${DOCS_PROD_NGING_PORT:-443}:8083" | ||
volumes: | ||
- ./docker/files/production/etc/nginx/conf.d:/etc/nginx/conf.d:ro | ||
- ${DOCS_PROD_NGINX_CERT_FOLDER:-./data/production/certs}:/etc/nginx/ssl:ro | ||
depends_on: | ||
frontend: | ||
condition: service_started | ||
y-provider: | ||
condition: service_started | ||
keycloak: | ||
condition: service_started | ||
backend: | ||
condition: service_healthy | ||
restart: true |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my version I added this:
deploy: ## Deploy the application in production mode (includes migrations)
@echo "Starting deployment..."
@echo "1. Starting required services..."
@$(COMPOSE_PRODUCTION) up -d postgresql redis minio
@echo "2. Waiting for PostgreSQL to be ready..."
sleep 5
@echo "3. Running database migrations..."
@$(COMPOSE_PRODUCTION) run --rm backend python manage.py migrate --noinput --skip-checks
@echo "4. Starting all services..."
@$(COMPOSE_PRODUCTION) up -d
@echo "Deployment complete!"
.PHONY: deploy
Or do you run the db migrations somewhere else?