From d1003af28e522a7a02d0e1bab4e5092663bba1db Mon Sep 17 00:00:00 2001 From: Shakar <5h4k4r.b4kr@gmail.com> Date: Sun, 26 Mar 2023 12:03:18 +0300 Subject: [PATCH 01/26] Adds environment variables page Signed-off-by: Shakar <5h4k4r.b4kr@gmail.com> --- .../06-Environment Variables.md | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 docs/Software Development/06-Environment Variables.md diff --git a/docs/Software Development/06-Environment Variables.md b/docs/Software Development/06-Environment Variables.md new file mode 100644 index 0000000..6c72314 --- /dev/null +++ b/docs/Software Development/06-Environment Variables.md @@ -0,0 +1,46 @@ +# Environment Variables for Micro-Service Applications + +This document provides a brief description of the environment variables that are used by the micro-service applications developed by the Department of Information & Technology (DIT). These variables are used to configure various aspects of the applications, such as database connections, cloud storage access, message queue settings, etc. The environment variables follow a standard naming convention that consists of two parts: the prefix and the suffix. The prefix indicates the component or service that the variable belongs to, and the suffix indicates the specific parameter or attribute that the variable represents. For example, `DATABASE__HOST` is an environment variable that specifies the host name of the database server for the application. + +The following table lists the environment variables that are common to all DIT micro-service applications, along with their descriptions. + +| Environment Variable | Description | +| :------------------------------------------------- | :----------------------------------------------------------------------------- | +| DATABASE\_\_HOST | The host name or IP address of the database server | +| DATABASE\_\_USERNAME | The username for accessing the database | +| DATABASE\_\_PASSWORD | The password for accessing the database | +| DATABASE\_\_NAME | The name of the database | +| DATABASE\_\_PORT | The port number of the database server | +| S3\_\_REGION | The AWS region of the S3 bucket | +| S3\_\_ENDPOINT | The endpoint URL of the S3 bucket | +| S3\_\_ACCESS_KEY_ID | The access key ID for accessing the S3 bucket | +| S3\_\_SECRET_ACCESS_KEY | The secret access key for accessing the S3 bucket | +| S3\_\_BUCKET | The name of the S3 bucket | +| SIDEKIQ\_\_USERNAME | The username for accessing the Sidekiq web interface | +| SIDEKIQ\_\_PASSWORD | The password for accessing the Sidekiq web interface | +| REDIS_SENTINEL\_\_HOST | The host name or IP address of the Redis Sentinel server | +| REDIS_SENTINEL\_\_PORT | The port number of the Redis Sentinel server | +| REDIS_SENTINEL\_\_PASSWORD | The password for accessing the Redis Sentinel server | +| REDIS_SENTINEL\_\_MASTER | The name of the Redis Sentinel master | +| REDIS\_\_PASSWORD | The password for accessing the Redis server | +| REDIS\_\_DB | The number of the Redis database | +| SIDEKIQ\_\_REDIS_DB | The number of the Redis database for Sidekiq | +| SENTRY\_\_DSN | The data source name (DSN) for Sentry error tracking | +| SENTRY\_\_TRACE_RATE | The sampling rate for Sentry performance tracing | +| SENTRY\_\_ENVIRONMENT | The environment name for Sentry error tracking | +| GATEWAY\_\_CERTIFICATE | The certificate file for accessing the gateway service | +| PROVINCE_SERVICE\_\_URL | The URL of the province service | +| DISTRICT_SERVICE\_\_URL | The URL of the district service | +| MESSAGING_API\_\_EXCHANGE_NAME | The name of the exchange for messaging API | +| NOTIFICATION\_\_WORKFLOW_TRANSITION_EMAIL_TEMPLATE | The email template ID for workflow transition notification | +| RABBITMQ\_\_HOST | The host name or IP address of the RabbitMQ server | +| RABBITMQ\_\_PORT | The port number of the RabbitMQ server | +| RABBITMQ\_\_VHOS | The virtual host name of the RabbitMQ server | +| RABBITMQ\_\_USERNAME | The username for accessing the RabbitMQ server | +| RABBITMQ\_\_PASSWORD | The password for accessing the RabbitMQ server | +| RABBITMQ\_\_MAX_ATTEMPTS | The maximum number of attempts for retrying failed messages in RabbitMQ queues | +| RABBITMQ\_\_RETRY_DELAY_IN_SECONDS | The delay in seconds between each retry attempt in RabbitMQ queues | +| TAX_CORPORATE_REGISTRATION_PORTAL\_\_URL | The URL of the tax corporate registration portal | +| EVENTBUS\_\_EXCHANGE_NAME | The name of the exchange for event bus | + +In addition to these common environment variables, some applications may have specific environment variables that are related to their functionality or dependencies. These variables are prefixed with the name of the application or service that they belong to, such as `PROVINCE_SERVICE__URL` or `TAX_CORPORATE_REGISTRATION_PORTAL__URL`. These variables are documented in their respective application repositories or README files. From 26b2d96c58f281ff77799aa536514880b40b1668 Mon Sep 17 00:00:00 2001 From: Shakar <5h4k4r.b4kr@gmail.com> Date: Sun, 26 Mar 2023 12:03:44 +0300 Subject: [PATCH 02/26] Fix typo Signed-off-by: Shakar <5h4k4r.b4kr@gmail.com> --- docs/Software Development/06-Environment Variables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Software Development/06-Environment Variables.md b/docs/Software Development/06-Environment Variables.md index 6c72314..6716103 100644 --- a/docs/Software Development/06-Environment Variables.md +++ b/docs/Software Development/06-Environment Variables.md @@ -35,7 +35,7 @@ The following table lists the environment variables that are common to all DIT m | NOTIFICATION\_\_WORKFLOW_TRANSITION_EMAIL_TEMPLATE | The email template ID for workflow transition notification | | RABBITMQ\_\_HOST | The host name or IP address of the RabbitMQ server | | RABBITMQ\_\_PORT | The port number of the RabbitMQ server | -| RABBITMQ\_\_VHOS | The virtual host name of the RabbitMQ server | +| RABBITMQ\_\_VHOST | The virtual host name of the RabbitMQ server | | RABBITMQ\_\_USERNAME | The username for accessing the RabbitMQ server | | RABBITMQ\_\_PASSWORD | The password for accessing the RabbitMQ server | | RABBITMQ\_\_MAX_ATTEMPTS | The maximum number of attempts for retrying failed messages in RabbitMQ queues | From 74416c9d83cd62ba8a5b2b3aa6be209580c422e0 Mon Sep 17 00:00:00 2001 From: MohamadTahir Date: Sun, 26 Mar 2023 12:21:41 +0300 Subject: [PATCH 03/26] run on local git hub runners --- .github/workflows/deploy-base.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-base.yaml b/.github/workflows/deploy-base.yaml index 6b7744f..7ef5198 100644 --- a/.github/workflows/deploy-base.yaml +++ b/.github/workflows/deploy-base.yaml @@ -22,7 +22,7 @@ env: jobs: deploy: timeout-minutes: 10 - runs-on: ubuntu-20.04 + runs-on: [self-hosted, ubuntu-focal] environment: url: ${{ inputs.env_url }} name: ${{ inputs.env_name }} From 2715fde766cbe26fc1ca9b99942f3a029948a31c Mon Sep 17 00:00:00 2001 From: Shakar <5h4k4r.b4kr@gmail.com> Date: Mon, 27 Mar 2023 12:50:33 +0300 Subject: [PATCH 04/26] fix typo Signed-off-by: Shakar <5h4k4r.b4kr@gmail.com> --- .github/workflows/tests-base.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests-base.yaml b/.github/workflows/tests-base.yaml index caa8a93..0d3d791 100644 --- a/.github/workflows/tests-base.yaml +++ b/.github/workflows/tests-base.yaml @@ -24,7 +24,7 @@ jobs: uses: actions/checkout@v3 - name: Kubectl tool installer - uses: Azure/setup-kubectl@v3 + uses: azure/setup-kubectl@v3 - name: Setup Kustomize uses: imranismail/setup-kustomize@v2 From 79699b5a075202a035c2b0de20a9efe2bd34245b Mon Sep 17 00:00:00 2001 From: Shakar <5h4k4r.b4kr@gmail.com> Date: Mon, 27 Mar 2023 13:11:30 +0300 Subject: [PATCH 05/26] Add mongodb Signed-off-by: Shakar <5h4k4r.b4kr@gmail.com> --- docs/Software Development/06-Environment Variables.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Software Development/06-Environment Variables.md b/docs/Software Development/06-Environment Variables.md index 6716103..f55d6bd 100644 --- a/docs/Software Development/06-Environment Variables.md +++ b/docs/Software Development/06-Environment Variables.md @@ -40,6 +40,7 @@ The following table lists the environment variables that are common to all DIT m | RABBITMQ\_\_PASSWORD | The password for accessing the RabbitMQ server | | RABBITMQ\_\_MAX_ATTEMPTS | The maximum number of attempts for retrying failed messages in RabbitMQ queues | | RABBITMQ\_\_RETRY_DELAY_IN_SECONDS | The delay in seconds between each retry attempt in RabbitMQ queues | +| MONGO\_\URL | The MongoDB Connection string | | TAX_CORPORATE_REGISTRATION_PORTAL\_\_URL | The URL of the tax corporate registration portal | | EVENTBUS\_\_EXCHANGE_NAME | The name of the exchange for event bus | From 74f7e1cceca7b36e338d9ff77d15c1fbc74fa174 Mon Sep 17 00:00:00 2001 From: Shakar <5h4k4r.b4kr@gmail.com> Date: Mon, 27 Mar 2023 16:40:42 +0300 Subject: [PATCH 06/26] Deploy using Rancher Fleet Signed-off-by: Shakar <5h4k4r.b4kr@gmail.com> --- .github/workflows/deploy-base.yaml | 54 ------------------------ .github/workflows/deploy-dev.yaml | 45 -------------------- .github/workflows/deploy-production.yaml | 45 -------------------- kubernetes/fleet.yaml | 9 ++++ 4 files changed, 9 insertions(+), 144 deletions(-) delete mode 100644 .github/workflows/deploy-base.yaml delete mode 100644 .github/workflows/deploy-dev.yaml delete mode 100644 .github/workflows/deploy-production.yaml create mode 100644 kubernetes/fleet.yaml diff --git a/.github/workflows/deploy-base.yaml b/.github/workflows/deploy-base.yaml deleted file mode 100644 index 7ef5198..0000000 --- a/.github/workflows/deploy-base.yaml +++ /dev/null @@ -1,54 +0,0 @@ -name: Deploy - -on: - workflow_call: - inputs: - image: - type: string - required: true - env_url: - type: string - required: true - env_name: - type: string - required: true - - secrets: - KUBECONFIG: { required: true } - -env: - NAMESPACE: dit-docs - -jobs: - deploy: - timeout-minutes: 10 - runs-on: [self-hosted, ubuntu-focal] - environment: - url: ${{ inputs.env_url }} - name: ${{ inputs.env_name }} - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Kubectl tool installer - uses: Azure/setup-kubectl@v3 - - - uses: azure/k8s-set-context@v3 - with: - method: kubeconfig - kubeconfig: ${{ secrets.KUBECONFIG }} - - - name: Setup Kustomize - uses: imranismail/setup-kustomize@v2 - - - name: Edit kustomization file - working-directory: kubernetes/base - run: kustomize edit set image IMAGE="${{ inputs.image }}" - - - name: Deploy - working-directory: kubernetes/${{ inputs.env_name }} - run: |- - - kustomize build | kubectl apply -f - - kubectl rollout -n "$NAMESPACE" status deployment/dsm-client-deployment -w --timeout=3m diff --git a/.github/workflows/deploy-dev.yaml b/.github/workflows/deploy-dev.yaml deleted file mode 100644 index c689c7a..0000000 --- a/.github/workflows/deploy-dev.yaml +++ /dev/null @@ -1,45 +0,0 @@ ---- -name: Deploy To Development - -on: - push: - branches: - - dev - - paths-ignore: - - "README.md" - - ".vscode/**" - - - ".github/**" - - "!.github/workflows/tests-base.yaml" - - "!.github/workflows/deploy-base.yaml" - - "!.github/workflows/deploy-dev.yaml" - -concurrency: - group: deploy-dev - cancel-in-progress: true - -jobs: - test: - uses: ./.github/workflows/tests-base.yaml - - build: - uses: ditkrg/build-image-workflow/.github/workflows/workflow.yaml@v1 - needs: test - with: - image: dit-docs/dsm-client - runs-on: "['ubuntu-latest']" - secrets: - username: ${{ secrets.HARBOR_PUBLIC_USER }} - password: ${{ secrets.HARBOR_PUBLIC_TOKEN }} - - deploy: - uses: ./.github/workflows/deploy-base.yaml - needs: build - with: - image: ${{ needs.build.outputs.tag }} - env_url: https://service-manual.docs.dev.krd - env_name: development - - secrets: - KUBECONFIG: ${{ secrets.KUBECONFIG }} diff --git a/.github/workflows/deploy-production.yaml b/.github/workflows/deploy-production.yaml deleted file mode 100644 index 8a6924e..0000000 --- a/.github/workflows/deploy-production.yaml +++ /dev/null @@ -1,45 +0,0 @@ ---- -name: Deploy To Production - -on: - push: - branches: - - main - - paths-ignore: - - "README.md" - - ".vscode/**" - - - ".github/**" - - "!.github/workflows/tests-base.yaml" - - "!.github/workflows/deploy-base.yaml" - - "!.github/workflows/deploy-production.yaml" - -concurrency: - group: deploy-production - cancel-in-progress: false - -jobs: - test: - uses: ditkrg/dit-digital-service-manual/.github/workflows/tests-base.yaml@main - - build: - uses: ditkrg/build-image-workflow/.github/workflows/workflow.yaml@v1 - needs: test - with: - image: dit-docs/dsm-client - runs-on: "['ubuntu-latest']" - secrets: - username: ${{ secrets.HARBOR_PUBLIC_USER }} - password: ${{ secrets.HARBOR_PUBLIC_TOKEN }} - - deploy: - uses: ./.github/workflows/deploy-base.yaml - needs: build - with: - image: ${{ needs.build.outputs.tag }} - env_url: https://docs.digital.gov.krd - env_name: production - - secrets: - KUBECONFIG: ${{ secrets.KUBECONFIG }} diff --git a/kubernetes/fleet.yaml b/kubernetes/fleet.yaml new file mode 100644 index 0000000..4036ab7 --- /dev/null +++ b/kubernetes/fleet.yaml @@ -0,0 +1,9 @@ +namespace: dit-docs + +targetCustomizations: + - name: development + clusterSelector: + matchLabels: + env: dev + kustomize: + dir: development From 5b5d186cce7cdc4b97f21b82721e3444850c44ae Mon Sep 17 00:00:00 2001 From: Shakar <5h4k4r.b4kr@gmail.com> Date: Tue, 28 Mar 2023 09:42:14 +0300 Subject: [PATCH 07/26] Deletes tests-base Adds production in fleet.yaml Signed-off-by: Shakar <5h4k4r.b4kr@gmail.com> --- .github/dependabot.yml | 8 ------- .github/workflows/tests-base.yaml | 40 ------------------------------- kubernetes/fleet.yaml | 7 ++++++ 3 files changed, 7 insertions(+), 48 deletions(-) delete mode 100644 .github/workflows/tests-base.yaml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index fd57540..cf546a0 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,14 +1,6 @@ --- version: 2 updates: - - package-ecosystem: "github-actions" - directory: "/" - target-branch: dev - schedule: - interval: "daily" - reviewers: - - "ditkrg/devops" - - package-ecosystem: "npm" directory: "/" target-branch: dev diff --git a/.github/workflows/tests-base.yaml b/.github/workflows/tests-base.yaml deleted file mode 100644 index 0d3d791..0000000 --- a/.github/workflows/tests-base.yaml +++ /dev/null @@ -1,40 +0,0 @@ ---- -name: Run Tests - -on: - push: - branches-ignore: - - dev - - main - - paths-ignore: - - "README.md" - - ".vscode/**" - - workflow_call: - -jobs: - run-tests: - name: Run Tests - timeout-minutes: 10 - runs-on: ubuntu-20.04 - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Kubectl tool installer - uses: azure/setup-kubectl@v3 - - - name: Setup Kustomize - uses: imranismail/setup-kustomize@v2 - - - name: Build k8s manifests - working-directory: kubernetes - run: | - envs=( "development" "production" ) - - for i in "${envs[@]}" - do - kustomize build "$i" - done diff --git a/kubernetes/fleet.yaml b/kubernetes/fleet.yaml index 4036ab7..23991b0 100644 --- a/kubernetes/fleet.yaml +++ b/kubernetes/fleet.yaml @@ -7,3 +7,10 @@ targetCustomizations: env: dev kustomize: dir: development + + - name: production + clusterSelector: + matchLabels: + env: prod + kustomize: + dir: production From 93b0fe0123838bae27ef05a032c730cedef44583 Mon Sep 17 00:00:00 2001 From: Shakar <5h4k4r.b4kr@gmail.com> Date: Tue, 4 Apr 2023 13:55:48 +0300 Subject: [PATCH 08/26] Updates environment variables Signed-off-by: Shakar <5h4k4r.b4kr@gmail.com> --- .../06-Environment Variables.md | 77 +++++++++---------- 1 file changed, 37 insertions(+), 40 deletions(-) diff --git a/docs/Software Development/06-Environment Variables.md b/docs/Software Development/06-Environment Variables.md index f55d6bd..dc1cbbb 100644 --- a/docs/Software Development/06-Environment Variables.md +++ b/docs/Software Development/06-Environment Variables.md @@ -4,44 +4,41 @@ This document provides a brief description of the environment variables that are The following table lists the environment variables that are common to all DIT micro-service applications, along with their descriptions. -| Environment Variable | Description | -| :------------------------------------------------- | :----------------------------------------------------------------------------- | -| DATABASE\_\_HOST | The host name or IP address of the database server | -| DATABASE\_\_USERNAME | The username for accessing the database | -| DATABASE\_\_PASSWORD | The password for accessing the database | -| DATABASE\_\_NAME | The name of the database | -| DATABASE\_\_PORT | The port number of the database server | -| S3\_\_REGION | The AWS region of the S3 bucket | -| S3\_\_ENDPOINT | The endpoint URL of the S3 bucket | -| S3\_\_ACCESS_KEY_ID | The access key ID for accessing the S3 bucket | -| S3\_\_SECRET_ACCESS_KEY | The secret access key for accessing the S3 bucket | -| S3\_\_BUCKET | The name of the S3 bucket | -| SIDEKIQ\_\_USERNAME | The username for accessing the Sidekiq web interface | -| SIDEKIQ\_\_PASSWORD | The password for accessing the Sidekiq web interface | -| REDIS_SENTINEL\_\_HOST | The host name or IP address of the Redis Sentinel server | -| REDIS_SENTINEL\_\_PORT | The port number of the Redis Sentinel server | -| REDIS_SENTINEL\_\_PASSWORD | The password for accessing the Redis Sentinel server | -| REDIS_SENTINEL\_\_MASTER | The name of the Redis Sentinel master | -| REDIS\_\_PASSWORD | The password for accessing the Redis server | -| REDIS\_\_DB | The number of the Redis database | -| SIDEKIQ\_\_REDIS_DB | The number of the Redis database for Sidekiq | -| SENTRY\_\_DSN | The data source name (DSN) for Sentry error tracking | -| SENTRY\_\_TRACE_RATE | The sampling rate for Sentry performance tracing | -| SENTRY\_\_ENVIRONMENT | The environment name for Sentry error tracking | -| GATEWAY\_\_CERTIFICATE | The certificate file for accessing the gateway service | -| PROVINCE_SERVICE\_\_URL | The URL of the province service | -| DISTRICT_SERVICE\_\_URL | The URL of the district service | -| MESSAGING_API\_\_EXCHANGE_NAME | The name of the exchange for messaging API | -| NOTIFICATION\_\_WORKFLOW_TRANSITION_EMAIL_TEMPLATE | The email template ID for workflow transition notification | -| RABBITMQ\_\_HOST | The host name or IP address of the RabbitMQ server | -| RABBITMQ\_\_PORT | The port number of the RabbitMQ server | -| RABBITMQ\_\_VHOST | The virtual host name of the RabbitMQ server | -| RABBITMQ\_\_USERNAME | The username for accessing the RabbitMQ server | -| RABBITMQ\_\_PASSWORD | The password for accessing the RabbitMQ server | -| RABBITMQ\_\_MAX_ATTEMPTS | The maximum number of attempts for retrying failed messages in RabbitMQ queues | -| RABBITMQ\_\_RETRY_DELAY_IN_SECONDS | The delay in seconds between each retry attempt in RabbitMQ queues | -| MONGO\_\URL | The MongoDB Connection string | -| TAX_CORPORATE_REGISTRATION_PORTAL\_\_URL | The URL of the tax corporate registration portal | -| EVENTBUS\_\_EXCHANGE_NAME | The name of the exchange for event bus | +| Environment Variable | Description | +| :--------------------------------- | :----------------------------------------------------------------------------- | +| DATABASE\_\_HOST | The host name or IP address of the database server | +| DATABASE\_\_USERNAME | The username for accessing the database | +| DATABASE\_\_PASSWORD | The password for accessing the database | +| DATABASE\_\_NAME | The name of the database | +| DATABASE\_\_PORT | The port number of the database server | +| S3\_\_REGION | The AWS region of the S3 bucket | +| S3\_\_ENDPOINT | The endpoint URL of the S3 bucket | +| S3\_\_ACCESS_KEY_ID | The access key ID for accessing the S3 bucket | +| S3\_\_SECRET_ACCESS_KEY | The secret access key for accessing the S3 bucket | +| S3\_\_BUCKET | The name of the S3 bucket | +| SIDEKIQ\_\_USERNAME | The username for accessing the Sidekiq web interface | +| SIDEKIQ\_\_PASSWORD | The password for accessing the Sidekiq web interface | +| REDIS_SENTINEL\_\_HOST | The host name or IP address of the Redis Sentinel server | +| REDIS_SENTINEL\_\_PORT | The port number of the Redis Sentinel server | +| REDIS_SENTINEL\_\_PASSWORD | The password for accessing the Redis Sentinel server | +| REDIS_SENTINEL\_\_MASTER | The name of the Redis Sentinel master | +| REDIS\_\_PASSWORD | The password for accessing the Redis server | +| REDIS\_\_DB | The number of the Redis database | +| SIDEKIQ\_\_REDIS_DB | The number of the Redis database for Sidekiq | +| SENTRY\_\_DSN | The data source name (DSN) for Sentry error tracking | +| SENTRY\_\_TRACE_RATE | The sampling rate for Sentry performance tracing | +| SENTRY\_\_ENVIRONMENT | The environment name for Sentry error tracking | +| GATEWAY\_\_CERTIFICATE | The certificate file for accessing the gateway service | +| RABBITMQ\_\_HOST | The host name or IP address of the RabbitMQ server | +| RABBITMQ\_\_PORT | The port number of the RabbitMQ server | +| RABBITMQ\_\_VHOST | The virtual host name of the RabbitMQ server | +| RABBITMQ\_\_USERNAME | The username for accessing the RabbitMQ server | +| RABBITMQ\_\_PASSWORD | The password for accessing the RabbitMQ server | +| RABBITMQ\_\_MAX_ATTEMPTS | The maximum number of attempts for retrying failed messages in RabbitMQ queues | +| RABBITMQ\_\_RETRY_DELAY_IN_SECONDS | The delay in seconds between each retry attempt in RabbitMQ queues | +| MONGO\_\URL | The MongoDB Connection string | +| SERIVCE\_\_[Name of service]\_URL | The URL of the tax corporate registration portal | +| EVENTBUS\_\_EXCHANGE_NAME | The name of the exchange for event bus | +| EMAIL_TEMPLATE_ID\_\_[action] | The database ID of the email template | -In addition to these common environment variables, some applications may have specific environment variables that are related to their functionality or dependencies. These variables are prefixed with the name of the application or service that they belong to, such as `PROVINCE_SERVICE__URL` or `TAX_CORPORATE_REGISTRATION_PORTAL__URL`. These variables are documented in their respective application repositories or README files. +In addition to these common environment variables, some applications may have specific environment variables that are related to their functionality or dependencies. These variables are prefixed with the name of the application or service that they belong to, such as `TAX_CORPORATE_REGISTRATION_PORTAL_URL`. These variables are documented in their respective application repositories or README files. From d96f56d8258e791b1909ad85348f20e3416dc0c9 Mon Sep 17 00:00:00 2001 From: Shakar <5h4k4r.b4kr@gmail.com> Date: Tue, 4 Apr 2023 14:15:49 +0300 Subject: [PATCH 09/26] Revert "Deletes tests-base" This reverts commit 5b5d186cce7cdc4b97f21b82721e3444850c44ae. --- .github/dependabot.yml | 8 +++++++ .github/workflows/tests-base.yaml | 40 +++++++++++++++++++++++++++++++ kubernetes/fleet.yaml | 7 ------ 3 files changed, 48 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/tests-base.yaml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index cf546a0..fd57540 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,6 +1,14 @@ --- version: 2 updates: + - package-ecosystem: "github-actions" + directory: "/" + target-branch: dev + schedule: + interval: "daily" + reviewers: + - "ditkrg/devops" + - package-ecosystem: "npm" directory: "/" target-branch: dev diff --git a/.github/workflows/tests-base.yaml b/.github/workflows/tests-base.yaml new file mode 100644 index 0000000..0d3d791 --- /dev/null +++ b/.github/workflows/tests-base.yaml @@ -0,0 +1,40 @@ +--- +name: Run Tests + +on: + push: + branches-ignore: + - dev + - main + + paths-ignore: + - "README.md" + - ".vscode/**" + + workflow_call: + +jobs: + run-tests: + name: Run Tests + timeout-minutes: 10 + runs-on: ubuntu-20.04 + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Kubectl tool installer + uses: azure/setup-kubectl@v3 + + - name: Setup Kustomize + uses: imranismail/setup-kustomize@v2 + + - name: Build k8s manifests + working-directory: kubernetes + run: | + envs=( "development" "production" ) + + for i in "${envs[@]}" + do + kustomize build "$i" + done diff --git a/kubernetes/fleet.yaml b/kubernetes/fleet.yaml index 23991b0..4036ab7 100644 --- a/kubernetes/fleet.yaml +++ b/kubernetes/fleet.yaml @@ -7,10 +7,3 @@ targetCustomizations: env: dev kustomize: dir: development - - - name: production - clusterSelector: - matchLabels: - env: prod - kustomize: - dir: production From 55467a497ac6da2c1f03bbc3c8cefe5f623d00b7 Mon Sep 17 00:00:00 2001 From: Shakar <5h4k4r.b4kr@gmail.com> Date: Tue, 4 Apr 2023 14:16:59 +0300 Subject: [PATCH 10/26] Revert "Deploy using Rancher Fleet" This reverts commit 74f7e1cceca7b36e338d9ff77d15c1fbc74fa174. --- .github/workflows/deploy-base.yaml | 54 ++++++++++++++++++++++++ .github/workflows/deploy-dev.yaml | 45 ++++++++++++++++++++ .github/workflows/deploy-production.yaml | 45 ++++++++++++++++++++ kubernetes/fleet.yaml | 9 ---- 4 files changed, 144 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/deploy-base.yaml create mode 100644 .github/workflows/deploy-dev.yaml create mode 100644 .github/workflows/deploy-production.yaml delete mode 100644 kubernetes/fleet.yaml diff --git a/.github/workflows/deploy-base.yaml b/.github/workflows/deploy-base.yaml new file mode 100644 index 0000000..7ef5198 --- /dev/null +++ b/.github/workflows/deploy-base.yaml @@ -0,0 +1,54 @@ +name: Deploy + +on: + workflow_call: + inputs: + image: + type: string + required: true + env_url: + type: string + required: true + env_name: + type: string + required: true + + secrets: + KUBECONFIG: { required: true } + +env: + NAMESPACE: dit-docs + +jobs: + deploy: + timeout-minutes: 10 + runs-on: [self-hosted, ubuntu-focal] + environment: + url: ${{ inputs.env_url }} + name: ${{ inputs.env_name }} + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Kubectl tool installer + uses: Azure/setup-kubectl@v3 + + - uses: azure/k8s-set-context@v3 + with: + method: kubeconfig + kubeconfig: ${{ secrets.KUBECONFIG }} + + - name: Setup Kustomize + uses: imranismail/setup-kustomize@v2 + + - name: Edit kustomization file + working-directory: kubernetes/base + run: kustomize edit set image IMAGE="${{ inputs.image }}" + + - name: Deploy + working-directory: kubernetes/${{ inputs.env_name }} + run: |- + + kustomize build | kubectl apply -f - + kubectl rollout -n "$NAMESPACE" status deployment/dsm-client-deployment -w --timeout=3m diff --git a/.github/workflows/deploy-dev.yaml b/.github/workflows/deploy-dev.yaml new file mode 100644 index 0000000..c689c7a --- /dev/null +++ b/.github/workflows/deploy-dev.yaml @@ -0,0 +1,45 @@ +--- +name: Deploy To Development + +on: + push: + branches: + - dev + + paths-ignore: + - "README.md" + - ".vscode/**" + + - ".github/**" + - "!.github/workflows/tests-base.yaml" + - "!.github/workflows/deploy-base.yaml" + - "!.github/workflows/deploy-dev.yaml" + +concurrency: + group: deploy-dev + cancel-in-progress: true + +jobs: + test: + uses: ./.github/workflows/tests-base.yaml + + build: + uses: ditkrg/build-image-workflow/.github/workflows/workflow.yaml@v1 + needs: test + with: + image: dit-docs/dsm-client + runs-on: "['ubuntu-latest']" + secrets: + username: ${{ secrets.HARBOR_PUBLIC_USER }} + password: ${{ secrets.HARBOR_PUBLIC_TOKEN }} + + deploy: + uses: ./.github/workflows/deploy-base.yaml + needs: build + with: + image: ${{ needs.build.outputs.tag }} + env_url: https://service-manual.docs.dev.krd + env_name: development + + secrets: + KUBECONFIG: ${{ secrets.KUBECONFIG }} diff --git a/.github/workflows/deploy-production.yaml b/.github/workflows/deploy-production.yaml new file mode 100644 index 0000000..8a6924e --- /dev/null +++ b/.github/workflows/deploy-production.yaml @@ -0,0 +1,45 @@ +--- +name: Deploy To Production + +on: + push: + branches: + - main + + paths-ignore: + - "README.md" + - ".vscode/**" + + - ".github/**" + - "!.github/workflows/tests-base.yaml" + - "!.github/workflows/deploy-base.yaml" + - "!.github/workflows/deploy-production.yaml" + +concurrency: + group: deploy-production + cancel-in-progress: false + +jobs: + test: + uses: ditkrg/dit-digital-service-manual/.github/workflows/tests-base.yaml@main + + build: + uses: ditkrg/build-image-workflow/.github/workflows/workflow.yaml@v1 + needs: test + with: + image: dit-docs/dsm-client + runs-on: "['ubuntu-latest']" + secrets: + username: ${{ secrets.HARBOR_PUBLIC_USER }} + password: ${{ secrets.HARBOR_PUBLIC_TOKEN }} + + deploy: + uses: ./.github/workflows/deploy-base.yaml + needs: build + with: + image: ${{ needs.build.outputs.tag }} + env_url: https://docs.digital.gov.krd + env_name: production + + secrets: + KUBECONFIG: ${{ secrets.KUBECONFIG }} diff --git a/kubernetes/fleet.yaml b/kubernetes/fleet.yaml deleted file mode 100644 index 4036ab7..0000000 --- a/kubernetes/fleet.yaml +++ /dev/null @@ -1,9 +0,0 @@ -namespace: dit-docs - -targetCustomizations: - - name: development - clusterSelector: - matchLabels: - env: dev - kustomize: - dir: development From 6ce207ab44cd3a83b18c227dcaf8016e40712abd Mon Sep 17 00:00:00 2001 From: Shakar <5h4k4r.b4kr@gmail.com> Date: Tue, 4 Apr 2023 14:19:37 +0300 Subject: [PATCH 11/26] Revert "fix typo" This reverts commit 2715fde766cbe26fc1ca9b99942f3a029948a31c. --- .github/workflows/tests-base.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests-base.yaml b/.github/workflows/tests-base.yaml index 0d3d791..caa8a93 100644 --- a/.github/workflows/tests-base.yaml +++ b/.github/workflows/tests-base.yaml @@ -24,7 +24,7 @@ jobs: uses: actions/checkout@v3 - name: Kubectl tool installer - uses: azure/setup-kubectl@v3 + uses: Azure/setup-kubectl@v3 - name: Setup Kustomize uses: imranismail/setup-kustomize@v2 From f0ba09a67925ea40b71449837bdb2f2f442c9a88 Mon Sep 17 00:00:00 2001 From: Shakar <5h4k4r.b4kr@gmail.com> Date: Tue, 4 Apr 2023 14:19:53 +0300 Subject: [PATCH 12/26] Revert "run on local git hub runners" This reverts commit 74416c9d83cd62ba8a5b2b3aa6be209580c422e0. --- .github/workflows/deploy-base.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-base.yaml b/.github/workflows/deploy-base.yaml index 7ef5198..6b7744f 100644 --- a/.github/workflows/deploy-base.yaml +++ b/.github/workflows/deploy-base.yaml @@ -22,7 +22,7 @@ env: jobs: deploy: timeout-minutes: 10 - runs-on: [self-hosted, ubuntu-focal] + runs-on: ubuntu-20.04 environment: url: ${{ inputs.env_url }} name: ${{ inputs.env_name }} From 1796c41532b1301abe01eafb979c8583de670c70 Mon Sep 17 00:00:00 2001 From: Shakar <5h4k4r.b4kr@gmail.com> Date: Tue, 4 Apr 2023 14:24:41 +0300 Subject: [PATCH 13/26] Changes s3 variables Adds RabbitMQ__URL Updates the description of service url Signed-off-by: Shakar <5h4k4r.b4kr@gmail.com> --- docs/Software Development/06-Environment Variables.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/Software Development/06-Environment Variables.md b/docs/Software Development/06-Environment Variables.md index dc1cbbb..7f4b219 100644 --- a/docs/Software Development/06-Environment Variables.md +++ b/docs/Software Development/06-Environment Variables.md @@ -13,8 +13,8 @@ The following table lists the environment variables that are common to all DIT m | DATABASE\_\_PORT | The port number of the database server | | S3\_\_REGION | The AWS region of the S3 bucket | | S3\_\_ENDPOINT | The endpoint URL of the S3 bucket | -| S3\_\_ACCESS_KEY_ID | The access key ID for accessing the S3 bucket | -| S3\_\_SECRET_ACCESS_KEY | The secret access key for accessing the S3 bucket | +| S3\_\_ACCESS_KEY | The access key ID for accessing the S3 bucket | +| S3\_\_SECRET_KEY | The secret access key for accessing the S3 bucket | | S3\_\_BUCKET | The name of the S3 bucket | | SIDEKIQ\_\_USERNAME | The username for accessing the Sidekiq web interface | | SIDEKIQ\_\_PASSWORD | The password for accessing the Sidekiq web interface | @@ -29,6 +29,7 @@ The following table lists the environment variables that are common to all DIT m | SENTRY\_\_TRACE_RATE | The sampling rate for Sentry performance tracing | | SENTRY\_\_ENVIRONMENT | The environment name for Sentry error tracking | | GATEWAY\_\_CERTIFICATE | The certificate file for accessing the gateway service | +| RABBITMQ\_\_URL | The URL the RabbitMQ server | | RABBITMQ\_\_HOST | The host name or IP address of the RabbitMQ server | | RABBITMQ\_\_PORT | The port number of the RabbitMQ server | | RABBITMQ\_\_VHOST | The virtual host name of the RabbitMQ server | @@ -37,7 +38,7 @@ The following table lists the environment variables that are common to all DIT m | RABBITMQ\_\_MAX_ATTEMPTS | The maximum number of attempts for retrying failed messages in RabbitMQ queues | | RABBITMQ\_\_RETRY_DELAY_IN_SECONDS | The delay in seconds between each retry attempt in RabbitMQ queues | | MONGO\_\URL | The MongoDB Connection string | -| SERIVCE\_\_[Name of service]\_URL | The URL of the tax corporate registration portal | +| SERIVCE\_\_[Name of service]\_URL | The URL of other services | | EVENTBUS\_\_EXCHANGE_NAME | The name of the exchange for event bus | | EMAIL_TEMPLATE_ID\_\_[action] | The database ID of the email template | From d2aadc4c40375f26f5524227c2e70c3f2ae7e3d6 Mon Sep 17 00:00:00 2001 From: Shakar <5h4k4r.b4kr@gmail.com> Date: Tue, 4 Apr 2023 16:34:26 +0300 Subject: [PATCH 14/26] Update environment variables page Signed-off-by: Shakar <5h4k4r.b4kr@gmail.com> --- .../06-Environment Variables.md | 89 +++++++++++-------- 1 file changed, 51 insertions(+), 38 deletions(-) diff --git a/docs/Software Development/06-Environment Variables.md b/docs/Software Development/06-Environment Variables.md index 7f4b219..684629b 100644 --- a/docs/Software Development/06-Environment Variables.md +++ b/docs/Software Development/06-Environment Variables.md @@ -1,45 +1,58 @@ # Environment Variables for Micro-Service Applications -This document provides a brief description of the environment variables that are used by the micro-service applications developed by the Department of Information & Technology (DIT). These variables are used to configure various aspects of the applications, such as database connections, cloud storage access, message queue settings, etc. The environment variables follow a standard naming convention that consists of two parts: the prefix and the suffix. The prefix indicates the component or service that the variable belongs to, and the suffix indicates the specific parameter or attribute that the variable represents. For example, `DATABASE__HOST` is an environment variable that specifies the host name of the database server for the application. +This document provides a brief description of the environment variables that are used by the micro-service applications developed and maintained by the Department of Information & Technology (DIT). These variables are used to configure various aspects of the applications, such as database connections, cloud storage access, message queue settings, etc. The environment variables follow a standard naming convention that consists of two parts: the prefix and the suffix. The prefix indicates the component or service that the variable belongs to, and the suffix indicates the specific parameter or attribute that the variable represents. For example, `DATABASE__HOST` is an environment variable that specifies the host name of the database server for the application. The following table lists the environment variables that are common to all DIT micro-service applications, along with their descriptions. -| Environment Variable | Description | -| :--------------------------------- | :----------------------------------------------------------------------------- | -| DATABASE\_\_HOST | The host name or IP address of the database server | -| DATABASE\_\_USERNAME | The username for accessing the database | -| DATABASE\_\_PASSWORD | The password for accessing the database | -| DATABASE\_\_NAME | The name of the database | -| DATABASE\_\_PORT | The port number of the database server | -| S3\_\_REGION | The AWS region of the S3 bucket | -| S3\_\_ENDPOINT | The endpoint URL of the S3 bucket | -| S3\_\_ACCESS_KEY | The access key ID for accessing the S3 bucket | -| S3\_\_SECRET_KEY | The secret access key for accessing the S3 bucket | -| S3\_\_BUCKET | The name of the S3 bucket | -| SIDEKIQ\_\_USERNAME | The username for accessing the Sidekiq web interface | -| SIDEKIQ\_\_PASSWORD | The password for accessing the Sidekiq web interface | -| REDIS_SENTINEL\_\_HOST | The host name or IP address of the Redis Sentinel server | -| REDIS_SENTINEL\_\_PORT | The port number of the Redis Sentinel server | -| REDIS_SENTINEL\_\_PASSWORD | The password for accessing the Redis Sentinel server | -| REDIS_SENTINEL\_\_MASTER | The name of the Redis Sentinel master | -| REDIS\_\_PASSWORD | The password for accessing the Redis server | -| REDIS\_\_DB | The number of the Redis database | -| SIDEKIQ\_\_REDIS_DB | The number of the Redis database for Sidekiq | -| SENTRY\_\_DSN | The data source name (DSN) for Sentry error tracking | -| SENTRY\_\_TRACE_RATE | The sampling rate for Sentry performance tracing | -| SENTRY\_\_ENVIRONMENT | The environment name for Sentry error tracking | -| GATEWAY\_\_CERTIFICATE | The certificate file for accessing the gateway service | -| RABBITMQ\_\_URL | The URL the RabbitMQ server | -| RABBITMQ\_\_HOST | The host name or IP address of the RabbitMQ server | -| RABBITMQ\_\_PORT | The port number of the RabbitMQ server | -| RABBITMQ\_\_VHOST | The virtual host name of the RabbitMQ server | -| RABBITMQ\_\_USERNAME | The username for accessing the RabbitMQ server | -| RABBITMQ\_\_PASSWORD | The password for accessing the RabbitMQ server | -| RABBITMQ\_\_MAX_ATTEMPTS | The maximum number of attempts for retrying failed messages in RabbitMQ queues | -| RABBITMQ\_\_RETRY_DELAY_IN_SECONDS | The delay in seconds between each retry attempt in RabbitMQ queues | -| MONGO\_\URL | The MongoDB Connection string | -| SERIVCE\_\_[Name of service]\_URL | The URL of other services | -| EVENTBUS\_\_EXCHANGE_NAME | The name of the exchange for event bus | -| EMAIL_TEMPLATE_ID\_\_[action] | The database ID of the email template | +| Environment Variable | Description | +| :------------------------- | :------------------------------------------------------------------------ | +| CAS\_\_URL | The URI format for the connection string of database server | +| CAS\_\_M2M_CLIENT_ID | The URI format for the connection string of database server | +| CAS\_\_M2M_CLIENT_SECRET | The URI format for the connection string of database server | +| DATABASE\_\_URL | The URI format for the connection string of database server | +| DATABASE\_\_HOST | The host name or IP address of the database server | +| DATABASE\_\_USERNAME | The username for accessing the database | +| DATABASE\_\_PASSWORD | The password for accessing the database | +| DATABASE\_\_NAME | The name of the database | +| DATABASE\_\_PORT | The port number of the database server | +| S3\_\_REGION | The AWS region of the S3 bucket | +| S3\_\_ENDPOINT | The endpoint URL of the S3 bucket | +| S3\_\_ACCESS_KEY_ID | The access key ID for accessing the S3 bucket | +| S3\_\_SECRET_ACCESS_KEY | The secret access key for accessing the S3 bucket | +| S3\_\_SELF_BUCKET | The name of the S3 bucket used for storing self-related files | +| S3\_\_UPLOADS_API_BUCKET | The name of the S3 bucket used for storing uploaded files via Uploads API | +| SIDEKIQ\_\_USERNAME | The username for accessing the Sidekiq web interface | +| SIDEKIQ\_\_PASSWORD | The password for accessing the Sidekiq web interface | +| REDIS_SENTINEL\_\_HOST | The host name or IP address of the Redis Sentinel server | +| REDIS_SENTINEL\_\_PORT | The port number of the Redis Sentinel server | +| REDIS_SENTINEL\_\_PASSWORD | The password for accessing the Redis Sentinel server | +| REDIS_SENTINEL\_\_MASTER | The name of the Redis Sentinel master | +| REDIS\_\_PASSWORD | The password for accessing the Redis server | +| REDIS\_\_DB | The number of the Redis database | +| SIDEKIQ\_\_REDIS_DB | The number of the Redis database for Sidekiq | +| SENTRY\_\_DSN | The data source name (DSN) for Sentry error tracking | +| SENTRY\_\_TRACE_RATE | The sampling rate for Sentry performance tracing | +| SENTRY\_\_ENVIRONMENT | The environment name for Sentry error tracking | +| GATEWAY\_\_CERTIFICATE | The certificate file for accessing the gateway service | +| RABBITMQ\_\_URL | The URL the RabbitMQ server | +| RABBITMQ\_\_HOST | The host name or IP address of the RabbitMQ server | +| RABBITMQ\_\_PORT | The port number of the RabbitMQ server | +| RABBITMQ\_\_VHOST | The virtual host name of the RabbitMQ server | +| RABBITMQ\_\_USERNAME | The username for accessing the RabbitMQ server | +| RABBITMQ\_\_PASSWORD | The password for accessing the RabbitMQ server | +| RABBITMQ\_\_EXCHANGE_NAME | The name of the exchange for RabbitMQ server | In addition to these common environment variables, some applications may have specific environment variables that are related to their functionality or dependencies. These variables are prefixed with the name of the application or service that they belong to, such as `TAX_CORPORATE_REGISTRATION_PORTAL_URL`. These variables are documented in their respective application repositories or README files. + +## Environment Variables for Micro-Service Applications + +1. Use double underscores (\_\_) to separate words in the variable name. +2. Use all uppercase letters for the variable name. +3. Use descriptive names for the variable that indicate their purpose or usage. +4. Use consistent naming across all microservice applications developed by DIT. +5. Store environment variables securely, using an encrypted secrets store, such as HashiCorp Vault or Amazon Secrets Manager. +6. Avoid hard-coding sensitive information, such as passwords or API keys, in the code. + +## Conclusion + +The standard naming convention for environment variables used by microservice applications developed and maintained by the Department of Information & Technology (DIT) has been outlined in this document. Following these guidelines will ensure consistency and clarity across all microservice applications developed by DIT. From 77bf4f8da9348c33e74e87c968ece85b2f261afd Mon Sep 17 00:00:00 2001 From: Shakar <5h4k4r.b4kr@gmail.com> Date: Tue, 4 Apr 2023 16:37:21 +0300 Subject: [PATCH 15/26] Revert "Revert "Deploy using Rancher Fleet"" This reverts commit 55467a497ac6da2c1f03bbc3c8cefe5f623d00b7. Signed-off-by: Shakar <5h4k4r.b4kr@gmail.com> --- .github/workflows/deploy-base.yaml | 54 ------------------------ .github/workflows/deploy-dev.yaml | 45 -------------------- .github/workflows/deploy-production.yaml | 45 -------------------- kubernetes/fleet.yaml | 9 ++++ 4 files changed, 9 insertions(+), 144 deletions(-) delete mode 100644 .github/workflows/deploy-base.yaml delete mode 100644 .github/workflows/deploy-dev.yaml delete mode 100644 .github/workflows/deploy-production.yaml create mode 100644 kubernetes/fleet.yaml diff --git a/.github/workflows/deploy-base.yaml b/.github/workflows/deploy-base.yaml deleted file mode 100644 index 6b7744f..0000000 --- a/.github/workflows/deploy-base.yaml +++ /dev/null @@ -1,54 +0,0 @@ -name: Deploy - -on: - workflow_call: - inputs: - image: - type: string - required: true - env_url: - type: string - required: true - env_name: - type: string - required: true - - secrets: - KUBECONFIG: { required: true } - -env: - NAMESPACE: dit-docs - -jobs: - deploy: - timeout-minutes: 10 - runs-on: ubuntu-20.04 - environment: - url: ${{ inputs.env_url }} - name: ${{ inputs.env_name }} - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Kubectl tool installer - uses: Azure/setup-kubectl@v3 - - - uses: azure/k8s-set-context@v3 - with: - method: kubeconfig - kubeconfig: ${{ secrets.KUBECONFIG }} - - - name: Setup Kustomize - uses: imranismail/setup-kustomize@v2 - - - name: Edit kustomization file - working-directory: kubernetes/base - run: kustomize edit set image IMAGE="${{ inputs.image }}" - - - name: Deploy - working-directory: kubernetes/${{ inputs.env_name }} - run: |- - - kustomize build | kubectl apply -f - - kubectl rollout -n "$NAMESPACE" status deployment/dsm-client-deployment -w --timeout=3m diff --git a/.github/workflows/deploy-dev.yaml b/.github/workflows/deploy-dev.yaml deleted file mode 100644 index c689c7a..0000000 --- a/.github/workflows/deploy-dev.yaml +++ /dev/null @@ -1,45 +0,0 @@ ---- -name: Deploy To Development - -on: - push: - branches: - - dev - - paths-ignore: - - "README.md" - - ".vscode/**" - - - ".github/**" - - "!.github/workflows/tests-base.yaml" - - "!.github/workflows/deploy-base.yaml" - - "!.github/workflows/deploy-dev.yaml" - -concurrency: - group: deploy-dev - cancel-in-progress: true - -jobs: - test: - uses: ./.github/workflows/tests-base.yaml - - build: - uses: ditkrg/build-image-workflow/.github/workflows/workflow.yaml@v1 - needs: test - with: - image: dit-docs/dsm-client - runs-on: "['ubuntu-latest']" - secrets: - username: ${{ secrets.HARBOR_PUBLIC_USER }} - password: ${{ secrets.HARBOR_PUBLIC_TOKEN }} - - deploy: - uses: ./.github/workflows/deploy-base.yaml - needs: build - with: - image: ${{ needs.build.outputs.tag }} - env_url: https://service-manual.docs.dev.krd - env_name: development - - secrets: - KUBECONFIG: ${{ secrets.KUBECONFIG }} diff --git a/.github/workflows/deploy-production.yaml b/.github/workflows/deploy-production.yaml deleted file mode 100644 index 8a6924e..0000000 --- a/.github/workflows/deploy-production.yaml +++ /dev/null @@ -1,45 +0,0 @@ ---- -name: Deploy To Production - -on: - push: - branches: - - main - - paths-ignore: - - "README.md" - - ".vscode/**" - - - ".github/**" - - "!.github/workflows/tests-base.yaml" - - "!.github/workflows/deploy-base.yaml" - - "!.github/workflows/deploy-production.yaml" - -concurrency: - group: deploy-production - cancel-in-progress: false - -jobs: - test: - uses: ditkrg/dit-digital-service-manual/.github/workflows/tests-base.yaml@main - - build: - uses: ditkrg/build-image-workflow/.github/workflows/workflow.yaml@v1 - needs: test - with: - image: dit-docs/dsm-client - runs-on: "['ubuntu-latest']" - secrets: - username: ${{ secrets.HARBOR_PUBLIC_USER }} - password: ${{ secrets.HARBOR_PUBLIC_TOKEN }} - - deploy: - uses: ./.github/workflows/deploy-base.yaml - needs: build - with: - image: ${{ needs.build.outputs.tag }} - env_url: https://docs.digital.gov.krd - env_name: production - - secrets: - KUBECONFIG: ${{ secrets.KUBECONFIG }} diff --git a/kubernetes/fleet.yaml b/kubernetes/fleet.yaml new file mode 100644 index 0000000..4036ab7 --- /dev/null +++ b/kubernetes/fleet.yaml @@ -0,0 +1,9 @@ +namespace: dit-docs + +targetCustomizations: + - name: development + clusterSelector: + matchLabels: + env: dev + kustomize: + dir: development From e5a275f94c450e98efc1b1110a9cff8797f7bb35 Mon Sep 17 00:00:00 2001 From: Shakar <5h4k4r.b4kr@gmail.com> Date: Tue, 4 Apr 2023 16:54:18 +0300 Subject: [PATCH 16/26] Fix the description of these environment variables Signed-off-by: Shakar <5h4k4r.b4kr@gmail.com> --- .../06-Environment Variables.md | 75 ++++++++++--------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/docs/Software Development/06-Environment Variables.md b/docs/Software Development/06-Environment Variables.md index 684629b..6428f38 100644 --- a/docs/Software Development/06-Environment Variables.md +++ b/docs/Software Development/06-Environment Variables.md @@ -4,43 +4,44 @@ This document provides a brief description of the environment variables that are The following table lists the environment variables that are common to all DIT micro-service applications, along with their descriptions. -| Environment Variable | Description | -| :------------------------- | :------------------------------------------------------------------------ | -| CAS\_\_URL | The URI format for the connection string of database server | -| CAS\_\_M2M_CLIENT_ID | The URI format for the connection string of database server | -| CAS\_\_M2M_CLIENT_SECRET | The URI format for the connection string of database server | -| DATABASE\_\_URL | The URI format for the connection string of database server | -| DATABASE\_\_HOST | The host name or IP address of the database server | -| DATABASE\_\_USERNAME | The username for accessing the database | -| DATABASE\_\_PASSWORD | The password for accessing the database | -| DATABASE\_\_NAME | The name of the database | -| DATABASE\_\_PORT | The port number of the database server | -| S3\_\_REGION | The AWS region of the S3 bucket | -| S3\_\_ENDPOINT | The endpoint URL of the S3 bucket | -| S3\_\_ACCESS_KEY_ID | The access key ID for accessing the S3 bucket | -| S3\_\_SECRET_ACCESS_KEY | The secret access key for accessing the S3 bucket | -| S3\_\_SELF_BUCKET | The name of the S3 bucket used for storing self-related files | -| S3\_\_UPLOADS_API_BUCKET | The name of the S3 bucket used for storing uploaded files via Uploads API | -| SIDEKIQ\_\_USERNAME | The username for accessing the Sidekiq web interface | -| SIDEKIQ\_\_PASSWORD | The password for accessing the Sidekiq web interface | -| REDIS_SENTINEL\_\_HOST | The host name or IP address of the Redis Sentinel server | -| REDIS_SENTINEL\_\_PORT | The port number of the Redis Sentinel server | -| REDIS_SENTINEL\_\_PASSWORD | The password for accessing the Redis Sentinel server | -| REDIS_SENTINEL\_\_MASTER | The name of the Redis Sentinel master | -| REDIS\_\_PASSWORD | The password for accessing the Redis server | -| REDIS\_\_DB | The number of the Redis database | -| SIDEKIQ\_\_REDIS_DB | The number of the Redis database for Sidekiq | -| SENTRY\_\_DSN | The data source name (DSN) for Sentry error tracking | -| SENTRY\_\_TRACE_RATE | The sampling rate for Sentry performance tracing | -| SENTRY\_\_ENVIRONMENT | The environment name for Sentry error tracking | -| GATEWAY\_\_CERTIFICATE | The certificate file for accessing the gateway service | -| RABBITMQ\_\_URL | The URL the RabbitMQ server | -| RABBITMQ\_\_HOST | The host name or IP address of the RabbitMQ server | -| RABBITMQ\_\_PORT | The port number of the RabbitMQ server | -| RABBITMQ\_\_VHOST | The virtual host name of the RabbitMQ server | -| RABBITMQ\_\_USERNAME | The username for accessing the RabbitMQ server | -| RABBITMQ\_\_PASSWORD | The password for accessing the RabbitMQ server | -| RABBITMQ\_\_EXCHANGE_NAME | The name of the exchange for RabbitMQ server | +| Environment Variable | Description | +| :--------------------------- | :------------------------------------------------------------------------ | +| CAS\_\_URL | URL for the Central Authentication Service (CAS) | +| CAS\_\_M2M_CLIENT_ID | Client ID for machine-to-machine authentication with the CAS | +| CAS\_\_M2M_CLIENT_SECRET | Client secret for machine-to-machine authentication with the CAS | +| DATABASE\_\_CONNECTIONSTRING | The connection string of database server | +| DATABASE\_\_URL | The URL format for the connection string of database server | +| DATABASE\_\_HOST | The host name or IP address of the database server | +| DATABASE\_\_USERNAME | The username for accessing the database | +| DATABASE\_\_PASSWORD | The password for accessing the database | +| DATABASE\_\_NAME | The name of the database | +| DATABASE\_\_PORT | The port number of the database server | +| S3\_\_REGION | The AWS region of the S3 bucket | +| S3\_\_ENDPOINT | The endpoint URL of the S3 bucket | +| S3\_\_ACCESS_KEY_ID | The access key ID for accessing the S3 bucket | +| S3\_\_SECRET_ACCESS_KEY | The secret access key for accessing the S3 bucket | +| S3\_\_SELF_BUCKET | The name of the S3 bucket used for storing self-related files | +| S3\_\_UPLOADS_API_BUCKET | The name of the S3 bucket used for storing uploaded files via Uploads API | +| SIDEKIQ\_\_USERNAME | The username for accessing the Sidekiq web interface | +| SIDEKIQ\_\_PASSWORD | The password for accessing the Sidekiq web interface | +| REDIS_SENTINEL\_\_HOST | The host name or IP address of the Redis Sentinel server | +| REDIS_SENTINEL\_\_PORT | The port number of the Redis Sentinel server | +| REDIS_SENTINEL\_\_PASSWORD | The password for accessing the Redis Sentinel server | +| REDIS_SENTINEL\_\_MASTER | The name of the Redis Sentinel master | +| REDIS\_\_PASSWORD | The password for accessing the Redis server | +| REDIS\_\_DB | The number of the Redis database | +| SIDEKIQ\_\_REDIS_DB | The number of the Redis database for Sidekiq | +| SENTRY\_\_DSN | The data source name (DSN) for Sentry error tracking | +| SENTRY\_\_TRACE_RATE | The sampling rate for Sentry performance tracing | +| SENTRY\_\_ENVIRONMENT | The environment name for Sentry error tracking | +| GATEWAY\_\_CERTIFICATE | The certificate file for accessing the gateway service | +| RABBITMQ\_\_URL | The URL the RabbitMQ server | +| RABBITMQ\_\_HOST | The host name or IP address of the RabbitMQ server | +| RABBITMQ\_\_PORT | The port number of the RabbitMQ server | +| RABBITMQ\_\_VHOST | The virtual host name of the RabbitMQ server | +| RABBITMQ\_\_USERNAME | The username for accessing the RabbitMQ server | +| RABBITMQ\_\_PASSWORD | The password for accessing the RabbitMQ server | +| RABBITMQ\_\_EXCHANGE_NAME | The name of the exchange for RabbitMQ server | In addition to these common environment variables, some applications may have specific environment variables that are related to their functionality or dependencies. These variables are prefixed with the name of the application or service that they belong to, such as `TAX_CORPORATE_REGISTRATION_PORTAL_URL`. These variables are documented in their respective application repositories or README files. From b56c6075eb887342125825e7e866968ae021841d Mon Sep 17 00:00:00 2001 From: Shakar <5h4k4r.b4kr@gmail.com> Date: Tue, 4 Apr 2023 16:56:16 +0300 Subject: [PATCH 17/26] Revert "Revert "Deletes tests-base"" This reverts commit d96f56d8258e791b1909ad85348f20e3416dc0c9. Signed-off-by: Shakar <5h4k4r.b4kr@gmail.com> --- .github/dependabot.yml | 8 ------- .github/workflows/tests-base.yaml | 40 ------------------------------- kubernetes/fleet.yaml | 7 ++++++ 3 files changed, 7 insertions(+), 48 deletions(-) delete mode 100644 .github/workflows/tests-base.yaml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index fd57540..cf546a0 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,14 +1,6 @@ --- version: 2 updates: - - package-ecosystem: "github-actions" - directory: "/" - target-branch: dev - schedule: - interval: "daily" - reviewers: - - "ditkrg/devops" - - package-ecosystem: "npm" directory: "/" target-branch: dev diff --git a/.github/workflows/tests-base.yaml b/.github/workflows/tests-base.yaml deleted file mode 100644 index caa8a93..0000000 --- a/.github/workflows/tests-base.yaml +++ /dev/null @@ -1,40 +0,0 @@ ---- -name: Run Tests - -on: - push: - branches-ignore: - - dev - - main - - paths-ignore: - - "README.md" - - ".vscode/**" - - workflow_call: - -jobs: - run-tests: - name: Run Tests - timeout-minutes: 10 - runs-on: ubuntu-20.04 - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Kubectl tool installer - uses: Azure/setup-kubectl@v3 - - - name: Setup Kustomize - uses: imranismail/setup-kustomize@v2 - - - name: Build k8s manifests - working-directory: kubernetes - run: | - envs=( "development" "production" ) - - for i in "${envs[@]}" - do - kustomize build "$i" - done diff --git a/kubernetes/fleet.yaml b/kubernetes/fleet.yaml index 4036ab7..23991b0 100644 --- a/kubernetes/fleet.yaml +++ b/kubernetes/fleet.yaml @@ -7,3 +7,10 @@ targetCustomizations: env: dev kustomize: dir: development + + - name: production + clusterSelector: + matchLabels: + env: prod + kustomize: + dir: production From 70ee7a9161b0a7eedf7ba81d3e33f3f244746121 Mon Sep 17 00:00:00 2001 From: Shakar <5h4k4r.b4kr@gmail.com> Date: Tue, 4 Apr 2023 16:57:32 +0300 Subject: [PATCH 18/26] Deleted a the section in Environment variables Signed-off-by: Shakar <5h4k4r.b4kr@gmail.com> --- docs/Software Development/06-Environment Variables.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/Software Development/06-Environment Variables.md b/docs/Software Development/06-Environment Variables.md index 6428f38..613f43b 100644 --- a/docs/Software Development/06-Environment Variables.md +++ b/docs/Software Development/06-Environment Variables.md @@ -43,8 +43,6 @@ The following table lists the environment variables that are common to all DIT m | RABBITMQ\_\_PASSWORD | The password for accessing the RabbitMQ server | | RABBITMQ\_\_EXCHANGE_NAME | The name of the exchange for RabbitMQ server | -In addition to these common environment variables, some applications may have specific environment variables that are related to their functionality or dependencies. These variables are prefixed with the name of the application or service that they belong to, such as `TAX_CORPORATE_REGISTRATION_PORTAL_URL`. These variables are documented in their respective application repositories or README files. - ## Environment Variables for Micro-Service Applications 1. Use double underscores (\_\_) to separate words in the variable name. From 4e8bdaabdec3fcf930358f77b3350237e54c321a Mon Sep 17 00:00:00 2001 From: Shakar <5h4k4r.b4kr@gmail.com> Date: Tue, 4 Apr 2023 17:04:31 +0300 Subject: [PATCH 19/26] Revert "Deletes tests-base" This reverts commit b56c6075eb887342125825e7e866968ae021841d. Signed-off-by: Shakar <5h4k4r.b4kr@gmail.com> --- .github/dependabot.yml | 8 +++++++ .github/workflows/tests-base.yaml | 40 +++++++++++++++++++++++++++++++ kubernetes/fleet.yaml | 7 ------ 3 files changed, 48 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/tests-base.yaml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index cf546a0..fd57540 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,6 +1,14 @@ --- version: 2 updates: + - package-ecosystem: "github-actions" + directory: "/" + target-branch: dev + schedule: + interval: "daily" + reviewers: + - "ditkrg/devops" + - package-ecosystem: "npm" directory: "/" target-branch: dev diff --git a/.github/workflows/tests-base.yaml b/.github/workflows/tests-base.yaml new file mode 100644 index 0000000..caa8a93 --- /dev/null +++ b/.github/workflows/tests-base.yaml @@ -0,0 +1,40 @@ +--- +name: Run Tests + +on: + push: + branches-ignore: + - dev + - main + + paths-ignore: + - "README.md" + - ".vscode/**" + + workflow_call: + +jobs: + run-tests: + name: Run Tests + timeout-minutes: 10 + runs-on: ubuntu-20.04 + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Kubectl tool installer + uses: Azure/setup-kubectl@v3 + + - name: Setup Kustomize + uses: imranismail/setup-kustomize@v2 + + - name: Build k8s manifests + working-directory: kubernetes + run: | + envs=( "development" "production" ) + + for i in "${envs[@]}" + do + kustomize build "$i" + done diff --git a/kubernetes/fleet.yaml b/kubernetes/fleet.yaml index 23991b0..4036ab7 100644 --- a/kubernetes/fleet.yaml +++ b/kubernetes/fleet.yaml @@ -7,10 +7,3 @@ targetCustomizations: env: dev kustomize: dir: development - - - name: production - clusterSelector: - matchLabels: - env: prod - kustomize: - dir: production From a700e397a810096e8941c66f1b9f7e93bab752f8 Mon Sep 17 00:00:00 2001 From: Shakar <5h4k4r.b4kr@gmail.com> Date: Tue, 4 Apr 2023 17:05:15 +0300 Subject: [PATCH 20/26] Revert "Deploy using Rancher Fleet" This reverts commit 77bf4f8da9348c33e74e87c968ece85b2f261afd. Signed-off-by: Shakar <5h4k4r.b4kr@gmail.com> --- .github/workflows/deploy-base.yaml | 54 ++++++++++++++++++++++++ .github/workflows/deploy-dev.yaml | 45 ++++++++++++++++++++ .github/workflows/deploy-production.yaml | 45 ++++++++++++++++++++ kubernetes/fleet.yaml | 9 ---- 4 files changed, 144 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/deploy-base.yaml create mode 100644 .github/workflows/deploy-dev.yaml create mode 100644 .github/workflows/deploy-production.yaml delete mode 100644 kubernetes/fleet.yaml diff --git a/.github/workflows/deploy-base.yaml b/.github/workflows/deploy-base.yaml new file mode 100644 index 0000000..6b7744f --- /dev/null +++ b/.github/workflows/deploy-base.yaml @@ -0,0 +1,54 @@ +name: Deploy + +on: + workflow_call: + inputs: + image: + type: string + required: true + env_url: + type: string + required: true + env_name: + type: string + required: true + + secrets: + KUBECONFIG: { required: true } + +env: + NAMESPACE: dit-docs + +jobs: + deploy: + timeout-minutes: 10 + runs-on: ubuntu-20.04 + environment: + url: ${{ inputs.env_url }} + name: ${{ inputs.env_name }} + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Kubectl tool installer + uses: Azure/setup-kubectl@v3 + + - uses: azure/k8s-set-context@v3 + with: + method: kubeconfig + kubeconfig: ${{ secrets.KUBECONFIG }} + + - name: Setup Kustomize + uses: imranismail/setup-kustomize@v2 + + - name: Edit kustomization file + working-directory: kubernetes/base + run: kustomize edit set image IMAGE="${{ inputs.image }}" + + - name: Deploy + working-directory: kubernetes/${{ inputs.env_name }} + run: |- + + kustomize build | kubectl apply -f - + kubectl rollout -n "$NAMESPACE" status deployment/dsm-client-deployment -w --timeout=3m diff --git a/.github/workflows/deploy-dev.yaml b/.github/workflows/deploy-dev.yaml new file mode 100644 index 0000000..c689c7a --- /dev/null +++ b/.github/workflows/deploy-dev.yaml @@ -0,0 +1,45 @@ +--- +name: Deploy To Development + +on: + push: + branches: + - dev + + paths-ignore: + - "README.md" + - ".vscode/**" + + - ".github/**" + - "!.github/workflows/tests-base.yaml" + - "!.github/workflows/deploy-base.yaml" + - "!.github/workflows/deploy-dev.yaml" + +concurrency: + group: deploy-dev + cancel-in-progress: true + +jobs: + test: + uses: ./.github/workflows/tests-base.yaml + + build: + uses: ditkrg/build-image-workflow/.github/workflows/workflow.yaml@v1 + needs: test + with: + image: dit-docs/dsm-client + runs-on: "['ubuntu-latest']" + secrets: + username: ${{ secrets.HARBOR_PUBLIC_USER }} + password: ${{ secrets.HARBOR_PUBLIC_TOKEN }} + + deploy: + uses: ./.github/workflows/deploy-base.yaml + needs: build + with: + image: ${{ needs.build.outputs.tag }} + env_url: https://service-manual.docs.dev.krd + env_name: development + + secrets: + KUBECONFIG: ${{ secrets.KUBECONFIG }} diff --git a/.github/workflows/deploy-production.yaml b/.github/workflows/deploy-production.yaml new file mode 100644 index 0000000..8a6924e --- /dev/null +++ b/.github/workflows/deploy-production.yaml @@ -0,0 +1,45 @@ +--- +name: Deploy To Production + +on: + push: + branches: + - main + + paths-ignore: + - "README.md" + - ".vscode/**" + + - ".github/**" + - "!.github/workflows/tests-base.yaml" + - "!.github/workflows/deploy-base.yaml" + - "!.github/workflows/deploy-production.yaml" + +concurrency: + group: deploy-production + cancel-in-progress: false + +jobs: + test: + uses: ditkrg/dit-digital-service-manual/.github/workflows/tests-base.yaml@main + + build: + uses: ditkrg/build-image-workflow/.github/workflows/workflow.yaml@v1 + needs: test + with: + image: dit-docs/dsm-client + runs-on: "['ubuntu-latest']" + secrets: + username: ${{ secrets.HARBOR_PUBLIC_USER }} + password: ${{ secrets.HARBOR_PUBLIC_TOKEN }} + + deploy: + uses: ./.github/workflows/deploy-base.yaml + needs: build + with: + image: ${{ needs.build.outputs.tag }} + env_url: https://docs.digital.gov.krd + env_name: production + + secrets: + KUBECONFIG: ${{ secrets.KUBECONFIG }} diff --git a/kubernetes/fleet.yaml b/kubernetes/fleet.yaml deleted file mode 100644 index 4036ab7..0000000 --- a/kubernetes/fleet.yaml +++ /dev/null @@ -1,9 +0,0 @@ -namespace: dit-docs - -targetCustomizations: - - name: development - clusterSelector: - matchLabels: - env: dev - kustomize: - dir: development From e46c18d86f1005a9e43aa0c26c43006e91bc23f8 Mon Sep 17 00:00:00 2001 From: Shakar <5h4k4r.b4kr@gmail.com> Date: Tue, 4 Apr 2023 17:13:05 +0300 Subject: [PATCH 21/26] S3__REGION is not needed. Signed-off-by: Shakar <5h4k4r.b4kr@gmail.com> --- docs/Software Development/06-Environment Variables.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/Software Development/06-Environment Variables.md b/docs/Software Development/06-Environment Variables.md index 613f43b..bad3cf5 100644 --- a/docs/Software Development/06-Environment Variables.md +++ b/docs/Software Development/06-Environment Variables.md @@ -16,7 +16,6 @@ The following table lists the environment variables that are common to all DIT m | DATABASE\_\_PASSWORD | The password for accessing the database | | DATABASE\_\_NAME | The name of the database | | DATABASE\_\_PORT | The port number of the database server | -| S3\_\_REGION | The AWS region of the S3 bucket | | S3\_\_ENDPOINT | The endpoint URL of the S3 bucket | | S3\_\_ACCESS_KEY_ID | The access key ID for accessing the S3 bucket | | S3\_\_SECRET_ACCESS_KEY | The secret access key for accessing the S3 bucket | From 4f2255c4b3c530328fbc1e4a470142a6723a6828 Mon Sep 17 00:00:00 2001 From: Shakar Bakr <5h4k4r.b4kr@gmail.com> Date: Wed, 5 Apr 2023 02:17:16 +0300 Subject: [PATCH 22/26] Changes the name of the database connection string env variable Adds REDIS__CONNECTION_STRING Signed-off-by: Shakar Bakr <5h4k4r.b4kr@gmail.com> --- .../06-Environment Variables.md | 75 ++++++++++--------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/docs/Software Development/06-Environment Variables.md b/docs/Software Development/06-Environment Variables.md index bad3cf5..1982d79 100644 --- a/docs/Software Development/06-Environment Variables.md +++ b/docs/Software Development/06-Environment Variables.md @@ -4,43 +4,44 @@ This document provides a brief description of the environment variables that are The following table lists the environment variables that are common to all DIT micro-service applications, along with their descriptions. -| Environment Variable | Description | -| :--------------------------- | :------------------------------------------------------------------------ | -| CAS\_\_URL | URL for the Central Authentication Service (CAS) | -| CAS\_\_M2M_CLIENT_ID | Client ID for machine-to-machine authentication with the CAS | -| CAS\_\_M2M_CLIENT_SECRET | Client secret for machine-to-machine authentication with the CAS | -| DATABASE\_\_CONNECTIONSTRING | The connection string of database server | -| DATABASE\_\_URL | The URL format for the connection string of database server | -| DATABASE\_\_HOST | The host name or IP address of the database server | -| DATABASE\_\_USERNAME | The username for accessing the database | -| DATABASE\_\_PASSWORD | The password for accessing the database | -| DATABASE\_\_NAME | The name of the database | -| DATABASE\_\_PORT | The port number of the database server | -| S3\_\_ENDPOINT | The endpoint URL of the S3 bucket | -| S3\_\_ACCESS_KEY_ID | The access key ID for accessing the S3 bucket | -| S3\_\_SECRET_ACCESS_KEY | The secret access key for accessing the S3 bucket | -| S3\_\_SELF_BUCKET | The name of the S3 bucket used for storing self-related files | -| S3\_\_UPLOADS_API_BUCKET | The name of the S3 bucket used for storing uploaded files via Uploads API | -| SIDEKIQ\_\_USERNAME | The username for accessing the Sidekiq web interface | -| SIDEKIQ\_\_PASSWORD | The password for accessing the Sidekiq web interface | -| REDIS_SENTINEL\_\_HOST | The host name or IP address of the Redis Sentinel server | -| REDIS_SENTINEL\_\_PORT | The port number of the Redis Sentinel server | -| REDIS_SENTINEL\_\_PASSWORD | The password for accessing the Redis Sentinel server | -| REDIS_SENTINEL\_\_MASTER | The name of the Redis Sentinel master | -| REDIS\_\_PASSWORD | The password for accessing the Redis server | -| REDIS\_\_DB | The number of the Redis database | -| SIDEKIQ\_\_REDIS_DB | The number of the Redis database for Sidekiq | -| SENTRY\_\_DSN | The data source name (DSN) for Sentry error tracking | -| SENTRY\_\_TRACE_RATE | The sampling rate for Sentry performance tracing | -| SENTRY\_\_ENVIRONMENT | The environment name for Sentry error tracking | -| GATEWAY\_\_CERTIFICATE | The certificate file for accessing the gateway service | -| RABBITMQ\_\_URL | The URL the RabbitMQ server | -| RABBITMQ\_\_HOST | The host name or IP address of the RabbitMQ server | -| RABBITMQ\_\_PORT | The port number of the RabbitMQ server | -| RABBITMQ\_\_VHOST | The virtual host name of the RabbitMQ server | -| RABBITMQ\_\_USERNAME | The username for accessing the RabbitMQ server | -| RABBITMQ\_\_PASSWORD | The password for accessing the RabbitMQ server | -| RABBITMQ\_\_EXCHANGE_NAME | The name of the exchange for RabbitMQ server | +| Environment Variable | Description | +| :---------------------------- | :------------------------------------------------------------------------ | +| CAS\_\_URL | URL for the Central Authentication Service (CAS) | +| CAS\_\_M2M_CLIENT_ID | Client ID for machine-to-machine authentication with the CAS | +| CAS\_\_M2M_CLIENT_SECRET | Client secret for machine-to-machine authentication with the CAS | +| DATABASE\_\_CONNECTION_STRING | The connection string of database server | +| DATABASE\_\_URL | The URL format for the connection string of database server | +| DATABASE\_\_HOST | The host name or IP address of the database server | +| DATABASE\_\_USERNAME | The username for accessing the database | +| DATABASE\_\_PASSWORD | The password for accessing the database | +| DATABASE\_\_NAME | The name of the database | +| DATABASE\_\_PORT | The port number of the database server | +| S3\_\_ENDPOINT | The endpoint URL of the S3 bucket | +| S3\_\_ACCESS_KEY_ID | The access key ID for accessing the S3 bucket | +| S3\_\_SECRET_ACCESS_KEY | The secret access key for accessing the S3 bucket | +| S3\_\_SELF_BUCKET | The name of the S3 bucket used for storing self-related files | +| S3\_\_UPLOADS_API_BUCKET | The name of the S3 bucket used for storing uploaded files via Uploads API | +| SIDEKIQ\_\_USERNAME | The username for accessing the Sidekiq web interface | +| SIDEKIQ\_\_PASSWORD | The password for accessing the Sidekiq web interface | +| REDIS\_\_CONNECTION_STRING | The connection string of redis database server | +| REDIS_SENTINEL\_\_HOST | The host name or IP address of the Redis Sentinel server | +| REDIS_SENTINEL\_\_PORT | The port number of the Redis Sentinel server | +| REDIS_SENTINEL\_\_PASSWORD | The password for accessing the Redis Sentinel server | +| REDIS_SENTINEL\_\_MASTER | The name of the Redis Sentinel master | +| REDIS\_\_PASSWORD | The password for accessing the Redis server | +| REDIS\_\_DB | The number of the Redis database | +| SIDEKIQ\_\_REDIS_DB | The number of the Redis database for Sidekiq | +| SENTRY\_\_DSN | The data source name (DSN) for Sentry error tracking | +| SENTRY\_\_TRACE_RATE | The sampling rate for Sentry performance tracing | +| SENTRY\_\_ENVIRONMENT | The environment name for Sentry error tracking | +| GATEWAY\_\_CERTIFICATE | The certificate file for accessing the gateway service | +| RABBITMQ\_\_URL | The URL the RabbitMQ server | +| RABBITMQ\_\_HOST | The host name or IP address of the RabbitMQ server | +| RABBITMQ\_\_PORT | The port number of the RabbitMQ server | +| RABBITMQ\_\_VHOST | The virtual host name of the RabbitMQ server | +| RABBITMQ\_\_USERNAME | The username for accessing the RabbitMQ server | +| RABBITMQ\_\_PASSWORD | The password for accessing the RabbitMQ server | +| RABBITMQ\_\_EXCHANGE_NAME | The name of the exchange for RabbitMQ server | ## Environment Variables for Micro-Service Applications From 9fc3370f8135fc0ca9abf3814621e7c443e09122 Mon Sep 17 00:00:00 2001 From: Shakar <5h4k4r.b4kr@gmail.com> Date: Thu, 6 Apr 2023 10:55:51 +0300 Subject: [PATCH 23/26] Adds Redis__URL Signed-off-by: Shakar <5h4k4r.b4kr@gmail.com> --- docs/Software Development/06-Environment Variables.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Software Development/06-Environment Variables.md b/docs/Software Development/06-Environment Variables.md index 1982d79..34929e0 100644 --- a/docs/Software Development/06-Environment Variables.md +++ b/docs/Software Development/06-Environment Variables.md @@ -23,6 +23,7 @@ The following table lists the environment variables that are common to all DIT m | S3\_\_UPLOADS_API_BUCKET | The name of the S3 bucket used for storing uploaded files via Uploads API | | SIDEKIQ\_\_USERNAME | The username for accessing the Sidekiq web interface | | SIDEKIQ\_\_PASSWORD | The password for accessing the Sidekiq web interface | +| REDIS\_\_URL | The URL format for the connection string of redis database server | | REDIS\_\_CONNECTION_STRING | The connection string of redis database server | | REDIS_SENTINEL\_\_HOST | The host name or IP address of the Redis Sentinel server | | REDIS_SENTINEL\_\_PORT | The port number of the Redis Sentinel server | From b2a9bee17ac0912566f8d1d0475a5460b20135e3 Mon Sep 17 00:00:00 2001 From: Shakar <5h4k4r.b4kr@gmail.com> Date: Thu, 6 Apr 2023 11:21:26 +0300 Subject: [PATCH 24/26] Adds SIDEKIQ__REDIS_URL Signed-off-by: Shakar <5h4k4r.b4kr@gmail.com> --- docs/Software Development/06-Environment Variables.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Software Development/06-Environment Variables.md b/docs/Software Development/06-Environment Variables.md index 34929e0..b2506e8 100644 --- a/docs/Software Development/06-Environment Variables.md +++ b/docs/Software Development/06-Environment Variables.md @@ -23,6 +23,7 @@ The following table lists the environment variables that are common to all DIT m | S3\_\_UPLOADS_API_BUCKET | The name of the S3 bucket used for storing uploaded files via Uploads API | | SIDEKIQ\_\_USERNAME | The username for accessing the Sidekiq web interface | | SIDEKIQ\_\_PASSWORD | The password for accessing the Sidekiq web interface | +| SIDEKIQ\_\_REDIS_URL | The URL of the redis database used by the Sidekiq web interface | | REDIS\_\_URL | The URL format for the connection string of redis database server | | REDIS\_\_CONNECTION_STRING | The connection string of redis database server | | REDIS_SENTINEL\_\_HOST | The host name or IP address of the Redis Sentinel server | From b38a071c8da9eb36572075f2c5d3043f3045fac7 Mon Sep 17 00:00:00 2001 From: Shakar <5h4k4r.b4kr@gmail.com> Date: Thu, 27 Apr 2023 16:01:04 +0300 Subject: [PATCH 25/26] Use the new github runner that can deploy public repos Signed-off-by: Shakar <5h4k4r.b4kr@gmail.com> --- .github/workflows/deploy-base.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-base.yaml b/.github/workflows/deploy-base.yaml index 6b7744f..5430852 100644 --- a/.github/workflows/deploy-base.yaml +++ b/.github/workflows/deploy-base.yaml @@ -22,7 +22,7 @@ env: jobs: deploy: timeout-minutes: 10 - runs-on: ubuntu-20.04 + runs-on: [self-hosted, ubuntu-jammy, public] environment: url: ${{ inputs.env_url }} name: ${{ inputs.env_name }} From 8474cde70e903a99862853d3f6e909343a5491f9 Mon Sep 17 00:00:00 2001 From: MohamadTahir Date: Thu, 27 Apr 2023 17:08:54 +0300 Subject: [PATCH 26/26] specify kubectl version --- .github/workflows/deploy-base.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-base.yaml b/.github/workflows/deploy-base.yaml index 5430852..328bc4c 100644 --- a/.github/workflows/deploy-base.yaml +++ b/.github/workflows/deploy-base.yaml @@ -32,7 +32,9 @@ jobs: uses: actions/checkout@v3 - name: Kubectl tool installer - uses: Azure/setup-kubectl@v3 + uses: azure/setup-kubectl@v3 + with: + version: v1.25.8 - uses: azure/k8s-set-context@v3 with: