From 3bbded3555522590cde729bda4c131eb57444a6b Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 14 Sep 2020 22:54:25 +0200 Subject: [PATCH] docs: remove default password for docker-compose, improve instructions --- .github/workflows/release.yml | 3 +++ .github/workflows/tag.yml | 5 ++++- docker-compose.yml | 12 ++++++++---- docs/installation/docker-compose.md | 21 ++++++++++++++------- passbook/flows/tests/test_views.py | 2 -- 5 files changed, 29 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a157de677..0e92dcd7a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -93,6 +93,9 @@ jobs: - uses: actions/checkout@v1 - name: Run test suite in final docker images run: | + sudo apt-get install -y pwgen + echo "PG_PASS=$(pwgen 40 1)" >> .env + echo "PASSBOOK_SECRET_KEY=$(pwgen 50 1)" >> .env docker-compose pull -q docker-compose up --no-start docker-compose start postgresql redis diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index d3dcc1c68..9a2a6c5e2 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -13,7 +13,10 @@ jobs: - uses: actions/checkout@master - name: Pre-release test run: | - export PASSBOOK_TAG=latest + sudo apt-get install -y pwgen + echo "PASSBOOK_TAG=latest" >> .env + echo "PG_PASS=$(pwgen 40 1)" >> .env + echo "PASSBOOK_SECRET_KEY=$(pwgen 50 1)" >> .env docker-compose pull -q docker build \ --no-cache \ diff --git a/docker-compose.yml b/docker-compose.yml index e8336d323..457441aca 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,6 +14,8 @@ services: - POSTGRES_DB=passbook labels: - traefik.enable=false + env_file: + - .env redis: image: redis networks: @@ -25,9 +27,8 @@ services: command: server environment: PASSBOOK_REDIS__HOST: redis - PASSBOOK_ERROR_REPORTING: ${PASSBOOK_ERROR_REPORTING:-false} PASSBOOK_POSTGRESQL__HOST: postgresql - PASSBOOK_POSTGRESQL__PASSWORD: ${PG_PASS:-thisisnotagoodpassword} + PASSBOOK_POSTGRESQL__PASSWORD: ${PG_PASS} PASSBOOK_LOG_LEVEL: debug ports: - 8000 @@ -37,6 +38,8 @@ services: - traefik.port=8000 - traefik.docker.network=internal - traefik.frontend.rule=PathPrefix:/ + env_file: + - .env worker: image: beryju/passbook:${PASSBOOK_TAG:-0.10.0-stable} command: worker @@ -46,10 +49,11 @@ services: - traefik.enable=false environment: PASSBOOK_REDIS__HOST: redis - PASSBOOK_ERROR_REPORTING: ${PASSBOOK_ERROR_REPORTING:-false} PASSBOOK_POSTGRESQL__HOST: postgresql - PASSBOOK_POSTGRESQL__PASSWORD: ${PG_PASS:-thisisnotagoodpassword} + PASSBOOK_POSTGRESQL__PASSWORD: ${PG_PASS} PASSBOOK_LOG_LEVEL: debug + env_file: + - .env static: image: beryju/passbook-static:${PASSBOOK_TAG:-0.10.0-stable} networks: diff --git a/docs/installation/docker-compose.md b/docs/installation/docker-compose.md index 04932c99e..fe5dbc716 100644 --- a/docs/installation/docker-compose.md +++ b/docs/installation/docker-compose.md @@ -11,14 +11,21 @@ This installation method is for test-setups and small-scale productive setups. Download the latest `docker-compose.yml` from [here](https://raw.githubusercontent.com/BeryJu/passbook/master/docker-compose.yml). Place it in a directory of your choice. +To optionally enable error-reporting, run `echo PASSBOOK_ERROR_REPORTING=true >> .env` + +To optionally deploy a different version run `echo PASSBOOK_TAG=0.10.0-stable >> .env` + +If this is a fresh passbook install run the following commands to generate a password: + +``` +sudo apt-get install -y pwgen +echo "PG_PASS=$(pwgen 40 1)" >> .env +echo "PASSBOOK_SECRET_KEY=$(pwgen 50 1)" >> .env +``` + +Afterwards, run these commands to finish + ``` -wget https://raw.githubusercontent.com/BeryJu/passbook/master/docker-compose.yml -# Optionally enable Error-reporting -# export PASSBOOK_ERROR_REPORTING=true -# Optionally deploy a different version -# export PASSBOOK_TAG=0.10.0-stable -# If this is a productive installation, set a different PostgreSQL Password -# export PG_PASS=$(pwgen 40 1) docker-compose pull docker-compose up -d docker-compose run --rm server migrate diff --git a/passbook/flows/tests/test_views.py b/passbook/flows/tests/test_views.py index 0dfe92c0e..72e376c0c 100644 --- a/passbook/flows/tests/test_views.py +++ b/passbook/flows/tests/test_views.py @@ -1,12 +1,10 @@ """flow views tests""" -from json import loads from unittest.mock import MagicMock, PropertyMock, patch from django.shortcuts import reverse from django.test import Client, TestCase from django.utils.encoding import force_str -from passbook.flows.exceptions import EmptyFlowException, FlowNonApplicableException from passbook.flows.markers import ReevaluateMarker, StageMarker from passbook.flows.models import Flow, FlowDesignation, FlowStageBinding from passbook.flows.planner import FlowPlan