Skip to content

Commit

Permalink
docker deployment refactoring
Browse files Browse the repository at this point in the history
- volumes for mail server is redundant
- 1/0 values for bool variables turned into True/False to increase visibility
- env variable for DEBUG mode added
- log directories naming refactores to avoid misunderstandings in case of using shared glusterfs volumes

PAY ATTENTION (For Mirantis Only):
This changes dependen on MCP reclas model , so pls review also:
https://gerrit.mcp.mirantis.net/#/q/topic:kqueen+(status:open+OR+status:merged)
  • Loading branch information
naumvd95 committed Mar 16, 2018
1 parent bf284ef commit 07c749c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ WORKDIR /code
# install dependencies
RUN apt-get update && \
apt-get install --no-install-recommends -y libsasl2-dev python-dev libldap2-dev libssl-dev && \
rm -rf /var/lib/apt/lists/*
rm -rf /var/lib/apt/lists/* && \
mkdir /var/log/kqueen-api

# copy app
COPY . .
RUN pip install .


# run app
CMD ./entrypoint.sh
9 changes: 4 additions & 5 deletions docker-compose.demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ services:
- etcd
environment:
KQUEEN_CONFIG_FILE: config/demo.py
KQUEEN_DEBUG: 'False'
KQUEEN_ETCD_HOST: etcd
KQUEEN_SECRET_KEY: 'SecretSecretSecret123'
#KQUEEN_DEBUG: 'True'
BOOTSTRAP_ADMIN: 1
BOOTSTRAP_ADMIN: 'True'
BOOTSTRAP_ADMIN_USERNAME: admin
BOOTSTRAP_ADMIN_PASSWORD: default
BOOTSTRAP_ADMIN_ORGANIZATION: DemoOrg
Expand All @@ -26,6 +26,8 @@ services:
- api
environment:
KQUEEN_UI_CONFIG_FILE: config/demo.py
KQUEENUI_DEBUG: 'False'
KQUEENUI_SECRET_KEY: 'SecretSecretSecret123'
KQUEENUI_KQUEEN_API_URL: http://api:5000/api/v1/
KQUEENUI_KQUEEN_AUTH_URL: http://api:5000/api/v1/auth
KQUEENUI_KQUEEN_SERVICE_USER_USERNAME: admin
Expand All @@ -35,8 +37,5 @@ services:
# Uncomment this to enable sending validation emails
# mail:
# image: modularitycontainers/postfix
# volumes:
# - /var/spool/postfix:/var/spool/postfix
# - /var/spool/mail:/var/spool/mail
# environment:
# MYHOSTNAME: 'mail'
10 changes: 5 additions & 5 deletions docker-compose.production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ services:
restart: always
environment:
KQUEEN_CONFIG_FILE: config/prod.py
KQUEEN_DEBUG: False
KQUEEN_ETCD_HOST: etcd
KQUEEN_PROMETHEUS_WHITELIST: '172.16.238.0/24'
# TODO: set SECRET_KEY
KQUEEN_SECRET_KEY: ''
BOOTSTRAP_ADMIN: 1
BOOTSTRAP_ADMIN: True
BOOTSTRAP_ADMIN_USERNAME: admin
# TODO: set admin password
BOOTSTRAP_ADMIN_PASSWORD:
Expand All @@ -40,14 +41,16 @@ services:
environment:
KQUEENUI_PREFERRED_URL_SCHEME: https
KQUEEN_UI_CONFIG_FILE: config/prod.py
KQUEENUI_DEBUG: False
KQUEENUI_SECRET_KEY: 'SecretSecretSecret123'
KQUEENUI_KQUEEN_API_URL: http://api:5000/api/v1/
KQUEENUI_KQUEEN_AUTH_URL: http://api:5000/api/v1/auth
KQUEENUI_KQUEEN_SERVICE_USER_USERNAME: admin
# TODO: set same password as in api BOOTSTRAP_ADMIN_PASSWORD
KQUEENUI_KQUEEN_SERVICE_USER_PASSWORD:
KQUEENUI_MAIL_SERVER: mail
KQUEENUI_MAIL_PORT: 10025
KQUEENUI_ENABLE_PUBLIC_REGISTRATION: 1
KQUEENUI_ENABLE_PUBLIC_REGISTRATION: True
STATIC_DIR: /mnt/static/
volumes:
- /mnt/static/
Expand All @@ -57,9 +60,6 @@ services:
mail:
image: modularitycontainers/postfix
restart: always
volumes:
- /var/spool/postfix/
- /var/spool/mail/
environment:
MYHOSTNAME: 'mail'
prometheus:
Expand Down
4 changes: 2 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/bash

export prometheus_multiproc_dir="$(mktemp -d)"
BOOTSTRAP_ADMIN="${BOOTSTRAP_ADMIN:-0}"
BOOTSTRAP_ADMIN="${BOOTSTRAP_ADMIN:-False}"
BOOTSTRAP_ADMIN_USERNAME="${BOOTSTRAP_ADMIN_USERNAME:-admin}"
BOOTSTRAP_ADMIN_PASSWORD="${BOOTSTRAP_ADMIN_PASSWORD:-default}"
BOOTSTRAP_ADMIN_ORGANIZATION="${BOOTSTRAP_ADMIN_ORGANIZATION:-DemoOrg}"
BOOTSTRAP_ADMIN_NAMESPACE="${BOOTSTRAP_ADMIN_NAMESPACE:-demoorg}"

if [[ "$BOOTSTRAP_ADMIN" > 0 ]] ; then
if [[ "$BOOTSTRAP_ADMIN" == "True" ]] ; then
python bootstrap_admin.py ${BOOTSTRAP_ADMIN_ORGANIZATION} ${BOOTSTRAP_ADMIN_NAMESPACE} ${BOOTSTRAP_ADMIN_USERNAME} ${BOOTSTRAP_ADMIN_PASSWORD}
fi

Expand Down
4 changes: 2 additions & 2 deletions kqueen/utils/logger_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ handlers:
class: logging.handlers.RotatingFileHandler
level: DEBUG
formatter: standard
filename: /tmp/kqueen.log
filename: /var/log/kqueen-api/kqueen_api.log
maxBytes: 10485760 # 10MB
backupCount: 20
encoding: utf8
Expand All @@ -28,7 +28,7 @@ handlers:
class: logging.handlers.RotatingFileHandler
level: ERROR
formatter: error
filename: /tmp/kqueen_error.log
filename: /var/log/kqueen-api/kqueen_api_error.log
maxBytes: 10485760 # 10MB
backupCount: 20
encoding: utf8
Expand Down

0 comments on commit 07c749c

Please sign in to comment.