-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #90 from Full-Tortuga/config/docker
ci: config docker deployment
- Loading branch information
Showing
24 changed files
with
190 additions
and
473 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
**/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
|
||
import ldap | ||
from django_auth_ldap.config import LDAPSearch, GroupOfNamesType | ||
import os | ||
|
||
# dev env CORS SETTINGS | ||
BASEURL = 'http://localhost:8000' | ||
FE_BASEURL = 'http://localhost:3000' | ||
|
||
CORS_ALLOW_CREDENTIALS = True | ||
CORS_ORIGIN_ALLOW_ALL = False | ||
CORS_ORIGIN_WHITELIST = ( | ||
BASEURL, FE_BASEURL | ||
) | ||
CSRF_TRUSTED_ORIGINS = [ | ||
BASEURL, FE_BASEURL | ||
] | ||
|
||
|
||
# Modules in use, commented modules that you won't use | ||
MODULES = [ | ||
'administration', | ||
'authentication', | ||
'base', | ||
'booth', | ||
'census', | ||
'mixnet', | ||
'postproc', | ||
'store', | ||
'visualizer', | ||
'voting', | ||
] | ||
|
||
|
||
APIS = { | ||
'administration': BASEURL, | ||
'authentication': BASEURL, | ||
'base': BASEURL, | ||
'booth': BASEURL, | ||
'census': BASEURL, | ||
'mixnet': BASEURL, | ||
'postproc': BASEURL, | ||
'store': BASEURL, | ||
'visualizer': BASEURL, | ||
'voting': BASEURL, | ||
} | ||
|
||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'djongo', | ||
'NAME': 'db', | ||
'CLIENT': { | ||
'username': os.environ.get('MONGO_USER'), | ||
'password': os.environ.get('MONGO_PASSWORD'), | ||
'host': os.environ.get('MONGO_HOST'), | ||
'port': int(os.environ.get('MONGO_PORT')), | ||
'authSource': os.environ.get('MONGO_NAME'), | ||
'authMechanism': 'SCRAM-SHA-1' | ||
} | ||
} | ||
} | ||
|
||
# number of bits for the key, all auths should use the same number of bits | ||
KEYBITS = 256 | ||
|
||
# Baseline configuration. | ||
AUTH_LDAP_SERVER_URI = 'ldap://:389' | ||
|
||
AUTH_LDAP_BIND_DN = 'cn=admin,dc=decide,dc=org' | ||
AUTH_LDAP_BIND_PASSWORD = 'decide' | ||
AUTH_LDAP_USER_SEARCH = LDAPSearch( | ||
'ou=people,dc=decide,dc=org', | ||
ldap.SCOPE_SUBTREE, | ||
'(uid=%(user)s)', | ||
) | ||
|
||
# Populate the Django user from the LDAP directory. | ||
AUTH_LDAP_USER_ATTR_MAP = { | ||
'first_name': 'cn', | ||
'last_name': 'sn', | ||
'email': 'mail', | ||
} | ||
|
||
# Keep ModelBackend around for per-user permissions and maybe a local | ||
# superuser. | ||
|
||
AUTHENTICATION_BACKENDS = [ | ||
'django.contrib.auth.backends.ModelBackend', | ||
'django_auth_ldap.backend.LDAPBackend', | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# syntax=docker/dockerfile:1 | ||
FROM python:3 | ||
ENV PYTHONDONTWRITEBYTECODE=1 | ||
ENV PYTHONUNBUFFERED=1 | ||
WORKDIR /app | ||
|
||
RUN apt-get update | ||
RUN apt-get install -y libsasl2-dev python-dev libldap2-dev libssl-dev | ||
|
||
RUN git clone https://github.com/Full-Tortuga/decide-full-tortuga-admin.git . | ||
RUN pip3 install -r requirements.txt | ||
|
||
WORKDIR /app/decide | ||
|
||
# local settings.py | ||
ADD docker-settings.py /app/decide/local_settings.py | ||
ADD .env /app/decide/.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
version: '3' | ||
services: | ||
mongo-decide: | ||
image: 'mongo' | ||
environment: | ||
- MONGO_INITDB_DATABASE=db | ||
- MONGO_INITDB_ROOT_USERNAME=root | ||
- MONGO_INITDB_ROOT_PASSWORD=root | ||
- MONGO_INITDB_USER=mongo | ||
- MONGO_INITDB_PWD=mongo | ||
volumes: | ||
- ./init-mongo.sh:/docker-entrypoint-initdb.d/init-mongo.sh | ||
- mongo_decide_data:/data/db | ||
ports: | ||
- 27017:27017 | ||
decide: | ||
build: . | ||
command: bash -c "python manage.py makemigrations && python manage.py migrate && python manage.py runserver 0.0.0.0:8000" | ||
volumes: | ||
- ./decide:/code | ||
ports: | ||
- "8000:8000" | ||
environment: | ||
- MONGO_NAME=db | ||
- MONGO_USER=mongo | ||
- MONGO_HOST=mongo-decide | ||
- MONGO_PASSWORD=mongo | ||
- MONGO_PORT=27017 | ||
depends_on: | ||
- mongo-decide | ||
volumes: | ||
mongo_decide_data: {} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
set -e | ||
|
||
mongo <<EOF | ||
use $MONGO_INITDB_DATABASE | ||
db.createUser( | ||
{ | ||
user: "$MONGO_INITDB_USER", | ||
pwd: "$MONGO_INITDB_PWD", | ||
roles: [ | ||
{ role: "readWrite", db: "$MONGO_INITDB_DATABASE" } | ||
] | ||
}) | ||
EOF |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.