Skip to content
Snippets Groups Projects
Commit 4488f087 authored by Nico Vermaas's avatar Nico Vermaas
Browse files

Merge branch 'dev-nico' into 'master'

CI/CD pipeline for production (sdc.astron.nl)

See merge request !13
parents 9d762d56 ddd8158c
No related branches found
No related tags found
3 merge requests!39Dev nico,!17pre-deploy to acceptance,!13CI/CD pipeline for production (sdc.astron.nl)
Pipeline #9360 passed
...@@ -16,6 +16,7 @@ docker-build-master: ...@@ -16,6 +16,7 @@ docker-build-master:
only: only:
- master - master
- acceptance - acceptance
- release
docker-build-branch: docker-build-branch:
# Official docker image. # Official docker image.
...@@ -30,10 +31,10 @@ docker-build-branch: ...@@ -30,10 +31,10 @@ docker-build-branch:
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
except: except:
- master - master
- acceptance
- release
# this deploys the 'esap-gateway-query' branch (a dev/test branch) as 'vermaas' # deploy test/dev version on 'sdc-dev.astron.nl'
# by running /docker_compose/esap-api-gateway/docker-compose-query-cd.yml
docker-deploy-master: docker-deploy-master:
image: docker:latest image: docker:latest
stage: deploy stage: deploy
...@@ -52,6 +53,7 @@ docker-deploy-master: ...@@ -52,6 +53,7 @@ docker-deploy-master:
only: only:
- master - master
# deploy acceptance version on 'dop457.astron.nl'
docker-deploy-acceptance: docker-deploy-acceptance:
image: docker:latest image: docker:latest
stage: deploy stage: deploy
...@@ -68,4 +70,23 @@ docker-deploy-acceptance: ...@@ -68,4 +70,23 @@ docker-deploy-acceptance:
- ssh -o StrictHostKeyChecking=no vermaas@dop457.astron.nl "docker-compose -p atdb -f /data/docker_compose/docker-compose-atdb-ldv-acc-cd.yml up -d" - ssh -o StrictHostKeyChecking=no vermaas@dop457.astron.nl "docker-compose -p atdb -f /data/docker_compose/docker-compose-atdb-ldv-acc-cd.yml up -d"
when: manual when: manual
only: only:
- acceptance - acceptance
\ No newline at end of file
# deploy release version on 'sdc.astron.nl'
docker-deploy-release:
image: docker:latest
stage: deploy
before_script:
- 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan dop821.astron.nl >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
script:
- ssh -o StrictHostKeyChecking=no sdco@dop821.astron.nl "docker pull "$CI_REGISTRY_IMAGE""
- ssh -o StrictHostKeyChecking=no sdco@dop821.astron.nl "docker-compose -p atdb -f /opt/dockercompose/docker-compose-production-cd.yml up -d"
when: manual
only:
- release
\ No newline at end of file
...@@ -7,30 +7,6 @@ DEBUG = True ...@@ -7,30 +7,6 @@ DEBUG = True
ALLOWED_HOSTS = ["*"] ALLOWED_HOSTS = ["*"]
CORS_ORIGIN_ALLOW_ALL = True CORS_ORIGIN_ALLOW_ALL = True
#####################################################
# These settings mainly deal with https.
# See http://django-secure.readthedocs.io/en/latest/middleware.html
# Check the warning and instructions with:
# (.env) atdb@/var/.../atdb ./manage.py check --deploy --settings=atdb.settings.prod
#####################################################
# Assume SSL is correctly set up.
SSL_ENABLED = False
if SSL_ENABLED:
# True: Django now checks that cookies are ONLY sent over SSL.
# https://docs.djangoproject.com/en/1.11/ref/settings/#session-cookie-secure
SESSION_COOKIE_SECURE = True
# True: Django now checks that csrf tokens are ONLY sent over SSL.
# https://docs.djangoproject.com/en/1.11/ref/settings/#csrf-cookie-secure
CSRF_COOKIE_SECURE = True
# True: Always redirect requests back to https (currently ignored as Nginx should enforces https).
# Alternatively, enable and add set SECURE_PROXY_SSL_HEADER.
SECURE_SSL_REDIRECT = False
# Setting this to a non-zero value, will default the client UA always to connect over https.
# Unclear how or if this possibly affects other *.astron.nl domains. Especially, if these do
# not support https whether this option then breaks those http-only locations.
# SECURE_HSTS_SECONDS = 31536000
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', 'ENGINE': 'django.db.backends.postgresql_psycopg2',
......
...@@ -29,4 +29,6 @@ services: ...@@ -29,4 +29,6 @@ services:
depends_on: depends_on:
- atdb-ldv-db - atdb-ldv-db
env_file:
- /data/shared/atdb_ldv.env
restart: always restart: always
...@@ -34,4 +34,6 @@ services: ...@@ -34,4 +34,6 @@ services:
depends_on: depends_on:
- atdb-ldv-db - atdb-ldv-db
env_file:
- /data/shared/atdb_ldv.env
restart: always restart: always
...@@ -43,5 +43,5 @@ services: ...@@ -43,5 +43,5 @@ services:
depends_on: depends_on:
- atdb-ldv-db - atdb-ldv-db
env_file: env_file:
- $HOME/shared/atdb_ldv.env - $HOME/shared/atdb_ldv.env
restart: always restart: always
...@@ -23,4 +23,6 @@ services: ...@@ -23,4 +23,6 @@ services:
- "traefik.http.routers.atdb-backend.service=atdb-backend" - "traefik.http.routers.atdb-backend.service=atdb-backend"
- "traefik.http.routers.atdb-backend.rule=Host(`sdc.astron.nl`) && PathPrefix(`/atdb`)" - "traefik.http.routers.atdb-backend.rule=Host(`sdc.astron.nl`) && PathPrefix(`/atdb`)"
- "traefik.http.services.atdb-backend.loadbalancer.server.port=8000" - "traefik.http.services.atdb-backend.loadbalancer.server.port=8000"
env_file:
- $HOME/shared/atdb_ldv.env
restart: always restart: always
...@@ -22,4 +22,6 @@ services: ...@@ -22,4 +22,6 @@ services:
- "traefik.http.routers.atdb-backend.service=atdb-backend" - "traefik.http.routers.atdb-backend.service=atdb-backend"
- "traefik.http.routers.atdb-backend.rule=Host(`sdc.astron.nl`) && PathPrefix(`/atdb`)" - "traefik.http.routers.atdb-backend.rule=Host(`sdc.astron.nl`) && PathPrefix(`/atdb`)"
- "traefik.http.services.atdb-backend.loadbalancer.server.port=8000" - "traefik.http.services.atdb-backend.loadbalancer.server.port=8000"
env_file:
- $HOME/shared/atdb_ldv.env
restart: always restart: always
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
</div> </div>
{% include 'taskdatabase/pagination.html' %} {% include 'taskdatabase/pagination.html' %}
</div> </div>
<p class="footer"> Version 1.0.0 (11 feb 2021 - 16:00) <p class="footer"> Version 1.0.0 (11 feb 2021 - 16:15)
<script type="text/javascript"> <script type="text/javascript">
(function(seconds) { (function(seconds) {
var refresh, var refresh,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment