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

Update docker-compose #402

Merged
merged 1 commit into from
Aug 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,13 @@ docker run --rm -p 8000:8000 -v ~/.config/promgen:/etc/promgen/ line/promgen
# Run Promgen celery worker. Make sure to run it on the same machine as your Prometheus server to manage the config settings
docker run --rm -v ~/.config/promgen:/etc/promgen/ -v /etc/prometheus:/etc/prometheus line/promgen worker

# Or if using docker-compose you can spin up a complete test environment
# If you are using docker compose, you can spin up a demo environment
docker-compose up -d
# Database Migration
docker-compose run web migrate
# Create initial user
# Database migration to populate with initial data
docker-compose run web docker-compose-bootstrap
# If you want to create a different admin user
docker-compose run web createsuperuser
# Now you should be able to open the demo environment in your browser
```

## The MIT License
Expand Down
48 changes: 32 additions & 16 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
# Reference for exteranl_links and bridge containers
# https://blog.virtualzone.de/2016/09/docker-compose-link-containers-outside-compose-file-using-external_links.html

version: '2'
services:
base:
build: .
image: promgen
command: docker-compose-bootstrap
environment:
CELERY_BROKER_URL: redis://redis:6379/0
DATABASE_URL: mysql://promgen:promgen@mysql:3306/promgen
SECRET_KEY: docker-compose-demo

x-promgen-env: &x-promgen-env
CELERY_BROKER_URL: redis://redis:6379/0
DATABASE_URL: mysql://promgen:promgen@mysql:3306/promgen
SECRET_KEY: docker-compose-demo
DEBUG: 1

version: "2"
services:
web:
extends: base
build: .
image: line/promgen
command: web -b 0.0.0.0:8000
environment:
<<: *x-promgen-env
ports:
- "8080:8000"
links:
- mysql
- redis

worker:
extends: base
command: worker -l info --queues localhost,celery
image: line/promgen
# For our demo, we'll have the worker listen both on the
# default celery queue (for notification processing) and
# on the prometheus queue (for deploying targets/etc)
command: worker -l debug --queues prometheus,celery
environment:
<<: *x-promgen-env
links:
- prometheus
- mysql
Expand All @@ -39,6 +43,15 @@ services:
- blackbox
ports:
- "9090:9090"
# We need to repeat some of the default options and also add lifecycle
# so that we can call to reload Prometheus
command: >
--config.file=/etc/prometheus/prometheus.yml
--log.level=info
--storage.tsdb.path=/prometheus
--web.console.libraries=/usr/share/prometheus/console_libraries
--web.console.templates=/usr/share/prometheus/consoles
--web.enable-lifecycle
volumes:
- ./docker:/etc/prometheus
- ./docker/prom_data:/prometheus
Expand All @@ -51,16 +64,19 @@ services:

alertmanager:
image: prom/alertmanager
command: --config.file=/etc/prometheus/alertmanager.yml
links:
- web
ports:
- "9093:9093"
command: >
--config.file=/etc/alertmanager/alertmanager.yml
--log.level=info
volumes:
- ./docker:/etc/prometheus

mysql:
image: mysql:5.7
image: mysql:8
command: --default-authentication-plugin=mysql_native_password
environment:
MYSQL_ROOT_PASSWORD: example
MYSQL_DATABASE: promgen
Expand Down