-
Notifications
You must be signed in to change notification settings - Fork 5
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
Make dumpus API easier to self-host #48
base: main
Are you sure you want to change the base?
Changes from 2 commits
5809384
cf8d150
67835dd
705366b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,5 @@ CELERY_HOSTNAME="" | |
|
||
DISWHO_JWT_SECRET="" | ||
DISWHO_BASE_URL="" | ||
|
||
DISCORD_SECRET="" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
services: | ||
|
||
broker: | ||
container_name: dumpus-broker | ||
image: rabbitmq:latest | ||
ports: | ||
- "5672:5672" | ||
|
||
healthcheck: | ||
test: [ "CMD", "rabbitmq-diagnostics", "--quiet", "ping" ] | ||
timeout: 10s | ||
retries: 5 | ||
start_period: 10s | ||
|
||
environment: | ||
RABBITMQ_DEFAULT_USER: dumpus | ||
RABBITMQ_DEFAULT_PASS: dumpus | ||
|
||
restart: unless-stopped | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider on-failure in case of an error |
||
|
||
db: | ||
container_name: dumpus-db | ||
image: postgres:latest | ||
ports: | ||
- "6641:5432" | ||
Comment on lines
+20
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding a volume here would be useful for database persistence db:
volumes:
- postgres_data:/var/lib/postgresql/data
volumes:
postgres_data: |
||
|
||
healthcheck: | ||
test: [ "CMD-SHELL", "PGUSER=dumpus", "pg_isready" ] | ||
interval: 1s | ||
timeout: 10s | ||
retries: 5 | ||
|
||
environment: | ||
POSTGRES_USER: dumpus | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same thing as the first comment, use environment variables |
||
POSTGRES_PASSWORD: dumpus | ||
POSTGRES_DB: dumpus | ||
|
||
restart: unless-stopped | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider on-failure in case of an error |
||
|
||
worker: | ||
container_name: dumpus-worker | ||
build: | ||
dockerfile: Dockerfile.worker | ||
|
||
healthcheck: | ||
test: [ "CMD-SHELL", "celery", "-A", "tasks", "inspect", "ping", "-d", "regular_process@$HOSTNAME" ] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. test: ["CMD-SHELL", "celery -A tasks inspect ping -d regular_process@$$HOSTNAME"] This is a better way to implement the health check because the command isn't split into multiple arguments but rather a single shell command. |
||
interval: 2s | ||
timeout: 10s | ||
retries: 5 | ||
|
||
depends_on: | ||
broker: | ||
condition: service_healthy | ||
restart: true | ||
db: | ||
condition: service_healthy | ||
restart: true | ||
|
||
environment: | ||
POSTGRES_URL: "postgresql+psycopg2://dumpus:dumpus@db:5432/dumpus" | ||
RABBITMQ_URL: "amqp://dumpus:dumpus@broker:5672/" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make sure to update the connection strings |
||
|
||
api: | ||
container_name: dumpus-api | ||
build: | ||
dockerfile: Dockerfile.api | ||
|
||
ports: | ||
- "5000:5000" | ||
depends_on: | ||
worker: | ||
condition: service_healthy | ||
restart: true | ||
|
||
environment: | ||
POSTGRES_URL: "postgresql+psycopg2://dumpus:dumpus@db:5432/dumpus" | ||
RABBITMQ_URL: "amqp://dumpus:dumpus@broker:5672/" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make sure to update the connection strings |
||
|
||
# flower: | ||
# container_name: flower | ||
# build: | ||
# dockerfile: Dockerfile.flower | ||
|
||
# ports: | ||
# - "5566:5566" | ||
|
||
# depends_on: | ||
# worker: | ||
# condition: service_healthy | ||
# restart: true |
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.
Here, it would be better if you used environment variables instead of hard coding usernames and passwords 😅