From dc8d8dd2b62b9b75884cdab09af5da483bde43ed Mon Sep 17 00:00:00 2001 From: "Langhammer, Jens" Date: Fri, 4 Oct 2019 11:50:26 +0200 Subject: [PATCH] deploy(minor): add docker-compose file for easy testing --- .dockerignore | 1 + README.md | 9 ++ docker-compose.yml | 100 ++++++++++++++++++++ helm/passbook/templates/web-deployment.yaml | 4 +- 4 files changed, 112 insertions(+), 2 deletions(-) create mode 100644 README.md create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore index 7be654a78..366a6bf0e 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,3 +2,4 @@ env helm passbook-ui static +*.env.yml diff --git a/README.md b/README.md new file mode 100644 index 000000000..40a1f13ed --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# passbook + +## Quick instance + +``` +docker-compose pull +docker-compose up -d +docker-compose exec server ./manage.py createsuperuser +``` diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..05447011e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,100 @@ +--- +version: '3.2' + +services: + postgresql: + image: postgres + volumes: + - database:/var/lib/postgresql/data + networks: + - internal + environment: + - POSTGRES_PASSWORD=${PG_PASS:-thisisnotagoodpassword} + - POSTGRES_USER=passbook + - POSTGRES_DB=passbook + labels: + - traefik.enable=false + redis: + image: redis + networks: + - internal + labels: + - traefik.enable=false + database-migrate: + build: + context: . + image: docker.beryju.org/passbook/server:${TAG:-test} + command: + - ./manage.py + - migrate + networks: + - internal + restart: 'no' + environment: + - PASSBOOK_REDIS__HOST=redis + - PASSBOOK_POSTGRESQL__HOST=postgresql + - PASSBOOK_POSTGRESQL__PASSWORD=${PG_PASS:-thisisnotagoodpassword} + server: + build: + context: . + image: docker.beryju.org/passbook/server:${TAG:-test} + command: + - uwsgi + - --http=0.0.0.0:8000 + - --wsgi-file=passbook/root/wsgi.py + - --master + - --enable-threads + environment: + - PASSBOOK_REDIS__HOST=redis + - PASSBOOK_POSTGRESQL__HOST=postgresql + - PASSBOOK_POSTGRESQL__PASSWORD=${PG_PASS:-thisisnotagoodpassword} + ports: + - 8000 + networks: + - internal + labels: + - traefik.port=8000 + - traefik.docker.network=internal + - traefik.frontend.rule=PathPrefix:/ + worker: + image: docker.beryju.org/passbook/server:${TAG:-test} + command: + - ./manage.py + - worker + networks: + - internal + labels: + - traefik.enable=false + environment: + - PASSBOOK_REDIS__HOST=redis + - PASSBOOK_POSTGRESQL__HOST=postgresql + - PASSBOOK_POSTGRESQL__PASSWORD=${PG_PASS:-thisisnotagoodpassword} + static: + build: + context: . + dockerfile: static.Dockerfile + image: docker.beryju.org/passbook/static:${TAG:-test} + networks: + - internal + labels: + - traefik.frontend.rule=PathPrefix:/static + - traefik.port=80 + - traefik.docker.network=internal + traefik: + image: traefik:1.7 + command: --api --docker + volumes: + - /var/run/docker.sock:/var/run/docker.sock:ro + ports: + - "0.0.0.0:80:80" + - "0.0.0.0:443:443" + - "0.0.0.0:8080:8080" + networks: + - internal + +volumes: + database: + driver: local + +networks: + internal: {} diff --git a/helm/passbook/templates/web-deployment.yaml b/helm/passbook/templates/web-deployment.yaml index c5c9b8230..8bb58268a 100644 --- a/helm/passbook/templates/web-deployment.yaml +++ b/helm/passbook/templates/web-deployment.yaml @@ -56,8 +56,8 @@ spec: command: - uwsgi args: - - --http 0.0.0.0:8000 - - --wsgi-file passbook/root/wsgi.py + - --http=0.0.0.0:8000 + - --wsgi-file=passbook/root/wsgi.py - --master - --enable-threads envFrom: