Skip to content

Commit

Permalink
Merge pull request #35 from bpereto/feature-docker-hub
Browse files Browse the repository at this point in the history
FEATURE: improve docker-compose.yaml
  • Loading branch information
bpereto authored Sep 18, 2020
2 parents 8b4c68e + 6958cb4 commit 2811973
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 35 deletions.
5 changes: 3 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
DEBUG=0
#
# docker-compose
REPO_PATH=/repos
BORG_SSH_PORT=2222
#
# mariadb
Expand All @@ -10,18 +8,21 @@ MYSQL_HOST=db
MYSQL_USER=borghive
MYSQL_PASSWORD=borghive
#
# django settings
APP_LOG_LEVEL=INFO
# These are the defaults
# DJANGO_LANGUAGE_CODE=en-us
# DJANGO_TIME_ZONE=UTC
#
DJANGO_ALLOWED_HOSTS=*
#
# ldap settings
LDAP_ORGANISATION=borghive
LDAP_DOMAIN=borghive.local
LDAP_ADMIN_PASSWORD=borghive
LDAP_READONLY_USER=true
#
# borg ldap settings
BORG_LDAP_HOST=ldap://ldap
BORG_LDAP_BASE_DN=dc=borghive,dc=local
BORG_LDAP_READONLY_DN=cn=readonly,dc=borghive,dc=local
Expand Down
3 changes: 1 addition & 2 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,9 @@ services:
build:
context: .
dockerfile: Dockerfile.base
entrypoint: /bin/bash -c "/app/manage.py watch_repositories --repo-path=$${REPO_PATH}"
entrypoint: /bin/bash -c "/app/manage.py watch_repositories"
environment:
- APP_LOG_LEVEL=DEBUG
- REPO_PATH=/repos
- MYSQL_HOST=db
- MYSQL_DATABASE=borghive
- MYSQL_USER=borghive
Expand Down
50 changes: 32 additions & 18 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,55 +10,47 @@ services:
- .env

app:
build:
context: .
dockerfile: Dockerfile.base
image: bpereto/borg-hive:0.1.1
env_file:
- .env
volumes:
- borg-config:/config
- borg-repos:${REPO_PATH}
- borg-repos:/repos
- static:/staticfiles
ports:
- "8000:8000"
depends_on:
- db

worker:
build:
context: .
dockerfile: Dockerfile.base
image: bpereto/borg-hive:0.1.1
entrypoint: celery worker -A core -l INFO -B --scheduler django_celery_beat.schedulers:DatabaseScheduler
env_file:
- .env
volumes:
- borg-config:/config
- borg-repos:${REPO_PATH}:ro
- borg-repos:/repos:ro
depends_on:
- db

watcher:
build:
context: .
dockerfile: Dockerfile.base
entrypoint: /bin/bash -c "/app/manage.py watch_repositories --repo-path=$${REPO_PATH}"
image: bpereto/borg-hive:0.1.1
entrypoint: /bin/bash -c "/app/manage.py watch_repositories"
env_file:
- .env
volumes:
- borg-repos:${REPO_PATH}:ro
- borg-repos:/repos:ro
depends_on:
- db

borg:
build:
context: .
dockerfile: Dockerfile.borg
image: bpereto/borg-hive:borg-0.1.1
depends_on:
- db
env_file:
- .env
volumes:
- borg-repos:${REPO_PATH}
- borg-repos:/repos
- borg-config:/config
ports:
- "${BORG_SSH_PORT}:22"
Expand Down Expand Up @@ -91,6 +83,28 @@ volumes:
mariadb-data:
ldap-data:
ldap-config:
borg-repos:
borg-config:
static:
borg-repos:

#
# EXAMPLES for other repository locations (borg-repos):
#
# BIND MOUNT on docker host:
#
# volumes:
# borg-repos:
# driver_opts:
# type: none
# o: bind
# device: /opt/mydata/path
#
# NFS MOUNT:
#
# volumes:
# example:
# driver_opts:
# type: "nfs"
# o: "nfsvers=4,addr=10.40.0.199,nolock,soft,rw"
# device: ":/docker/example"
#
12 changes: 2 additions & 10 deletions helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ spec:
name: mariadb
- name: "DEBUG"
value: "{{ .Values.app.debug }}"
- name: "REPO_PATH"
value: "{{ .Values.app.repoPath }}"
- name: "APP_LOG_LEVEL"
value: "{{ .Values.app.logLevel }}"
- name: "DJANGO_ALLOWED_HOSTS"
Expand Down Expand Up @@ -173,8 +171,6 @@ spec:
name: mariadb
- name: "DEBUG"
value: "{{ .Values.app.debug }}"
- name: "REPO_PATH"
value: "{{ .Values.app.repoPath }}"
- name: "APP_LOG_LEVEL"
value: "{{ .Values.app.logLevel }}"
- name: "BORG_LDAP_HOST"
Expand Down Expand Up @@ -259,10 +255,10 @@ spec:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ["/bin/bash", "-c"]
args: ["/app/manage.py watch_repositories --repo-path=$${REPO_PATH}"]
args: ["/app/manage.py watch_repositories"]
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
env:
env:
- name: "MYSQL_DATBASE"
value: "{{ .Values.app.db.name }}"
- name: "MYSQL_USER"
Expand All @@ -276,8 +272,6 @@ spec:
name: mariadb
- name: "DEBUG"
value: "{{ .Values.app.debug }}"
- name: "REPO_PATH"
value: "{{ .Values.app.repoPath }}"
- name: "APP_LOG_LEVEL"
value: "{{ .Values.app.logLevel }}"
- name: "CELERY_BROKER_URL"
Expand Down Expand Up @@ -365,8 +359,6 @@ spec:
name: mariadb
- name: "DEBUG"
value: "{{ .Values.app.debug }}"
- name: "REPO_PATH"
value: "{{ .Values.app.repoPath }}"
- name: "APP_LOG_LEVEL"
value: "{{ .Values.app.logLevel }}"
- name: "CELERY_BROKER_URL"
Expand Down
3 changes: 1 addition & 2 deletions helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ app:
user: "borghive"
name: "borghive"
debug: 1
repoPath: "/repos"
logLevel: "INFO"
allowedHosts: "*"
email:
Expand Down Expand Up @@ -118,4 +117,4 @@ openldap:
LDAP_TLS_ENFORCE: "false"
LDAP_READONLY_USER: "true"
persistence:
enabled: True
enabled: True
2 changes: 1 addition & 1 deletion src/borghive/management/commands/watch_repositories.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Command(BaseCommand):

def add_arguments(self, parser):
"""arguments parser"""
parser.add_argument('--repo-path', type=str)
parser.add_argument('--repo-path', type=str, default='/repos')

def get_repo_by_path(self, path): # pylint: disable=no-self-use
"""distill repo name from inotify path"""
Expand Down

0 comments on commit 2811973

Please sign in to comment.