diff --git a/.github/ISSUE_TEMPLATE/---bug-report.md b/.github/ISSUE_TEMPLATE/---bug-report.md new file mode 100644 index 0000000..602283a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/---bug-report.md @@ -0,0 +1,11 @@ +--- +name: "\U0001F41B Bug Report" +about: Create a report to help us improve +title: "\U0001F41B [Bug] XXX" +labels: bug +assignees: '' + +--- + +## :bug: Bug Report + diff --git a/.github/ISSUE_TEMPLATE/---devops-ticket.md b/.github/ISSUE_TEMPLATE/---devops-ticket.md new file mode 100644 index 0000000..a382d1f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/---devops-ticket.md @@ -0,0 +1,11 @@ +--- +name: "\U0001F4A5 DevOps Ticket" +about: Help us manage our deployed app. +title: "\U0001F4A5 [DevOps] XXX" +labels: '' +assignees: '' + +--- + +## 💥 DevOps Ticket + diff --git a/.github/ISSUE_TEMPLATE/---epic.md b/.github/ISSUE_TEMPLATE/---epic.md new file mode 100644 index 0000000..8dcb195 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/---epic.md @@ -0,0 +1,15 @@ +--- +name: "\U0001F31F Epic" +about: Define a big development step. +title: "\U0001F31F [EPIC] XXX" +labels: '' +assignees: '' + +--- + + + + +## 🌟 EPIC + diff --git a/.github/ISSUE_TEMPLATE/---feature-request.md b/.github/ISSUE_TEMPLATE/---feature-request.md new file mode 100644 index 0000000..f387d77 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/---feature-request.md @@ -0,0 +1,11 @@ +--- +name: "\U0001F680 Feature Request" +about: Suggest an idea for this project. +title: "\U0001F680 [Feature] XXX" +labels: enhancement +assignees: '' + +--- + +## :rocket: Feature Request + diff --git a/.github/ISSUE_TEMPLATE/---question.md b/.github/ISSUE_TEMPLATE/---question.md new file mode 100644 index 0000000..cbbcaaa --- /dev/null +++ b/.github/ISSUE_TEMPLATE/---question.md @@ -0,0 +1,15 @@ +--- +name: "\U0001F4AC Question" +about: If you need help understanding ocelot.social. +title: "\U0001F4AC [Question] XXX" +labels: '' +assignees: '' + +--- + + + + +## 💬 Question + diff --git a/.github/ISSUE_TEMPLATE/---refactor.md b/.github/ISSUE_TEMPLATE/---refactor.md new file mode 100644 index 0000000..fb1ac4e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/---refactor.md @@ -0,0 +1,11 @@ +--- +name: "\U0001F527 Refactor" +about: Help us improve our code by refactoring it. +title: "\U0001F527 [Refactor] XXX" +labels: enhancement +assignees: '' + +--- + +## 🔧 Refactor + diff --git a/.github/ISSUE_TEMPLATE/custom.md b/.github/ISSUE_TEMPLATE/custom.md new file mode 100644 index 0000000..48d5f81 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/custom.md @@ -0,0 +1,10 @@ +--- +name: Custom issue template +about: Describe this issue template's purpose here. +title: '' +labels: '' +assignees: '' + +--- + + diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0fde053..2743a25 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -4,7 +4,7 @@ on: push: branches: - master - # - 14-new-deployment-with-base-and-code # for testing while developing + # - 55-implement-PRODUCTION_DB_CLEAN_ALLOW-for-staging-production-evironments # for testing while developing jobs: ############################################################################## diff --git a/TODO-next-update.md b/TODO-next-update.md index c324ad9..4cf3c8d 100644 --- a/TODO-next-update.md +++ b/TODO-next-update.md @@ -2,16 +2,25 @@ When you overtake this deploy and rebrand repo to your network you have to recognize the following changes and doings … -## Version 1.0.9 with 'ocelotDockerVersionTag' 1.0.9-199 +## This Latest Version >= 1.1.0 with 'ocelotDockerVersionTag' 1.1.0-205 + +### Deployment/Rebranding PR – chore: 🍰 Release v1.1.0 - Implement Categories Again #63 + +- You have to add the `CATEGORIES_ACTIVE` from the `deployment/kubernetes/values.template.yaml` to your `deployment/kubernetes/values.yaml` and set it to your prevered value. +- Make sure the correct categories are in your Neo4j database on the server. + +## Version >= 1.0.9 with 'ocelotDockerVersionTag' 1.0.9-199 + +### Deployment/Rebranding PR – chore: 🍰 Implement PRODUCTION_DB_CLEAN_ALLOW for Staging Production Environments #56 + +- Copy `PRODUCTION_DB_CLEAN_ALLOW` from `deployment/kubernetes/values.template.yaml` to `values.yaml` and set it to `false` for production envireonments and only for several stage test servers to `true`. ### Deployment/Rebranding PR – chore: [WIP] 🍰 Refine docs, first step #46 -- PR: `chore: 🍰 Implement PRODUCTION_DB_CLEAN_ALLOW for Staging Production Environments #56` - - Copy `PRODUCTION_DB_CLEAN_ALLOW` from `values.template.yaml` to `values.yaml` and set it to `false` for production envireonments and only for several stage test servers to `true`. - Commit: `Update cert-manager apiVersion "cert-manager.io/v1alpha2" to "cert-manager.io/v1" - Check for `kubectl` and `helm` versions. -## Version 1.0.8 with 'ocelotDockerVersionTag' 1.0.8-182 +## Version >= 1.0.8 with 'ocelotDockerVersionTag' 1.0.8-182 ### PR – feat: 🍰 Configure Cookie Expire Time #43 diff --git a/deployment/kubernetes/README.md b/deployment/kubernetes/README.md index 8388f50..868676d 100644 --- a/deployment/kubernetes/README.md +++ b/deployment/kubernetes/README.md @@ -246,3 +246,50 @@ support, try this [helm chart](https://github.com/helm/charts/tree/master/stable On our kubernetes cluster we get "mult-attach" errors for persistent volumes. Apparently DigitalOcean's kubernetes clusters do not fulfill the requirements. + +## Kubernetes Commands (Without Helm) To Deploy New Docker Images To A Kubernetes Cluster + +### Deploy A Version + +```bash +# !!! be aware of the correct kube context !!! +$ kubectl config get-contexts + +# deploy version '$BUILD_VERSION' +# !!! 'latest' is not recommended on production !!! + +# for easyness set env +$ export BUILD_VERSION=1.0.8-48-ocelot.social1.0.8-184 # example +# check this with +$ echo $BUILD_VERSION +1.0.8-48-ocelot.social1.0.8-184 + +# deploy actual version '$BUILD_VERSION' to Kubernetes cluster +$ kubectl -n default set image deployment/ocelot-webapp container-ocelot-webapp=ocelotsocialnetwork/webapp:$BUILD_VERSION +$ kubectl -n default rollout restart deployment/ocelot-webapp +$ kubectl -n default set image deployment/ocelot-backend container-ocelot-backend=ocelotsocialnetwork/backend:$BUILD_VERSION +$ kubectl -n default rollout restart deployment/ocelot-backend +$ kubectl -n default set image deployment/ocelot-maintenance container-ocelot-maintenance=ocelotsocialnetwork/maintenance:$BUILD_VERSION +$ kubectl -n default rollout restart deployment/ocelot-maintenance +$ kubectl -n default set image deployment/ocelot-neo4j container-ocelot-neo4j=ocelotsocialnetwork/neo4j-community:$BUILD_VERSION +$ kubectl -n default rollout restart deployment/ocelot-neo4j +# verify deployment and wait for the pods of each deployment to get ready for cleaning and seeding of the database +$ kubectl -n default rollout status deployment/ocelot-webapp --timeout=240s +$ kubectl -n default rollout status deployment/ocelot-maintenance --timeout=240s +$ kubectl -n default rollout status deployment/ocelot-backend --timeout=240s +$ kubectl -n default rollout status deployment/ocelot-neo4j --timeout=240s +``` + +### Staging – Clean And Seed Neo4j Database + +***ATTENTION:*** Cleaning and seeding of our Neo4j database is only possible in production if env `PRODUCTION_DB_CLEAN_ALLOW=true` is set in our deployment. + +```bash +# !!! be aware of the correct kube context !!! +$ kubectl config get-contexts + +# reset and seed Neo4j database via backend for staging +$ kubectl -n default exec -it $(kubectl -n default get pods | grep ocelot-backend | awk '{ print $1 }') -- /bin/sh -c "node --experimental-repl-await dist/db/clean.js && node --experimental-repl-await dist/db/seed.js" + + +``` diff --git a/deployment/kubernetes/templates/backend/ConfigMap.yml b/deployment/kubernetes/templates/backend/ConfigMap.yml index 4ea065c..1222b0d 100644 --- a/deployment/kubernetes/templates/backend/ConfigMap.yml +++ b/deployment/kubernetes/templates/backend/ConfigMap.yml @@ -11,8 +11,10 @@ metadata: app.kubernetes.io/managed-by: "{{ .Release.Service }}" helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" data: + PRODUCTION_DB_CLEAN_ALLOW: "{{ .Values.PRODUCTION_DB_CLEAN_ALLOW }}" PUBLIC_REGISTRATION: "{{ .Values.PUBLIC_REGISTRATION }}" INVITE_REGISTRATION: "{{ .Values.INVITE_REGISTRATION }}" + CATEGORIES_ACTIVE: "{{ .Values.CATEGORIES_ACTIVE }}" CLIENT_URI: "{{ .Values.BACKEND.CLIENT_URI }}" EMAIL_DEFAULT_SENDER: "{{ .Values.BACKEND.EMAIL_DEFAULT_SENDER }}" SMTP_HOST: "{{ .Values.BACKEND.SMTP_HOST }}" diff --git a/deployment/kubernetes/templates/maintenance/Deployment.yaml b/deployment/kubernetes/templates/maintenance/Deployment.yaml index 5a2eb39..fd1aa31 100644 --- a/deployment/kubernetes/templates/maintenance/Deployment.yaml +++ b/deployment/kubernetes/templates/maintenance/Deployment.yaml @@ -26,7 +26,7 @@ spec: rollme: {{ randAlphaNum 5 | quote }} spec: containers: - - name: maintenance + - name: container-{{ .Release.Name }}-maintenance image: "{{ .Values.MAINTENANCE.DOCKER_IMAGE_REPO }}:{{ .Chart.AppVersion }}" imagePullPolicy: {{ .Values.MAINTENANCE.DOCKER_IMAGE_PULL_POLICY }} envFrom: diff --git a/deployment/kubernetes/templates/webapp/ConfigMap.yml b/deployment/kubernetes/templates/webapp/ConfigMap.yml index 685f676..762b355 100644 --- a/deployment/kubernetes/templates/webapp/ConfigMap.yml +++ b/deployment/kubernetes/templates/webapp/ConfigMap.yml @@ -14,6 +14,7 @@ data: HOST: "0.0.0.0" PUBLIC_REGISTRATION: "{{ .Values.PUBLIC_REGISTRATION }}" INVITE_REGISTRATION: "{{ .Values.INVITE_REGISTRATION }}" + CATEGORIES_ACTIVE: "{{ .Values.CATEGORIES_ACTIVE }}" COOKIE_EXPIRE_TIME: "{{ .Values.COOKIE_EXPIRE_TIME }}" WEBSOCKETS_URI: "{{ .Values.WEBAPP.WEBSOCKETS_URI }}" GRAPHQL_URI: "http://{{ .Release.Name }}-backend:4000" \ No newline at end of file diff --git a/deployment/kubernetes/values.template.yaml b/deployment/kubernetes/values.template.yaml index 921ce3c..e601f1a 100644 --- a/deployment/kubernetes/values.template.yaml +++ b/deployment/kubernetes/values.template.yaml @@ -1,9 +1,11 @@ # please duplicate template file and rename to "values.yaml" and fill in your value # change all the below if needed +PRODUCTION_DB_CLEAN_ALLOW: false # only true for production environments on staging servers PUBLIC_REGISTRATION: false INVITE_REGISTRATION: false COOKIE_EXPIRE_TIME: 730 # days (730 days, two years is the default in main code) +CATEGORIES_ACTIVE: false BACKEND: # change all the below if needed diff --git a/docker-compose.apple-m1.override.yml b/docker-compose.apple-m1.override.yml new file mode 100644 index 0000000..80344e4 --- /dev/null +++ b/docker-compose.apple-m1.override.yml @@ -0,0 +1,36 @@ +# This docker-compose file is just here for testing + +version: "3.4" + +services: + + ######################################################## + # WEBAPP ############################################### + ######################################################## + webapp: + platform: linux/amd64 + + ######################################################## + # BACKEND ############################################## + ######################################################## + backend: + platform: linux/amd64 + + ######################################################## + # MAINTENANCE ########################################## + ######################################################## + maintenance: + platform: linux/amd64 + + ######################################################## + # NEO4J ################################################ + ######################################################## + neo4j: + platform: linux/amd64 + + ######################################################## + # MAILSERVER TO FAKE SMTP ############################## + ######################################################## + # commented out, because otherwise override of production would error. and it seems unnecessary + # mailserver: + # platform: linux/amd64 diff --git a/docker-compose.ocelotsocial-branded.yml b/docker-compose.ocelotsocial-branded.yml index 6d4c148..b8c3ce4 100644 --- a/docker-compose.ocelotsocial-branded.yml +++ b/docker-compose.ocelotsocial-branded.yml @@ -2,10 +2,12 @@ version: "3.4" services: + ######################################################## # WEBAPP ############################################### ######################################################## webapp: + # name the image to match our image to be tested from our DockerHub repository so that it can be pulled from there, otherwise it will be created locally from the 'dockerfile' image: ocelotsocialnetwork/webapp-branded:latest ports: - 3000:3000 @@ -19,10 +21,12 @@ services: - MAPBOX_TOKEN="pk.eyJ1IjoiYnVzZmFrdG9yIiwiYSI6ImNraDNiM3JxcDBhaWQydG1uczhpZWtpOW4ifQ.7TNRTO-o9aK1Y6MyW_Nd4g" # - WEBSOCKETS_URI=ws://backend:4000/graphql # is not working and not given in Docker YAML in main repo - PUBLIC_REGISTRATION=true + ######################################################## # BACKEND ############################################## ######################################################## backend: + # name the image to match our image to be tested from our DockerHub repository so that it can be pulled from there, otherwise it will be created locally from the 'dockerfile' image: ocelotsocialnetwork/backend-branded:latest networks: - test-network @@ -41,16 +45,30 @@ services: - PRIVATE_KEY_PASSPHRASE=a7dsf78sadg87ad87sfagsadg78 - EMAIL_SUPPORT=support@wir.social - EMAIL_DEFAULT_SENDER=info@wir.social + # - PRODUCTION_DB_CLEAN_ALLOW=false # only true for production environments on staging servers - PUBLIC_REGISTRATION=true - SMTP_USERNAME=${SMTP_USERNAME} - SMTP_PASSWORD=${SMTP_PASSWORD} - SMTP_HOST=mailserver - SMTP_PORT=25 - SMTP_IGNORE_TLS=true + + ######################################################## + # MAINTENANCE ########################################## + ######################################################## + maintenance: + # name the image to match our image to be tested from our DockerHub repository so that it can be pulled from there, otherwise it will be created locally from the 'dockerfile' + image: ocelotsocialnetwork/maintenance-branded:latest + networks: + - test-network + ports: + - 3001:80 + ######################################################## # NEO4J ################################################ ######################################################## neo4j: + # name the image to match our image to be tested from our DockerHub repository so that it can be pulled from there, otherwise it will be created locally from the 'dockerfile' image: ocelotsocialnetwork/neo4j-community-branded:latest networks: - test-network @@ -62,15 +80,7 @@ services: - 7687:7687 volumes: - neo4j_data:/data - ######################################################## - # MAINTENANCE ########################################## - ######################################################## - maintenance: - image: ocelotsocialnetwork/maintenance-branded:latest - networks: - - test-network - ports: - - 5000:80 + ######################################################## # MAILSERVER TO FAKE SMTP ############################## ######################################################## diff --git a/docker-compose.yml b/docker-compose.yml index 41d515d..285a0d3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,11 +1,15 @@ # This docker-compose file is just here for testing + version: "3.4" services: + ######################################################## # WEBAPP ############################################### ######################################################## webapp: + # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there + image: ocelotsocialnetwork/webapp-branded:local-production build: dockerfile: docker/webapp.Dockerfile target: branded @@ -22,10 +26,13 @@ services: - MAPBOX_TOKEN="pk.eyJ1IjoiYnVzZmFrdG9yIiwiYSI6ImNraDNiM3JxcDBhaWQydG1uczhpZWtpOW4ifQ.7TNRTO-o9aK1Y6MyW_Nd4g" # - WEBSOCKETS_URI=ws://backend:4000/graphql # is not working and not given in Docker YAML in main repo - PUBLIC_REGISTRATION=true + ######################################################## # BACKEND ############################################## ######################################################## backend: + # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there + image: ocelotsocialnetwork/backend-branded:local-production build: dockerfile: docker/backend.Dockerfile target: branded @@ -47,17 +54,36 @@ services: - PRIVATE_KEY_PASSPHRASE=a7dsf78sadg87ad87sfagsadg78 - EMAIL_SUPPORT=support@wir.social - EMAIL_DEFAULT_SENDER=info@wir.social + # - PRODUCTION_DB_CLEAN_ALLOW=false # only true for production environments on staging servers - PUBLIC_REGISTRATION=true - SMTP_USERNAME=${SMTP_USERNAME} - SMTP_PASSWORD=${SMTP_PASSWORD} - SMTP_HOST=mailserver - SMTP_PORT=25 - SMTP_IGNORE_TLS=true + + ######################################################## + # MAINTENANCE ########################################## + ######################################################## + maintenance: + # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there + image: ocelotsocialnetwork/maintenance-branded:local-production + build: + # TODO: Separate from webapp, this must be independent + dockerfile: docker/maintenance.Dockerfile + target: branded + context: . + networks: + - test-network + ports: + - 3001:80 + ######################################################## # NEO4J ################################################ ######################################################## neo4j: - image: ocelotsocialnetwork/neo4j:community + # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there + image: ocelotsocialnetwork/neo4j-community-branded:local-production networks: - test-network volumes: @@ -68,19 +94,7 @@ services: - NEO4J_ACCEPT_LICENSE_AGREEMENT=yes ports: - 7687:7687 - ######################################################## - # MAINTENANCE ########################################## - ######################################################## - maintenance: - build: - # TODO: Separate from webapp, this must be independent - dockerfile: docker/maintenance.Dockerfile - target: branded - context: . - networks: - - test-network - ports: - - 5000:80 + ######################################################## # MAILSERVER TO FAKE SMTP ############################## ######################################################## diff --git a/docker/DOCKER_MORE_CLOSELY.md b/docker/DOCKER_MORE_CLOSELY.md index c5c9269..113e3a4 100644 --- a/docker/DOCKER_MORE_CLOSELY.md +++ b/docker/DOCKER_MORE_CLOSELY.md @@ -11,6 +11,23 @@ $ export DOCKER_DEFAULT_PLATFORM=linux/amd64 For even more informations, see [Docker More Closely](#docker-more-closely) -## Docker More Closely +### Docker Compose Override File For Apple M1 Platform + +For Docker compose `up` or `build` commands, you can use our Apple M1 override file that specifies the M1 platform: + +```bash +# in main folder + +# for production +$ docker compose -f docker-compose.yml -f docker-compose.apple-m1.override.yml up + +# for production testing Docker images from DockerHub +$ docker compose -f docker-compose.ocelotsocial-branded.yml -f docker-compose.apple-m1.override.yml up + +# only once: init admin user and create indexes and contraints in Neo4j database +$ docker compose exec backend /bin/sh -c "yarn prod:migrate init" +``` + +## Docker More Closely In Main Code To get more informations about the Apple M1 platform and to analyze the Docker builds etc. you find our documentation in our main code, [here](https://github.com/Ocelot-Social-Community/Ocelot-Social/blob/master/DOCKER_MORE_CLOSELY.md). diff --git a/docker/neo4j.Dockerfile b/docker/neo4j.Dockerfile index 980c45e..eddc7be 100644 --- a/docker/neo4j.Dockerfile +++ b/docker/neo4j.Dockerfile @@ -1,4 +1,4 @@ -ARG APP_IMAGE=ocelotsocialnetwork/neo4j +ARG APP_IMAGE=ocelotsocialnetwork/neo4j-community ARG APP_IMAGE_TAG=latest ARG APP_IMAGE_COMMUNITY=${APP_IMAGE}:${APP_IMAGE_TAG} @@ -10,4 +10,5 @@ FROM $APP_IMAGE_COMMUNITY as community-branded ################################################################################## # ENTERPRISE ##################################################################### ################################################################################## +# Todo: refactor this with 'APP_IMAGE', 'APP_IMAGE_TAG', and similar to 'APP_IMAGE_COMMUNITY', Neo4j 'dockerfile' from main code FROM ocelotsocialnetwork/neo4j-enterprise:latest as enterprise-branded diff --git a/package.json b/package.json index 9963e69..1bbd611 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ocelot-social-branded", - "version": "1.0.8", - "ocelotDockerVersionTag": "1.0.8-182", + "version": "1.1.0", + "ocelotDockerVersionTag": "1.1.0-205", "dockerOrganisation": "ocelotsocialnetwork", "description": "ocelot.social Branded", "author": "ocelot.social Community",