diff --git a/SUMMARY.md b/SUMMARY.md index c281e2fae..10d997a32 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -28,6 +28,7 @@ * [HTTPS](deployment/digital-ocean/https/README.md) * [Human Connection](deployment/human-connection/README.md) * [Mailserver](deployment/human-connection/mailserver/README.md) + * [Maintenance](deployment/human-connection/maintenance/README.md) * [Volumes](deployment/volumes/README.md) * [Neo4J Offline-Backups](deployment/volumes/neo4j-offline-backup/README.md) * [Volume Snapshots](deployment/volumes/volume-snapshots/README.md) diff --git a/deployment/human-connection/maintenance/Dockerfile b/deployment/human-connection/maintenance/Dockerfile new file mode 100644 index 000000000..4681356ab --- /dev/null +++ b/deployment/human-connection/maintenance/Dockerfile @@ -0,0 +1,3 @@ +FROM nginx:alpine +COPY ./onourjourney.svg /usr/share/nginx/html/ +COPY ./maintenance.html /usr/share/nginx/html/index.html diff --git a/deployment/human-connection/maintenance/README.md b/deployment/human-connection/maintenance/README.md new file mode 100644 index 000000000..02bcb44e2 --- /dev/null +++ b/deployment/human-connection/maintenance/README.md @@ -0,0 +1,43 @@ +# Maintenance mode + +> Despite our best efforts, systems sometimes require downtime for a variety of reasons. + +Quote from [here](https://www.nrmitchi.com/2017/11/easy-maintenance-mode-in-kubernetes/) + +We use our maintenance mode for manual database backup and restore. Also we +bring the database into maintenance mode for manual database migrations. + +## Deploy the service + +We prepared sample configuration, so you can simply run: +```sh +# in folder deployment/ +kubectl apply -f human-connection/maintenance +``` + +This will fire up a maintenance service. + +## Bring application into maintenance mode + +Now if you want to have a controlled downtime and you want to bring your +application into maintenance mode, you can edit your global ingress server. + +E.g. in file `deployment/digital-ocean/https/ingress.yaml` change the following: +```yaml +... + + - host: nitro-staging.human-connection.org + http: + paths: + - path: / + backend: + # serviceName: nitro-web + serviceName: maintenance + # servicePort: 3000 + servicePort: 80 +``` + +Then run ` kubectl apply -f deployment/digital-ocean/https/ingress.yaml`. If you +want to deactivate the maintenance server, just undo the edit and apply the +configuration again. + diff --git a/deployment/human-connection/maintenance/deployment-maintenance.yaml b/deployment/human-connection/maintenance/deployment-maintenance.yaml new file mode 100644 index 000000000..fbbeec639 --- /dev/null +++ b/deployment/human-connection/maintenance/deployment-maintenance.yaml @@ -0,0 +1,27 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: maintenance + namespace: human-connection +spec: + selector: + matchLabels: + human-connection.org/selector: deployment-human-connection-maintenance + template: + metadata: + labels: + human-connection.org/commit: COMMIT + human-connection.org/selector: deployment-human-connection-maintenance + name: maintenance + spec: + containers: + - name: web + env: + - name: HOST + value: 0.0.0.0 + image: humanconnection/maintenance:latest + ports: + - containerPort: 80 + imagePullPolicy: Always + restartPolicy: Always + terminationGracePeriodSeconds: 30 diff --git a/deployment/human-connection/maintenance/maintenance.html b/deployment/human-connection/maintenance/maintenance.html new file mode 100644 index 000000000..906286342 --- /dev/null +++ b/deployment/human-connection/maintenance/maintenance.html @@ -0,0 +1,61 @@ + + + + +
+

+ At the moment we are doing some scheduled maintenance, please try again + later. +

+ Maintenance mode image +

+ Any Questions or concerns, send an email to
+ +

+
+ diff --git a/deployment/human-connection/maintenance/onourjourney.svg b/deployment/human-connection/maintenance/onourjourney.svg new file mode 100644 index 000000000..0950b7532 --- /dev/null +++ b/deployment/human-connection/maintenance/onourjourney.svg @@ -0,0 +1,360 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/deployment/human-connection/maintenance/service-maintenance.yaml b/deployment/human-connection/maintenance/service-maintenance.yaml new file mode 100644 index 000000000..43aab9331 --- /dev/null +++ b/deployment/human-connection/maintenance/service-maintenance.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: maintenance + namespace: human-connection + labels: + human-connection.org/selector: deployment-human-connection-maintenance +spec: + ports: + - name: web + port: 80 + targetPort: 80 + selector: + human-connection.org/selector: deployment-human-connection-maintenance diff --git a/deployment/volumes/neo4j-offline-backup/README.md b/deployment/volumes/neo4j-offline-backup/README.md index 3638ebc89..5d773714b 100644 --- a/deployment/volumes/neo4j-offline-backup/README.md +++ b/deployment/volumes/neo4j-offline-backup/README.md @@ -23,11 +23,7 @@ So, all we have to do is edit the kubernetes deployment of our Neo4J database and set a custom `command` every time we have to carry out tasks like backup, restore, seed etc. -{% hint style="info" %} -TODO: implement maintenance mode -{% endhint %} - -First bring the application into maintenance mode to ensure there are no +First bring the application into [maintenance mode](https://github.com/Human-Connection/Human-Connection/blob/master/deployment/human-connection/maintenance/README.md) to ensure there are no database connections left and nobody can access the application. Run the following: diff --git a/docker-compose.yml b/docker-compose.yml index a8ce871ec..bae571b86 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -42,5 +42,14 @@ services: context: neo4j networks: - hc-network + maintenance: + image: humanconnection/maintenance:latest + build: + context: deployment/human-connection/maintenance + networks: + - hc-network + ports: + - 80:80 + networks: hc-network: diff --git a/scripts/docker_push.sh b/scripts/docker_push.sh index c70367005..fe644c52a 100755 --- a/scripts/docker_push.sh +++ b/scripts/docker_push.sh @@ -4,7 +4,9 @@ docker build --build-arg BUILD_COMMIT=$TRAVIS_COMMIT --target production -t huma docker build --build-arg BUILD_COMMIT=$TRAVIS_COMMIT --target production -t humanconnection/nitro-web:latest $TRAVIS_BUILD_DIR/webapp docker build --build-arg BUILD_COMMIT=$TRAVIS_COMMIT -t humanconnection/neo4j:latest $TRAVIS_BUILD_DIR/neo4j docker build -t humanconnection/maintenance-worker:latest $TRAVIS_BUILD_DIR/deployment/legacy-migration/maintenance-worker +docker build -t humanconnection/maintenance:latest $TRAVIS_BUILD_DIR/deployment/human-connection/maintenance docker push humanconnection/nitro-backend:latest docker push humanconnection/nitro-web:latest docker push humanconnection/neo4j:latest -docker push humanconnection/maintenance-worker:latest \ No newline at end of file +docker push humanconnection/maintenance-worker:latest +docker push humanconnection/maintenance:latest