diff --git a/.github/workflows/business-api-cd.yml b/.github/workflows/business-api-cd.yml new file mode 100644 index 0000000000..677b792fa6 --- /dev/null +++ b/.github/workflows/business-api-cd.yml @@ -0,0 +1,30 @@ +name: Business API CD + +on: + push: + branches: + - main + paths: + - "legal-api/**" + workflow_dispatch: + inputs: + target: + description: "Deploy To" + required: true + type: choice + options: + - dev + - test + - sandbox + - prod + +jobs: + business-api-cd: + uses: pwei1018/bcregistry-sre/.github/workflows/cloud-run-service-cd.yaml@main + with: + target: ${{ inputs.target }} + app_name: "business-api" + working_directory: "./legal-api" + secrets: + WORKLOAD_IDENTIFY_POOLS_PROVIDER: ${{ secrets.WORKLOAD_IDENTIFY_POOLS_PROVIDER }} + GCP_SERVICE_ACCOUNT: ${{ secrets.GCP_SERVICE_ACCOUNT }} diff --git a/.github/workflows/legal-api-ci.yml b/.github/workflows/business-api-ci.yml similarity index 94% rename from .github/workflows/legal-api-ci.yml rename to .github/workflows/business-api-ci.yml index 52b422ce67..c28e1ab226 100644 --- a/.github/workflows/legal-api-ci.yml +++ b/.github/workflows/business-api-ci.yml @@ -1,4 +1,4 @@ -name: Legal API CI +name: Business API CI on: pull_request: @@ -58,7 +58,7 @@ jobs: DATABASE_HOST: localhost DATABASE_PASSWORD: postgres NATS_SERVERS: "nats://nats:4222" - NATS_CLIENT_NAME: entity.legal_api + NATS_CLIENT_NAME: entity.business_api NATS_CLUSTER_ID: test-cluster NATS_FILER_SUBJECT: entity.filing.filer NATS_QUEUE: entity-filer-worker @@ -95,9 +95,9 @@ jobs: - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: - file: ./legal-api/coverage.xml + file: ./business-api/coverage.xml flags: legalapi - name: codecov-legal-api + name: codecov-business-api fail_ci_if_error: true build-check: diff --git a/.github/workflows/business-auth-cd.yml b/.github/workflows/business-auth-cd.yml new file mode 100644 index 0000000000..4ec8e662c4 --- /dev/null +++ b/.github/workflows/business-auth-cd.yml @@ -0,0 +1,31 @@ +name: Business Auth CD + +on: + push: + branches: + - main + paths: + - "queue_services/entity-auth/**" + - "queue_services/common/**" + workflow_dispatch: + inputs: + target: + description: "Deploy To" + required: true + type: choice + options: + - dev + - test + - sandbox + - prod + +jobs: + business-auth-cd: + uses: pwei1018/bcregistry-sre/.github/workflows/cloud-run-service-cd.yaml@main + with: + target: ${{ inputs.target }} + app_name: "business-auth" + working_directory: "./queue_services/entity-auth" + secrets: + WORKLOAD_IDENTIFY_POOLS_PROVIDER: ${{ secrets.WORKLOAD_IDENTIFY_POOLS_PROVIDER }} + GCP_SERVICE_ACCOUNT: ${{ secrets.GCP_SERVICE_ACCOUNT }} diff --git a/.github/workflows/business-auth-ci.yml b/.github/workflows/business-auth-ci.yml new file mode 100644 index 0000000000..17d0be823a --- /dev/null +++ b/.github/workflows/business-auth-ci.yml @@ -0,0 +1,121 @@ +name: Business Auth CI + +on: + pull_request: + types: [assigned, synchronize] + paths: + - "queue_services/entity-auth/**" + - "queue_services/common/**" + +defaults: + run: + shell: bash + working-directory: ./queue_services/entity-auth + +jobs: + setup-job: + runs-on: ubuntu-20.04 + + if: github.repository == 'bcgov/lear' + + steps: + - uses: actions/checkout@v3 + - run: "true" + + linting: + needs: setup-job + runs-on: ubuntu-20.04 + + strategy: + matrix: + python-version: [3.8] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + make setup + - name: Lint with pylint + id: pylint + run: | + make pylint + - name: Lint with flake8 + id: flake8 + run: | + make flake8 + + testing: + needs: setup-job + env: + DATABASE_TEST_USERNAME: postgres + DATABASE_TEST_PASSWORD: postgres + DATABASE_TEST_NAME: postgres + DATABASE_TEST_HOST: localhost + DATABASE_HOST: localhost + DATABASE_PASSWORD: postgres + NATS_SERVERS: "nats://nats:4222" + NATS_CLIENT_NAME: entity.legal_api + NATS_CLUSTER_ID: test-cluster + NATS_FILER_SUBJECT: entity.filing.filer + NATS_QUEUE: entity-auth-worker + TEST_NATS_DOCKER: True + STAN_CLUSTER_NAME: test-cluster + JWT_OIDC_JWKS_CACHE_TIMEOUT: 300 + GO_LIVE_DATE: 2019-08-12 + LEGAL_API_URL: https://mock_legal_api_url + ACCOUNT_SVC_ENTITY_URL: https://mock_account_svc_entity_url + COLIN_API: https://mock_colin_api_url + ACCOUNT_SVC_AUTH_URL: https://mock_account_svc_auth_url + ACCOUNT_SVC_CLIENT_ID: account_svc_client_id + ACCOUNT_SVC_CLIENT_SECRET: account_svc_client_secret + + + runs-on: ubuntu-20.04 + + services: + postgres: + image: postgres:12 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: postgres + ports: + - 5432:5432 + # needed because the postgres container does not provide a healthcheck + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + make setup + - name: Test with pytest + id: test + run: | + make test + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + file: ./queue_services/entity-auth/coverage.xml + flags: entityfiler + name: codecov-entity-auth + fail_ci_if_error: true + + build-check: + needs: setup-job + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v3 + - name: build to check strictness + id: build + run: | + make build-nc diff --git a/.github/workflows/business-bn-cd.yml b/.github/workflows/business-bn-cd.yml new file mode 100644 index 0000000000..a45a68f93c --- /dev/null +++ b/.github/workflows/business-bn-cd.yml @@ -0,0 +1,31 @@ +name: Business BN CD + +on: + push: + branches: + - main + paths: + - "queue_services/entity-bn/**" + - "queue_services/common/**" + workflow_dispatch: + inputs: + target: + description: "Deploy To" + required: true + type: choice + options: + - dev + - test + - sandbox + - prod + +jobs: + business-bn-cd: + uses: pwei1018/bcregistry-sre/.github/workflows/cloud-run-service-cd.yaml@main + with: + target: ${{ inputs.target }} + app_name: "business-bn" + working_directory: "./queue_services/entity-bn" + secrets: + WORKLOAD_IDENTIFY_POOLS_PROVIDER: ${{ secrets.WORKLOAD_IDENTIFY_POOLS_PROVIDER }} + GCP_SERVICE_ACCOUNT: ${{ secrets.GCP_SERVICE_ACCOUNT }} diff --git a/.github/workflows/entity-bn-ci.yml b/.github/workflows/business-bn-ci.yml similarity index 99% rename from .github/workflows/entity-bn-ci.yml rename to .github/workflows/business-bn-ci.yml index 618c68917a..54fea27525 100644 --- a/.github/workflows/entity-bn-ci.yml +++ b/.github/workflows/business-bn-ci.yml @@ -1,4 +1,4 @@ -name: Entity BN CI +name: Business BN CI on: pull_request: diff --git a/.github/workflows/business-email-reminder-cd.yml b/.github/workflows/business-email-reminder-cd.yml new file mode 100644 index 0000000000..fc36a4576a --- /dev/null +++ b/.github/workflows/business-email-reminder-cd.yml @@ -0,0 +1,30 @@ +name: Business Email Reminder Job CD + +on: + push: + branches: + - main + paths: + - "./jobs/email-reminder/**" + workflow_dispatch: + inputs: + target: + description: "Deploy To" + required: true + type: choice + options: + - dev + - test + - sandbox + - prod + +jobs: + business-email-reminder-cd: + uses: pwei1018/bcregistry-sre/.github/workflows/cloud-run-job-cd.yaml@main + with: + target: ${{ inputs.target }} + app_name: "business-email-reminder" + working_directory: "./jobs/email-reminder" + secrets: + WORKLOAD_IDENTIFY_POOLS_PROVIDER: ${{ secrets.WORKLOAD_IDENTIFY_POOLS_PROVIDER }} + GCP_SERVICE_ACCOUNT: ${{ secrets.GCP_SERVICE_ACCOUNT }} diff --git a/.github/workflows/email-reminder-ci.yml b/.github/workflows/business-email-reminder-ci.yml similarity index 97% rename from .github/workflows/email-reminder-ci.yml rename to .github/workflows/business-email-reminder-ci.yml index cf1a3fb317..fcaf4a021b 100644 --- a/.github/workflows/email-reminder-ci.yml +++ b/.github/workflows/business-email-reminder-ci.yml @@ -1,4 +1,4 @@ -name: Email Reminder Job CI +name: Business Email Reminder Job CI on: pull_request: diff --git a/.github/workflows/business-emailer-cd.yml b/.github/workflows/business-emailer-cd.yml new file mode 100644 index 0000000000..140ce0f48e --- /dev/null +++ b/.github/workflows/business-emailer-cd.yml @@ -0,0 +1,31 @@ +name: Business Emailer CD + +on: + push: + branches: + - main + paths: + - "queue_services/entity-emailer/**" + - "queue_services/common/**" + workflow_dispatch: + inputs: + target: + description: "Deploy To" + required: true + type: choice + options: + - dev + - test + - sandbox + - prod + +jobs: + business-emailer-cd: + uses: pwei1018/bcregistry-sre/.github/workflows/cloud-run-service-cd.yaml@main + with: + target: ${{ inputs.target }} + app_name: "business-emailer" + working_directory: "./queue_services/entity-emailer" + secrets: + WORKLOAD_IDENTIFY_POOLS_PROVIDER: ${{ secrets.WORKLOAD_IDENTIFY_POOLS_PROVIDER }} + GCP_SERVICE_ACCOUNT: ${{ secrets.GCP_SERVICE_ACCOUNT }} diff --git a/.github/workflows/entity-emailer-ci.yml b/.github/workflows/business-emailer-ci.yml similarity index 99% rename from .github/workflows/entity-emailer-ci.yml rename to .github/workflows/business-emailer-ci.yml index 4299229f0b..e6f818b06d 100644 --- a/.github/workflows/entity-emailer-ci.yml +++ b/.github/workflows/business-emailer-ci.yml @@ -1,4 +1,4 @@ -name: Entity Emailer CI +name: Business Emailer CI on: pull_request: diff --git a/.github/workflows/business-filer-cd.yml b/.github/workflows/business-filer-cd.yml new file mode 100644 index 0000000000..5341ff9e99 --- /dev/null +++ b/.github/workflows/business-filer-cd.yml @@ -0,0 +1,31 @@ +name: Business Filer CD + +on: + push: + branches: + - main + paths: + - "queue_services/entity-filer/**" + - "queue_services/common/**" + workflow_dispatch: + inputs: + target: + description: "Deploy To" + required: true + type: choice + options: + - dev + - test + - sandbox + - prod + +jobs: + business-filer-cd: + uses: pwei1018/bcregistry-sre/.github/workflows/cloud-run-service-cd.yaml@main + with: + target: ${{ inputs.target }} + app_name: "business-filer" + working_directory: "./queue_services/entity-filer" + secrets: + WORKLOAD_IDENTIFY_POOLS_PROVIDER: ${{ secrets.WORKLOAD_IDENTIFY_POOLS_PROVIDER }} + GCP_SERVICE_ACCOUNT: ${{ secrets.GCP_SERVICE_ACCOUNT }} diff --git a/.github/workflows/entity-filer-ci.yml b/.github/workflows/business-filer-ci.yml similarity index 99% rename from .github/workflows/entity-filer-ci.yml rename to .github/workflows/business-filer-ci.yml index 164ce124ff..678e44c874 100644 --- a/.github/workflows/entity-filer-ci.yml +++ b/.github/workflows/business-filer-ci.yml @@ -1,4 +1,4 @@ -name: Entity Filer CI +name: Business Filer CI on: pull_request: @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-20.04 if: github.repository == 'bcgov/lear' - + steps: - uses: actions/checkout@v3 - run: "true" diff --git a/.github/workflows/business-future-effective-filings-cd.yml b/.github/workflows/business-future-effective-filings-cd.yml new file mode 100644 index 0000000000..3627b3a128 --- /dev/null +++ b/.github/workflows/business-future-effective-filings-cd.yml @@ -0,0 +1,30 @@ +name: Business Future Effective Filings Job CD + +on: + push: + branches: + - main + paths: + - "./jobs/future-effective-filings/**" + workflow_dispatch: + inputs: + target: + description: "Deploy To" + required: true + type: choice + options: + - dev + - test + - sandbox + - prod + +jobs: + business-future-effective-filings-cd: + uses: pwei1018/bcregistry-sre/.github/workflows/cloud-run-job-cd.yaml@main + with: + target: ${{ inputs.target }} + app_name: "business-future-effective-filings" + working_directory: "./jobs/future-effective-filings" + secrets: + WORKLOAD_IDENTIFY_POOLS_PROVIDER: ${{ secrets.WORKLOAD_IDENTIFY_POOLS_PROVIDER }} + GCP_SERVICE_ACCOUNT: ${{ secrets.GCP_SERVICE_ACCOUNT }} diff --git a/.github/workflows/future-effective-filings-ci.yml b/.github/workflows/business-future-effective-filings-ci.yml similarity index 97% rename from .github/workflows/future-effective-filings-ci.yml rename to .github/workflows/business-future-effective-filings-ci.yml index f741fd5524..8dadd9253a 100644 --- a/.github/workflows/future-effective-filings-ci.yml +++ b/.github/workflows/business-future-effective-filings-ci.yml @@ -1,4 +1,4 @@ -name: Future Effective Filings Job CI +name: Business Future Effective Filings Job CI on: pull_request: diff --git a/.github/workflows/business-pay-cd.yml b/.github/workflows/business-pay-cd.yml new file mode 100644 index 0000000000..df7be2031a --- /dev/null +++ b/.github/workflows/business-pay-cd.yml @@ -0,0 +1,31 @@ +name: Business Pay CD + +on: + push: + branches: + - main + paths: + - "queue_services/entity-pay/**" + - "queue_services/common/**" + workflow_dispatch: + inputs: + target: + description: "Deploy To" + required: true + type: choice + options: + - dev + - test + - sandbox + - prod + +jobs: + business-pay-cd: + uses: pwei1018/bcregistry-sre/.github/workflows/cloud-run-service-cd.yaml@main + with: + target: ${{ inputs.target }} + app_name: "business-pay" + working_directory: "./queue_services/entity-pay" + secrets: + WORKLOAD_IDENTIFY_POOLS_PROVIDER: ${{ secrets.WORKLOAD_IDENTIFY_POOLS_PROVIDER }} + GCP_SERVICE_ACCOUNT: ${{ secrets.GCP_SERVICE_ACCOUNT }} diff --git a/.github/workflows/entity-pay-ci.yml b/.github/workflows/business-pay-ci.yml similarity index 97% rename from .github/workflows/entity-pay-ci.yml rename to .github/workflows/business-pay-ci.yml index a3744ea2dc..9f7888e05c 100644 --- a/.github/workflows/entity-pay-ci.yml +++ b/.github/workflows/business-pay-ci.yml @@ -1,4 +1,4 @@ -name: Entity Pay CI +name: Business Pay CI on: pull_request: @@ -15,7 +15,7 @@ defaults: jobs: setup-job: runs-on: ubuntu-20.04 - + if: github.repository == 'bcgov/lear' steps: @@ -64,7 +64,7 @@ jobs: NATS_QUEUE: filing-worker JWT_OIDC_JWKS_CACHE_TIMEOUT: 300 TEST_NATS_DOCKER: True - STAN_CLUSTER_NAME: test-cluster + STAN_CLUSTER_NAME: test-cluster GO_LIVE_DATE: 2019-08-12 NATS_SUBJECT: entity.filings NATS_EMAILER_SUBJECT: entity.email diff --git a/.github/workflows/business-update-colin-filings-cd.yml b/.github/workflows/business-update-colin-filings-cd.yml new file mode 100644 index 0000000000..6689003261 --- /dev/null +++ b/.github/workflows/business-update-colin-filings-cd.yml @@ -0,0 +1,30 @@ +name: Business Update Colin Filings Job CD + +on: + push: + branches: + - main + paths: + - "./jobs/update-colin-filings/**" + workflow_dispatch: + inputs: + target: + description: "Deploy To" + required: true + type: choice + options: + - dev + - test + - sandbox + - prod + +jobs: + business-update-colin-filings-cd: + uses: pwei1018/bcregistry-sre/.github/workflows/cloud-run-job-cd.yaml@main + with: + target: ${{ inputs.target }} + app_name: "business-update-colin-filings" + working_directory: "./jobs/update-colin-filings" + secrets: + WORKLOAD_IDENTIFY_POOLS_PROVIDER: ${{ secrets.WORKLOAD_IDENTIFY_POOLS_PROVIDER }} + GCP_SERVICE_ACCOUNT: ${{ secrets.GCP_SERVICE_ACCOUNT }} diff --git a/.github/workflows/update-colin-filings-ci.yml b/.github/workflows/business-update-colin-filings-ci.yml similarity index 97% rename from .github/workflows/update-colin-filings-ci.yml rename to .github/workflows/business-update-colin-filings-ci.yml index 7859dc82c6..c5b779a20c 100644 --- a/.github/workflows/update-colin-filings-ci.yml +++ b/.github/workflows/business-update-colin-filings-ci.yml @@ -1,4 +1,4 @@ -name: Update Colin Filings Job CI +name: Business Update Colin Filings Job CI on: pull_request: diff --git a/.github/workflows/business-update-legal-filings-cd.yml b/.github/workflows/business-update-legal-filings-cd.yml new file mode 100644 index 0000000000..0b52a141d0 --- /dev/null +++ b/.github/workflows/business-update-legal-filings-cd.yml @@ -0,0 +1,30 @@ +name: Business Update Legal Filings Job CD + +on: + push: + branches: + - main + paths: + - "./jobs/update-legal-filings/**" + workflow_dispatch: + inputs: + target: + description: "Deploy To" + required: true + type: choice + options: + - dev + - test + - sandbox + - prod + +jobs: + business-update-legal-filings-cd: + uses: pwei1018/bcregistry-sre/.github/workflows/cloud-run-job-cd.yaml@main + with: + target: ${{ inputs.target }} + app_name: "business-update-legal-filings" + working_directory: "./jobs/update-legal-filings" + secrets: + WORKLOAD_IDENTIFY_POOLS_PROVIDER: ${{ secrets.WORKLOAD_IDENTIFY_POOLS_PROVIDER }} + GCP_SERVICE_ACCOUNT: ${{ secrets.GCP_SERVICE_ACCOUNT }} diff --git a/.github/workflows/update-legal-filings-ci.yml b/.github/workflows/business-update-legal-filings-ci.yml similarity index 97% rename from .github/workflows/update-legal-filings-ci.yml rename to .github/workflows/business-update-legal-filings-ci.yml index b4e69a1e3f..7b8c23ae8b 100644 --- a/.github/workflows/update-legal-filings-ci.yml +++ b/.github/workflows/business-update-legal-filings-ci.yml @@ -1,4 +1,4 @@ -name: Update Legal Filings Job CI +name: Business Update Legal Filings Job CI on: pull_request: diff --git a/.github/workflows/email-reminder-cd.yml b/.github/workflows/email-reminder-cd.yml deleted file mode 100644 index 5c6ff84bfb..0000000000 --- a/.github/workflows/email-reminder-cd.yml +++ /dev/null @@ -1,103 +0,0 @@ -name: Email Reminder Job CD - -on: - push: - branches: - - main - paths: - - "jobs/email-reminder/**" - workflow_dispatch: - inputs: - environment: - description: "Environment (dev/test/prod)" - required: true - default: "dev" - -defaults: - run: - shell: bash - working-directory: ./jobs/email-reminder - -env: - APP_NAME: "email-reminder" - TAG_NAME: "dev" - -jobs: - email-reminder-cd-by-push: - runs-on: ubuntu-20.04 - - if: github.event_name == 'push' && github.repository == 'bcgov/lear' - environment: - name: "dev" - - steps: - - uses: actions/checkout@v3 - - - name: Login Openshift - shell: bash - run: | - oc login --server=${{secrets.OPENSHIFT4_LOGIN_REGISTRY}} --token=${{secrets.OPENSHIFT4_SA_TOKEN}} - - - name: CD Flow - shell: bash - env: - OPS_REPOSITORY: ${{ secrets.OPS_REPOSITORY }} - OPENSHIFT_DOCKER_REGISTRY: ${{ secrets.OPENSHIFT4_DOCKER_REGISTRY }} - OPENSHIFT_SA_NAME: ${{ secrets.OPENSHIFT4_SA_NAME }} - OPENSHIFT_SA_TOKEN: ${{ secrets.OPENSHIFT4_SA_TOKEN }} - OPENSHIFT_REPOSITORY: ${{ secrets.OPENSHIFT4_REPOSITORY }} - TAG_NAME: ${{ env.TAG_NAME }} - run: | - make cd - - - name: Rocket.Chat Notification - uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@master - if: failure() - with: - type: ${{ job.status }} - job_name: "*Email Reminder Job Built and Deployed to ${{env.TAG_NAME}}*" - channel: "#registries-bot" - url: ${{ secrets.ROCKETCHAT_WEBHOOK }} - commit: true - token: ${{ secrets.GITHUB_TOKEN }} - - email-reminder-cd-by-dispatch: - runs-on: ubuntu-20.04 - - if: github.event_name == 'workflow_dispatch' && github.repository == 'bcgov/lear' - environment: - name: "${{ github.event.inputs.environment }}" - - steps: - - uses: actions/checkout@v3 - - name: Set env by input - run: | - echo "TAG_NAME=${{ github.event.inputs.environment }}" >> $GITHUB_ENV - - - name: Login Openshift - shell: bash - run: | - oc login --server=${{secrets.OPENSHIFT4_LOGIN_REGISTRY}} --token=${{secrets.OPENSHIFT4_SA_TOKEN}} - - - name: CD Flow - shell: bash - env: - OPS_REPOSITORY: ${{ secrets.OPS_REPOSITORY }} - OPENSHIFT_DOCKER_REGISTRY: ${{ secrets.OPENSHIFT4_DOCKER_REGISTRY }} - OPENSHIFT_SA_NAME: ${{ secrets.OPENSHIFT4_SA_NAME }} - OPENSHIFT_SA_TOKEN: ${{ secrets.OPENSHIFT4_SA_TOKEN }} - OPENSHIFT_REPOSITORY: ${{ secrets.OPENSHIFT4_REPOSITORY }} - TAG_NAME: ${{ env.TAG_NAME }} - run: | - make cd - - - name: Rocket.Chat Notification - uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@master - if: failure() - with: - type: ${{ job.status }} - job_name: "*Email Reminder Job Built and Deployed to ${{env.TAG_NAME}}*" - channel: "#registries-bot" - url: ${{ secrets.ROCKETCHAT_WEBHOOK }} - commit: true - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/entity-bn-cd.yml b/.github/workflows/entity-bn-cd.yml deleted file mode 100644 index 57ea0d4c29..0000000000 --- a/.github/workflows/entity-bn-cd.yml +++ /dev/null @@ -1,114 +0,0 @@ -name: Entity BN CD - -on: - push: - branches: - - main - paths: - - "queue_services/entity-bn/**" - - "queue_services/common/**" - workflow_dispatch: - inputs: - environment: - description: "Environment (dev/test/prod)" - required: true - default: "dev" - -defaults: - run: - shell: bash - working-directory: ./queue_services/entity-bn - -env: - APP_NAME: "entity-bn" - TAG_NAME: "dev" - -jobs: - entity-bn-cd-by-push: - runs-on: ubuntu-20.04 - - if: github.event_name == 'push' && github.repository == 'bcgov/lear' - environment: - name: "dev" - - steps: - - uses: actions/checkout@v3 - - - name: Login Openshift - shell: bash - run: | - oc login --server=${{secrets.OPENSHIFT4_LOGIN_REGISTRY}} --token=${{secrets.OPENSHIFT4_SA_TOKEN}} - - - name: CD Flow - shell: bash - env: - OPS_REPOSITORY: ${{ secrets.OPS_REPOSITORY }} - OPENSHIFT_DOCKER_REGISTRY: ${{ secrets.OPENSHIFT4_DOCKER_REGISTRY }} - OPENSHIFT_SA_NAME: ${{ secrets.OPENSHIFT4_SA_NAME }} - OPENSHIFT_SA_TOKEN: ${{ secrets.OPENSHIFT4_SA_TOKEN }} - OPENSHIFT_REPOSITORY: ${{ secrets.OPENSHIFT4_REPOSITORY }} - TAG_NAME: ${{ env.TAG_NAME }} - run: | - make cd - - - name: Watch new rollout (trigger by image change in Openshift) - shell: bash - run: | - oc rollout status dc/${{ env.APP_NAME }}-${{ env.TAG_NAME }} -n ${{ secrets.OPENSHIFT4_REPOSITORY }}-${{ env.TAG_NAME }} -w - - - name: Rocket.Chat Notification - uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@master - if: failure() - with: - type: ${{ job.status }} - job_name: "*Entity BN Built and Deployed to ${{env.TAG_NAME}}*" - channel: "#registries-bot" - url: ${{ secrets.ROCKETCHAT_WEBHOOK }} - commit: true - token: ${{ secrets.GITHUB_TOKEN }} - - entity-bn-cd-by-dispatch: - runs-on: ubuntu-20.04 - - if: github.event_name == 'workflow_dispatch' && github.repository == 'bcgov/lear' - environment: - name: "${{ github.event.inputs.environment }}" - - steps: - - uses: actions/checkout@v3 - - name: Set env by input - run: | - echo "TAG_NAME=${{ github.event.inputs.environment }}" >> $GITHUB_ENV - - - name: Login Openshift - shell: bash - run: | - oc login --server=${{secrets.OPENSHIFT4_LOGIN_REGISTRY}} --token=${{secrets.OPENSHIFT4_SA_TOKEN}} - - - name: CD Flow - shell: bash - env: - OPS_REPOSITORY: ${{ secrets.OPS_REPOSITORY }} - OPENSHIFT_DOCKER_REGISTRY: ${{ secrets.OPENSHIFT4_DOCKER_REGISTRY }} - OPENSHIFT_SA_NAME: ${{ secrets.OPENSHIFT4_SA_NAME }} - OPENSHIFT_SA_TOKEN: ${{ secrets.OPENSHIFT4_SA_TOKEN }} - OPENSHIFT_REPOSITORY: ${{ secrets.OPENSHIFT4_REPOSITORY }} - TAG_NAME: ${{ env.TAG_NAME }} - run: | - make cd - - - name: Watch new rollout (trigger by image change in Openshift) - shell: bash - run: | - oc rollout status dc/${{ env.APP_NAME }}-${{ env.TAG_NAME }} -n ${{ secrets.OPENSHIFT4_REPOSITORY }}-${{ env.TAG_NAME }} -w - - - name: Rocket.Chat Notification - uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@master - if: failure() - with: - type: ${{ job.status }} - job_name: "*Entity BN Built and Deployed to ${{env.TAG_NAME}}*" - channel: "#registries-bot" - url: ${{ secrets.ROCKETCHAT_WEBHOOK }} - commit: true - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/entity-emailer-cd.yml b/.github/workflows/entity-emailer-cd.yml deleted file mode 100644 index 9643b0bd78..0000000000 --- a/.github/workflows/entity-emailer-cd.yml +++ /dev/null @@ -1,114 +0,0 @@ -name: Entity Emailer CD - -on: - push: - branches: - - main - paths: - - "queue_services/entity-emailer/**" - - "queue_services/common/**" - workflow_dispatch: - inputs: - environment: - description: "Environment (dev/test/prod)" - required: true - default: "dev" - -defaults: - run: - shell: bash - working-directory: ./queue_services/entity-emailer - -env: - APP_NAME: "entity-emailer" - TAG_NAME: "dev" - -jobs: - entity-emailer-cd-by-push: - runs-on: ubuntu-20.04 - - if: github.event_name == 'push' && github.repository == 'bcgov/lear' - environment: - name: "dev" - - steps: - - uses: actions/checkout@v3 - - - name: Login Openshift - shell: bash - run: | - oc login --server=${{secrets.OPENSHIFT4_LOGIN_REGISTRY}} --token=${{secrets.OPENSHIFT4_SA_TOKEN}} - - - name: CD Flow - shell: bash - env: - OPS_REPOSITORY: ${{ secrets.OPS_REPOSITORY }} - OPENSHIFT_DOCKER_REGISTRY: ${{ secrets.OPENSHIFT4_DOCKER_REGISTRY }} - OPENSHIFT_SA_NAME: ${{ secrets.OPENSHIFT4_SA_NAME }} - OPENSHIFT_SA_TOKEN: ${{ secrets.OPENSHIFT4_SA_TOKEN }} - OPENSHIFT_REPOSITORY: ${{ secrets.OPENSHIFT4_REPOSITORY }} - TAG_NAME: ${{ env.TAG_NAME }} - run: | - make cd - - - name: Watch new rollout (trigger by image change in Openshift) - shell: bash - run: | - oc rollout status dc/${{ env.APP_NAME }}-${{ env.TAG_NAME }} -n ${{ secrets.OPENSHIFT4_REPOSITORY }}-${{ env.TAG_NAME }} -w - - - name: Rocket.Chat Notification - uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@master - if: failure() - with: - type: ${{ job.status }} - job_name: "*Entity Emailer Built and Deployed to ${{env.TAG_NAME}}*" - channel: "#registries-bot" - url: ${{ secrets.ROCKETCHAT_WEBHOOK }} - commit: true - token: ${{ secrets.GITHUB_TOKEN }} - - entity-emailer-cd-by-dispatch: - runs-on: ubuntu-20.04 - - if: github.event_name == 'workflow_dispatch' && github.repository == 'bcgov/lear' - environment: - name: "${{ github.event.inputs.environment }}" - - steps: - - uses: actions/checkout@v3 - - name: Set env by input - run: | - echo "TAG_NAME=${{ github.event.inputs.environment }}" >> $GITHUB_ENV - - - name: Login Openshift - shell: bash - run: | - oc login --server=${{secrets.OPENSHIFT4_LOGIN_REGISTRY}} --token=${{secrets.OPENSHIFT4_SA_TOKEN}} - - - name: CD Flow - shell: bash - env: - OPS_REPOSITORY: ${{ secrets.OPS_REPOSITORY }} - OPENSHIFT_DOCKER_REGISTRY: ${{ secrets.OPENSHIFT4_DOCKER_REGISTRY }} - OPENSHIFT_SA_NAME: ${{ secrets.OPENSHIFT4_SA_NAME }} - OPENSHIFT_SA_TOKEN: ${{ secrets.OPENSHIFT4_SA_TOKEN }} - OPENSHIFT_REPOSITORY: ${{ secrets.OPENSHIFT4_REPOSITORY }} - TAG_NAME: ${{ env.TAG_NAME }} - run: | - make cd - - - name: Watch new rollout (trigger by image change in Openshift) - shell: bash - run: | - oc rollout status dc/${{ env.APP_NAME }}-${{ env.TAG_NAME }} -n ${{ secrets.OPENSHIFT4_REPOSITORY }}-${{ env.TAG_NAME }} -w - - - name: Rocket.Chat Notification - uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@master - if: failure() - with: - type: ${{ job.status }} - job_name: "*Entity Emailer Built and Deployed to ${{env.TAG_NAME}}*" - channel: "#registries-bot" - url: ${{ secrets.ROCKETCHAT_WEBHOOK }} - commit: true - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/entity-filer-cd.yml b/.github/workflows/entity-filer-cd.yml deleted file mode 100644 index c02c180cff..0000000000 --- a/.github/workflows/entity-filer-cd.yml +++ /dev/null @@ -1,114 +0,0 @@ -name: Entity Filer CD - -on: - push: - branches: - - main - paths: - - "queue_services/entity-filer/**" - - "queue_services/common/**" - workflow_dispatch: - inputs: - environment: - description: "Environment (dev/test/prod)" - required: true - default: "dev" - -defaults: - run: - shell: bash - working-directory: ./queue_services/entity-filer - -env: - APP_NAME: "entity-filer" - TAG_NAME: "dev" - -jobs: - entity-filer-cd-by-push: - runs-on: ubuntu-20.04 - - if: github.event_name == 'push' && github.repository == 'bcgov/lear' - environment: - name: "dev" - - steps: - - uses: actions/checkout@v3 - - - name: Login Openshift - shell: bash - run: | - oc login --server=${{secrets.OPENSHIFT4_LOGIN_REGISTRY}} --token=${{secrets.OPENSHIFT4_SA_TOKEN}} - - - name: CD Flow - shell: bash - env: - OPS_REPOSITORY: ${{ secrets.OPS_REPOSITORY }} - OPENSHIFT_DOCKER_REGISTRY: ${{ secrets.OPENSHIFT4_DOCKER_REGISTRY }} - OPENSHIFT_SA_NAME: ${{ secrets.OPENSHIFT4_SA_NAME }} - OPENSHIFT_SA_TOKEN: ${{ secrets.OPENSHIFT4_SA_TOKEN }} - OPENSHIFT_REPOSITORY: ${{ secrets.OPENSHIFT4_REPOSITORY }} - TAG_NAME: ${{ env.TAG_NAME }} - run: | - make cd - - - name: Watch new rollout (trigger by image change in Openshift) - shell: bash - run: | - oc rollout status dc/${{ env.APP_NAME }}-${{ env.TAG_NAME }} -n ${{ secrets.OPENSHIFT4_REPOSITORY }}-${{ env.TAG_NAME }} -w - - - name: Rocket.Chat Notification - uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@master - if: failure() - with: - type: ${{ job.status }} - job_name: "*Entity Filer Built and Deployed to ${{env.TAG_NAME}}*" - channel: "#registries-bot" - url: ${{ secrets.ROCKETCHAT_WEBHOOK }} - commit: true - token: ${{ secrets.GITHUB_TOKEN }} - - entity-filer-cd-by-dispatch: - runs-on: ubuntu-20.04 - - if: github.event_name == 'workflow_dispatch' && github.repository == 'bcgov/lear' - environment: - name: "${{ github.event.inputs.environment }}" - - steps: - - uses: actions/checkout@v3 - - name: Set env by input - run: | - echo "TAG_NAME=${{ github.event.inputs.environment }}" >> $GITHUB_ENV - - - name: Login Openshift - shell: bash - run: | - oc login --server=${{secrets.OPENSHIFT4_LOGIN_REGISTRY}} --token=${{secrets.OPENSHIFT4_SA_TOKEN}} - - - name: CD Flow - shell: bash - env: - OPS_REPOSITORY: ${{ secrets.OPS_REPOSITORY }} - OPENSHIFT_DOCKER_REGISTRY: ${{ secrets.OPENSHIFT4_DOCKER_REGISTRY }} - OPENSHIFT_SA_NAME: ${{ secrets.OPENSHIFT4_SA_NAME }} - OPENSHIFT_SA_TOKEN: ${{ secrets.OPENSHIFT4_SA_TOKEN }} - OPENSHIFT_REPOSITORY: ${{ secrets.OPENSHIFT4_REPOSITORY }} - TAG_NAME: ${{ env.TAG_NAME }} - run: | - make cd - - - name: Watch new rollout (trigger by image change in Openshift) - shell: bash - run: | - oc rollout status dc/${{ env.APP_NAME }}-${{ env.TAG_NAME }} -n ${{ secrets.OPENSHIFT4_REPOSITORY }}-${{ env.TAG_NAME }} -w - - - name: Rocket.Chat Notification - uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@master - if: failure() - with: - type: ${{ job.status }} - job_name: "*Entity Filer Built and Deployed to ${{env.TAG_NAME}}*" - channel: "#registries-bot" - url: ${{ secrets.ROCKETCHAT_WEBHOOK }} - commit: true - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/entity-pay-cd.yml b/.github/workflows/entity-pay-cd.yml deleted file mode 100644 index 77508a607b..0000000000 --- a/.github/workflows/entity-pay-cd.yml +++ /dev/null @@ -1,114 +0,0 @@ -name: Entity Pay CD - -on: - push: - branches: - - main - paths: - - "queue_services/entity-pay/**" - - "queue_services/common/**" - workflow_dispatch: - inputs: - environment: - description: "Environment (dev/test/prod)" - required: true - default: "dev" - -defaults: - run: - shell: bash - working-directory: ./queue_services/entity-pay - -env: - APP_NAME: "entity-pay" - TAG_NAME: "dev" - -jobs: - entity-pay-cd-by-push: - runs-on: ubuntu-20.04 - - if: github.event_name == 'push' && github.repository == 'bcgov/lear' - environment: - name: "dev" - - steps: - - uses: actions/checkout@v3 - - - name: Login Openshift - shell: bash - run: | - oc login --server=${{secrets.OPENSHIFT4_LOGIN_REGISTRY}} --token=${{secrets.OPENSHIFT4_SA_TOKEN}} - - - name: CD Flow - shell: bash - env: - OPS_REPOSITORY: ${{ secrets.OPS_REPOSITORY }} - OPENSHIFT_DOCKER_REGISTRY: ${{ secrets.OPENSHIFT4_DOCKER_REGISTRY }} - OPENSHIFT_SA_NAME: ${{ secrets.OPENSHIFT4_SA_NAME }} - OPENSHIFT_SA_TOKEN: ${{ secrets.OPENSHIFT4_SA_TOKEN }} - OPENSHIFT_REPOSITORY: ${{ secrets.OPENSHIFT4_REPOSITORY }} - TAG_NAME: ${{ env.TAG_NAME }} - run: | - make cd - - - name: Watch new rollout (trigger by image change in Openshift) - shell: bash - run: | - oc rollout status dc/${{ env.APP_NAME }}-${{ env.TAG_NAME }} -n ${{ secrets.OPENSHIFT4_REPOSITORY }}-${{ env.TAG_NAME }} -w - - - name: Rocket.Chat Notification - uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@master - if: failure() - with: - type: ${{ job.status }} - job_name: "*Entity Pay Built and Deployed to ${{env.TAG_NAME}}*" - channel: "#registries-bot" - url: ${{ secrets.ROCKETCHAT_WEBHOOK }} - commit: true - token: ${{ secrets.GITHUB_TOKEN }} - - entity-pay-cd-by-dispatch: - runs-on: ubuntu-20.04 - - if: github.event_name == 'workflow_dispatch' && github.repository == 'bcgov/lear' - environment: - name: "${{ github.event.inputs.environment }}" - - steps: - - uses: actions/checkout@v3 - - name: Set env by input - run: | - echo "TAG_NAME=${{ github.event.inputs.environment }}" >> $GITHUB_ENV - - - name: Login Openshift - shell: bash - run: | - oc login --server=${{secrets.OPENSHIFT4_LOGIN_REGISTRY}} --token=${{secrets.OPENSHIFT4_SA_TOKEN}} - - - name: CD Flow - shell: bash - env: - OPS_REPOSITORY: ${{ secrets.OPS_REPOSITORY }} - OPENSHIFT_DOCKER_REGISTRY: ${{ secrets.OPENSHIFT4_DOCKER_REGISTRY }} - OPENSHIFT_SA_NAME: ${{ secrets.OPENSHIFT4_SA_NAME }} - OPENSHIFT_SA_TOKEN: ${{ secrets.OPENSHIFT4_SA_TOKEN }} - OPENSHIFT_REPOSITORY: ${{ secrets.OPENSHIFT4_REPOSITORY }} - TAG_NAME: ${{ env.TAG_NAME }} - run: | - make cd - - - name: Watch new rollout (trigger by image change in Openshift) - shell: bash - run: | - oc rollout status dc/${{ env.APP_NAME }}-${{ env.TAG_NAME }} -n ${{ secrets.OPENSHIFT4_REPOSITORY }}-${{ env.TAG_NAME }} -w - - - name: Rocket.Chat Notification - uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@master - if: failure() - with: - type: ${{ job.status }} - job_name: "*Entity Pay Built and Deployed to ${{env.TAG_NAME}}*" - channel: "#registries-bot" - url: ${{ secrets.ROCKETCHAT_WEBHOOK }} - commit: true - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/future-effective-filings-cd.yml b/.github/workflows/future-effective-filings-cd.yml deleted file mode 100644 index ccde9f3172..0000000000 --- a/.github/workflows/future-effective-filings-cd.yml +++ /dev/null @@ -1,103 +0,0 @@ -name: Future Effective Filings Job CD - -on: - push: - branches: - - main - paths: - - "jobs/future-effective-filings/**" - workflow_dispatch: - inputs: - environment: - description: "Environment (dev/test/prod)" - required: true - default: "dev" - -defaults: - run: - shell: bash - working-directory: ./jobs/future-effective-filings - -env: - APP_NAME: "future-effective-filings" - TAG_NAME: "dev" - -jobs: - future-effective-filings-cd-by-push: - runs-on: ubuntu-20.04 - - if: github.event_name == 'push' && github.repository == 'bcgov/lear' - environment: - name: "dev" - - steps: - - uses: actions/checkout@v3 - - - name: Login Openshift - shell: bash - run: | - oc login --server=${{secrets.OPENSHIFT4_LOGIN_REGISTRY}} --token=${{secrets.OPENSHIFT4_SA_TOKEN}} - - - name: CD Flow - shell: bash - env: - OPS_REPOSITORY: ${{ secrets.OPS_REPOSITORY }} - OPENSHIFT_DOCKER_REGISTRY: ${{ secrets.OPENSHIFT4_DOCKER_REGISTRY }} - OPENSHIFT_SA_NAME: ${{ secrets.OPENSHIFT4_SA_NAME }} - OPENSHIFT_SA_TOKEN: ${{ secrets.OPENSHIFT4_SA_TOKEN }} - OPENSHIFT_REPOSITORY: ${{ secrets.OPENSHIFT4_REPOSITORY }} - TAG_NAME: ${{ env.TAG_NAME }} - run: | - make cd - - - name: Rocket.Chat Notification - uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@master - if: failure() - with: - type: ${{ job.status }} - job_name: "*Future Effective Filings Job Built and Deployed to ${{env.TAG_NAME}}*" - channel: "#registries-bot" - url: ${{ secrets.ROCKETCHAT_WEBHOOK }} - commit: true - token: ${{ secrets.GITHUB_TOKEN }} - - future-effective-filings-cd-by-dispatch: - runs-on: ubuntu-20.04 - - if: github.event_name == 'workflow_dispatch' && github.repository == 'bcgov/lear' - environment: - name: "${{ github.event.inputs.environment }}" - - steps: - - uses: actions/checkout@v3 - - name: Set env by input - run: | - echo "TAG_NAME=${{ github.event.inputs.environment }}" >> $GITHUB_ENV - - - name: Login Openshift - shell: bash - run: | - oc login --server=${{secrets.OPENSHIFT4_LOGIN_REGISTRY}} --token=${{secrets.OPENSHIFT4_SA_TOKEN}} - - - name: CD Flow - shell: bash - env: - OPS_REPOSITORY: ${{ secrets.OPS_REPOSITORY }} - OPENSHIFT_DOCKER_REGISTRY: ${{ secrets.OPENSHIFT4_DOCKER_REGISTRY }} - OPENSHIFT_SA_NAME: ${{ secrets.OPENSHIFT4_SA_NAME }} - OPENSHIFT_SA_TOKEN: ${{ secrets.OPENSHIFT4_SA_TOKEN }} - OPENSHIFT_REPOSITORY: ${{ secrets.OPENSHIFT4_REPOSITORY }} - TAG_NAME: ${{ env.TAG_NAME }} - run: | - make cd - - - name: Rocket.Chat Notification - uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@master - if: failure() - with: - type: ${{ job.status }} - job_name: "*Future Effective Filings Job Built and Deployed to ${{env.TAG_NAME}}*" - channel: "#registries-bot" - url: ${{ secrets.ROCKETCHAT_WEBHOOK }} - commit: true - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/legal-api-cd.yml b/.github/workflows/legal-api-cd.yml deleted file mode 100644 index 9be7c2c570..0000000000 --- a/.github/workflows/legal-api-cd.yml +++ /dev/null @@ -1,113 +0,0 @@ -name: Legal API CD - -on: - push: - branches: - - main - paths: - - "legal-api/**" - workflow_dispatch: - inputs: - environment: - description: "Environment (dev/test/prod)" - required: true - default: "dev" - -defaults: - run: - shell: bash - working-directory: ./legal-api - -env: - APP_NAME: "legal-api" - TAG_NAME: "dev" - -jobs: - legal-api-cd-by-push: - runs-on: ubuntu-20.04 - - if: github.event_name == 'push' && github.repository == 'bcgov/lear' - environment: - name: "dev" - - steps: - - uses: actions/checkout@v3 - - - name: Login Openshift - shell: bash - run: | - oc login --server=${{secrets.OPENSHIFT4_LOGIN_REGISTRY}} --token=${{secrets.OPENSHIFT4_SA_TOKEN}} - - - name: CD Flow - shell: bash - env: - OPS_REPOSITORY: ${{ secrets.OPS_REPOSITORY }} - OPENSHIFT_DOCKER_REGISTRY: ${{ secrets.OPENSHIFT4_DOCKER_REGISTRY }} - OPENSHIFT_SA_NAME: ${{ secrets.OPENSHIFT4_SA_NAME }} - OPENSHIFT_SA_TOKEN: ${{ secrets.OPENSHIFT4_SA_TOKEN }} - OPENSHIFT_REPOSITORY: ${{ secrets.OPENSHIFT4_REPOSITORY }} - TAG_NAME: ${{ env.TAG_NAME }} - run: | - make cd - - - name: Watch new rollout (trigger by image change in Openshift) - shell: bash - run: | - oc rollout status dc/${{ env.APP_NAME }}-${{ env.TAG_NAME }} -n ${{ secrets.OPENSHIFT4_REPOSITORY }}-${{ env.TAG_NAME }} -w - - - name: Rocket.Chat Notification - uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@master - if: failure() - with: - type: ${{ job.status }} - job_name: "*Legal API Built and Deployed to ${{env.TAG_NAME}}*" - channel: "#registries-bot" - url: ${{ secrets.ROCKETCHAT_WEBHOOK }} - commit: true - token: ${{ secrets.GITHUB_TOKEN }} - - legal-api-cd-by-dispatch: - runs-on: ubuntu-20.04 - - if: github.event_name == 'workflow_dispatch' && github.repository == 'bcgov/lear' - environment: - name: "${{ github.event.inputs.environment }}" - - steps: - - uses: actions/checkout@v3 - - name: Set env by input - run: | - echo "TAG_NAME=${{ github.event.inputs.environment }}" >> $GITHUB_ENV - - - name: Login Openshift - shell: bash - run: | - oc login --server=${{secrets.OPENSHIFT4_LOGIN_REGISTRY}} --token=${{secrets.OPENSHIFT4_SA_TOKEN}} - - - name: CD Flow - shell: bash - env: - OPS_REPOSITORY: ${{ secrets.OPS_REPOSITORY }} - OPENSHIFT_DOCKER_REGISTRY: ${{ secrets.OPENSHIFT4_DOCKER_REGISTRY }} - OPENSHIFT_SA_NAME: ${{ secrets.OPENSHIFT4_SA_NAME }} - OPENSHIFT_SA_TOKEN: ${{ secrets.OPENSHIFT4_SA_TOKEN }} - OPENSHIFT_REPOSITORY: ${{ secrets.OPENSHIFT4_REPOSITORY }} - TAG_NAME: ${{ env.TAG_NAME }} - run: | - make cd - - - name: Watch new rollout (trigger by image change in Openshift) - shell: bash - run: | - oc rollout status dc/${{ env.APP_NAME }}-${{ env.TAG_NAME }} -n ${{ secrets.OPENSHIFT4_REPOSITORY }}-${{ env.TAG_NAME }} -w - - - name: Rocket.Chat Notification - uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@master - if: failure() - with: - type: ${{ job.status }} - job_name: "*Legal API Built and Deployed to ${{env.TAG_NAME}}*" - channel: "#registries-bot" - url: ${{ secrets.ROCKETCHAT_WEBHOOK }} - commit: true - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/update-colin-filings-cd.yml b/.github/workflows/update-colin-filings-cd.yml deleted file mode 100644 index 72f32fc312..0000000000 --- a/.github/workflows/update-colin-filings-cd.yml +++ /dev/null @@ -1,103 +0,0 @@ -name: Update Colin Filings Job CD - -on: - push: - branches: - - main - paths: - - "jobs/update-colin-filings/**" - workflow_dispatch: - inputs: - environment: - description: "Environment (dev/test/prod)" - required: true - default: "dev" - -defaults: - run: - shell: bash - working-directory: ./jobs/update-colin-filings - -env: - APP_NAME: "update-colin-filings" - TAG_NAME: "dev" - -jobs: - update-colin-filings-cd-by-push: - runs-on: ubuntu-20.04 - - if: github.event_name == 'push' && github.repository == 'bcgov/lear' - environment: - name: "dev" - - steps: - - uses: actions/checkout@v3 - - - name: Login Openshift - shell: bash - run: | - oc login --server=${{secrets.OPENSHIFT4_LOGIN_REGISTRY}} --token=${{secrets.OPENSHIFT4_SA_TOKEN}} - - - name: CD Flow - shell: bash - env: - OPS_REPOSITORY: ${{ secrets.OPS_REPOSITORY }} - OPENSHIFT_DOCKER_REGISTRY: ${{ secrets.OPENSHIFT4_DOCKER_REGISTRY }} - OPENSHIFT_SA_NAME: ${{ secrets.OPENSHIFT4_SA_NAME }} - OPENSHIFT_SA_TOKEN: ${{ secrets.OPENSHIFT4_SA_TOKEN }} - OPENSHIFT_REPOSITORY: ${{ secrets.OPENSHIFT4_REPOSITORY }} - TAG_NAME: ${{ env.TAG_NAME }} - run: | - make cd - - - name: Rocket.Chat Notification - uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@master - if: failure() - with: - type: ${{ job.status }} - job_name: "*Update Colin Filings Job Built and Deployed to ${{env.TAG_NAME}}*" - channel: "#registries-bot" - url: ${{ secrets.ROCKETCHAT_WEBHOOK }} - commit: true - token: ${{ secrets.GITHUB_TOKEN }} - - update-colin-filings-cd-by-dispatch: - runs-on: ubuntu-20.04 - - if: github.event_name == 'workflow_dispatch' && github.repository == 'bcgov/lear' - environment: - name: "${{ github.event.inputs.environment }}" - - steps: - - uses: actions/checkout@v3 - - name: Set env by input - run: | - echo "TAG_NAME=${{ github.event.inputs.environment }}" >> $GITHUB_ENV - - - name: Login Openshift - shell: bash - run: | - oc login --server=${{secrets.OPENSHIFT4_LOGIN_REGISTRY}} --token=${{secrets.OPENSHIFT4_SA_TOKEN}} - - - name: CD Flow - shell: bash - env: - OPS_REPOSITORY: ${{ secrets.OPS_REPOSITORY }} - OPENSHIFT_DOCKER_REGISTRY: ${{ secrets.OPENSHIFT4_DOCKER_REGISTRY }} - OPENSHIFT_SA_NAME: ${{ secrets.OPENSHIFT4_SA_NAME }} - OPENSHIFT_SA_TOKEN: ${{ secrets.OPENSHIFT4_SA_TOKEN }} - OPENSHIFT_REPOSITORY: ${{ secrets.OPENSHIFT4_REPOSITORY }} - TAG_NAME: ${{ env.TAG_NAME }} - run: | - make cd - - - name: Rocket.Chat Notification - uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@master - if: failure() - with: - type: ${{ job.status }} - job_name: "*Update Colin Filings Job Built and Deployed to ${{env.TAG_NAME}}*" - channel: "#registries-bot" - url: ${{ secrets.ROCKETCHAT_WEBHOOK }} - commit: true - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/update-legal-filings-cd.yml b/.github/workflows/update-legal-filings-cd.yml deleted file mode 100644 index 18cdc2a743..0000000000 --- a/.github/workflows/update-legal-filings-cd.yml +++ /dev/null @@ -1,103 +0,0 @@ -name: Update Legal Filings Job CD - -on: - push: - branches: - - main - paths: - - "jobs/update-legal-filings/**" - workflow_dispatch: - inputs: - environment: - description: "Environment (dev/test/prod)" - required: true - default: "dev" - -defaults: - run: - shell: bash - working-directory: ./jobs/update-legal-filings - -env: - APP_NAME: "update-legal-filings" - TAG_NAME: "dev" - -jobs: - update-legal-filings-cd-by-push: - runs-on: ubuntu-20.04 - - if: github.event_name == 'push' && github.repository == 'bcgov/lear' - environment: - name: "dev" - - steps: - - uses: actions/checkout@v3 - - - name: Login Openshift - shell: bash - run: | - oc login --server=${{secrets.OPENSHIFT4_LOGIN_REGISTRY}} --token=${{secrets.OPENSHIFT4_SA_TOKEN}} - - - name: CD Flow - shell: bash - env: - OPS_REPOSITORY: ${{ secrets.OPS_REPOSITORY }} - OPENSHIFT_DOCKER_REGISTRY: ${{ secrets.OPENSHIFT4_DOCKER_REGISTRY }} - OPENSHIFT_SA_NAME: ${{ secrets.OPENSHIFT4_SA_NAME }} - OPENSHIFT_SA_TOKEN: ${{ secrets.OPENSHIFT4_SA_TOKEN }} - OPENSHIFT_REPOSITORY: ${{ secrets.OPENSHIFT4_REPOSITORY }} - TAG_NAME: ${{ env.TAG_NAME }} - run: | - make cd - - - name: Rocket.Chat Notification - uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@master - if: failure() - with: - type: ${{ job.status }} - job_name: "*Update Legal Filings Job Built and Deployed to ${{env.TAG_NAME}}*" - channel: "#registries-bot" - url: ${{ secrets.ROCKETCHAT_WEBHOOK }} - commit: true - token: ${{ secrets.GITHUB_TOKEN }} - - update-legal-filings-cd-by-dispatch: - runs-on: ubuntu-20.04 - - if: github.event_name == 'workflow_dispatch' && github.repository == 'bcgov/lear' - environment: - name: "${{ github.event.inputs.environment }}" - - steps: - - uses: actions/checkout@v3 - - name: Set env by input - run: | - echo "TAG_NAME=${{ github.event.inputs.environment }}" >> $GITHUB_ENV - - - name: Login Openshift - shell: bash - run: | - oc login --server=${{secrets.OPENSHIFT4_LOGIN_REGISTRY}} --token=${{secrets.OPENSHIFT4_SA_TOKEN}} - - - name: CD Flow - shell: bash - env: - OPS_REPOSITORY: ${{ secrets.OPS_REPOSITORY }} - OPENSHIFT_DOCKER_REGISTRY: ${{ secrets.OPENSHIFT4_DOCKER_REGISTRY }} - OPENSHIFT_SA_NAME: ${{ secrets.OPENSHIFT4_SA_NAME }} - OPENSHIFT_SA_TOKEN: ${{ secrets.OPENSHIFT4_SA_TOKEN }} - OPENSHIFT_REPOSITORY: ${{ secrets.OPENSHIFT4_REPOSITORY }} - TAG_NAME: ${{ env.TAG_NAME }} - run: | - make cd - - - name: Rocket.Chat Notification - uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@master - if: failure() - with: - type: ${{ job.status }} - job_name: "*Update Legal Filings Job Built and Deployed to ${{env.TAG_NAME}}*" - channel: "#registries-bot" - url: ${{ secrets.ROCKETCHAT_WEBHOOK }} - commit: true - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/jobs/email-reminder/config.py b/jobs/email-reminder/config.py index c62dfbdb44..9165ffa422 100644 --- a/jobs/email-reminder/config.py +++ b/jobs/email-reminder/config.py @@ -21,10 +21,10 @@ load_dotenv(find_dotenv()) CONFIGURATION = { - 'development': 'config.DevConfig', - 'testing': 'config.TestConfig', - 'production': 'config.ProdConfig', - 'default': 'config.ProdConfig' + "development": "config.DevConfig", + "testing": "config.TestConfig", + "production": "config.ProdConfig", + "default": "config.ProdConfig", } @@ -33,28 +33,28 @@ class _Config(object): # pylint: disable=too-few-public-methods PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__)) - SEND_OUTSTANDING_BCOMPS = os.getenv('SEND_OUTSTANDING_BCOMPS', None) - SENTRY_DSN = os.getenv('SENTRY_DSN', '') - LD_SDK_KEY = os.getenv('LD_SDK_KEY', None) + SEND_OUTSTANDING_BCOMPS = os.getenv("SEND_OUTSTANDING_BCOMPS", None) + SENTRY_DSN = os.getenv("SENTRY_DSN", "") + LD_SDK_KEY = os.getenv("LD_SDK_KEY", None) - ACCOUNT_SVC_AUTH_URL = os.getenv('ACCOUNT_SVC_AUTH_URL', None) - ACCOUNT_SVC_CLIENT_ID = os.getenv('ACCOUNT_SVC_CLIENT_ID', None) - ACCOUNT_SVC_CLIENT_SECRET = os.getenv('ACCOUNT_SVC_CLIENT_SECRET', None) + ACCOUNT_SVC_AUTH_URL = os.getenv("ACCOUNT_SVC_AUTH_URL", None) + ACCOUNT_SVC_CLIENT_ID = os.getenv("ACCOUNT_SVC_CLIENT_ID", None) + ACCOUNT_SVC_CLIENT_SECRET = os.getenv("ACCOUNT_SVC_CLIENT_SECRET", None) - PAYMENT_SVC_FEES_URL = os.getenv('PAYMENT_SVC_FEES_URL', None) + PAYMENT_SVC_FEES_URL = os.getenv("PAYMENT_SVC_FEES_URL", None) - SECRET_KEY = 'a secret' + SECRET_KEY = "a secret" SQLALCHEMY_TRACK_MODIFICATIONS = False - ALEMBIC_INI = 'migrations/alembic.ini' + ALEMBIC_INI = "migrations/alembic.ini" # POSTGRESQL - DB_USER = os.getenv('DATABASE_USERNAME', '') - DB_PASSWORD = os.getenv('DATABASE_PASSWORD', '') - DB_NAME = os.getenv('DATABASE_NAME', '') - DB_HOST = os.getenv('DATABASE_HOST', '') - DB_PORT = os.getenv('DATABASE_PORT', '5432') + DB_USER = os.getenv("DATABASE_USERNAME", "") + DB_PASSWORD = os.getenv("DATABASE_PASSWORD", "") + DB_NAME = os.getenv("DATABASE_NAME", "") + DB_HOST = os.getenv("DATABASE_HOST", "") + DB_PORT = os.getenv("DATABASE_PORT", "5432") if DB_UNIX_SOCKET := os.getenv("DATABASE_UNIX_SOCKET", None): SQLALCHEMY_DATABASE_URI = f"postgresql+pg8000://{DB_USER}:{DB_PASSWORD}@/{DB_NAME}?unix_sock={DB_UNIX_SOCKET}/.s.PGSQL.5432" @@ -92,22 +92,22 @@ class TestConfig(_Config): # pylint: disable=too-few-public-methods TESTING = True # POSTGRESQL - DB_USER = os.getenv('DATABASE_TEST_USERNAME', '') - DB_PASSWORD = os.getenv('DATABASE_TEST_PASSWORD', '') - DB_NAME = os.getenv('DATABASE_TEST_NAME', '') - DB_HOST = os.getenv('DATABASE_TEST_HOST', '') - DB_PORT = os.getenv('DATABASE_TEST_PORT', '5432') + DB_USER = os.getenv("DATABASE_TEST_USERNAME", "") + DB_PASSWORD = os.getenv("DATABASE_TEST_PASSWORD", "") + DB_NAME = os.getenv("DATABASE_TEST_NAME", "") + DB_HOST = os.getenv("DATABASE_TEST_HOST", "") + DB_PORT = os.getenv("DATABASE_TEST_PORT", "5432") SQLALCHEMY_DATABASE_URI = f"postgresql+pg8000://{DB_USER}:{DB_PASSWORD}@{DB_HOST}:{int(DB_PORT)}/{DB_NAME}" class ProdConfig(_Config): # pylint: disable=too-few-public-methods """Production environment configuration.""" - SECRET_KEY = os.getenv('SECRET_KEY', None) + SECRET_KEY = os.getenv("SECRET_KEY", None) if not SECRET_KEY: SECRET_KEY = os.urandom(24) - print('WARNING: SECRET_KEY being set as a one-shot', file=sys.stderr) + print("WARNING: SECRET_KEY being set as a one-shot", file=sys.stderr) TESTING = False DEBUG = False diff --git a/jobs/email-reminder/devops/gcp/clouddeploy-targets.yaml b/jobs/email-reminder/devops/gcp/clouddeploy-targets.yaml new file mode 100644 index 0000000000..f66a84239f --- /dev/null +++ b/jobs/email-reminder/devops/gcp/clouddeploy-targets.yaml @@ -0,0 +1,102 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: dev +description: Dev Environment +deployParameters: + deploy-project-id: "a083gt-dev" + service-name: "business-email-reminder-dev" + container-name: "business-email-reminder-dev" + app-env: "dev" + cloudsql-instances: "a083gt-dev:northamerica-northeast1:businesses-db-dev" + max-scale: "1" + container-concurrency: "2" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-dev/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' +--- + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: test +description: Test Environment +deployParameters: + deploy-project-id: "a083gt-test" + service-name: "business-email-reminder-test" + container-name: "business-email-reminder-test" + app-env: "test" + cloudsql-instances: "a083gt-test:northamerica-northeast1:businesses-db-test" + max-scale: "2" + container-concurrency: "3" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-test/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' +--- + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: sandbox +description: Sandbox Environment +requireApproval: true +deployParameters: + deploy-project-id: "a083gt-integration" + service-name: "business-email-reminder-sandbox" + container-name: "business-email-reminder-sandbox" + app-env: "sandbox" + cloudsql-instances: "a083gt-integration:northamerica-northeast1:businesses-db-sandbox" + max-scale: "3" + container-concurrency: "7" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-integration/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' +--- + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: prod +description: Production Environment +requireApproval: true +deployParameters: + deploy-project-id: "a083gt-prod" + service-name: "business-email-reminder-prod" + container-name: "business-email-reminder-prod" + app-env: "production" + cloudsql-instances: "a083gt-prod:northamerica-northeast1:businesses-db-prod" + max-scale: "3" + container-concurrency: "7" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-prod/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' \ No newline at end of file diff --git a/jobs/email-reminder/devops/vaults.gcp.env b/jobs/email-reminder/devops/vaults.gcp.env new file mode 100644 index 0000000000..d4b346a7f4 --- /dev/null +++ b/jobs/email-reminder/devops/vaults.gcp.env @@ -0,0 +1,34 @@ +KEYCLOAK_TIMEOUT="op://entity/$APP_ENV/business-api/KEYCLOAK_TIMEOUT" +LEGISLATIVE_TIMEZONE="op://entity/$APP_ENV/business-api/LEGISLATIVE_TIMEZONE" +DATABASE_NAME="op://database/$APP_ENV/business-db/DATABASE_NAME" +DATABASE_PASSWORD="op://database/$APP_ENV/business-db/DATABASE_PASSWORD" +DATABASE_PORT="op://database/$APP_ENV/business-db/DATABASE_PORT" +DATABASE_UNIX_SOCKET="op://database/$APP_ENV/business-db/DATABASE_UNIX_SOCKET" +DATABASE_USERNAME="op://database/$APP_ENV/business-db/DATABASE_USERNAME" +KEYCLOAK_AUTH_TOKEN_URL="op://keycloak/$APP_ENV/base/KEYCLOAK_AUTH_TOKEN_URL" +KEYCLOAK_CLIENT_ID="op://keycloak/$APP_ENV/entity-service-account/ENTITY_SERVICE_ACCOUNT_CLIENT_ID" +KEYCLOAK_CLIENT_SECRET="op://keycloak/$APP_ENV/entity-service-account/ENTITY_SERVICE_ACCOUNT_CLIENT_SECRET" +MINIO_ENDPOINT="op://minio/$APP_ENV/base/MINIO_ENDPOINT" +MINIO_ACCESS_KEY="op://minio/$APP_ENV/base/MINIO_ACCESS_KEY" +MINIO_ACCESS_SECRET="op://minio/$APP_ENV/base/MINIO_ACCESS_SECRET" +MINIO_BUCKET_BUSINESSES="op://minio/$APP_ENV/lear/MINIO_BUCKET_BUSINESSES" +AUTH_API_URL="op://API/$APP_ENV/auth-api/AUTH_API_URL" +AUTH_API_VERSION="op://API/$APP_ENV/auth-api/AUTH_API_VERSION" +COLIN_API_URL="op://API/$APP_ENV/colin-api-entity/COLIN_API_URL" +COLIN_API_VERSION="op://API/$APP_ENV/colin-api-entity/COLIN_API_VERSION" +NAMEX_API_URL="op://API/$APP_ENV/namex-api/NAMEX_API_URL" +NAMEX_API_VERSION="op://API/$APP_ENV/namex-api/NAMEX_API_VERSION" +BUSINESS_API_URL="op://API/$APP_ENV/business-api/BUSINESS_API_URL" +BUSINESS_API_VERSION2="op://API/$APP_ENV/business-api/BUSINESS_API_VERSION_2" +PAY_API_URL="op://API/$APP_ENV/pay-api/PAY_API_URL" +PAY_API_VERSION="op://API/$APP_ENV/pay-api/PAY_API_VERSION" +REPORT_API_URL="op://API/$APP_ENV/report-api/REPORT_API_URL" +REPORT_API_VERSION="op://API/$APP_ENV/report-api/REPORT_API_VERSION" +NATS_SERVERS="op://nats/$APP_ENV/base/NATS_SERVERS" +NATS_CLUSTER_ID="op://nats/$APP_ENV/base/NATS_CLUSTER_ID" +NATS_QUEUE="op://nats/$APP_ENV/nats-filer/NATS_QUEUE" +NATS_CLIENT_NAME="op://nats/$APP_ENV/nats-filer/NATS_CLIENT_NAME" +NATS_FILER_SUBJECT="op://nats/$APP_ENV/nats-filer/NATS_FILER_SUBJECT" +NATS_ENTITY_EVENT_SUBJECT="op://nats/$APP_ENV/nats-filer/NATS_ENTITY_EVENT_SUBJECT" +NATS_EMAILER_SUBJECT="op://nats/$APP_ENV/nats-emailer/NATS_EMAILER_SUBJECT" +SENTRY_DSN="" \ No newline at end of file diff --git a/jobs/email-reminder/poetry.lock b/jobs/email-reminder/poetry.lock index 2766aa4e39..998bd63e25 100644 --- a/jobs/email-reminder/poetry.lock +++ b/jobs/email-reminder/poetry.lock @@ -1022,18 +1022,18 @@ pycountry = "^22.3.5" pydantic = "^1.10.8" PyPDF2 = "^3.0.1" python-dotenv = "^1.0.0" -registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", branch = "dev_legal_name_changes"} +registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", branch = "feature-legal-name"} reportlab = "^4.0.0" requests = "^2.31.0" sentry-sdk = "^1.24.0" -sql-versioning = {git = "https://github.com/bcgov/lear.git", branch = "dev_legal_name_changes", subdirectory = "python/common/sql-versioning"} +sql-versioning = {git = "https://github.com/bcgov/lear.git", branch = "feature-legal-name", subdirectory = "python/common/sql-versioning"} sqlalchemy-continuum = "^1.3.14" strict-rfc3339 = "^0.7" [package.source] type = "git" url = "https://github.com/bcgov/lear.git" -reference = "dev_legal_name_changes" +reference = "feature-legal-name" resolved_reference = "b839230c813fee9e902ce7bbb57c3529772047f5" subdirectory = "legal-api" @@ -1734,7 +1734,7 @@ strict-rfc3339 = "*" [package.source] type = "git" url = "https://github.com/bcgov/business-schemas.git" -reference = "dev_legal_name_changes" +reference = "feature-legal-name" resolved_reference = "46fe42057ce8b8f7136ea2817b044b3a58d6939e" [[package]] @@ -2057,7 +2057,7 @@ develop = false [package.source] type = "git" url = "https://github.com/bcgov/lear.git" -reference = "dev_legal_name_changes" +reference = "feature-legal-name" resolved_reference = "b839230c813fee9e902ce7bbb57c3529772047f5" subdirectory = "python/common/sql-versioning" diff --git a/jobs/email-reminder/pyproject.toml b/jobs/email-reminder/pyproject.toml index 970af2b757..cffe2ca5e7 100644 --- a/jobs/email-reminder/pyproject.toml +++ b/jobs/email-reminder/pyproject.toml @@ -32,8 +32,8 @@ rsa = "^4.9" sentry-sdk = "^1.29.2" six = "^1.16.0" urllib3 = "^1.22.0" -legal_api = { git = "https://github.com/bcgov/lear.git", subdirectory = "legal-api", branch = "dev_legal_name_changes" } -registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", branch = "dev_legal_name_changes"} +legal_api = { git = "https://github.com/bcgov/lear.git", subdirectory = "legal-api", branch = "feature-legal-name" } +registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", branch = "feature-legal-name"} simple_cloudevent = { git = "https://github.com/daxiom/simple-cloudevent.py" } google-auth = "^2.21.0" google-cloud-pubsub = "^2.17.1" diff --git a/jobs/future-effective-filings/config.py b/jobs/future-effective-filings/config.py index 6618fbf81b..10ec7363e6 100644 --- a/jobs/future-effective-filings/config.py +++ b/jobs/future-effective-filings/config.py @@ -48,31 +48,38 @@ load_dotenv(find_dotenv()) CONFIGURATION = { - 'development': 'config.Development', - 'testing': 'config.Testing', - 'production': 'config.Production', - 'default': 'config.Production' + "development": "config.Development", + "testing": "config.Testing", + "production": "config.Production", + "default": "config.Production", } + class Config(object): # pylint: disable=too-few-public-methods """Base class configuration that should set reasonable defaults for all the other configurations.""" PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__)) - ENVIRONMENT = os.getenv('ENVIRONMENT', 'prod') - GCP_AUTH_KEY = os.getenv('GCP_AUTH_KEY', None) - ENTITY_FILER_TOPIC = os.getenv('ENTITY_FILER_TOPIC', 'filer') + SENTRY_DSN = os.getenv("SENTRY_DSN", "") + + SECRET_KEY = "a secret" + + ENVIRONMENT = os.getenv("APP_ENV", "prod") + + GCP_AUTH_KEY = os.getenv("GCP_AUTH_KEY", None) + ENTITY_FILER_TOPIC = os.getenv("ENTITY_FILER_TOPIC", "filer") AUDIENCE = os.getenv( - 'AUDIENCE', 'https://pubsub.googleapis.com/google.pubsub.v1.Subscriber' + "AUDIENCE", "https://pubsub.googleapis.com/google.pubsub.v1.Subscriber" ) PUBLISHER_AUDIENCE = os.getenv( - 'PUBLISHER_AUDIENCE', 'https://pubsub.googleapis.com/google.pubsub.v1.Publisher' + "PUBLISHER_AUDIENCE", "https://pubsub.googleapis.com/google.pubsub.v1.Publisher" ) - LEGAL_URL = os.getenv('LEGAL_URL', '') - SENTRY_DSN = os.getenv('SENTRY_DSN', '') + # API Endpoints + BUSINESS_API_URL = os.getenv("BUSINESS_API_URL", "") + BUSINESS_API_VERSION2 = os.getenv("BUSINESS_API_VERSION2", "") - SECRET_KEY = 'a secret' + LEGAL_URL = f"{BUSINESS_API_URL + BUSINESS_API_VERSION2}" class Development(Config): # pylint: disable=too-few-public-methods @@ -88,18 +95,18 @@ class Testing(Config): # pylint: disable=too-few-public-methods DEBUG = True TESTING = True - LEGAL_URL = os.getenv('LEGAL_URL', '') - SENTRY_DSN = os.getenv('SENTRY_DSN_TEST', '') + LEGAL_URL = os.getenv("LEGAL_URL", "") + SENTRY_DSN = os.getenv("SENTRY_DSN_TEST", "") class Production(Config): # pylint: disable=too-few-public-methods """Production environment configuration.""" - SECRET_KEY = os.getenv('SECRET_KEY', None) + SECRET_KEY = os.getenv("SECRET_KEY", None) if not SECRET_KEY: SECRET_KEY = os.urandom(24) - print('WARNING: SECRET_KEY being set as a one-shot', file=sys.stderr) + print("WARNING: SECRET_KEY being set as a one-shot", file=sys.stderr) TESTING = False DEBUG = False diff --git a/jobs/future-effective-filings/devops/gcp/clouddeploy-targets.yaml b/jobs/future-effective-filings/devops/gcp/clouddeploy-targets.yaml new file mode 100644 index 0000000000..89b6139499 --- /dev/null +++ b/jobs/future-effective-filings/devops/gcp/clouddeploy-targets.yaml @@ -0,0 +1,102 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: dev +description: Dev Environment +deployParameters: + deploy-project-id: "a083gt-dev" + service-name: "business-future-effective-filings-dev" + container-name: "business-future-effective-filings-dev" + app-env: "dev" + cloudsql-instances: "a083gt-dev:northamerica-northeast1:businesses-db-dev" + max-scale: "1" + container-concurrency: "2" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-dev/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' +--- + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: test +description: Test Environment +deployParameters: + deploy-project-id: "a083gt-test" + service-name: "business-future-effective-filings-test" + container-name: "business-future-effective-filings-test" + app-env: "test" + cloudsql-instances: "a083gt-test:northamerica-northeast1:businesses-db-test" + max-scale: "2" + container-concurrency: "3" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-test/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' +--- + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: sandbox +description: Sandbox Environment +requireApproval: true +deployParameters: + deploy-project-id: "a083gt-integration" + service-name: "business-future-effective-filings-sandbox" + container-name: "business-future-effective-filings-sandbox" + app-env: "sandbox" + cloudsql-instances: "a083gt-integration:northamerica-northeast1:businesses-db-sandbox" + max-scale: "3" + container-concurrency: "7" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-integration/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' +--- + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: prod +description: Production Environment +requireApproval: true +deployParameters: + deploy-project-id: "a083gt-prod" + service-name: "business-future-effective-filings-prod" + container-name: "business-future-effective-filings-prod" + app-env: "production" + cloudsql-instances: "a083gt-prod:northamerica-northeast1:businesses-db-prod" + max-scale: "3" + container-concurrency: "7" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-prod/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' \ No newline at end of file diff --git a/jobs/future-effective-filings/devops/vaults.gcp.env b/jobs/future-effective-filings/devops/vaults.gcp.env new file mode 100644 index 0000000000..9727634d8b --- /dev/null +++ b/jobs/future-effective-filings/devops/vaults.gcp.env @@ -0,0 +1,7 @@ +BUSINESS_API_URL="op://API/$APP_ENV/business-api/BUSINESS_API_URL" +BUSINESS_API_VERSION2="op://API/$APP_ENV/business-api/BUSINESS_API_VERSION_2" +AUDIENCE=op://gcp-queue/$APP_ENV/payment/AUDIENCE" +TOPIC_NAME=op://gcp-queue/$APP_ENV/payment/TOPIC_NAME" +PUBLISHER_AUDIENCE=op://gcp-queue/$APP_ENV/payment/PUBLISHER_AUDIENCE" +GCP_AUTH_KEY=op://gcp-queue/$APP_ENV/payment/GCP_AUTH_KEY" +SENTRY_DSN="" \ No newline at end of file diff --git a/jobs/future-effective-filings/devops/vaults.json b/jobs/future-effective-filings/devops/vaults.json deleted file mode 100644 index b8ccddd442..0000000000 --- a/jobs/future-effective-filings/devops/vaults.json +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "vault": "entity", - "application": [ - "filings-jobs", - "nats-filer", - "entity-service-account", - "sentry" - ] - } -] diff --git a/jobs/update-colin-filings/config.py b/jobs/update-colin-filings/config.py index 8f6c7b1cf1..d3e90b239a 100644 --- a/jobs/update-colin-filings/config.py +++ b/jobs/update-colin-filings/config.py @@ -21,20 +21,20 @@ load_dotenv(find_dotenv()) CONFIGURATION = { - 'development': 'config.DevConfig', - 'testing': 'config.TestConfig', - 'production': 'config.ProdConfig', - 'default': 'config.ProdConfig' + "development": "config.DevConfig", + "testing": "config.TestConfig", + "production": "config.ProdConfig", + "default": "config.ProdConfig", } -def get_named_config(config_name: str = 'production'): +def get_named_config(config_name: str = "production"): """Return the configuration object based on the name.""" - if config_name in ['production', 'staging', 'default']: + if config_name in ["production", "staging", "default"]: config = ProdConfig() - elif config_name == 'testing': + elif config_name == "testing": config = TestConfig() - elif config_name == 'development': + elif config_name == "development": config = DevConfig() else: raise KeyError(f"Unknown configuration '{config_name}'") @@ -46,15 +46,24 @@ class _Config(object): # pylint: disable=too-few-public-methods PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__)) - COLIN_URL = os.getenv('COLIN_URL', '') - LEGAL_URL = os.getenv('LEGAL_URL', '') - SENTRY_DSN = os.getenv('SENTRY_DSN', '') + SECRET_KEY = "a secret" - ACCOUNT_SVC_AUTH_URL = os.getenv('ACCOUNT_SVC_AUTH_URL', None) - ACCOUNT_SVC_CLIENT_ID = os.getenv('ACCOUNT_SVC_CLIENT_ID', None) - ACCOUNT_SVC_CLIENT_SECRET = os.getenv('ACCOUNT_SVC_CLIENT_SECRET', None) + SENTRY_DSN = os.getenv("SENTRY_DSN", "") - SECRET_KEY = 'a secret' + # API Endpoints + BUSINESS_API_URL = os.getenv("BUSINESS_API_URL", "") + BUSINESS_API_VERSION_2 = os.getenv("BUSINESS_API_VERSION2", "") + COLIN_API_URL = os.getenv("COLIN_API_URL", "") + COLIN_API_VERSION = os.getenv("COLIN_API_VERSION", "") + + COLIN_API = f"{COLIN_API_URL + COLIN_API_VERSION}" + LEGAL_URL = f"{BUSINESS_API_URL + BUSINESS_API_VERSION_2}" + + # service accounts + ACCOUNT_SVC_AUTH_URL = os.getenv("KEYCLOAK_AUTH_TOKEN_URL") + ACCOUNT_SVC_CLIENT_ID = os.getenv("KEYCLOAK_CLIENT_ID") + ACCOUNT_SVC_CLIENT_SECRET = os.getenv("KEYCLOAK_CLIENT_ID") + ACCOUNT_SVC_TIMEOUT = os.getenv("KEYCLOAK_TIMEOUT") TESTING = False DEBUG = False @@ -73,14 +82,14 @@ class TestConfig(_Config): # pylint: disable=too-few-public-methods DEBUG = True TESTING = True - COLIN_URL = os.getenv('COLIN_URL_TEST', '') - LEGAL_URL = os.getenv('LEGAL_URL_TEST', '') + COLIN_URL = os.getenv("COLIN_URL_TEST", "") + LEGAL_URL = os.getenv("LEGAL_URL_TEST", "") class ProdConfig(_Config): # pylint: disable=too-few-public-methods """Production environment configuration.""" - SECRET_KEY = os.getenv('SECRET_KEY', None) + SECRET_KEY = os.getenv("SECRET_KEY", None) if not SECRET_KEY: SECRET_KEY = os.urandom(24) diff --git a/jobs/update-colin-filings/devops/gcp/clouddeploy-targets.yaml b/jobs/update-colin-filings/devops/gcp/clouddeploy-targets.yaml new file mode 100644 index 0000000000..cdb5407778 --- /dev/null +++ b/jobs/update-colin-filings/devops/gcp/clouddeploy-targets.yaml @@ -0,0 +1,102 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: dev +description: Dev Environment +deployParameters: + deploy-project-id: "a083gt-dev" + service-name: "business-update-colin-filings-dev" + container-name: "business-update-colin-filings-dev" + app-env: "dev" + cloudsql-instances: "a083gt-dev:northamerica-northeast1:businesses-db-dev" + max-scale: "1" + container-concurrency: "2" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-dev/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' +--- + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: test +description: Test Environment +deployParameters: + deploy-project-id: "a083gt-test" + service-name: "business-update-colin-filings-test" + container-name: "business-update-colin-filings-test" + app-env: "test" + cloudsql-instances: "a083gt-test:northamerica-northeast1:businesses-db-test" + max-scale: "2" + container-concurrency: "3" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-test/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' +--- + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: sandbox +description: Sandbox Environment +requireApproval: true +deployParameters: + deploy-project-id: "a083gt-integration" + service-name: "business-update-colin-filings-sandbox" + container-name: "business-update-colin-filings-sandbox" + app-env: "sandbox" + cloudsql-instances: "a083gt-integration:northamerica-northeast1:businesses-db-sandbox" + max-scale: "3" + container-concurrency: "7" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-integration/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' +--- + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: prod +description: Production Environment +requireApproval: true +deployParameters: + deploy-project-id: "a083gt-prod" + service-name: "business-update-colin-filings-prod" + container-name: "business-update-colin-filings-prod" + app-env: "production" + cloudsql-instances: "a083gt-prod:northamerica-northeast1:businesses-db-prod" + max-scale: "3" + container-concurrency: "7" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-prod/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' \ No newline at end of file diff --git a/jobs/update-colin-filings/devops/vaults.gcp.env b/jobs/update-colin-filings/devops/vaults.gcp.env new file mode 100644 index 0000000000..f78c03b188 --- /dev/null +++ b/jobs/update-colin-filings/devops/vaults.gcp.env @@ -0,0 +1,9 @@ +KEYCLOAK_TIMEOUT="op://entity/$APP_ENV/business-api/KEYCLOAK_TIMEOUT" +KEYCLOAK_AUTH_TOKEN_URL="op://keycloak/$APP_ENV/base/KEYCLOAK_AUTH_TOKEN_URL" +KEYCLOAK_CLIENT_ID="op://keycloak/$APP_ENV/entity-service-account/ENTITY_SERVICE_ACCOUNT_CLIENT_ID" +KEYCLOAK_CLIENT_SECRET="op://keycloak/$APP_ENV/entity-service-account/ENTITY_SERVICE_ACCOUNT_CLIENT_SECRET" +COLIN_API_URL="op://API/$APP_ENV/colin-api-entity/COLIN_API_URL" +COLIN_API_VERSION="op://API/$APP_ENV/colin-api-entity/COLIN_API_VERSION" +BUSINESS_API_URL="op://API/$APP_ENV/business-api/BUSINESS_API_URL" +BUSINESS_API_VERSION2="op://API/$APP_ENV/business-api/BUSINESS_API_VERSION_2" +SENTRY_DSN="" \ No newline at end of file diff --git a/jobs/update-colin-filings/devops/vaults.json b/jobs/update-colin-filings/devops/vaults.json deleted file mode 100644 index ff693d1c2b..0000000000 --- a/jobs/update-colin-filings/devops/vaults.json +++ /dev/null @@ -1,10 +0,0 @@ -[ - { - "vault": "entity", - "application": [ - "filings-jobs", - "entity-service-account", - "sentry" - ] - } -] diff --git a/jobs/update-colin-filings/poetry.lock b/jobs/update-colin-filings/poetry.lock index 72d1ace4bc..fc84d29f71 100644 --- a/jobs/update-colin-filings/poetry.lock +++ b/jobs/update-colin-filings/poetry.lock @@ -832,18 +832,18 @@ pycountry = "^22.3.5" pydantic = "^1.10.8" PyPDF2 = "^3.0.1" python-dotenv = "^1.0.0" -registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", branch = "dev_legal_name_changes"} +registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", branch = "feature-legal-name"} reportlab = "^4.0.0" requests = "^2.31.0" sentry-sdk = "^1.24.0" -sql-versioning = {git = "https://github.com/bcgov/lear.git", branch = "dev_legal_name_changes", subdirectory = "python/common/sql-versioning"} +sql-versioning = {git = "https://github.com/bcgov/lear.git", branch = "feature-legal-name", subdirectory = "python/common/sql-versioning"} sqlalchemy-continuum = "^1.3.14" strict-rfc3339 = "^0.7" [package.source] type = "git" url = "https://github.com/bcgov/lear.git" -reference = "dev_legal_name_changes" +reference = "feature-legal-name" resolved_reference = "ca569b0bacc5ed5fd9c3a845bf30d02011b1334d" subdirectory = "legal-api" @@ -1497,7 +1497,7 @@ strict-rfc3339 = "*" [package.source] type = "git" url = "https://github.com/bcgov/business-schemas.git" -reference = "dev_legal_name_changes" +reference = "feature-legal-name" resolved_reference = "46fe42057ce8b8f7136ea2817b044b3a58d6939e" [[package]] @@ -1789,7 +1789,7 @@ develop = false [package.source] type = "git" url = "https://github.com/bcgov/lear.git" -reference = "dev_legal_name_changes" +reference = "feature-legal-name" resolved_reference = "ca569b0bacc5ed5fd9c3a845bf30d02011b1334d" subdirectory = "python/common/sql-versioning" diff --git a/jobs/update-colin-filings/pyproject.toml b/jobs/update-colin-filings/pyproject.toml index 3d24a51275..65bb0dbd91 100644 --- a/jobs/update-colin-filings/pyproject.toml +++ b/jobs/update-colin-filings/pyproject.toml @@ -36,8 +36,8 @@ rsa = "^4.9" sentry-sdk = "^1.30.0" six = "^1.16.0" urllib3 = "^1.22.0" -legal_api = { git = "https://github.com/bcgov/lear.git", subdirectory = "legal-api", branch = "dev_legal_name_changes" } -registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", branch = "dev_legal_name_changes"} +legal_api = { git = "https://github.com/bcgov/lear.git", subdirectory = "legal-api", branch = "feature-legal-name" } +registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", branch = "feature-legal-name"} referencing = "^0.30.2" [tool.poetry.group.dev.dependencies] diff --git a/jobs/update-legal-filings/config.py b/jobs/update-legal-filings/config.py index 353420148a..a0dc4918b6 100644 --- a/jobs/update-legal-filings/config.py +++ b/jobs/update-legal-filings/config.py @@ -21,10 +21,10 @@ load_dotenv(find_dotenv()) CONFIGURATION = { - 'development': 'config.DevConfig', - 'testing': 'config.TestConfig', - 'production': 'config.ProdConfig', - 'default': 'config.ProdConfig' + "development": "config.DevConfig", + "testing": "config.TestConfig", + "production": "config.ProdConfig", + "default": "config.ProdConfig", } @@ -33,29 +33,34 @@ class _Config(object): # pylint: disable=too-few-public-methods PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__)) - COLIN_URL = os.getenv('COLIN_URL', '') - LEGAL_URL = os.getenv('LEGAL_URL', '') - SENTRY_DSN = os.getenv('SENTRY_DSN', '') + SECRET_KEY = "a secret" - ACCOUNT_SVC_AUTH_URL = os.getenv('ACCOUNT_SVC_AUTH_URL', None) - ACCOUNT_SVC_CLIENT_ID = os.getenv('ACCOUNT_SVC_CLIENT_ID', None) - ACCOUNT_SVC_CLIENT_SECRET = os.getenv('ACCOUNT_SVC_CLIENT_SECRET', None) + SENTRY_DSN = os.getenv("SENTRY_DSN", "") - SECRET_KEY = 'a secret' + # API Endpoints + BUSINESS_API_URL = os.getenv("BUSINESS_API_URL", "") + BUSINESS_API_VERSION_2 = os.getenv("BUSINESS_API_VERSION2", "") + COLIN_API_URL = os.getenv("COLIN_API_URL", "") + COLIN_API_VERSION = os.getenv("COLIN_API_VERSION", "") - SQLALCHEMY_TRACK_MODIFICATIONS = False + COLIN_API = f"{COLIN_API_URL + COLIN_API_VERSION}" + LEGAL_URL = f"{BUSINESS_API_URL + BUSINESS_API_VERSION_2}" - ALEMBIC_INI = 'migrations/alembic.ini' + # service accounts + ACCOUNT_SVC_AUTH_URL = os.getenv("KEYCLOAK_AUTH_TOKEN_URL") + ACCOUNT_SVC_CLIENT_ID = os.getenv("KEYCLOAK_CLIENT_ID") + ACCOUNT_SVC_CLIENT_SECRET = os.getenv("KEYCLOAK_CLIENT_ID") + ACCOUNT_SVC_TIMEOUT = os.getenv("KEYCLOAK_TIMEOUT") # GCP QUEUE - GCP_AUTH_KEY = os.getenv('GCP_AUTH_KEY', None) - ENTITY_MAILER_TOPIC = os.getenv('ENTITY_MAILER_TOPIC', 'mailer') - ENTITY_EVENTS_TOPIC = os.getenv('ENTITY_EVENTS_TOPIC', 'events') + GCP_AUTH_KEY = os.getenv("GCP_AUTH_KEY", None) + ENTITY_MAILER_TOPIC = os.getenv("ENTITY_MAILER_TOPIC", "mailer") + ENTITY_EVENTS_TOPIC = os.getenv("ENTITY_EVENTS_TOPIC", "events") AUDIENCE = os.getenv( - 'AUDIENCE', 'https://pubsub.googleapis.com/google.pubsub.v1.Subscriber' + "AUDIENCE", "https://pubsub.googleapis.com/google.pubsub.v1.Subscriber" ) PUBLISHER_AUDIENCE = os.getenv( - 'PUBLISHER_AUDIENCE', 'https://pubsub.googleapis.com/google.pubsub.v1.Publisher' + "PUBLISHER_AUDIENCE", "https://pubsub.googleapis.com/google.pubsub.v1.Publisher" ) TESTING = False @@ -75,15 +80,14 @@ class TestConfig(_Config): # pylint: disable=too-few-public-methods DEBUG = True TESTING = True - COLIN_URL = os.getenv('COLIN_URL_TEST', '') - LEGAL_URL = os.getenv('LEGAL_URL_TEST', '') - + COLIN_URL = os.getenv("COLIN_URL_TEST", "") + LEGAL_URL = os.getenv("LEGAL_URL_TEST", "") class ProdConfig(_Config): # pylint: disable=too-few-public-methods """Production environment configuration.""" - SECRET_KEY = os.getenv('SECRET_KEY', None) + SECRET_KEY = os.getenv("SECRET_KEY", None) if not SECRET_KEY: SECRET_KEY = os.urandom(24) diff --git a/jobs/update-legal-filings/devops/gcp/clouddeploy-targets.yaml b/jobs/update-legal-filings/devops/gcp/clouddeploy-targets.yaml new file mode 100644 index 0000000000..95087b2a9b --- /dev/null +++ b/jobs/update-legal-filings/devops/gcp/clouddeploy-targets.yaml @@ -0,0 +1,102 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: dev +description: Dev Environment +deployParameters: + deploy-project-id: "a083gt-dev" + service-name: "business-update-legal-filings-dev" + container-name: "business-update-legal-filings-dev" + app-env: "dev" + cloudsql-instances: "a083gt-dev:northamerica-northeast1:businesses-db-dev" + max-scale: "1" + container-concurrency: "2" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-dev/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' +--- + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: test +description: Test Environment +deployParameters: + deploy-project-id: "a083gt-test" + service-name: "business-update-legal-filings-test" + container-name: "business-update-legal-filings-test" + app-env: "test" + cloudsql-instances: "a083gt-test:northamerica-northeast1:businesses-db-test" + max-scale: "2" + container-concurrency: "3" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-test/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' +--- + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: sandbox +description: Sandbox Environment +requireApproval: true +deployParameters: + deploy-project-id: "a083gt-integration" + service-name: "business-update-legal-filings-sandbox" + container-name: "business-update-legal-filings-sandbox" + app-env: "sandbox" + cloudsql-instances: "a083gt-integration:northamerica-northeast1:businesses-db-sandbox" + max-scale: "3" + container-concurrency: "7" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-integration/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' +--- + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: prod +description: Production Environment +requireApproval: true +deployParameters: + deploy-project-id: "a083gt-prod" + service-name: "business-update-legal-filings-prod" + container-name: "business-update-legal-filings-prod" + app-env: "production" + cloudsql-instances: "a083gt-prod:northamerica-northeast1:businesses-db-prod" + max-scale: "3" + container-concurrency: "7" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-prod/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' \ No newline at end of file diff --git a/jobs/update-legal-filings/devops/vaults.gcp.env b/jobs/update-legal-filings/devops/vaults.gcp.env new file mode 100644 index 0000000000..0e740c602f --- /dev/null +++ b/jobs/update-legal-filings/devops/vaults.gcp.env @@ -0,0 +1,13 @@ +KEYCLOAK_TIMEOUT="op://entity/$APP_ENV/business-api/KEYCLOAK_TIMEOUT" +KEYCLOAK_AUTH_TOKEN_URL="op://keycloak/$APP_ENV/base/KEYCLOAK_AUTH_TOKEN_URL" +KEYCLOAK_CLIENT_ID="op://keycloak/$APP_ENV/entity-service-account/ENTITY_SERVICE_ACCOUNT_CLIENT_ID" +KEYCLOAK_CLIENT_SECRET="op://keycloak/$APP_ENV/entity-service-account/ENTITY_SERVICE_ACCOUNT_CLIENT_SECRET" +COLIN_API_URL="op://API/$APP_ENV/colin-api-entity/COLIN_API_URL" +COLIN_API_VERSION="op://API/$APP_ENV/colin-api-entity/COLIN_API_VERSION" +BUSINESS_API_URL="op://API/$APP_ENV/business-api/BUSINESS_API_URL" +BUSINESS_API_VERSION2="op://API/$APP_ENV/business-api/BUSINESS_API_VERSION_2" +AUDIENCE=op://gcp-queue/$APP_ENV/payment/AUDIENCE" +TOPIC_NAME=op://gcp-queue/$APP_ENV/payment/TOPIC_NAME" +PUBLISHER_AUDIENCE=op://gcp-queue/$APP_ENV/payment/PUBLISHER_AUDIENCE" +GCP_AUTH_KEY=op://gcp-queue/$APP_ENV/payment/GCP_AUTH_KEY" +SENTRY_DSN="" \ No newline at end of file diff --git a/jobs/update-legal-filings/devops/vaults.json b/jobs/update-legal-filings/devops/vaults.json deleted file mode 100644 index ff693d1c2b..0000000000 --- a/jobs/update-legal-filings/devops/vaults.json +++ /dev/null @@ -1,10 +0,0 @@ -[ - { - "vault": "entity", - "application": [ - "filings-jobs", - "entity-service-account", - "sentry" - ] - } -] diff --git a/jobs/update-legal-filings/poetry.lock b/jobs/update-legal-filings/poetry.lock index 7e39e61f1d..c66d0e4c09 100644 --- a/jobs/update-legal-filings/poetry.lock +++ b/jobs/update-legal-filings/poetry.lock @@ -292,7 +292,7 @@ Werkzeug = "*" [package.source] type = "git" url = "https://github.com/bcgov/lear.git" -reference = "dev_legal_name_changes" +reference = "feature-legal-name" resolved_reference = "a1bb9d7ea9228d7397c3f6db1b95773ee8250917" subdirectory = "colin-api" @@ -1046,18 +1046,18 @@ pycountry = "^22.3.5" pydantic = "^1.10.8" PyPDF2 = "^3.0.1" python-dotenv = "^1.0.0" -registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", branch = "dev_legal_name_changes"} +registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", branch = "feature-legal-name"} reportlab = "^4.0.0" requests = "^2.31.0" sentry-sdk = "^1.24.0" -sql-versioning = {git = "https://github.com/bcgov/lear.git", branch = "dev_legal_name_changes", subdirectory = "python/common/sql-versioning"} +sql-versioning = {git = "https://github.com/bcgov/lear.git", branch = "feature-legal-name", subdirectory = "python/common/sql-versioning"} sqlalchemy-continuum = "^1.3.14" strict-rfc3339 = "^0.7" [package.source] type = "git" url = "https://github.com/bcgov/lear.git" -reference = "dev_legal_name_changes" +reference = "feature-legal-name" resolved_reference = "a1bb9d7ea9228d7397c3f6db1b95773ee8250917" subdirectory = "legal-api" @@ -1790,7 +1790,7 @@ strict-rfc3339 = "*" [package.source] type = "git" url = "https://github.com/bcgov/business-schemas.git" -reference = "dev_legal_name_changes" +reference = "feature-legal-name" resolved_reference = "46fe42057ce8b8f7136ea2817b044b3a58d6939e" [[package]] @@ -2104,7 +2104,7 @@ develop = false [package.source] type = "git" url = "https://github.com/bcgov/lear.git" -reference = "dev_legal_name_changes" +reference = "feature-legal-name" resolved_reference = "a1bb9d7ea9228d7397c3f6db1b95773ee8250917" subdirectory = "python/common/sql-versioning" diff --git a/jobs/update-legal-filings/pyproject.toml b/jobs/update-legal-filings/pyproject.toml index f8a6973f37..0b49358a69 100644 --- a/jobs/update-legal-filings/pyproject.toml +++ b/jobs/update-legal-filings/pyproject.toml @@ -35,9 +35,9 @@ urllib3 = "^1.22.0" google-auth = "^2.21.0" google-cloud-pubsub = "^2.17.1" simple_cloudevent = { git = "https://github.com/daxiom/simple-cloudevent.py" } -colin_api = { git = "https://github.com/bcgov/lear.git", subdirectory = "colin-api", branch = "dev_legal_name_changes" } -legal_api = { git = "https://github.com/bcgov/lear.git", subdirectory = "legal-api", branch = "dev_legal_name_changes" } -registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", branch = "dev_legal_name_changes"} +colin_api = { git = "https://github.com/bcgov/lear.git", subdirectory = "colin-api", branch = "feature-legal-name" } +legal_api = { git = "https://github.com/bcgov/lear.git", subdirectory = "legal-api", branch = "feature-legal-name" } +registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", branch = "feature-legal-name"} [tool.poetry.group.dev.dependencies] pytest = "^7.4.2" diff --git a/legal-api/devops/gcp/clouddeploy-targets.yaml b/legal-api/devops/gcp/clouddeploy-targets.yaml new file mode 100644 index 0000000000..b3e41510e5 --- /dev/null +++ b/legal-api/devops/gcp/clouddeploy-targets.yaml @@ -0,0 +1,102 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: dev +description: Dev Environment +deployParameters: + deploy-project-id: "a083gt-dev" + service-name: "business-api-dev" + container-name: "business-api-dev" + app-env: "dev" + cloudsql-instances: "a083gt-dev:northamerica-northeast1:businesses-db-dev" + max-scale: "5" + container-concurrency: "2" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-dev/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' +--- + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: test +description: Test Environment +deployParameters: + deploy-project-id: "a083gt-test" + service-name: "business-api-test" + container-name: "business-api-test" + app-env: "test" + cloudsql-instances: "a083gt-test:northamerica-northeast1:businesses-db-test" + max-scale: "5" + container-concurrency: "2" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-test/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' +--- + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: sandbox +description: Sandbox Environment +requireApproval: true +deployParameters: + deploy-project-id: "a083gt-integration" + service-name: "business-api-sandbox" + container-name: "business-api-sandbox" + app-env: "sandbox" + cloudsql-instances: "a083gt-integration:northamerica-northeast1:businesses-db-sandbox" + max-scale: "5" + container-concurrency: "20" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-integration/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' +--- + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: prod +description: Production Environment +requireApproval: true +deployParameters: + deploy-project-id: "a083gt-prod" + service-name: "business-api-prod" + container-name: "business-api-prod" + app-env: "production" + cloudsql-instances: "a083gt-prod:northamerica-northeast1:businesses-db-prod" + max-scale: "10" + container-concurrency: "20" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-prod/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' \ No newline at end of file diff --git a/legal-api/devops/vaults.gcp.env b/legal-api/devops/vaults.gcp.env new file mode 100644 index 0000000000..9cba8e36ae --- /dev/null +++ b/legal-api/devops/vaults.gcp.env @@ -0,0 +1,57 @@ +GO_LIVE_DATE="op://entity/$APP_ENV/business-api/GO_LIVE_DATE" +GUNICORN_PROCESSES="op://entity/$APP_ENV/business-api/GUNICORN_PROCESSES" +GUNICORN_THREADS="op://entity/$APP_ENV/business-api/GUNICORN_THREADS" +KEYCLOAK_TIMEOUT="op://entity/$APP_ENV/business-api/KEYCLOAK_TIMEOUT" +WS_ALLOWED_ORIGINS="op://entity/$APP_ENV/business-api/WS_ALLOWED_ORIGINS" +NAICS_YEAR="op://entity/$APP_ENV/business-api/NAICS_YEAR" +NAICS_VERSION="op://entity/$APP_ENV/business-api/NAICS_VERSION" +LEGISLATIVE_TIMEZONE="op://entity/$APP_ENV/business-api/LEGISLATIVE_TIMEZONE" +DATABASE_NAME="op://database/$APP_ENV/business-db/DATABASE_NAME" +DATABASE_PASSWORD="op://database/$APP_ENV/business-db/DATABASE_PASSWORD" +DATABASE_PORT="op://database/$APP_ENV/business-db/DATABASE_PORT" +DATABASE_UNIX_SOCKET="op://database/$APP_ENV/business-db/DATABASE_UNIX_SOCKET" +DATABASE_USERNAME="op://database/$APP_ENV/business-db/DATABASE_USERNAME" +JWT_OIDC_JWKS_CACHE_TIMEOUT="op://keycloak/$APP_ENV/jwt-base/JWT_OIDC_JWKS_CACHE_TIMEOUT" +JWT_OIDC_WELL_KNOWN_CONFIG="op://keycloak/$APP_ENV/jwt-base/JWT_OIDC_WELL_KNOWN_CONFIG" +JWT_OIDC_ISSUER="op://keycloak/$APP_ENV/jwt-base/JWT_OIDC_ISSUER" +JWT_OIDC_JWKS_CACHE_TIMEOUT="op://keycloak/$APP_ENV/jwt-base/JWT_OIDC_JWKS_CACHE_TIMEOUT" +JWT_OIDC_CACHING_ENABLED="op://keycloak/$APP_ENV/jwt-base/JWT_OIDC_CACHING_ENABLED" +JWT_OIDC_ALGORITHMS="op://keycloak/$APP_ENV/jwt-base/JWT_OIDC_ALGORITHMS" +KEYCLOAK_AUTH_TOKEN_URL="op://keycloak/$APP_ENV/base/KEYCLOAK_AUTH_TOKEN_URL" +KEYCLOAK_CLIENT_ID="op://keycloak/$APP_ENV/entity-service-account/ENTITY_SERVICE_ACCOUNT_CLIENT_ID" +KEYCLOAK_CLIENT_SECRET="op://keycloak/$APP_ENV/entity-service-account/ENTITY_SERVICE_ACCOUNT_CLIENT_SECRET" +MINIO_ENDPOINT="op://minio/$APP_ENV/base/MINIO_ENDPOINT" +MINIO_ACCESS_KEY="op://minio/$APP_ENV/base/MINIO_ACCESS_KEY" +MINIO_ACCESS_SECRET="op://minio/$APP_ENV/base/MINIO_ACCESS_SECRET" +MINIO_BUCKET_BUSINESSES="op://minio/$APP_ENV/lear/MINIO_BUCKET_BUSINESSES" +AUTH_API_URL="op://API/$APP_ENV/auth-api/AUTH_API_URL" +AUTH_API_VERSION="op://API/$APP_ENV/auth-api/AUTH_API_VERSION" +NAMEX_API_URL="op://API/$APP_ENV/namex-api/NAMEX_API_URL" +NAMEX_API_VERSION="op://API/$APP_ENV/namex-api/NAMEX_API_VERSION" +BUSINESS_API_URL="op://API/$APP_ENV/business-api/BUSINESS_API_URL" +BUSINESS_API_VERSION2="op://API/$APP_ENV/business-api/BUSINESS_API_VERSION_2" +PAY_API_URL="op://API/$APP_ENV/pay-api/PAY_API_URL" +PAY_API_VERSION="op://API/$APP_ENV/pay-api/PAY_API_VERSION" +REPORT_API_URL="op://API/$APP_ENV/report-api/REPORT_API_URL" +REPORT_API_VERSION="op://API/$APP_ENV/report-api/REPORT_API_VERSION" +ACA_PY_ADMIN_API_URL="op://bbdc/$APP_ENV/aca-py/ACA_PY_ADMIN_API_URL" +ACA_PY_ADMIN_API_KEY="op://bbdc/$APP_ENV/aca-py/ACA_PY_ADMIN_API_KEY" +ACA_PY_ENTITY_DID="op://bbdc/$APP_ENV/aca-py/ACA_PY_ENTITY_DID" +TRACTION_API_URL="op://bbdc/$APP_ENV/aca-py/TRACTION_API_URL" +TRACTION_PUBLIC_SCHEMA_DID="op://bbdc/$APP_ENV/aca-py/TRACTION_PUBLIC_SCHEMA_DID" +TRACTION_PUBLIC_ISSUER_DID="op://bbdc/$APP_ENV/aca-py/TRACTION_PUBLIC_ISSUER_DID" +TRACTION_TENANT_ID="op://bbdc/$APP_ENV/aca-py/TRACTION_TENANT_ID" +TRACTION_API_KEY="op://bbdc/$APP_ENV/aca-py/TRACTION_API_KEY" +BUSINESS_SCHEMA_NAME="op://bbdc/$APP_ENV/aca-py/BUSINESS_SCHEMA_NAME" +BUSINESS_SCHEMA_VERSION="op://bbdc/$APP_ENV/aca-py/BUSINESS_SCHEMA_VERSION" +BUSINESS_SCHEMA_ID="op://bbdc/$APP_ENV/aca-py/BUSINESS_SCHEMA_ID" +BUSINESS_CRED_DEF_ID="op://bbdc/$APP_ENV/aca-py/BUSINESS_CRED_DEF_ID" +NATS_SERVERS="op://nats/$APP_ENV/base/NATS_SERVERS" +NATS_CLUSTER_ID="op://nats/$APP_ENV/base/NATS_CLUSTER_ID" +NATS_QUEUE="op://nats/$APP_ENV/nats-filer/NATS_QUEUE" +NATS_CLIENT_NAME="op://nats/$APP_ENV/nats-filer/NATS_CLIENT_NAME" +NATS_FILER_SUBJECT="op://nats/$APP_ENV/nats-filer/NATS_FILER_SUBJECT" +NATS_ENTITY_EVENT_SUBJECT="op://nats/$APP_ENV/nats-filer/NATS_ENTITY_EVENT_SUBJECT" +NATS_EMAILER_SUBJECT="op://nats/$APP_ENV/nats-emailer/NATS_EMAILER_SUBJECT" +BUSINESS_LD_SDK_KEY="op://launchdarkly/$APP_ENV/business-api/BUSINESS_API_LD_SDK_KEY" +SENTRY_DSN="" \ No newline at end of file diff --git a/legal-api/devops/vaults.json b/legal-api/devops/vaults.json deleted file mode 100644 index ad9ca75e3b..0000000000 --- a/legal-api/devops/vaults.json +++ /dev/null @@ -1,34 +0,0 @@ -[ - { - "vault": "shared", - "application": [ - "nats", - "naics" - ] - }, - { - "vault": "minio", - "application": [ - "base", - "lear" - ] - }, - { - "vault": "bbdc", - "application": [ - "aca-py" - ] - }, - { - "vault": "entity", - "application": [ - "jwt", - "postgres-legal", - "legal-api", - "nats-filer", - "entity-service-account", - "launchdarkly", - "sentry" - ] - } -] diff --git a/legal-api/k8s/Readme.md b/legal-api/k8s/Readme.md deleted file mode 100644 index b612d864ca..0000000000 --- a/legal-api/k8s/Readme.md +++ /dev/null @@ -1,8 +0,0 @@ - -# buildconfig -oc process -f openshift/templates/bc.yaml -o yaml | oc apply -f - -n cc892f-tools -# deploymentconfig, service and route -oc process -f openshift/templates/dc.yaml -o yaml | oc apply -f - -n cc892f-dev -oc process -f openshift/templates/dc.yaml -p TAG=test -p APPLICATION_DOMAIN=legal-api-test.apps.silver.devops.gov.bc.ca -o yaml | oc apply -f - -n cc892f-test -oc process -f openshift/templates/dc.yaml -p TAG=prod -p APPLICATION_DOMAIN=legal-api.apps.silver.devops.gov.bc.ca -o yaml | oc apply -f - -n cc892f-prod - diff --git a/legal-api/k8s/templates/bc.yaml b/legal-api/k8s/templates/bc.yaml deleted file mode 100644 index b9f50bfc9f..0000000000 --- a/legal-api/k8s/templates/bc.yaml +++ /dev/null @@ -1,122 +0,0 @@ -apiVersion: template.openshift.io/v1 -kind: Template -metadata: - labels: - app: ${NAME} - name: ${NAME}-build -objects: -- apiVersion: v1 - kind: ImageStream - metadata: - name: ${NAME} - labels: - app: ${NAME} -- apiVersion: v1 - kind: BuildConfig - metadata: - name: ${NAME} - labels: - app: ${NAME} - spec: - output: - to: - kind: ImageStreamTag - name: ${NAME}:${OUTPUT_IMAGE_TAG} - resources: - limits: - cpu: ${CPU_LIMIT} - memory: ${MEMORY_LIMIT} - requests: - cpu: ${CPU_REQUEST} - memory: ${MEMORY_REQUEST} - runPolicy: Serial - source: - contextDir: ${SOURCE_CONTEXT_DIR} - git: - ref: ${GIT_REF} - uri: ${GIT_REPO_URL} - dockerfile: | - FROM docker-remote.artifacts.developer.gov.bc.ca/python:3.8.5-buster - USER root - - # Create working directory - RUN mkdir /opt/app-root && chmod 755 /opt/app-root - WORKDIR /opt/app-root - - # Install the requirements - COPY ./requirements.txt . - - RUN pip install --upgrade pip - RUN pip install --no-cache-dir -r requirements.txt - - COPY . . - - RUN pip install . - - USER 1001 - - # Set Python path - ENV PYTHONPATH=/opt/app-root/src - - EXPOSE 8080 - - CMD ["gunicorn", "--bind", "0.0.0.0:8080", "--config", "/opt/app-root/gunicorn_config.py", "wsgi:application"] - type: Git - strategy: - type: Docker - dockerStrategy: - pullSecret: - name: artifactory-creds - - triggers: - - type: ConfigChange -parameters: -- description: | - The name assigned to all of the objects defined in this template. - You should keep this as default unless your know what your doing. - displayName: Name - name: NAME - required: true - value: legal-api -- description: | - The URL to your GIT repo, don't use the this default unless - your just experimenting. - displayName: Git Repo URL - name: GIT_REPO_URL - required: true - value: https://github.com/bcgov/lear.git -- description: The git reference or branch. - displayName: Git Reference - name: GIT_REF - required: true - value: master -- description: The source context directory. - displayName: Source Context Directory - name: SOURCE_CONTEXT_DIR - required: false - value: legal-api -- description: The tag given to the built image. - displayName: Output Image Tag - name: OUTPUT_IMAGE_TAG - required: true - value: latest -- description: The resources CPU limit (in cores) for this build. - displayName: Resources CPU Limit - name: CPU_LIMIT - required: true - value: "2" -- description: The resources Memory limit (in Mi, Gi, etc) for this build. - displayName: Resources Memory Limit - name: MEMORY_LIMIT - required: true - value: 2Gi -- description: The resources CPU request (in cores) for this build. - displayName: Resources CPU Request - name: CPU_REQUEST - required: true - value: "1" -- description: The resources Memory request (in Mi, Gi, etc) for this build. - displayName: Resources Memory Request - name: MEMORY_REQUEST - required: true - value: 2Gi diff --git a/legal-api/k8s/templates/dc.yaml b/legal-api/k8s/templates/dc.yaml deleted file mode 100644 index c7bab28af5..0000000000 --- a/legal-api/k8s/templates/dc.yaml +++ /dev/null @@ -1,222 +0,0 @@ ---- -kind: Template -apiVersion: v1 -metadata: - name: ${NAME}-${TAG}-deployment-template - annotations: - description: - Deployment template for an API application and connect to database. - tags: Flask - iconClass: icon-python -objects: - - kind: Service - apiVersion: v1 - metadata: - name: ${NAME}-${TAG} - labels: - name: ${NAME} - environment: ${TAG} - role: ${ROLE} - annotations: - description: Exposes and load balances the application pods - service.alpha.openshift.io/dependencies: "[{name: ${DB_NAME}-${TAG}, kind: Service}]" - spec: - ports: - - name: ${NAME}-${TAG}-tcp - port: 8080 - targetPort: 8080 - selector: - name: ${NAME} - environment: ${TAG} - - - kind: Route - apiVersion: v1 - metadata: - name: ${NAME}-${TAG} - labels: - name: ${NAME} - environment: ${TAG} - role: ${ROLE} - annotations: - haproxy.router.openshift.io/ip_whitelist: ${ALLOW_LIST} - spec: - host: ${APPLICATION_DOMAIN} - tls: - insecureEdgeTerminationPolicy: Redirect - termination: edge - port: - targetPort: ${NAME}-${TAG}-tcp - to: - kind: Service - name: ${NAME}-${TAG} - weight: 100 - - - kind: DeploymentConfig - apiVersion: v1 - metadata: - name: ${NAME}-${TAG} - labels: - name: ${NAME} - environment: ${TAG} - role: ${ROLE} - annotations: - description: Defines how to deploy the application server - spec: - strategy: - rollingParams: - intervalSeconds: 1 - maxSurge: 25% - maxUnavailable: 25% - pre: - execNewPod: - command: - - /opt/app-root/pre-hook-update-db.sh - containerName: ${NAME}-${TAG} - failurePolicy: Abort - timeoutSeconds: 600 - updatePeriodSeconds: 1 - type: Rolling - triggers: - - type: ImageChange - imageChangeParams: - automatic: true - containerNames: - - ${NAME}-${TAG} - from: - kind: ImageStreamTag - namespace: ${NAMESPACE}-${IMAGE_NAMESPACE} - name: ${NAME}:${TAG} - replicas: 1 - selector: - name: ${NAME} - environment: ${TAG} - template: - metadata: - name: ${NAME}-${TAG} - labels: - name: ${NAME} - environment: ${TAG} - role: ${ROLE} - spec: - containers: - - name: ${NAME}-${TAG} - image: ${IMAGE_REGISTRY}/${NAMESPACE}-${IMAGE_NAMESPACE}/${NAME}:${TAG} - ports: - - containerPort: 8080 - protocol: TCP - readinessProbe: - initialDelaySeconds: 3 - timeoutSeconds: 30 - httpGet: - path: /ops/readyz - port: 8080 - livenessProbe: - initialDelaySeconds: 120 - timeoutSeconds: 30 - httpGet: - path: /ops/healthz - port: 8080 - - - kind: HorizontalPodAutoscaler - apiVersion: autoscaling/v1 - metadata: - name: ${NAME}-${TAG} - labels: - name: ${NAME} - environment: ${TAG} - role: ${ROLE} - spec: - scaleTargetRef: - kind: DeploymentConfig - name: ${NAME}-${TAG} - minReplicas: ${{MIN_REPLICAS}} - maxReplicas: ${{MAX_REPLICAS}} - -parameters: - - name: NAME - displayName: Name - description: The name assigned to all of the OpenShift resources associated to the server instance. - required: true - value: legal-api - - - name: TAG - displayName: Environment TAG name - description: The TAG name for this environment, e.g., dev, test, prod - value: dev - required: true - - - name: ROLE - displayName: Role - description: Role - required: true - value: api - - - name: NAMESPACE - displayName: Namespace Name - description: The base namespace name for the project. - required: true - value: cc892f - - - name: IMAGE_NAMESPACE - displayName: Image Namespace - required: true - description: The namespace of the OpenShift project containing the imagestream for the application. - value: tools - - - name: IMAGE_REGISTRY - displayName: Image Registry - required: true - description: The image registry of the OpenShift project. - value: image-registry.openshift-image-registry.svc:5000 - - - name: DB_NAME - displayName: Database Service Name - description: The name of the database server/service. - required: true - value: postgresql - - - name: APPLICATION_DOMAIN - displayName: Application Domain - description: The endpoint used for routing access to the application. - value: legal-api-dev.apps.silver.devops.gov.bc.ca - - - name: ALLOW_LIST - displayName: Allow List - description: The allow list containing all of the trusted source IPs. - required: false - - - name: MIN_REPLICAS - displayName: Minimum Replicas - description: The minimum number of pods to have running. - required: true - value: "1" - - - name: MAX_REPLICAS - displayName: Maximum Replicas - description: The maximum number of pods to have running. - required: true - value: "1" - - - name: CPU_REQUEST - displayName: Resources CPU Request - description: The resources CPU request (in cores) for this build. - required: true - value: 10m - - - name: CPU_LIMIT - displayName: Resources CPU Limit - description: The resources CPU limit (in cores) for this build. - required: true - value: 500m - - - name: MEMORY_REQUEST - displayName: Resources Memory Request - description: The resources Memory request (in Mi, Gi, etc) for this build. - required: true - value: 10Mi - - - name: MEMORY_LIMIT - displayName: Resources Memory Limit - description: The resources Memory limit (in Mi, Gi, etc) for this build. - required: true - value: 1Gi diff --git a/legal-api/poetry.lock b/legal-api/poetry.lock index a50cd9dc6e..94e9e6884e 100644 --- a/legal-api/poetry.lock +++ b/legal-api/poetry.lock @@ -1442,7 +1442,7 @@ strict-rfc3339 = "*" [package.source] type = "git" url = "https://github.com/bcgov/business-schemas.git" -reference = "dev_legal_name_changes" +reference = "feature-legal-name" resolved_reference = "46fe42057ce8b8f7136ea2817b044b3a58d6939e" [[package]] @@ -1764,7 +1764,7 @@ develop = false [package.source] type = "git" url = "https://github.com/bcgov/lear.git" -reference = "dev_legal_name_changes" +reference = "feature-legal-name" resolved_reference = "ff4f152c9f934311a9605e0690a6ee033754a8de" subdirectory = "python/common/sql-versioning" diff --git a/legal-api/pyproject.toml b/legal-api/pyproject.toml index ad7387a7a0..eb3516d6cd 100644 --- a/legal-api/pyproject.toml +++ b/legal-api/pyproject.toml @@ -35,8 +35,8 @@ strict-rfc3339 = "^0.7" minio = "^7.1.15" html-sanitizer = "^1.9.3" #registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", rev = "2.18.10"} -registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", branch = "dev_legal_name_changes"} -sql-versioning = { git = "https://github.com/bcgov/lear.git", subdirectory = "python/common/sql-versioning", branch = "dev_legal_name_changes" } +registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", branch = "feature-legal-name"} +sql-versioning = { git = "https://github.com/bcgov/lear.git", subdirectory = "python/common/sql-versioning", branch = "feature-legal-name" } sentry-sdk = "^1.24.0" sqlalchemy-continuum = "^1.3.14" diff --git a/legal-api/scripts/manual_db_scripts/legal_name_change/README.md b/legal-api/scripts/manual_db_scripts/legal_name_change/README.md index 064f83c6ae..56ef262378 100644 --- a/legal-api/scripts/manual_db_scripts/legal_name_change/README.md +++ b/legal-api/scripts/manual_db_scripts/legal_name_change/README.md @@ -17,7 +17,7 @@ The following will serve as steps required to get the LEAR database model and da A successful run will look like the following: ``` bash -(legal-api-py3.10) argus@Argus-Mac-Studio ~/h3/git/bcreg/lear/legal-api (dev_legal_name_changes) $ dbshell /Users/argus/h3/git/bcreg/lear/legal-api/scripts/manual_db_scripts/legal_name_change/transfer_to_new_lear.sql +(legal-api-py3.10) argus@Argus-Mac-Studio ~/h3/git/bcreg/lear/legal-api (feature-legal-name) $ dbshell /Users/argus/h3/git/bcreg/lear/legal-api/scripts/manual_db_scripts/legal_name_change/transfer_to_new_lear.sql DbShell 1.3.2 Build #210311 Type 'help' for a list of commands. @@ -71,4 +71,3 @@ Done 1. Run `/legal-api/scripts/manual_db_scripts/legal_name_change/legal_name_updates.sql` against new LEAR db 2. Cleanup temporary artifacts and states created by data transfer scripts. Run `/legal-api/scripts/manual_db_scripts/legal_name_change/transfer_to_new_lear_after.sql` against new LEAR db - diff --git a/legal-api/src/legal_api/config.py b/legal-api/src/legal_api/config.py index 283dc81b81..87d046cddf 100644 --- a/legal-api/src/legal_api/config.py +++ b/legal-api/src/legal_api/config.py @@ -1,13 +1,13 @@ # Copyright © 2019 Province of British Columbia # -# Licensed under the Apache License, Version 2.0 (the 'License'); +# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an 'AS IS' BASIS, +# distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. @@ -29,124 +29,145 @@ load_dotenv(find_dotenv()) CONFIGURATION = { - 'development': 'legal_api.config.DevConfig', - 'testing': 'legal_api.config.TestConfig', - 'production': 'legal_api.config.ProdConfig', - 'default': 'legal_api.config.ProdConfig' + "development": "legal_api.config.DevConfig", + "testing": "legal_api.config.TestConfig", + "production": "legal_api.config.ProdConfig", + "default": "legal_api.config.ProdConfig", } -def get_named_config(config_name: str = 'production'): +def get_named_config(config_name: str = "production"): """Return the configuration object based on the name. :raise: KeyError: if an unknown configuration is requested """ - if config_name in ['production', 'staging', 'default']: + if config_name in ["production", "staging", "default"]: config = ProdConfig() - elif config_name == 'testing': + elif config_name == "testing": config = TestConfig() - elif config_name == 'development': + elif config_name == "development": config = DevConfig() else: - raise KeyError(f'Unknown configuration: {config_name}') + raise KeyError(f"Unknown configuration: {config_name}") return config -class _Config(): # pylint: disable=too-few-public-methods +class _Config: # pylint: disable=too-few-public-methods """Base class configuration that should set reasonable defaults. Used as the base for all the other configurations. """ PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__)) + SECRET_KEY = "a secret" - LEGAL_API_BASE_URL = os.getenv('LEGAL_API_BASE_URL', 'https://LEGAL_API_BASE_URL/api/v1/businesses') - PAYMENT_SVC_URL = os.getenv('PAYMENT_SVC_URL', 'http://PAYMENT_BASE/api/v1/payment-request') - AUTH_SVC_URL = os.getenv('AUTH_SVC_URL', 'http://') - REPORT_SVC_URL = os.getenv('REPORT_SVC_URL', 'http://') - REPORT_TEMPLATE_PATH = os.getenv('REPORT_PATH', 'report-templates') - FONTS_PATH = os.getenv('FONTS_PATH', 'fonts') - - GO_LIVE_DATE = os.getenv('GO_LIVE_DATE') - - SENTRY_DSN = os.getenv('SENTRY_DSN', None) - LD_SDK_KEY = os.getenv('LD_SDK_KEY', None) - SECRET_KEY = 'a secret' + GO_LIVE_DATE = os.getenv("GO_LIVE_DATE") SQLALCHEMY_TRACK_MODIFICATIONS = False - ALEMBIC_INI = 'migrations/alembic.ini' + ALEMBIC_INI = "migrations/alembic.ini" # POSTGRESQL - DB_USER = os.getenv('DATABASE_USERNAME', '') - DB_PASSWORD = os.getenv('DATABASE_PASSWORD', '') - DB_NAME = os.getenv('DATABASE_NAME', '') - DB_HOST = os.getenv('DATABASE_HOST', '') - DB_PORT = os.getenv('DATABASE_PORT', '5432') + DB_USER = os.getenv("DATABASE_USERNAME", "") + DB_PASSWORD = os.getenv("DATABASE_PASSWORD", "") + DB_NAME = os.getenv("DATABASE_NAME", "") + DB_HOST = os.getenv("DATABASE_HOST", "") + DB_PORT = os.getenv("DATABASE_PORT", "5432") # POSTGRESQL - if DB_UNIX_SOCKET := os.getenv('DATABASE_UNIX_SOCKET', None): - SQLALCHEMY_DATABASE_URI = f'postgresql+psycopg2://{DB_USER}:{DB_PASSWORD}@/{DB_NAME}?host={DB_UNIX_SOCKET}' + if DB_UNIX_SOCKET := os.getenv("DATABASE_UNIX_SOCKET", None): + SQLALCHEMY_DATABASE_URI = f"postgresql+pg8000://{DB_USER}:{DB_PASSWORD}@/{DB_NAME}?unix_sock={DB_UNIX_SOCKET}/.s.PGSQL.5432" else: - SQLALCHEMY_DATABASE_URI = f'postgresql://{DB_USER}:{DB_PASSWORD}@{DB_HOST}:{DB_PORT}/{DB_NAME}' + SQLALCHEMY_DATABASE_URI = ( + f"postgresql+pg8000://{DB_USER}:{DB_PASSWORD}@{DB_HOST}:{DB_PORT}/{DB_NAME}" + ) # JWT_OIDC Settings - JWT_OIDC_WELL_KNOWN_CONFIG = os.getenv('JWT_OIDC_WELL_KNOWN_CONFIG') - JWT_OIDC_ALGORITHMS = os.getenv('JWT_OIDC_ALGORITHMS') - JWT_OIDC_JWKS_URI = os.getenv('JWT_OIDC_JWKS_URI') - JWT_OIDC_ISSUER = os.getenv('JWT_OIDC_ISSUER') - JWT_OIDC_AUDIENCE = os.getenv('JWT_OIDC_AUDIENCE') - JWT_OIDC_CLIENT_SECRET = os.getenv('JWT_OIDC_CLIENT_SECRET') - JWT_OIDC_CACHING_ENABLED = os.getenv('JWT_OIDC_CACHING_ENABLED') - JWT_OIDC_USERNAME = os.getenv('JWT_OIDC_USERNAME', 'username') - JWT_OIDC_FIRSTNAME = os.getenv('JWT_OIDC_FIRSTNAME', 'firstname') - JWT_OIDC_LASTNAME = os.getenv('JWT_OIDC_LASTNAME', 'lastname') + JWT_OIDC_WELL_KNOWN_CONFIG = os.getenv("JWT_OIDC_WELL_KNOWN_CONFIG") + JWT_OIDC_ALGORITHMS = os.getenv("JWT_OIDC_ALGORITHMS") + JWT_OIDC_JWKS_URI = os.getenv("JWT_OIDC_JWKS_URI") + JWT_OIDC_ISSUER = os.getenv("JWT_OIDC_ISSUER") + JWT_OIDC_AUDIENCE = os.getenv("KEYCLOAK_CLIENT_ID") + JWT_OIDC_CLIENT_SECRET = os.getenv("JWT_OIDC_CLIENT_SECRET") + JWT_OIDC_CACHING_ENABLED = os.getenv("KEYCLOAK_CLIENT_SECRET") + JWT_OIDC_USERNAME = os.getenv("JWT_OIDC_USERNAME", "username") + JWT_OIDC_FIRSTNAME = os.getenv("JWT_OIDC_FIRSTNAME", "firstname") + JWT_OIDC_LASTNAME = os.getenv("JWT_OIDC_LASTNAME", "lastname") try: - JWT_OIDC_JWKS_CACHE_TIMEOUT = int(os.getenv('JWT_OIDC_JWKS_CACHE_TIMEOUT')) + JWT_OIDC_JWKS_CACHE_TIMEOUT = int(os.getenv("JWT_OIDC_JWKS_CACHE_TIMEOUT")) if not JWT_OIDC_JWKS_CACHE_TIMEOUT: JWT_OIDC_JWKS_CACHE_TIMEOUT = 300 except (TypeError, ValueError): JWT_OIDC_JWKS_CACHE_TIMEOUT = 300 - # NATS / STAN - NATS_SERVERS = os.getenv('NATS_SERVERS') - NATS_CLIENT_NAME = os.getenv('NATS_CLIENT_NAME', 'entity.legal_api') - NATS_CLUSTER_ID = os.getenv('NATS_CLUSTER_ID', 'test-cluster') - NATS_FILER_SUBJECT = os.getenv('NATS_FILER_SUBJECT', 'entity.filing.filer') - NATS_ENTITY_EVENT_SUBJECT = os.getenv('NATS_ENTITY_EVENT_SUBJECT', 'entity.events') - NATS_EMAILER_SUBJECT = os.getenv('NATS_EMAILER_SUBJECT', 'entity.email') - NATS_QUEUE = os.getenv('NATS_QUEUE', 'entity-filer-worker') + # API Endpoints + AUTH_API_URL = os.getenv("AUTH_API_URL", "") + AUTH_API_VERSION = os.getenv("AUTH_API_VERSION", "") + BUSINESS_API_URL = os.getenv("BUSINESS_API_URL", "") + BUSINESS_API_VERSION_2 = os.getenv("BUSINESS_API_VERSION2", "") + NAMEX_API_URL = os.getenv("NAMEX_API_URL", "") + NAMEX_API_VERSION = os.getenv("NAMEX_API_VERSION", "") + PAY_API_URL = os.getenv("PAY_API_URL", "") + PAY_API_VERSION = os.getenv("PAY_API_VERSION", "") + REPORT_API_URL = os.getenv("REPORT_API_URL", "") + REPORT_API_VERSION = os.getenv("REPORT_API_VERSION", "") + + LEGAL_API_BASE_URL = f"{BUSINESS_API_URL + BUSINESS_API_VERSION_2}/businesses" + NAMEX_SVC_URL = f"{NAMEX_API_URL + NAMEX_API_VERSION}" + PAYMENT_SVC_URL = f"{PAY_API_URL + PAY_API_VERSION}/payment-request" + AUTH_SVC_URL = f"{AUTH_API_URL + AUTH_API_VERSION}" + REPORT_SVC_URL = f"{REPORT_API_URL + REPORT_API_VERSION}/reports" + + REPORT_TEMPLATE_PATH = os.getenv("REPORT_PATH", "report-templates") + FONTS_PATH = os.getenv("FONTS_PATH", "fonts") # NAMEX PROXY Settings - NAMEX_AUTH_SVC_URL = os.getenv('NAMEX_AUTH_SVC_URL', 'http://') - NAMEX_SERVICE_CLIENT_USERNAME = os.getenv('NAMEX_SERVICE_CLIENT_USERNAME') - NAMEX_SERVICE_CLIENT_SECRET = os.getenv('NAMEX_SERVICE_CLIENT_SECRET') - NAMEX_SVC_URL = os.getenv('NAMEX_SVC_URL', 'http://') + NAMEX_AUTH_SVC_URL = os.getenv("KEYCLOAK_AUTH_TOKEN_URL", "http://") + NAMEX_SERVICE_CLIENT_USERNAME = os.getenv("KEYCLOAK_CLIENT_ID") + NAMEX_SERVICE_CLIENT_SECRET = os.getenv("KEYCLOAK_CLIENT_SECRET") # service accounts - ACCOUNT_SVC_AUTH_URL = os.getenv('ACCOUNT_SVC_AUTH_URL') - ACCOUNT_SVC_CLIENT_ID = os.getenv('ACCOUNT_SVC_CLIENT_ID') - ACCOUNT_SVC_CLIENT_SECRET = os.getenv('ACCOUNT_SVC_CLIENT_SECRET') - ACCOUNT_SVC_TIMEOUT = os.getenv('ACCOUNT_SVC_TIMEOUT') + ACCOUNT_SVC_AUTH_URL = os.getenv("KEYCLOAK_AUTH_TOKEN_URL") + ACCOUNT_SVC_CLIENT_ID = os.getenv("KEYCLOAK_CLIENT_ID") + ACCOUNT_SVC_CLIENT_SECRET = os.getenv("KEYCLOAK_CLIENT_ID") + ACCOUNT_SVC_TIMEOUT = os.getenv("KEYCLOAK_TIMEOUT") # legislative timezone for future effective dating - LEGISLATIVE_TIMEZONE = os.getenv('LEGISLATIVE_TIMEZONE', 'America/Vancouver') + LEGISLATIVE_TIMEZONE = os.getenv("LEGISLATIVE_TIMEZONE", "America/Vancouver") # Minio configuration values - MINIO_ENDPOINT = os.getenv('MINIO_ENDPOINT') - MINIO_ACCESS_KEY = os.getenv('MINIO_ACCESS_KEY') - MINIO_ACCESS_SECRET = os.getenv('MINIO_ACCESS_SECRET') - MINIO_BUCKET_BUSINESSES = os.getenv('MINIO_BUCKET_BUSINESSES', 'businesses') + MINIO_ENDPOINT = os.getenv("MINIO_ENDPOINT") + MINIO_ACCESS_KEY = os.getenv("MINIO_ACCESS_KEY") + MINIO_ACCESS_SECRET = os.getenv("MINIO_ACCESS_SECRET") + MINIO_BUCKET_BUSINESSES = os.getenv("MINIO_BUCKET_BUSINESSES", "businesses") MINIO_SECURE = True # determines which year of NAICS data will be used to drive NAICS search - NAICS_YEAR = int(os.getenv('NAICS_YEAR', '2022')) + NAICS_YEAR = int(os.getenv("NAICS_YEAR", "2022")) # determines which version of NAICS data will be used to drive NAICS search - NAICS_VERSION = int(os.getenv('NAICS_VERSION', '1')) + NAICS_VERSION = int(os.getenv("NAICS_VERSION", "1")) + NAICS_API_URL = f"{BUSINESS_API_URL + BUSINESS_API_VERSION_2}/naics" + + ACA_PY_ADMIN_API_URL = os.getenv("ACA_PY_ADMIN_API_URL") + ACA_PY_ADMIN_API_KEY = os.getenv("ACA_PY_ADMIN_API_KEY") + ACA_PY_ENTITY_DID = os.getenv("ACA_PY_ENTITY_DID") + + # Traction ACA-Py tenant settings to issue credentials from + # TRACTION_API_URL = os.getenv("TRACTION_API_URL") + # TRACTION_TENANT_ID = os.getenv("TRACTION_TENANT_ID") + # TRACTION_API_KEY = os.getenv("TRACTION_API_KEY") + # TRACTION_PUBLIC_SCHEMA_DID = os.getenv("TRACTION_PUBLIC_SCHEMA_DID") + # TRACTION_PUBLIC_ISSUER_DID = os.getenv("TRACTION_PUBLIC_ISSUER_DID") + + # Web socket settings + # WS_ALLOWED_ORIGINS = os.getenv("WS_ALLOWED_ORIGINS") - NAICS_API_URL = os.getenv('NAICS_API_URL', 'https://NAICS_API_URL/api/v2/naics') + # Digital Business Card configuration values (required to issue credentials) + # BUSINESS_SCHEMA_NAME = os.getenv("BUSINESS_SCHEMA_NAME") + # BUSINESS_SCHEMA_VERSION = os.getenv("BUSINESS_SCHEMA_VERSION") + # BUSINESS_SCHEMA_ID = os.getenv("BUSINESS_SCHEMA_ID") + # BUSINESS_CRED_DEF_ID = os.getenv("BUSINESS_CRED_DEF_ID") - ACA_PY_ADMIN_API_URL = os.getenv('ACA_PY_ADMIN_API_URL') - ACA_PY_ADMIN_API_KEY = os.getenv('ACA_PY_ADMIN_API_KEY') - ACA_PY_ENTITY_DID = os.getenv('ACA_PY_ENTITY_DID') + SENTRY_DSN = os.getenv("SENTRY_DSN", None) + LD_SDK_KEY = os.getenv("BUSINESS_API_LD_SDK_KEY", None) TESTING = False DEBUG = False @@ -168,53 +189,55 @@ class TestConfig(_Config): # pylint: disable=too-few-public-methods DEBUG = True TESTING = True # POSTGRESQL - DB_USER = os.getenv('DATABASE_TEST_USERNAME', '') - DB_PASSWORD = os.getenv('DATABASE_TEST_PASSWORD', '') - DB_NAME = os.getenv('DATABASE_TEST_NAME', '') - DB_HOST = os.getenv('DATABASE_TEST_HOST', '') - DB_PORT = os.getenv('DATABASE_TEST_PORT', '5432') + DB_USER = os.getenv("DATABASE_TEST_USERNAME", "") + DB_PASSWORD = os.getenv("DATABASE_TEST_PASSWORD", "") + DB_NAME = os.getenv("DATABASE_TEST_NAME", "") + DB_HOST = os.getenv("DATABASE_TEST_HOST", "") + DB_PORT = os.getenv("DATABASE_TEST_PORT", "5432") # POSTGRESQL - if DB_UNIX_SOCKET := os.getenv('DATABASE_UNIX_SOCKET', None): - SQLALCHEMY_DATABASE_URI = f'postgresql+psycopg2://{DB_USER}:{DB_PASSWORD}@/{DB_NAME}?host={DB_UNIX_SOCKET}' + if DB_UNIX_SOCKET := os.getenv("DATABASE_UNIX_SOCKET", None): + SQLALCHEMY_DATABASE_URI = f"postgresql+psycopg2://{DB_USER}:{DB_PASSWORD}@/{DB_NAME}?host={DB_UNIX_SOCKET}" else: - SQLALCHEMY_DATABASE_URI = f'postgresql://{DB_USER}:{DB_PASSWORD}@{DB_HOST}:{DB_PORT}/{DB_NAME}' + SQLALCHEMY_DATABASE_URI = ( + f"postgresql://{DB_USER}:{DB_PASSWORD}@{DB_HOST}:{DB_PORT}/{DB_NAME}" + ) # URLs - AUTH_SVC_URL = os.getenv('AUTH_SVC_URL', 'http://test-auth-url') + AUTH_SVC_URL = os.getenv("AUTH_SVC_URL", "http://test-auth-url") # JWT OIDC settings # JWT_OIDC_TEST_MODE will set jwt_manager to use JWT_OIDC_TEST_MODE = True - JWT_OIDC_TEST_AUDIENCE = 'example' - JWT_OIDC_TEST_ISSUER = 'https://example.localdomain/auth/realms/example' + JWT_OIDC_TEST_AUDIENCE = "example" + JWT_OIDC_TEST_ISSUER = "https://example.localdomain/auth/realms/example" JWT_OIDC_TEST_KEYS = { - 'keys': [ + "keys": [ { - 'kid': 'flask-jwt-oidc-test-client', - 'kty': 'RSA', - 'alg': 'RS256', - 'use': 'sig', - 'n': 'AN-fWcpCyE5KPzHDjigLaSUVZI0uYrcGcc40InVtl-rQRDmAh-C2W8H4_Hxhr5VLc6crsJ2LiJTV_E72S03pzpOOaaYV6-TzAjCou2GYJIXev7f6Hh512PuG5wyxda_TlBSsI-gvphRTPsKCnPutrbiukCYrnPuWxX5_cES9eStR', # noqa: E501 - 'e': 'AQAB' + "kid": "flask-jwt-oidc-test-client", + "kty": "RSA", + "alg": "RS256", + "use": "sig", + "n": "AN-fWcpCyE5KPzHDjigLaSUVZI0uYrcGcc40InVtl-rQRDmAh-C2W8H4_Hxhr5VLc6crsJ2LiJTV_E72S03pzpOOaaYV6-TzAjCou2GYJIXev7f6Hh512PuG5wyxda_TlBSsI-gvphRTPsKCnPutrbiukCYrnPuWxX5_cES9eStR", # noqa: E501 + "e": "AQAB", } ] } JWT_OIDC_TEST_PRIVATE_KEY_JWKS = { - 'keys': [ + "keys": [ { - 'kid': 'flask-jwt-oidc-test-client', - 'kty': 'RSA', - 'alg': 'RS256', - 'use': 'sig', - 'n': 'AN-fWcpCyE5KPzHDjigLaSUVZI0uYrcGcc40InVtl-rQRDmAh-C2W8H4_Hxhr5VLc6crsJ2LiJTV_E72S03pzpOOaaYV6-TzAjCou2GYJIXev7f6Hh512PuG5wyxda_TlBSsI-gvphRTPsKCnPutrbiukCYrnPuWxX5_cES9eStR', # noqa: E501 - 'e': 'AQAB', - 'd': 'C0G3QGI6OQ6tvbCNYGCqq043YI_8MiBl7C5dqbGZmx1ewdJBhMNJPStuckhskURaDwk4-8VBW9SlvcfSJJrnZhgFMjOYSSsBtPGBIMIdM5eSKbenCCjO8Tg0BUh_xa3CHST1W4RQ5rFXadZ9AeNtaGcWj2acmXNO3DVETXAX3x0', # noqa: E501 - 'p': 'APXcusFMQNHjh6KVD_hOUIw87lvK13WkDEeeuqAydai9Ig9JKEAAfV94W6Aftka7tGgE7ulg1vo3eJoLWJ1zvKM', - 'q': 'AOjX3OnPJnk0ZFUQBwhduCweRi37I6DAdLTnhDvcPTrrNWuKPg9uGwHjzFCJgKd8KBaDQ0X1rZTZLTqi3peT43s', - 'dp': 'AN9kBoA5o6_Rl9zeqdsIdWFmv4DB5lEqlEnC7HlAP-3oo3jWFO9KQqArQL1V8w2D4aCd0uJULiC9pCP7aTHvBhc', - 'dq': 'ANtbSY6njfpPploQsF9sU26U0s7MsuLljM1E8uml8bVJE1mNsiu9MgpUvg39jEu9BtM2tDD7Y51AAIEmIQex1nM', - 'qi': 'XLE5O360x-MhsdFXx8Vwz4304-MJg-oGSJXCK_ZWYOB_FGXFRTfebxCsSYi0YwJo-oNu96bvZCuMplzRI1liZw' + "kid": "flask-jwt-oidc-test-client", + "kty": "RSA", + "alg": "RS256", + "use": "sig", + "n": "AN-fWcpCyE5KPzHDjigLaSUVZI0uYrcGcc40InVtl-rQRDmAh-C2W8H4_Hxhr5VLc6crsJ2LiJTV_E72S03pzpOOaaYV6-TzAjCou2GYJIXev7f6Hh512PuG5wyxda_TlBSsI-gvphRTPsKCnPutrbiukCYrnPuWxX5_cES9eStR", # noqa: E501 + "e": "AQAB", + "d": "C0G3QGI6OQ6tvbCNYGCqq043YI_8MiBl7C5dqbGZmx1ewdJBhMNJPStuckhskURaDwk4-8VBW9SlvcfSJJrnZhgFMjOYSSsBtPGBIMIdM5eSKbenCCjO8Tg0BUh_xa3CHST1W4RQ5rFXadZ9AeNtaGcWj2acmXNO3DVETXAX3x0", # noqa: E501 + "p": "APXcusFMQNHjh6KVD_hOUIw87lvK13WkDEeeuqAydai9Ig9JKEAAfV94W6Aftka7tGgE7ulg1vo3eJoLWJ1zvKM", + "q": "AOjX3OnPJnk0ZFUQBwhduCweRi37I6DAdLTnhDvcPTrrNWuKPg9uGwHjzFCJgKd8KBaDQ0X1rZTZLTqi3peT43s", + "dp": "AN9kBoA5o6_Rl9zeqdsIdWFmv4DB5lEqlEnC7HlAP-3oo3jWFO9KQqArQL1V8w2D4aCd0uJULiC9pCP7aTHvBhc", + "dq": "ANtbSY6njfpPploQsF9sU26U0s7MsuLljM1E8uml8bVJE1mNsiu9MgpUvg39jEu9BtM2tDD7Y51AAIEmIQex1nM", + "qi": "XLE5O360x-MhsdFXx8Vwz4304-MJg-oGSJXCK_ZWYOB_FGXFRTfebxCsSYi0YwJo-oNu96bvZCuMplzRI1liZw", } ] } @@ -237,10 +260,10 @@ class TestConfig(_Config): # pylint: disable=too-few-public-methods -----END RSA PRIVATE KEY-----""" # Minio variables - MINIO_ENDPOINT = 'localhost:9000' - MINIO_ACCESS_KEY = 'minio' - MINIO_ACCESS_SECRET = 'minio123' - MINIO_BUCKET_BUSINESSES = 'businesses' + MINIO_ENDPOINT = "localhost:9000" + MINIO_ACCESS_KEY = "minio" + MINIO_ACCESS_SECRET = "minio123" + MINIO_BUCKET_BUSINESSES = "businesses" MINIO_SECURE = False # determines which year of NAICS data will be used to drive NAICS search @@ -252,11 +275,11 @@ class TestConfig(_Config): # pylint: disable=too-few-public-methods class ProdConfig(_Config): # pylint: disable=too-few-public-methods """Production environment configuration.""" - SECRET_KEY = os.getenv('SECRET_KEY', None) + SECRET_KEY = os.getenv("SECRET_KEY", None) if not SECRET_KEY: SECRET_KEY = os.urandom(24) - print('WARNING: SECRET_KEY being set as a one-shot', file=sys.stderr) + print("WARNING: SECRET_KEY being set as a one-shot", file=sys.stderr) TESTING = False DEBUG = False diff --git a/python/common/business-registry-model/poetry.lock b/python/common/business-registry-model/poetry.lock index 3ea38b52c2..39dffa0f4b 100644 --- a/python/common/business-registry-model/poetry.lock +++ b/python/common/business-registry-model/poetry.lock @@ -1052,7 +1052,7 @@ develop = false [package.source] type = "git" url = "https://github.com/bcgov/lear.git" -reference = "dev_legal_name_changes" +reference = "feature-legal-name" resolved_reference = "de407723bd4a0a1d6a29059caffac48ac25ab567" subdirectory = "python/common/sql-versioning" diff --git a/python/common/business-registry-model/pyproject.toml b/python/common/business-registry-model/pyproject.toml index 3266881792..0d74ef34bd 100644 --- a/python/common/business-registry-model/pyproject.toml +++ b/python/common/business-registry-model/pyproject.toml @@ -17,7 +17,7 @@ datedelta = "^1.4" registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", rev = "2.18.10"} ## sql-versioning = {path = "../sql-versioning"} -sql-versioning = { git = "https://github.com/bcgov/lear.git", subdirectory = "python/common/sql-versioning", branch = "dev_legal_name_changes" } +sql-versioning = { git = "https://github.com/bcgov/lear.git", subdirectory = "python/common/sql-versioning", branch = "feature-legal-name" } [tool.poetry.group.dev.dependencies] Flask = "^2.3.2" diff --git a/queue_services/entity-auth/devops/gcp/clouddeploy-targets.yaml b/queue_services/entity-auth/devops/gcp/clouddeploy-targets.yaml new file mode 100644 index 0000000000..42a740e8e5 --- /dev/null +++ b/queue_services/entity-auth/devops/gcp/clouddeploy-targets.yaml @@ -0,0 +1,102 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: dev +description: Dev Environment +deployParameters: + deploy-project-id: "a083gt-dev" + service-name: "business-auth-dev" + container-name: "business-auth-dev" + app-env: "dev" + cloudsql-instances: "a083gt-dev:northamerica-northeast1:businesses-db-dev" + max-scale: "1" + container-concurrency: "2" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-dev/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' +--- + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: test +description: Test Environment +deployParameters: + deploy-project-id: "a083gt-test" + service-name: "business-auth-test" + container-name: "business-auth-test" + app-env: "test" + cloudsql-instances: "a083gt-test:northamerica-northeast1:businesses-db-test" + max-scale: "2" + container-concurrency: "3" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-test/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' +--- + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: sandbox +description: Sandbox Environment +requireApproval: true +deployParameters: + deploy-project-id: "a083gt-integration" + service-name: "business-auth-sandbox" + container-name: "business-auth-sandbox" + app-env: "sandbox" + cloudsql-instances: "a083gt-integration:northamerica-northeast1:businesses-db-sandbox" + max-scale: "3" + container-concurrency: "7" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-integration/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' +--- + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: prod +description: Production Environment +requireApproval: true +deployParameters: + deploy-project-id: "a083gt-prod" + service-name: "business-auth-prod" + container-name: "business-auth-prod" + app-env: "production" + cloudsql-instances: "a083gt-prod:northamerica-northeast1:businesses-db-prod" + max-scale: "3" + container-concurrency: "7" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-prod/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' \ No newline at end of file diff --git a/queue_services/entity-auth/devops/vaults.gcp.env b/queue_services/entity-auth/devops/vaults.gcp.env new file mode 100644 index 0000000000..43e7e5ddbd --- /dev/null +++ b/queue_services/entity-auth/devops/vaults.gcp.env @@ -0,0 +1,17 @@ +KEYCLOAK_TIMEOUT="op://entity/$APP_ENV/business-api/KEYCLOAK_TIMEOUT" +LEGISLATIVE_TIMEZONE="op://entity/$APP_ENV/business-api/LEGISLATIVE_TIMEZONE" +DATABASE_NAME="op://database/$APP_ENV/business-db/DATABASE_NAME" +DATABASE_PASSWORD="op://database/$APP_ENV/business-db/DATABASE_PASSWORD" +DATABASE_PORT="op://database/$APP_ENV/business-db/DATABASE_PORT" +DATABASE_UNIX_SOCKET="op://database/$APP_ENV/business-db/DATABASE_UNIX_SOCKET" +DATABASE_USERNAME="op://database/$APP_ENV/business-db/DATABASE_USERNAME" +KEYCLOAK_AUTH_TOKEN_URL="op://keycloak/$APP_ENV/base/KEYCLOAK_AUTH_TOKEN_URL" +KEYCLOAK_CLIENT_ID="op://keycloak/$APP_ENV/entity-service-account/ENTITY_SERVICE_ACCOUNT_CLIENT_ID" +KEYCLOAK_CLIENT_SECRET="op://keycloak/$APP_ENV/entity-service-account/ENTITY_SERVICE_ACCOUNT_CLIENT_SECRET" +NAMEX_API_URL="op://API/$APP_ENV/namex-api/NAMEX_API_URL" +NAMEX_API_VERSION="op://API/$APP_ENV/namex-api/NAMEX_API_VERSION" +AUDIENCE=op://gcp-queue/$APP_ENV/payment/AUDIENCE" +TOPIC_NAME=op://gcp-queue/$APP_ENV/payment/TOPIC_NAME" +PUBLISHER_AUDIENCE=op://gcp-queue/$APP_ENV/payment/PUBLISHER_AUDIENCE" +GCP_AUTH_KEY=op://gcp-queue/$APP_ENV/payment/GCP_AUTH_KEY" +SENTRY_DSN="" \ No newline at end of file diff --git a/queue_services/entity-auth/devops/vaults.json b/queue_services/entity-auth/devops/vaults.json deleted file mode 100644 index 4e1b91fa7a..0000000000 --- a/queue_services/entity-auth/devops/vaults.json +++ /dev/null @@ -1,20 +0,0 @@ -[ - { - "vault": "database", - "application": [ - "entity-db" - ] - }, - { - "vault": "sentry", - "application": [ - "entity" - ] - }, - { - "vault": "entity", - "application": [ - "entity-auth" - ] - } -] diff --git a/queue_services/entity-auth/k8s/knative/dc.env-template b/queue_services/entity-auth/k8s/knative/dc.env-template deleted file mode 100644 index c994fb02fc..0000000000 --- a/queue_services/entity-auth/k8s/knative/dc.env-template +++ /dev/null @@ -1,25 +0,0 @@ -NAME=entity-auth -GENERATION=1 -CLOUDSQL_INSTANCES= -MAXSCALE= -CONTAINER_CONCURRENCY= -TIMEOUT_SECONDS=1800 -SERVICE_ACCOUNTNAME= -CONTAINER_IMAGE= -CONTAINER_PORT= -DATABASE_HOST= -DATABASE_NAME= -DATABASE_PASSWORD= -DATABASE_PORT= -GUNICORN_PROCESSES= -GUNICORN_THREADS= -DATABASE_UNIX_SOCKET= -DATABASE_USERNAME= -AUDIENCE= -PUBLISHER_AUDIENCE= -AUTH_SVC_URL= -ACCOUNT_SVC_AUTH_URL= -ACCOUNT_SVC_CLIENT_ID= -ACCOUNT_SVC_CLIENT_SECRET= -GCP_AUTH_KEY= -NAMEX_API= diff --git a/queue_services/entity-auth/k8s/knative/dc.yaml b/queue_services/entity-auth/k8s/knative/dc.yaml deleted file mode 100644 index 27581dc3e9..0000000000 --- a/queue_services/entity-auth/k8s/knative/dc.yaml +++ /dev/null @@ -1,72 +0,0 @@ -apiVersion: serving.knative.dev/v1 -kind: Service -metadata: - name: $NAME - generation: $GENERATION - labels: - cloud.googleapis.com/location: northamerica-northeast1 -spec: - template: - metadata: - labels: - run.googleapis.com/startupProbeType: Default - annotations: - run.googleapis.com/client-name: cloud-console - run.googleapis.com/cloudsql-instances: $CLOUDSQL_INSTANCES - autoscaling.knative.dev/maxScale: $MAXSCALE - spec: - containerConcurrency: $CONTAINER_CONCURRENCY - timeoutSeconds: $TIMEOUT_SECONDS - serviceAccountName: $SERVICE_ACCOUNTNAME - containers: - - image: >- - $CONTAINER_IMAGE - ports: - - name: http1 - containerPort: $CONTAINER_PORT - env: - - name: DATABASE_HOST - value: $DATABASE_HOST - - name: DATABASE_NAME - value: $DATABASE_NAME - - name: DATABASE_PASSWORD - value: $DATABASE_PASSWORD - - name: DATABASE_PORT - value: $DATABASE_PORT - - name: GUNICORN_PROCESSES - value: $GUNICORN_PROCESSES - - name: GUNICORN_THREADS - value: GUNICORN_THREADS - - name: DATABASE_UNIX_SOCKET - value: $DATABASE_UNIX_SOCKET - - name: DATABASE_USERNAME - value: DATABASE_USERNAME - - name: AUDIENCE - value: $AUDIENCE - - name: PUBLISHER_AUDIENCE - value: $PUBLISHER_AUDIENCE - - name: AUTH_SVC_URL - value: $AUTH_SVC_URL - - name: ACCOUNT_SVC_AUTH_URL - value: $ACCOUNT_SVC_AUTH_URL - - name: ACCOUNT_SVC_CLIENT_ID - value: $ACCOUNT_SVC_CLIENT_ID - - name: ACCOUNT_SVC_CLIENT_SECRET - value: $ACCOUNT_SVC_CLIENT_SECRET - - name: GCP_AUTH_KEY - value: $GCP_AUTH_KEY - - name: NAMEX_API - value: $NAMEX_API - resources: - limits: - cpu: 1000m - memory: 512Mi - startupProbe: - timeoutSeconds: 240 - periodSeconds: 240 - failureThreshold: 1 - tcpSocket: - port: 8080 - traffic: - - percent: 100 - latestRevision: true diff --git a/queue_services/entity-auth/poetry.lock b/queue_services/entity-auth/poetry.lock index 13cb2434e7..a08c01d837 100644 --- a/queue_services/entity-auth/poetry.lock +++ b/queue_services/entity-auth/poetry.lock @@ -147,7 +147,7 @@ sql-versioning = {path = "../sql-versioning"} [package.source] type = "git" url = "https://github.com/bcgov/lear.git" -reference = "dev_legal_name_changes" +reference = "feature-legal-name" resolved_reference = "a94b4fe2522eeedd5b5ab8657b4164812fd3ddbb" subdirectory = "python/common/business-registry-model" diff --git a/queue_services/entity-auth/pyproject.toml b/queue_services/entity-auth/pyproject.toml index 604aed80f3..1d14f3ce92 100644 --- a/queue_services/entity-auth/pyproject.toml +++ b/queue_services/entity-auth/pyproject.toml @@ -13,7 +13,7 @@ Flask = "^2.3.3" python-dotenv = "^1.0.0" sentry-sdk = "^1.27.1" launchdarkly-server-sdk = "^8.1.4" -business-model = { git = "https://github.com/bcgov/lear.git", subdirectory = "python/common/business-registry-model", branch = "dev_legal_name_changes" } +business-model = { git = "https://github.com/bcgov/lear.git", subdirectory = "python/common/business-registry-model", branch = "feature-legal-name" } simple_cloudevent = { git = "https://github.com/daxiom/simple-cloudevent.py" } requests = "^2.31.0" google-auth = "^2.21.0" diff --git a/queue_services/entity-auth/src/entity_auth/config.py b/queue_services/entity-auth/src/entity_auth/config.py index c95099a795..8cd475918c 100644 --- a/queue_services/entity-auth/src/entity_auth/config.py +++ b/queue_services/entity-auth/src/entity_auth/config.py @@ -36,26 +36,18 @@ class Config: # pylint: disable=too-few-public-methods PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__)) - SENTRY_DSN = os.getenv("SENTRY_DSN", None) - - # service accounts - AUTH_SVC_URL = os.getenv("AUTH_SVC_URL", "https://") - ACCOUNT_SVC_AUTH_URL = os.getenv("ACCOUNT_SVC_AUTH_URL") - ACCOUNT_SVC_CLIENT_ID = os.getenv("ACCOUNT_SVC_CLIENT_ID") - ACCOUNT_SVC_CLIENT_SECRET = os.getenv("ACCOUNT_SVC_CLIENT_SECRET") - ACCOUNT_SVC_TIMEOUT = os.getenv("ACCOUNT_SVC_TIMEOUT") + ENVIRONMENT = os.getenv("APP_ENV", "prod") - # BCRegistry Services - NAMEX_API = os.getenv("NAMEX_API") + SENTRY_DSN = os.getenv("SENTRY_DSN", None) SQLALCHEMY_TRACK_MODIFICATIONS = False - # POSTGRESQL DB_USER = os.getenv("DATABASE_USERNAME", "") DB_PASSWORD = os.getenv("DATABASE_PASSWORD", "") DB_NAME = os.getenv("DATABASE_NAME", "") DB_HOST = os.getenv("DATABASE_HOST", "") DB_PORT = os.getenv("DATABASE_PORT", "5432") + # POSTGRESQL if DB_UNIX_SOCKET := os.getenv("DATABASE_UNIX_SOCKET", None): SQLALCHEMY_DATABASE_URI = f"postgresql+pg8000://{DB_USER}:{DB_PASSWORD}@/{DB_NAME}?unix_sock={DB_UNIX_SOCKET}/.s.PGSQL.5432" @@ -64,8 +56,19 @@ class Config: # pylint: disable=too-few-public-methods f"postgresql+pg8000://{DB_USER}:{DB_PASSWORD}@{DB_HOST}:{DB_PORT}/{DB_NAME}" ) - ENVIRONMENT = os.getenv("ENVIRONMENT", "prod") + # API Endpoints + NAMEX_API_URL = os.getenv("NAMEX_API_URL", "") + NAMEX_API_VERSION = os.getenv("NAMEX_API_VERSION", "") + + NAMEX_API = f"{NAMEX_API_URL + NAMEX_API_VERSION}" + + # service accounts + ACCOUNT_SVC_AUTH_URL = os.getenv("KEYCLOAK_AUTH_TOKEN_URL") + ACCOUNT_SVC_CLIENT_ID = os.getenv("KEYCLOAK_CLIENT_ID") + ACCOUNT_SVC_CLIENT_SECRET = os.getenv("KEYCLOAK_CLIENT_ID") + ACCOUNT_SVC_TIMEOUT = os.getenv("KEYCLOAK_TIMEOUT") + # pub/sub GCP_AUTH_KEY = os.getenv("GCP_AUTH_KEY", None) AUDIENCE = os.getenv( "AUDIENCE", "https://pubsub.googleapis.com/google.pubsub.v1.Subscriber" diff --git a/queue_services/entity-bn/devops/gcp/clouddeploy-targets.yaml b/queue_services/entity-bn/devops/gcp/clouddeploy-targets.yaml new file mode 100644 index 0000000000..92e7c9d369 --- /dev/null +++ b/queue_services/entity-bn/devops/gcp/clouddeploy-targets.yaml @@ -0,0 +1,102 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: dev +description: Dev Environment +deployParameters: + deploy-project-id: "a083gt-dev" + service-name: "business-bn-dev" + container-name: "business-bn-dev" + app-env: "dev" + cloudsql-instances: "a083gt-dev:northamerica-northeast1:businesses-db-dev" + max-scale: "1" + container-concurrency: "2" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-dev/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' +--- + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: test +description: Test Environment +deployParameters: + deploy-project-id: "a083gt-test" + service-name: "business-bn-test" + container-name: "business-bn-test" + app-env: "test" + cloudsql-instances: "a083gt-test:northamerica-northeast1:businesses-db-test" + max-scale: "2" + container-concurrency: "3" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-test/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' +--- + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: sandbox +description: Sandbox Environment +requireApproval: true +deployParameters: + deploy-project-id: "a083gt-integration" + service-name: "business-bn-sandbox" + container-name: "business-bn-sandbox" + app-env: "sandbox" + cloudsql-instances: "a083gt-integration:northamerica-northeast1:businesses-db-sandbox" + max-scale: "3" + container-concurrency: "7" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-integration/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' +--- + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: prod +description: Production Environment +requireApproval: true +deployParameters: + deploy-project-id: "a083gt-prod" + service-name: "business-bn-prod" + container-name: "business-bn-prod" + app-env: "production" + cloudsql-instances: "a083gt-prod:northamerica-northeast1:businesses-db-prod" + max-scale: "3" + container-concurrency: "7" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-prod/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' \ No newline at end of file diff --git a/queue_services/entity-bn/devops/vaults.gcp.env b/queue_services/entity-bn/devops/vaults.gcp.env new file mode 100644 index 0000000000..4d3954c494 --- /dev/null +++ b/queue_services/entity-bn/devops/vaults.gcp.env @@ -0,0 +1,20 @@ +LEGISLATIVE_TIMEZONE="op://entity/$APP_ENV/business-api/LEGISLATIVE_TIMEZONE" +TEMPLATE_PATH="op://entity/$APP_ENV/business-bn/TEMPLATE_PATH" +DATABASE_NAME="op://database/$APP_ENV/business-db/DATABASE_NAME" +DATABASE_PASSWORD="op://database/$APP_ENV/business-db/DATABASE_PASSWORD" +DATABASE_PORT="op://database/$APP_ENV/business-db/DATABASE_PORT" +DATABASE_UNIX_SOCKET="op://database/$APP_ENV/business-db/DATABASE_UNIX_SOCKET" +DATABASE_USERNAME="op://database/$APP_ENV/business-db/DATABASE_USERNAME" +COLIN_API_URL="op://API/$APP_ENV/colin-api-entity/COLIN_API_URL" +COLIN_API_VERSION="op://API/$APP_ENV/colin-api-entity/COLIN_API_VERSION" +SEARCH_API_URL="op://API/$APP_ENV/registries-search-api/REGISTRIES_SEARCH_API_INTERNAL_URL" +SEARCH_API_VERSION="op://API/$APP_ENV/registries-search-api/REGISTRIES_SEARCH_API_VERSION" +BN_HUB_API_URL="op://Shared/$APP_ENV/bn-hub/BN_HUB_API_URL" +BN_HUB_CLIENT_ID="op://Shared/$APP_ENV/bn-hub/BN_HUB_CLIENT_ID" +BN_HUB_CLIENT_SECRET="op://Shared/$APP_ENV/bn-hub/BN_HUB_CLIENT_SECRET" +BN_HUB_MAX_RETRY="op://Shared/$APP_ENV/bn-hub/BN_HUB_MAX_RETRY" +AUDIENCE=op://gcp-queue/$APP_ENV/payment/AUDIENCE" +TOPIC_NAME=op://gcp-queue/$APP_ENV/payment/TOPIC_NAME" +PUBLISHER_AUDIENCE=op://gcp-queue/$APP_ENV/payment/PUBLISHER_AUDIENCE" +GCP_AUTH_KEY=op://gcp-queue/$APP_ENV/payment/GCP_AUTH_KEY" +SENTRY_DSN="" \ No newline at end of file diff --git a/queue_services/entity-bn/devops/vaults.json b/queue_services/entity-bn/devops/vaults.json deleted file mode 100644 index 15c7cd936a..0000000000 --- a/queue_services/entity-bn/devops/vaults.json +++ /dev/null @@ -1,27 +0,0 @@ -[ - { - "vault": "shared", - "application": [ - "bn-hub" - ] - }, - { - "vault": "api", - "application": [ - "colin-api-entity", - "registries-search-api-internal" - ] - }, - { - "vault": "database", - "application": [ - "entity-db" - ] - }, - { - "vault": "sentry", - "application": [ - "entity" - ] - } -] diff --git a/queue_services/entity-bn/k8s/knative/dc.env-template b/queue_services/entity-bn/k8s/knative/dc.env-template deleted file mode 100644 index 95c71e8c39..0000000000 --- a/queue_services/entity-bn/k8s/knative/dc.env-template +++ /dev/null @@ -1,30 +0,0 @@ -NAME=entity-bn -GENERATION=1 -CLOUDSQL_INSTANCES= -MAXSCALE= -CONTAINER_CONCURRENCY= -TIMEOUT_SECONDS=1800 -SERVICE_ACCOUNTNAME= -CONTAINER_IMAGE= -CONTAINER_PORT= -DATABASE_HOST= -DATABASE_NAME= -DATABASE_PASSWORD= -DATABASE_PORT= -GUNICORN_PROCESSES= -GUNICORN_THREADS= -DATABASE_UNIX_SOCKET= -DATABASE_USERNAME= -AUDIENCE= -PUBLISHER_AUDIENCE= -ENTITY_MAILER_TOPIC= -ENTITY_EVENT_TOPIC= -COLIN_API= -REGISTRIES_SEARCH_API_INTERNAL_URL= -REGISTRIES_SEARCH_API_VERSION= -BN_HUB_API_URL= -BN_HUB_CLIENT_ID= -BN_HUB_CLIENT_SECRET= -BN_HUB_MAX_RETRY= -TEMPLATE_PATH= -GCP_AUTH_KEY= diff --git a/queue_services/entity-bn/k8s/knative/dc.yaml b/queue_services/entity-bn/k8s/knative/dc.yaml deleted file mode 100644 index 9b446c04ea..0000000000 --- a/queue_services/entity-bn/k8s/knative/dc.yaml +++ /dev/null @@ -1,82 +0,0 @@ -apiVersion: serving.knative.dev/v1 -kind: Service -metadata: - name: $NAME - generation: $GENERATION - labels: - cloud.googleapis.com/location: northamerica-northeast1 -spec: - template: - metadata: - labels: - run.googleapis.com/startupProbeType: Default - annotations: - run.googleapis.com/client-name: cloud-console - run.googleapis.com/cloudsql-instances: $CLOUDSQL_INSTANCES - autoscaling.knative.dev/maxScale: $MAXSCALE - spec: - containerConcurrency: $CONTAINER_CONCURRENCY - timeoutSeconds: $TIMEOUT_SECONDS - serviceAccountName: $SERVICE_ACCOUNTNAME - containers: - - image: >- - $CONTAINER_IMAGE - ports: - - name: http1 - containerPort: $CONTAINER_PORT - env: - - name: DATABASE_HOST - value: $DATABASE_HOST - - name: DATABASE_NAME - value: $DATABASE_NAME - - name: DATABASE_PASSWORD - value: $DATABASE_PASSWORD - - name: DATABASE_PORT - value: $DATABASE_PORT - - name: GUNICORN_PROCESSES - value: $GUNICORN_PROCESSES - - name: GUNICORN_THREADS - value: GUNICORN_THREADS - - name: DATABASE_UNIX_SOCKET - value: $DATABASE_UNIX_SOCKET - - name: DATABASE_USERNAME - value: DATABASE_USERNAME - - name: AUDIENCE - value: $AUDIENCE - - name: PUBLISHER_AUDIENCE - value: $PUBLISHER_AUDIENCE - - name: ENTITY_MAILER_TOPIC - value: $ENTITY_MAILER_TOPIC - - name: ENTITY_EVENT_TOPIC - value: $ENTITY_EVENT_TOPIC - - name: COLIN_API - value: $COLIN_API - - name: REGISTRIES_SEARCH_API_INTERNAL_URL - value: $REGISTRIES_SEARCH_API_INTERNAL_URL - - name: REGISTRIES_SEARCH_API_VERSION - value: $REGISTRIES_SEARCH_API_VERSION - - name: BN_HUB_API_URL - value: $BN_HUB_API_URL - - name: BN_HUB_CLIENT_ID - value: $BN_HUB_CLIENT_ID - - name: BN_HUB_CLIENT_SECRET - value: $BN_HUB_CLIENT_SECRET - - name: BN_HUB_MAX_RETRY - value: $BN_HUB_MAX_RETRY - - name: TEMPLATE_PATH - value: $TEMPLATE_PATH - - name: GCP_AUTH_KEY - value: $GCP_AUTH_KEY - resources: - limits: - cpu: 1000m - memory: 512Mi - startupProbe: - timeoutSeconds: 240 - periodSeconds: 240 - failureThreshold: 1 - tcpSocket: - port: 8080 - traffic: - - percent: 100 - latestRevision: true diff --git a/queue_services/entity-bn/poetry.lock b/queue_services/entity-bn/poetry.lock index 46a101267b..0fbfd0ab97 100644 --- a/queue_services/entity-bn/poetry.lock +++ b/queue_services/entity-bn/poetry.lock @@ -962,18 +962,18 @@ pycountry = "^22.3.5" pydantic = "^1.10.8" PyPDF2 = "^3.0.1" python-dotenv = "^1.0.0" -registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", branch = "dev_legal_name_changes"} +registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", branch = "feature-legal-name"} reportlab = "^4.0.0" requests = "^2.31.0" sentry-sdk = "^1.24.0" -sql-versioning = {git = "https://github.com/bcgov/lear.git", branch = "dev_legal_name_changes", subdirectory = "python/common/sql-versioning"} +sql-versioning = {git = "https://github.com/bcgov/lear.git", branch = "feature-legal-name", subdirectory = "python/common/sql-versioning"} sqlalchemy-continuum = "^1.3.14" strict-rfc3339 = "^0.7" [package.source] type = "git" url = "https://github.com/bcgov/lear.git" -reference = "dev_legal_name_changes" +reference = "feature-legal-name" resolved_reference = "69aba4d3d7574f7624af5fab74fc1321338b0438" subdirectory = "legal-api" @@ -1636,7 +1636,7 @@ strict-rfc3339 = "*" [package.source] type = "git" url = "https://github.com/bcgov/business-schemas.git" -reference = "dev_legal_name_changes" +reference = "feature-legal-name" resolved_reference = "46fe42057ce8b8f7136ea2817b044b3a58d6939e" [[package]] @@ -1978,7 +1978,7 @@ develop = false [package.source] type = "git" url = "https://github.com/bcgov/lear.git" -reference = "dev_legal_name_changes" +reference = "feature-legal-name" resolved_reference = "69aba4d3d7574f7624af5fab74fc1321338b0438" subdirectory = "python/common/sql-versioning" diff --git a/queue_services/entity-bn/pyproject.toml b/queue_services/entity-bn/pyproject.toml index 10c5760416..4dfc7558db 100644 --- a/queue_services/entity-bn/pyproject.toml +++ b/queue_services/entity-bn/pyproject.toml @@ -14,9 +14,9 @@ python-dotenv = "^1.0.0" sentry-sdk = "^1.27.1" launchdarkly-server-sdk = "^8.1.4" #registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", rev = "2.18.10"} -registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", branch = "dev_legal_name_changes"} -sql-versioning = { git = "https://github.com/bcgov/lear.git", subdirectory = "python/common/sql-versioning", branch = "dev_legal_name_changes" } -legal_api = { git = "https://github.com/bcgov/lear.git", subdirectory = "legal-api", branch = "dev_legal_name_changes" } +registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", branch = "feature-legal-name"} +sql-versioning = { git = "https://github.com/bcgov/lear.git", subdirectory = "python/common/sql-versioning", branch = "feature-legal-name" } +legal_api = { git = "https://github.com/bcgov/lear.git", subdirectory = "legal-api", branch = "feature-legal-name" } simple_cloudevent = { git = "https://github.com/daxiom/simple-cloudevent.py" } requests = "^2.31.0" google-auth = "^2.21.0" diff --git a/queue_services/entity-bn/src/entity_bn/config.py b/queue_services/entity-bn/src/entity_bn/config.py index b762fa5ec7..9872c97fda 100644 --- a/queue_services/entity-bn/src/entity_bn/config.py +++ b/queue_services/entity-bn/src/entity_bn/config.py @@ -36,25 +36,18 @@ class Config: # pylint: disable=too-few-public-methods PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__)) - SENTRY_DSN = os.getenv("SENTRY_DSN", None) - COLIN_API = f"{os.getenv('COLIN_SVC_URL', '')}{os.getenv('COLIN_SVC_VERSION', '')}" - - SEARCH_API = f"{os.getenv('REGISTRIES_SEARCH_API_INTERNAL_URL', '')}{os.getenv('REGISTRIES_SEARCH_API_VERSION', '/api/v1')}" + ENVIRONMENT = os.getenv("APP_ENV", "prod") - BN_HUB_API_URL = os.getenv("BN_HUB_API_URL", None) - BN_HUB_CLIENT_ID = os.getenv("BN_HUB_CLIENT_ID", None) - BN_HUB_CLIENT_SECRET = os.getenv("BN_HUB_CLIENT_SECRET", None) - BN_HUB_MAX_RETRY = int(os.getenv("BN_HUB_MAX_RETRY", "9")) - TEMPLATE_PATH = os.getenv("TEMPLATE_PATH", None) + SENTRY_DSN = os.getenv("SENTRY_DSN", None) SQLALCHEMY_TRACK_MODIFICATIONS = False - # POSTGRESQL DB_USER = os.getenv("DATABASE_USERNAME", "") DB_PASSWORD = os.getenv("DATABASE_PASSWORD", "") DB_NAME = os.getenv("DATABASE_NAME", "") DB_HOST = os.getenv("DATABASE_HOST", "") DB_PORT = os.getenv("DATABASE_PORT", "5432") + # POSTGRESQL if DB_UNIX_SOCKET := os.getenv("DATABASE_UNIX_SOCKET", None): SQLALCHEMY_DATABASE_URI = f"postgresql+pg8000://{DB_USER}:{DB_PASSWORD}@/{DB_NAME}?unix_sock={DB_UNIX_SOCKET}/.s.PGSQL.5432" @@ -63,7 +56,22 @@ class Config: # pylint: disable=too-few-public-methods f"postgresql+pg8000://{DB_USER}:{DB_PASSWORD}@{DB_HOST}:{DB_PORT}/{DB_NAME}" ) - ENVIRONMENT = os.getenv("ENVIRONMENT", "prod") + # legislative timezone for future effective dating + LEGISLATIVE_TIMEZONE = os.getenv("LEGISLATIVE_TIMEZONE", "America/Vancouver") + TEMPLATE_PATH = os.getenv("TEMPLATE_PATH", None) + + # API Endpoints + COLIN_API_URL = os.getenv("COLIN_API_URL", "") + COLIN_API_VERSION = os.getenv("COLIN_API_VERSION", "") + SEARCH_API_URL = os.getenv("REGISTRIES_SEARCH_API_INTERNAL_URL", "") + SEARCH_API_VERSION = os.getenv("REGISTRIES_SEARCH_API_VERSION", "") + COLIN_API = f"{COLIN_API_URL + COLIN_API_VERSION}" + SEARCH_API = f"{SEARCH_API_URL + SEARCH_API_VERSION}" + + BN_HUB_API_URL = os.getenv("BN_HUB_API_URL", None) + BN_HUB_CLIENT_ID = os.getenv("BN_HUB_CLIENT_ID", None) + BN_HUB_CLIENT_SECRET = os.getenv("BN_HUB_CLIENT_SECRET", None) + BN_HUB_MAX_RETRY = int(os.getenv("BN_HUB_MAX_RETRY", "9")) GCP_AUTH_KEY = os.getenv("GCP_AUTH_KEY", None) ENTITY_MAILER_TOPIC = os.getenv("ENTITY_MAILER_TOPIC", "mailer") @@ -75,9 +83,6 @@ class Config: # pylint: disable=too-few-public-methods "PUBLISHER_AUDIENCE", "https://pubsub.googleapis.com/google.pubsub.v1.Publisher" ) - # legislative timezone for future effective dating - LEGISLATIVE_TIMEZONE = os.getenv("LEGISLATIVE_TIMEZONE", "America/Vancouver") - class Development(Config): # pylint: disable=too-few-public-methods """Creates the Development Config object.""" diff --git a/queue_services/entity-emailer/devops/gcp/clouddeploy-targets.yaml b/queue_services/entity-emailer/devops/gcp/clouddeploy-targets.yaml new file mode 100644 index 0000000000..dab2d37732 --- /dev/null +++ b/queue_services/entity-emailer/devops/gcp/clouddeploy-targets.yaml @@ -0,0 +1,102 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: dev +description: Dev Environment +deployParameters: + deploy-project-id: "a083gt-dev" + service-name: "business-emailer-dev" + container-name: "business-emailer-dev" + app-env: "dev" + cloudsql-instances: "a083gt-dev:northamerica-northeast1:businesses-db-dev" + max-scale: "1" + container-concurrency: "2" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-dev/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' +--- + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: test +description: Test Environment +deployParameters: + deploy-project-id: "a083gt-test" + service-name: "business-emailer-test" + container-name: "business-emailer-test" + app-env: "test" + cloudsql-instances: "a083gt-test:northamerica-northeast1:businesses-db-test" + max-scale: "2" + container-concurrency: "3" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-test/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' +--- + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: sandbox +description: Sandbox Environment +requireApproval: true +deployParameters: + deploy-project-id: "a083gt-integration" + service-name: "business-emailer-sandbox" + container-name: "business-emailer-sandbox" + app-env: "sandbox" + cloudsql-instances: "a083gt-integration:northamerica-northeast1:businesses-db-sandbox" + max-scale: "3" + container-concurrency: "7" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-integration/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' +--- + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: prod +description: Production Environment +requireApproval: true +deployParameters: + deploy-project-id: "a083gt-prod" + service-name: "business-emailer-prod" + container-name: "business-emailer-prod" + app-env: "production" + cloudsql-instances: "a083gt-prod:northamerica-northeast1:businesses-db-prod" + max-scale: "3" + container-concurrency: "7" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-prod/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' \ No newline at end of file diff --git a/queue_services/entity-emailer/devops/vaults.gcp.env b/queue_services/entity-emailer/devops/vaults.gcp.env new file mode 100644 index 0000000000..1626868efa --- /dev/null +++ b/queue_services/entity-emailer/devops/vaults.gcp.env @@ -0,0 +1,29 @@ +KEYCLOAK_TIMEOUT="op://entity/$APP_ENV/business-api/KEYCLOAK_TIMEOUT" +LEGISLATIVE_TIMEZONE="op://entity/$APP_ENV/business-api/LEGISLATIVE_TIMEZONE" +MSG_RETRY_NUM="op://entity/$APP_ENV/business-emailer/MSG_RETRY_NUM" +LOG_LEVEL="op://entity/$APP_ENV/business-emailer/LOG_LEVEL" +TEMPLATE_PATH="op://entity/$APP_ENV/business-emailer/TEMPLATE_PATH" +DASHBOARD_URL="op://web-url/$APP_ENV/business/DASHBOARD_URL" +DATABASE_NAME="op://database/$APP_ENV/business-db/DATABASE_NAME" +DATABASE_PASSWORD="op://database/$APP_ENV/business-db/DATABASE_PASSWORD" +DATABASE_PORT="op://database/$APP_ENV/business-db/DATABASE_PORT" +DATABASE_UNIX_SOCKET="op://database/$APP_ENV/business-db/DATABASE_UNIX_SOCKET" +DATABASE_USERNAME="op://database/$APP_ENV/business-db/DATABASE_USERNAME" +KEYCLOAK_AUTH_TOKEN_URL="op://keycloak/$APP_ENV/base/KEYCLOAK_AUTH_TOKEN_URL" +KEYCLOAK_CLIENT_ID="op://keycloak/$APP_ENV/entity-service-account/ENTITY_SERVICE_ACCOUNT_CLIENT_ID" +KEYCLOAK_CLIENT_SECRET="op://keycloak/$APP_ENV/entity-service-account/ENTITY_SERVICE_ACCOUNT_CLIENT_SECRET" +AUTH_API_URL="op://API/$APP_ENV/auth-api/AUTH_API_URL" +AUTH_API_VERSION="op://API/$APP_ENV/auth-api/AUTH_API_VERSION" +NOTIFY_API_URL="op://API/$APP_ENV/notify-api/NOTIFY_API_URL" +NOTIFY_API_VERSION="op://API/$APP_ENV/notify-api/NOTIFY_API_VERSION" +NAMEX_API_URL="op://API/$APP_ENV/namex-api/NAMEX_API_URL" +NAMEX_API_VERSION="op://API/$APP_ENV/namex-api/NAMEX_API_VERSION" +BUSINESS_API_URL="op://API/$APP_ENV/business-api/BUSINESS_API_URL" +BUSINESS_API_VERSION2="op://API/$APP_ENV/business-api/BUSINESS_API_VERSION_2" +PAY_API_URL="op://API/$APP_ENV/pay-api/PAY_API_URL" +PAY_API_VERSION="op://API/$APP_ENV/pay-api/PAY_API_VERSION" +AUDIENCE=op://gcp-queue/$APP_ENV/payment/AUDIENCE" +TOPIC_NAME=op://gcp-queue/$APP_ENV/payment/TOPIC_NAME" +PUBLISHER_AUDIENCE=op://gcp-queue/$APP_ENV/payment/PUBLISHER_AUDIENCE" +GCP_AUTH_KEY=op://gcp-queue/$APP_ENV/payment/GCP_AUTH_KEY" +SENTRY_DSN="" \ No newline at end of file diff --git a/queue_services/entity-emailer/devops/vaults.json b/queue_services/entity-emailer/devops/vaults.json deleted file mode 100644 index 1452eff6a3..0000000000 --- a/queue_services/entity-emailer/devops/vaults.json +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "vault": "entity", - "application": [ - "postgres-legal", - "entity-emailer", - "entity-service-account", - "sentry" - ] - } -] diff --git a/queue_services/entity-emailer/k8s/knative/dc.env-template b/queue_services/entity-emailer/k8s/knative/dc.env-template deleted file mode 100644 index 2d6f330405..0000000000 --- a/queue_services/entity-emailer/k8s/knative/dc.env-template +++ /dev/null @@ -1,19 +0,0 @@ -NAME=entity-emailer -GENERATION=1 -CLOUDSQL_INSTANCES= -MAXSCALE= -CONTAINER_CONCURRENCY= -TIMEOUT_SECONDS=1800 -SERVICE_ACCOUNTNAME= -CONTAINER_IMAGE= -CONTAINER_PORT= -DATABASE_HOST= -DATABASE_NAME= -DATABASE_PASSWORD= -DATABASE_PORT= -GUNICORN_PROCESSES= -GUNICORN_THREADS= -DATABASE_UNIX_SOCKET= -DATABASE_USERNAME= -AUDIENCE= -PUBLISHER_AUDIENCE= diff --git a/queue_services/entity-emailer/k8s/knative/dc.yaml b/queue_services/entity-emailer/k8s/knative/dc.yaml deleted file mode 100644 index f87152738e..0000000000 --- a/queue_services/entity-emailer/k8s/knative/dc.yaml +++ /dev/null @@ -1,60 +0,0 @@ -apiVersion: serving.knative.dev/v1 -kind: Service -metadata: - name: $NAME - generation: $GENERATION - labels: - cloud.googleapis.com/location: northamerica-northeast1 -spec: - template: - metadata: - labels: - run.googleapis.com/startupProbeType: Default - annotations: - run.googleapis.com/client-name: cloud-console - run.googleapis.com/cloudsql-instances: $CLOUDSQL_INSTANCES - autoscaling.knative.dev/maxScale: $MAXSCALE - spec: - containerConcurrency: $CONTAINER_CONCURRENCY - timeoutSeconds: $TIMEOUT_SECONDS - serviceAccountName: $SERVICE_ACCOUNTNAME - containers: - - image: >- - $CONTAINER_IMAGE - ports: - - name: http1 - containerPort: $CONTAINER_PORT - env: - - name: DATABASE_HOST - value: $DATABASE_HOST - - name: DATABASE_NAME - value: $DATABASE_NAME - - name: DATABASE_PASSWORD - value: $DATABASE_PASSWORD - - name: DATABASE_PORT - value: $DATABASE_PORT - - name: GUNICORN_PROCESSES - value: $GUNICORN_PROCESSES - - name: GUNICORN_THREADS - value: GUNICORN_THREADS - - name: DATABASE_UNIX_SOCKET - value: $DATABASE_UNIX_SOCKET - - name: DATABASE_USERNAME - value: DATABASE_USERNAME - - name: AUDIENCE - value: $AUDIENCE - - name: PUBLISHER_AUDIENCE - value: $PUBLISHER_AUDIENCE - resources: - limits: - cpu: 1000m - memory: 512Mi - startupProbe: - timeoutSeconds: 240 - periodSeconds: 240 - failureThreshold: 1 - tcpSocket: - port: 8080 - traffic: - - percent: 100 - latestRevision: true diff --git a/queue_services/entity-emailer/poetry.lock b/queue_services/entity-emailer/poetry.lock index e2a18c0e6f..ab7a7692b3 100644 --- a/queue_services/entity-emailer/poetry.lock +++ b/queue_services/entity-emailer/poetry.lock @@ -962,18 +962,18 @@ pycountry = "^22.3.5" pydantic = "^1.10.8" PyPDF2 = "^3.0.1" python-dotenv = "^1.0.0" -registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", branch = "dev_legal_name_changes"} +registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", branch = "feature-legal-name"} reportlab = "^4.0.0" requests = "^2.31.0" sentry-sdk = "^1.24.0" -sql-versioning = {git = "https://github.com/bcgov/lear.git", branch = "dev_legal_name_changes", subdirectory = "python/common/sql-versioning"} +sql-versioning = {git = "https://github.com/bcgov/lear.git", branch = "feature-legal-name", subdirectory = "python/common/sql-versioning"} sqlalchemy-continuum = "^1.3.14" strict-rfc3339 = "^0.7" [package.source] type = "git" url = "https://github.com/bcgov/lear.git" -reference = "dev_legal_name_changes" +reference = "feature-legal-name" resolved_reference = "b839230c813fee9e902ce7bbb57c3529772047f5" subdirectory = "legal-api" @@ -1636,7 +1636,7 @@ strict-rfc3339 = "*" [package.source] type = "git" url = "https://github.com/bcgov/business-schemas.git" -reference = "dev_legal_name_changes" +reference = "feature-legal-name" resolved_reference = "46fe42057ce8b8f7136ea2817b044b3a58d6939e" [[package]] @@ -1978,7 +1978,7 @@ develop = false [package.source] type = "git" url = "https://github.com/bcgov/lear.git" -reference = "dev_legal_name_changes" +reference = "feature-legal-name" resolved_reference = "b839230c813fee9e902ce7bbb57c3529772047f5" subdirectory = "python/common/sql-versioning" diff --git a/queue_services/entity-emailer/pyproject.toml b/queue_services/entity-emailer/pyproject.toml index 5efc75047d..a753cc62e3 100644 --- a/queue_services/entity-emailer/pyproject.toml +++ b/queue_services/entity-emailer/pyproject.toml @@ -13,7 +13,7 @@ Flask = "^2.3.2" python-dotenv = "^1.0.0" sentry-sdk = "^1.27.1" launchdarkly-server-sdk = "^8.1.4" -legal_api = { git = "https://github.com/bcgov/lear.git", subdirectory = "legal-api", branch = "dev_legal_name_changes" } +legal_api = { git = "https://github.com/bcgov/lear.git", subdirectory = "legal-api", branch = "feature-legal-name" } simple_cloudevent = { git = "https://github.com/daxiom/simple-cloudevent.py" } requests = "^2.31.0" google-auth = "^2.21.0" diff --git a/queue_services/entity-emailer/src/entity_emailer/config.py b/queue_services/entity-emailer/src/entity_emailer/config.py index 7fdd0aeb4c..33b406c61d 100644 --- a/queue_services/entity-emailer/src/entity_emailer/config.py +++ b/queue_services/entity-emailer/src/entity_emailer/config.py @@ -1,6 +1,6 @@ # Copyright © 2023 Province of British Columbia # -# Licensed under the BSD 3 Clause License, (the "License"); +# Licensed under the BSD 3 Clause License, (the 'License'); # you may not use this file except in compliance with the License. # The template for the license can be found here # https://opensource.org/license/bsd-3-clause/ @@ -72,42 +72,60 @@ class Config: # pylint: disable=too-few-public-methods PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__)) - MSG_RETRY_NUM = int(os.getenv("MSG_RETRY_NUM", "5")) + ENVIRONMENT = os.getenv("APP_ENV", "prod") - # urls - DASHBOARD_URL = os.getenv("DASHBOARD_URL", None) - NOTIFY_API_URL = os.getenv("NOTIFY_API_URL", None) - LEGAL_API_URL = os.getenv("LEGAL_API_URL", None) - PAY_API_URL = os.getenv("PAY_API_URL", None) - AUTH_URL = os.getenv("AUTH_URL", None) - ACCOUNT_SVC_AUTH_URL = os.getenv("ACCOUNT_SVC_AUTH_URL", None) - # secrets - ACCOUNT_SVC_CLIENT_ID = os.getenv("ACCOUNT_SVC_CLIENT_ID", None) - ACCOUNT_SVC_CLIENT_SECRET = os.getenv("ACCOUNT_SVC_CLIENT_SECRET", None) - # variables - LEGISLATIVE_TIMEZONE = os.getenv("LEGISLATIVE_TIMEZONE", "America/Vancouver") - TEMPLATE_PATH = os.getenv("TEMPLATE_PATH", None) + SENTRY_DSN = os.getenv("SENTRY_DSN", None) SQLALCHEMY_TRACK_MODIFICATIONS = False - - NAMEX_AUTH_SVC_URL = os.getenv("NAMEX_AUTH_SVC_URL", None) - NAMEX_SVC_URL = os.getenv("NAMEX_SVC_URL", None) - NAMEX_SERVICE_CLIENT_USERNAME = os.getenv("NAMEX_SERVICE_CLIENT_USERNAME", None) - NAMEX_SERVICE_CLIENT_SECRET = os.getenv("NAMEX_SERVICE_CLIENT_SECRET", None) - # POSTGRESQL DB_USER = os.getenv("DATABASE_USERNAME", "") DB_PASSWORD = os.getenv("DATABASE_PASSWORD", "") DB_NAME = os.getenv("DATABASE_NAME", "") DB_HOST = os.getenv("DATABASE_HOST", "") DB_PORT = os.getenv("DATABASE_PORT", "5432") + + # POSTGRESQL if DB_UNIX_SOCKET := os.getenv("DATABASE_UNIX_SOCKET", None): - SQLALCHEMY_DATABASE_URI = f"postgresql+pg8000://{DB_USER}:{DB_PASSWORD}@{DB_HOST}:{DB_PORT}/{DB_NAME}?unix_sock={DB_UNIX_SOCKET}/.s.PGSQL.5432" + SQLALCHEMY_DATABASE_URI = f"postgresql+pg8000://{DB_USER}:{DB_PASSWORD}@/{DB_NAME}?unix_sock={DB_UNIX_SOCKET}/.s.PGSQL.5432" else: SQLALCHEMY_DATABASE_URI = ( f"postgresql+pg8000://{DB_USER}:{DB_PASSWORD}@{DB_HOST}:{DB_PORT}/{DB_NAME}" ) + # variables + LEGISLATIVE_TIMEZONE = os.getenv("LEGISLATIVE_TIMEZONE", "America/Vancouver") + MSG_RETRY_NUM = int(os.getenv("MSG_RETRY_NUM", "5")) + TEMPLATE_PATH = os.getenv("TEMPLATE_PATH", None) + DASHBOARD_URL = os.getenv("DASHBOARD_URL", None) + LOG_LEVEL = os.getenv("LOG_LEVEL", None) + + # API Endpoints + AUTH_API_URL = os.getenv("AUTH_API_URL", "") + AUTH_API_VERSION = os.getenv("AUTH_API_VERSION", "") + NOTIFY_API_URL = os.getenv("NOTIFY_API_URL", "") + NOTIFY_API_VERSION = os.getenv("NOTIFY_API_VERSION", "") + BUSINESS_API_URL = os.getenv("BUSINESS_API_URL", "") + BUSINESS_API_VERSION_2 = os.getenv("BUSINESS_API_VERSION2", "") + NAMEX_API_URL = os.getenv("NAMEX_API_URL", "") + NAMEX_API_VERSION = os.getenv("NAMEX_API_VERSION", "") + PAY_API_URL = os.getenv("PAY_API_URL", "") + PAY_API_VERSION = os.getenv("PAY_API_VERSION", "") + + LEGAL_API_URL = f"{BUSINESS_API_URL + BUSINESS_API_VERSION_2}" + NOTIFY_API_URL = f"{NOTIFY_API_URL + AUTH_API_VERSION}/notify/" + NAMEX_SVC_URL = f"{NAMEX_API_URL + NAMEX_API_VERSION}" + PAY_API_URL = f"{PAY_API_URL + PAY_API_VERSION}/payment-request" + AUTH_URL = f"{AUTH_API_URL + AUTH_API_VERSION}" + + # service accounts + ACCOUNT_SVC_AUTH_URL = os.getenv("KEYCLOAK_AUTH_TOKEN_URL") + ACCOUNT_SVC_CLIENT_ID = os.getenv("KEYCLOAK_CLIENT_ID") + ACCOUNT_SVC_CLIENT_SECRET = os.getenv("KEYCLOAK_CLIENT_ID") + ACCOUNT_SVC_TIMEOUT = os.getenv("KEYCLOAK_TIMEOUT") + NAMEX_AUTH_SVC_URL = os.getenv("KEYCLOAK_AUTH_TOKEN_URL") + NAMEX_SERVICE_CLIENT_USERNAME = os.getenv("KEYCLOAK_CLIENT_ID") + NAMEX_SERVICE_CLIENT_SECRET = os.getenv("KEYCLOAK_CLIENT_ID") + GCP_AUTH_KEY = os.getenv("GCP_AUTH_KEY", None) AUDIENCE = os.getenv( "AUDIENCE", "https://pubsub.googleapis.com/google.pubsub.v1.Subscriber" diff --git a/queue_services/entity-filer/devops/gcp/clouddeploy-targets.yaml b/queue_services/entity-filer/devops/gcp/clouddeploy-targets.yaml new file mode 100644 index 0000000000..b7ab8d4d38 --- /dev/null +++ b/queue_services/entity-filer/devops/gcp/clouddeploy-targets.yaml @@ -0,0 +1,102 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: dev +description: Dev Environment +deployParameters: + deploy-project-id: "a083gt-dev" + service-name: "business-filer-dev" + container-name: "business-filer-dev" + app-env: "dev" + cloudsql-instances: "a083gt-dev:northamerica-northeast1:businesses-db-dev" + max-scale: "1" + container-concurrency: "2" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-dev/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' +--- + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: test +description: Test Environment +deployParameters: + deploy-project-id: "a083gt-test" + service-name: "business-filer-test" + container-name: "business-filer-test" + app-env: "test" + cloudsql-instances: "a083gt-test:northamerica-northeast1:businesses-db-test" + max-scale: "2" + container-concurrency: "3" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-test/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' +--- + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: sandbox +description: Sandbox Environment +requireApproval: true +deployParameters: + deploy-project-id: "a083gt-integration" + service-name: "business-filer-sandbox" + container-name: "business-filer-sandbox" + app-env: "sandbox" + cloudsql-instances: "a083gt-integration:northamerica-northeast1:businesses-db-sandbox" + max-scale: "3" + container-concurrency: "7" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-integration/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' +--- + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: prod +description: Production Environment +requireApproval: true +deployParameters: + deploy-project-id: "a083gt-prod" + service-name: "business-filer-prod" + container-name: "business-filer-prod" + app-env: "production" + cloudsql-instances: "a083gt-prod:northamerica-northeast1:businesses-db-prod" + max-scale: "3" + container-concurrency: "7" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-prod/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' \ No newline at end of file diff --git a/queue_services/entity-filer/devops/vaults.gcp.env b/queue_services/entity-filer/devops/vaults.gcp.env new file mode 100644 index 0000000000..d4b346a7f4 --- /dev/null +++ b/queue_services/entity-filer/devops/vaults.gcp.env @@ -0,0 +1,34 @@ +KEYCLOAK_TIMEOUT="op://entity/$APP_ENV/business-api/KEYCLOAK_TIMEOUT" +LEGISLATIVE_TIMEZONE="op://entity/$APP_ENV/business-api/LEGISLATIVE_TIMEZONE" +DATABASE_NAME="op://database/$APP_ENV/business-db/DATABASE_NAME" +DATABASE_PASSWORD="op://database/$APP_ENV/business-db/DATABASE_PASSWORD" +DATABASE_PORT="op://database/$APP_ENV/business-db/DATABASE_PORT" +DATABASE_UNIX_SOCKET="op://database/$APP_ENV/business-db/DATABASE_UNIX_SOCKET" +DATABASE_USERNAME="op://database/$APP_ENV/business-db/DATABASE_USERNAME" +KEYCLOAK_AUTH_TOKEN_URL="op://keycloak/$APP_ENV/base/KEYCLOAK_AUTH_TOKEN_URL" +KEYCLOAK_CLIENT_ID="op://keycloak/$APP_ENV/entity-service-account/ENTITY_SERVICE_ACCOUNT_CLIENT_ID" +KEYCLOAK_CLIENT_SECRET="op://keycloak/$APP_ENV/entity-service-account/ENTITY_SERVICE_ACCOUNT_CLIENT_SECRET" +MINIO_ENDPOINT="op://minio/$APP_ENV/base/MINIO_ENDPOINT" +MINIO_ACCESS_KEY="op://minio/$APP_ENV/base/MINIO_ACCESS_KEY" +MINIO_ACCESS_SECRET="op://minio/$APP_ENV/base/MINIO_ACCESS_SECRET" +MINIO_BUCKET_BUSINESSES="op://minio/$APP_ENV/lear/MINIO_BUCKET_BUSINESSES" +AUTH_API_URL="op://API/$APP_ENV/auth-api/AUTH_API_URL" +AUTH_API_VERSION="op://API/$APP_ENV/auth-api/AUTH_API_VERSION" +COLIN_API_URL="op://API/$APP_ENV/colin-api-entity/COLIN_API_URL" +COLIN_API_VERSION="op://API/$APP_ENV/colin-api-entity/COLIN_API_VERSION" +NAMEX_API_URL="op://API/$APP_ENV/namex-api/NAMEX_API_URL" +NAMEX_API_VERSION="op://API/$APP_ENV/namex-api/NAMEX_API_VERSION" +BUSINESS_API_URL="op://API/$APP_ENV/business-api/BUSINESS_API_URL" +BUSINESS_API_VERSION2="op://API/$APP_ENV/business-api/BUSINESS_API_VERSION_2" +PAY_API_URL="op://API/$APP_ENV/pay-api/PAY_API_URL" +PAY_API_VERSION="op://API/$APP_ENV/pay-api/PAY_API_VERSION" +REPORT_API_URL="op://API/$APP_ENV/report-api/REPORT_API_URL" +REPORT_API_VERSION="op://API/$APP_ENV/report-api/REPORT_API_VERSION" +NATS_SERVERS="op://nats/$APP_ENV/base/NATS_SERVERS" +NATS_CLUSTER_ID="op://nats/$APP_ENV/base/NATS_CLUSTER_ID" +NATS_QUEUE="op://nats/$APP_ENV/nats-filer/NATS_QUEUE" +NATS_CLIENT_NAME="op://nats/$APP_ENV/nats-filer/NATS_CLIENT_NAME" +NATS_FILER_SUBJECT="op://nats/$APP_ENV/nats-filer/NATS_FILER_SUBJECT" +NATS_ENTITY_EVENT_SUBJECT="op://nats/$APP_ENV/nats-filer/NATS_ENTITY_EVENT_SUBJECT" +NATS_EMAILER_SUBJECT="op://nats/$APP_ENV/nats-emailer/NATS_EMAILER_SUBJECT" +SENTRY_DSN="" \ No newline at end of file diff --git a/queue_services/entity-filer/devops/vaults.json b/queue_services/entity-filer/devops/vaults.json deleted file mode 100644 index 61ba69332e..0000000000 --- a/queue_services/entity-filer/devops/vaults.json +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "vault": "shared", - "application": [ - "nats", - "naics" - ] - }, - { - "vault": "minio", - "application": [ - "base", - "lear" - ] - }, - { - "vault": "entity", - "application": [ - "postgres-legal", - "entity-filer", - "nats-filer", - "entity-service-account", - "sentry" - ] - } -] diff --git a/queue_services/entity-filer/pyproject.toml b/queue_services/entity-filer/pyproject.toml index de8b64077f..d4598cd54f 100644 --- a/queue_services/entity-filer/pyproject.toml +++ b/queue_services/entity-filer/pyproject.toml @@ -25,9 +25,9 @@ flask-babel = "^3.1.0" registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", rev = "2.18.10"} simple_cloudevent = { git = "https://github.com/daxiom/simple-cloudevent.py" } -##sql-versioning = { git = "https://github.com/bcgov/lear.git", subdirectory = "python/common/sql-versioning", branch = "dev_legal_name_changes" } +##sql-versioning = { git = "https://github.com/bcgov/lear.git", subdirectory = "python/common/sql-versioning", branch = "feature_legal_name" } sql-versioning = {path = "../../python/common/sql-versioning"} -##business-model = { git = "https://github.com/bcgov/lear.git", subdirectory = "python/common/business-registry-model", branch = "dev_legal_name_changes" } +##business-model = { git = "https://github.com/bcgov/lear.git", subdirectory = "python/common/business-registry-model", branch = "feature_legal_name" } business-model = {path = "../../python/common/business-registry-model"} cattrs = "^23.1.2" google-cloud-pubsub = "^2.18.4" diff --git a/queue_services/entity-filer/src/entity_filer/config.py b/queue_services/entity-filer/src/entity_filer/config.py index f37e3c532e..48a3ac202d 100644 --- a/queue_services/entity-filer/src/entity_filer/config.py +++ b/queue_services/entity-filer/src/entity_filer/config.py @@ -56,21 +56,17 @@ class Config: # pylint: disable=too-few-public-methods PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__)) - PAYMENT_SVC_URL = os.getenv("PAYMENT_SVC_URL", "") - SENTRY_DSN = os.getenv("SENTRY_DSN", None) - REPORT_TEMPLATE_PATH = os.getenv("REPORT_PATH", "report-templates") - - FONTS_PATH = os.getenv("FONTS_PATH", "fonts") - - # POSTGRESQL SQLALCHEMY_TRACK_MODIFICATIONS = False + # POSTGRESQL DB_USER = os.getenv("DATABASE_USERNAME", "") DB_PASSWORD = os.getenv("DATABASE_PASSWORD", "") DB_NAME = os.getenv("DATABASE_NAME", "") DB_HOST = os.getenv("DATABASE_HOST", "") DB_PORT = os.getenv("DATABASE_PORT", "5432") + + # POSTGRESQL if DB_UNIX_SOCKET := os.getenv("DATABASE_UNIX_SOCKET", None): SQLALCHEMY_DATABASE_URI = f"postgresql+pg8000://{DB_USER}:{DB_PASSWORD}@/{DB_NAME}?unix_sock={DB_UNIX_SOCKET}/.s.PGSQL.5432" else: @@ -78,20 +74,36 @@ class Config: # pylint: disable=too-few-public-methods f"postgresql+pg8000://{DB_USER}:{DB_PASSWORD}@{DB_HOST}:{DB_PORT}/{DB_NAME}" ) - COLIN_API = os.getenv("COLIN_API", "") + # API Endpoints + AUTH_API_URL = os.getenv("AUTH_API_URL", "") + AUTH_API_VERSION = os.getenv("AUTH_API_VERSION", "") + COLIN_API_URL = os.getenv("COLIN_API_URL", "") + COLIN_API_VERSION = os.getenv("COLIN_API_VERSION", "") + BUSINESS_API_URL = os.getenv("BUSINESS_API_URL", "") + BUSINESS_API_VERSION_2 = os.getenv("BUSINESS_API_VERSION2", "") + NAMEX_API_URL = os.getenv("NAMEX_API_URL", "") + NAMEX_API_VERSION = os.getenv("NAMEX_API_VERSION", "") + PAY_API_URL = os.getenv("PAY_API_URL", "") + PAY_API_VERSION = os.getenv("PAY_API_VERSION", "") + REPORT_API_URL = os.getenv("REPORT_API_URL", "") + REPORT_API_VERSION = os.getenv("REPORT_API_VERSION", "") + + LEGAL_API_URL = f"{BUSINESS_API_URL + BUSINESS_API_VERSION_2}" + COLIN_API = f"{COLIN_API_URL + AUTH_API_VERSION}" + NAMEX_API = f"{NAMEX_API_URL + NAMEX_API_VERSION}" + PAYMENT_SVC_URL = f"{PAY_API_URL + PAY_API_VERSION}/payment-request" + AUTH_SVC_URL = f"{AUTH_API_URL + AUTH_API_VERSION}" + REPORT_SVC_URL = f"{REPORT_API_URL + REPORT_API_VERSION}/reports" + NAICS_API_URL = f"{BUSINESS_API_URL + BUSINESS_API_VERSION_2}/naics" + + REPORT_TEMPLATE_PATH = os.getenv("REPORT_PATH", "report-templates") + FONTS_PATH = os.getenv("FONTS_PATH", "fonts") # service accounts - AUTH_SVC_URL = os.getenv("AUTH_SVC_URL", "https://") - ACCOUNT_SVC_AUTH_URL = os.getenv("ACCOUNT_SVC_AUTH_URL") - ACCOUNT_SVC_CLIENT_ID = os.getenv("ACCOUNT_SVC_CLIENT_ID") - ACCOUNT_SVC_CLIENT_SECRET = os.getenv("ACCOUNT_SVC_CLIENT_SECRET") - ACCOUNT_SVC_TIMEOUT = os.getenv("ACCOUNT_SVC_TIMEOUT") - - # BCRegistry Services - ACCOUNT_SVC_ENTITY_URL = os.getenv("ACCOUNT_SVC_ENTITY_URL") - ACCOUNT_SVC_AFFILIATE_URL = os.getenv("ACCOUNT_SVC_AFFILIATE_URL") - LEGAL_API_URL = os.getenv("LEGAL_API_URL") - NAMEX_API = os.getenv("NAMEX_API") + ACCOUNT_SVC_AUTH_URL = os.getenv("KEYCLOAK_AUTH_TOKEN_URL") + ACCOUNT_SVC_CLIENT_ID = os.getenv("KEYCLOAK_CLIENT_ID") + ACCOUNT_SVC_CLIENT_SECRET = os.getenv("KEYCLOAK_CLIENT_ID") + ACCOUNT_SVC_TIMEOUT = os.getenv("KEYCLOAK_TIMEOUT") # legislative timezone for future effective dating LEGISLATIVE_TIMEZONE = os.getenv("LEGISLATIVE_TIMEZONE", "America/Vancouver") @@ -103,8 +115,6 @@ class Config: # pylint: disable=too-few-public-methods MINIO_BUCKET_BUSINESSES = os.getenv("MINIO_BUCKET_BUSINESSES", "businesses") MINIO_SECURE = True - NAICS_API_URL = os.getenv("NAICS_API_URL", "https://NAICS_API_URL/api/v2/naics") - class Development(Config): # pylint: disable=too-few-public-methods """Creates the Development Config object.""" diff --git a/queue_services/entity-pay/devops/gcp/clouddeploy-targets.yaml b/queue_services/entity-pay/devops/gcp/clouddeploy-targets.yaml new file mode 100644 index 0000000000..5a65e63e99 --- /dev/null +++ b/queue_services/entity-pay/devops/gcp/clouddeploy-targets.yaml @@ -0,0 +1,102 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: dev +description: Dev Environment +deployParameters: + deploy-project-id: "a083gt-dev" + service-name: "business-pay-dev" + container-name: "business-pay-dev" + app-env: "dev" + cloudsql-instances: "a083gt-dev:northamerica-northeast1:businesses-db-dev" + max-scale: "1" + container-concurrency: "2" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-dev/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' +--- + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: test +description: Test Environment +deployParameters: + deploy-project-id: "a083gt-test" + service-name: "business-pay-test" + container-name: "business-pay-test" + app-env: "test" + cloudsql-instances: "a083gt-test:northamerica-northeast1:businesses-db-test" + max-scale: "2" + container-concurrency: "3" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-test/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' +--- + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: sandbox +description: Sandbox Environment +requireApproval: true +deployParameters: + deploy-project-id: "a083gt-integration" + service-name: "business-pay-sandbox" + container-name: "business-pay-sandbox" + app-env: "sandbox" + cloudsql-instances: "a083gt-integration:northamerica-northeast1:businesses-db-sandbox" + max-scale: "3" + container-concurrency: "7" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-integration/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' +--- + +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: prod +description: Production Environment +requireApproval: true +deployParameters: + deploy-project-id: "a083gt-prod" + service-name: "business-pay-prod" + container-name: "business-pay-prod" + app-env: "production" + cloudsql-instances: "a083gt-prod:northamerica-northeast1:businesses-db-prod" + max-scale: "3" + container-concurrency: "7" + timeout-seconds: "300" + container-port: "8080" +run: + location: projects/a083gt-prod/locations/northamerica-northeast1 +executionConfigs: +- usages: [DEPLOY, RENDER] + artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' \ No newline at end of file diff --git a/queue_services/entity-pay/devops/vaults.gcp.env b/queue_services/entity-pay/devops/vaults.gcp.env new file mode 100644 index 0000000000..8fd845023b --- /dev/null +++ b/queue_services/entity-pay/devops/vaults.gcp.env @@ -0,0 +1,12 @@ +DATABASE_NAME="op://database/$APP_ENV/business-db/DATABASE_NAME" +DATABASE_PASSWORD="op://database/$APP_ENV/business-db/DATABASE_PASSWORD" +DATABASE_PORT="op://database/$APP_ENV/business-db/DATABASE_PORT" +DATABASE_UNIX_SOCKET="op://database/$APP_ENV/business-db/DATABASE_UNIX_SOCKET" +DATABASE_USERNAME="op://database/$APP_ENV/business-db/DATABASE_USERNAME" +PAY_API_URL="op://API/$APP_ENV/pay-api/PAY_API_URL" +PAY_API_VERSION="op://API/$APP_ENV/pay-api/PAY_API_VERSION" +AUDIENCE=op://gcp-queue/$APP_ENV/payment/AUDIENCE" +TOPIC_NAME=op://gcp-queue/$APP_ENV/payment/TOPIC_NAME" +PUBLISHER_AUDIENCE=op://gcp-queue/$APP_ENV/payment/PUBLISHER_AUDIENCE" +GCP_AUTH_KEY=op://gcp-queue/$APP_ENV/payment/GCP_AUTH_KEY" +SENTRY_DSN="" \ No newline at end of file diff --git a/queue_services/entity-pay/devops/vaults.json b/queue_services/entity-pay/devops/vaults.json deleted file mode 100644 index 347f9b5580..0000000000 --- a/queue_services/entity-pay/devops/vaults.json +++ /dev/null @@ -1,10 +0,0 @@ -[ - { - "vault": "entity", - "application": [ - "postgres-legal", - "entity-pay", - "sentry" - ] - } -] diff --git a/queue_services/entity-pay/k8s/knative/dc.env-template b/queue_services/entity-pay/k8s/knative/dc.env-template deleted file mode 100644 index b5464987af..0000000000 --- a/queue_services/entity-pay/k8s/knative/dc.env-template +++ /dev/null @@ -1,21 +0,0 @@ -NAME=entity-pay -GENERATION=1 -CLOUDSQL_INSTANCES= -MAXSCALE= -CONTAINER_CONCURRENCY= -TIMEOUT_SECONDS=1800 -SERVICE_ACCOUNTNAME= -CONTAINER_IMAGE= -CONTAINER_PORT= -DATABASE_HOST= -DATABASE_NAME= -DATABASE_PASSWORD= -DATABASE_PORT= -GUNICORN_PROCESSES= -GUNICORN_THREADS= -DATABASE_UNIX_SOCKET= -DATABASE_USERNAME= -AUDIENCE= -PUBLISHER_AUDIENCE= -ENTITY_MAILER_TOPIC= -ENTITY_FILER_TOPIC= diff --git a/queue_services/entity-pay/k8s/knative/dc.yaml b/queue_services/entity-pay/k8s/knative/dc.yaml deleted file mode 100644 index b0e30c4eb4..0000000000 --- a/queue_services/entity-pay/k8s/knative/dc.yaml +++ /dev/null @@ -1,64 +0,0 @@ -apiVersion: serving.knative.dev/v1 -kind: Service -metadata: - name: $NAME - generation: $GENERATION - labels: - cloud.googleapis.com/location: northamerica-northeast1 -spec: - template: - metadata: - labels: - run.googleapis.com/startupProbeType: Default - annotations: - run.googleapis.com/client-name: cloud-console - run.googleapis.com/cloudsql-instances: $CLOUDSQL_INSTANCES - autoscaling.knative.dev/maxScale: $MAXSCALE - spec: - containerConcurrency: $CONTAINER_CONCURRENCY - timeoutSeconds: $TIMEOUT_SECONDS - serviceAccountName: $SERVICE_ACCOUNTNAME - containers: - - image: >- - $CONTAINER_IMAGE - ports: - - name: http1 - containerPort: $CONTAINER_PORT - env: - - name: DATABASE_HOST - value: $DATABASE_HOST - - name: DATABASE_NAME - value: $DATABASE_NAME - - name: DATABASE_PASSWORD - value: $DATABASE_PASSWORD - - name: DATABASE_PORT - value: $DATABASE_PORT - - name: GUNICORN_PROCESSES - value: $GUNICORN_PROCESSES - - name: GUNICORN_THREADS - value: GUNICORN_THREADS - - name: DATABASE_UNIX_SOCKET - value: $DATABASE_UNIX_SOCKET - - name: DATABASE_USERNAME - value: DATABASE_USERNAME - - name: AUDIENCE - value: $AUDIENCE - - name: PUBLISHER_AUDIENCE - value: $PUBLISHER_AUDIENCE - - name: ENTITY_MAILER_TOPIC - value: $ENTITY_MAILER_TOPIC - - name: ENTITY_FILER_TOPIC - value: $ENTITY_FILER_TOPIC - resources: - limits: - cpu: 1000m - memory: 512Mi - startupProbe: - timeoutSeconds: 240 - periodSeconds: 240 - failureThreshold: 1 - tcpSocket: - port: 8080 - traffic: - - percent: 100 - latestRevision: true diff --git a/queue_services/entity-pay/poetry.lock b/queue_services/entity-pay/poetry.lock index 3f1926f435..b408c1cd0a 100644 --- a/queue_services/entity-pay/poetry.lock +++ b/queue_services/entity-pay/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.5.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand. [[package]] name = "alembic" @@ -511,14 +511,8 @@ files = [ [package.dependencies] google-auth = ">=2.14.1,<3.0.dev0" googleapis-common-protos = ">=1.56.2,<2.0.dev0" -grpcio = [ - {version = ">=1.33.2,<2.0dev", optional = true, markers = "extra == \"grpc\""}, - {version = ">=1.49.1,<2.0dev", optional = true, markers = "python_version >= \"3.11\" and extra == \"grpc\""}, -] -grpcio-status = [ - {version = ">=1.33.2,<2.0.dev0", optional = true, markers = "extra == \"grpc\""}, - {version = ">=1.49.1,<2.0.dev0", optional = true, markers = "python_version >= \"3.11\" and extra == \"grpc\""}, -] +grpcio = {version = ">=1.49.1,<2.0dev", optional = true, markers = "python_version >= \"3.11\" and extra == \"grpc\""} +grpcio-status = {version = ">=1.49.1,<2.0.dev0", optional = true, markers = "python_version >= \"3.11\" and extra == \"grpc\""} protobuf = ">=3.19.5,<3.20.0 || >3.20.0,<3.20.1 || >3.20.1,<4.21.0 || >4.21.0,<4.21.1 || >4.21.1,<4.21.2 || >4.21.2,<4.21.3 || >4.21.3,<4.21.4 || >4.21.4,<4.21.5 || >4.21.5,<5.0.0.dev0" requests = ">=2.18.0,<3.0.0.dev0" @@ -962,19 +956,19 @@ pycountry = "^22.3.5" pydantic = "^1.10.8" PyPDF2 = "^3.0.1" python-dotenv = "^1.0.0" -registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", rev = "2.18.7"} +registry-schemas = {git = "https://github.com/bcgov/business-schemas.git", branch = "feature-legal-name"} reportlab = "^4.0.0" requests = "^2.31.0" sentry-sdk = "^1.24.0" -sql-versioning = {git = "https://github.com/bcgov/lear.git", branch = "dev_legal_name_changes", subdirectory = "python/common/sql-versioning"} +sql-versioning = {git = "https://github.com/bcgov/lear.git", branch = "feature-legal-name", subdirectory = "python/common/sql-versioning"} sqlalchemy-continuum = "^1.3.14" strict-rfc3339 = "^0.7" [package.source] type = "git" url = "https://github.com/bcgov/lear.git" -reference = "dev_legal_name_changes" -resolved_reference = "1e99f8b407f83181725790d2c5ef18b1b42fd6db" +reference = "feature-legal-name" +resolved_reference = "276dd22920d983afc489ec7caea50179d2d537a7" subdirectory = "legal-api" [[package]] @@ -987,6 +981,8 @@ files = [ {file = "lxml-4.9.3-cp27-cp27m-macosx_11_0_x86_64.whl", hash = "sha256:b0a545b46b526d418eb91754565ba5b63b1c0b12f9bd2f808c852d9b4b2f9b5c"}, {file = "lxml-4.9.3-cp27-cp27m-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:075b731ddd9e7f68ad24c635374211376aa05a281673ede86cbe1d1b3455279d"}, {file = "lxml-4.9.3-cp27-cp27m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:1e224d5755dba2f4a9498e150c43792392ac9b5380aa1b845f98a1618c94eeef"}, + {file = "lxml-4.9.3-cp27-cp27m-win32.whl", hash = "sha256:2c74524e179f2ad6d2a4f7caf70e2d96639c0954c943ad601a9e146c76408ed7"}, + {file = "lxml-4.9.3-cp27-cp27m-win_amd64.whl", hash = "sha256:4f1026bc732b6a7f96369f7bfe1a4f2290fb34dce00d8644bc3036fb351a4ca1"}, {file = "lxml-4.9.3-cp27-cp27mu-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:c0781a98ff5e6586926293e59480b64ddd46282953203c76ae15dbbbf302e8bb"}, {file = "lxml-4.9.3-cp27-cp27mu-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:cef2502e7e8a96fe5ad686d60b49e1ab03e438bd9123987994528febd569868e"}, {file = "lxml-4.9.3-cp310-cp310-macosx_11_0_x86_64.whl", hash = "sha256:b86164d2cff4d3aaa1f04a14685cbc072efd0b4f99ca5708b2ad1b9b5988a991"}, @@ -1128,6 +1124,16 @@ files = [ {file = "MarkupSafe-2.1.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:5bbe06f8eeafd38e5d0a4894ffec89378b6c6a625ff57e3028921f8ff59318ac"}, {file = "MarkupSafe-2.1.3-cp311-cp311-win32.whl", hash = "sha256:dd15ff04ffd7e05ffcb7fe79f1b98041b8ea30ae9234aed2a9168b5797c3effb"}, {file = "MarkupSafe-2.1.3-cp311-cp311-win_amd64.whl", hash = "sha256:134da1eca9ec0ae528110ccc9e48041e0828d79f24121a1a146161103c76e686"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:f698de3fd0c4e6972b92290a45bd9b1536bffe8c6759c62471efaa8acb4c37bc"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:aa57bd9cf8ae831a362185ee444e15a93ecb2e344c8e52e4d721ea3ab6ef1823"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ffcc3f7c66b5f5b7931a5aa68fc9cecc51e685ef90282f4a82f0f5e9b704ad11"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:47d4f1c5f80fc62fdd7777d0d40a2e9dda0a05883ab11374334f6c4de38adffd"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1f67c7038d560d92149c060157d623c542173016c4babc0c1913cca0564b9939"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:9aad3c1755095ce347e26488214ef77e0485a3c34a50c5a5e2471dff60b9dd9c"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:14ff806850827afd6b07a5f32bd917fb7f45b046ba40c57abdb636674a8b559c"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8f9293864fe09b8149f0cc42ce56e3f0e54de883a9de90cd427f191c346eb2e1"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-win32.whl", hash = "sha256:715d3562f79d540f251b99ebd6d8baa547118974341db04f5ad06d5ea3eb8007"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-win_amd64.whl", hash = "sha256:1b8dd8c3fd14349433c79fa8abeb573a55fc0fdd769133baac1f5e07abf54aeb"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:8e254ae696c88d98da6555f5ace2279cf7cd5b3f52be2b5cf97feafe883b58d2"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cb0932dc158471523c9637e807d9bfb93e06a95cbf010f1a38b98623b929ef2b"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9402b03f1a1b4dc4c19845e5c749e3ab82d5078d16a2a4c2cd2df62d57bb0707"}, @@ -1248,6 +1254,7 @@ files = [ {file = "Pillow-10.0.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:3b08d4cc24f471b2c8ca24ec060abf4bebc6b144cb89cba638c720546b1cf538"}, {file = "Pillow-10.0.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:d737a602fbd82afd892ca746392401b634e278cb65d55c4b7a8f48e9ef8d008d"}, {file = "Pillow-10.0.0-cp311-cp311-win_amd64.whl", hash = "sha256:3a82c40d706d9aa9734289740ce26460a11aeec2d9c79b7af87bb35f0073c12f"}, + {file = "Pillow-10.0.0-cp311-cp311-win_arm64.whl", hash = "sha256:bc2ec7c7b5d66b8ec9ce9f720dbb5fa4bace0f545acd34870eff4a369b44bf37"}, {file = "Pillow-10.0.0-cp312-cp312-macosx_10_10_x86_64.whl", hash = "sha256:d80cf684b541685fccdd84c485b31ce73fc5c9b5d7523bf1394ce134a60c6883"}, {file = "Pillow-10.0.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:76de421f9c326da8f43d690110f0e79fe3ad1e54be811545d7d91898b4c8493e"}, {file = "Pillow-10.0.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:81ff539a12457809666fef6624684c008e00ff6bf455b4b89fd00a140eecd640"}, @@ -1257,6 +1264,7 @@ files = [ {file = "Pillow-10.0.0-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:d50b6aec14bc737742ca96e85d6d0a5f9bfbded018264b3b70ff9d8c33485551"}, {file = "Pillow-10.0.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:00e65f5e822decd501e374b0650146063fbb30a7264b4d2744bdd7b913e0cab5"}, {file = "Pillow-10.0.0-cp312-cp312-win_amd64.whl", hash = "sha256:f31f9fdbfecb042d046f9d91270a0ba28368a723302786c0009ee9b9f1f60199"}, + {file = "Pillow-10.0.0-cp312-cp312-win_arm64.whl", hash = "sha256:1ce91b6ec08d866b14413d3f0bbdea7e24dfdc8e59f562bb77bc3fe60b6144ca"}, {file = "Pillow-10.0.0-cp38-cp38-macosx_10_10_x86_64.whl", hash = "sha256:349930d6e9c685c089284b013478d6f76e3a534e36ddfa912cde493f235372f3"}, {file = "Pillow-10.0.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:3a684105f7c32488f7153905a4e3015a3b6c7182e106fe3c37fbb5ef3e6994c3"}, {file = "Pillow-10.0.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b4f69b3700201b80bb82c3a97d5e9254084f6dd5fb5b16fc1a7b974260f89f43"}, @@ -1633,8 +1641,8 @@ strict-rfc3339 = "*" [package.source] type = "git" url = "https://github.com/bcgov/business-schemas.git" -reference = "2.18.7" -resolved_reference = "a9afaa6a62d63cd53b0b38b714e6f1399aef4df7" +reference = "feature-legal-name" +resolved_reference = "46fe42057ce8b8f7136ea2817b044b3a58d6939e" [[package]] name = "reportlab" @@ -1975,7 +1983,7 @@ develop = false [package.source] type = "git" url = "https://github.com/bcgov/lear.git" -reference = "dev_legal_name_changes" +reference = "feature-legal-name" resolved_reference = "1e99f8b407f83181725790d2c5ef18b1b42fd6db" subdirectory = "python/common/sql-versioning" @@ -2030,7 +2038,7 @@ files = [ ] [package.dependencies] -greenlet = {version = "!=0.4.17", markers = "platform_machine == \"win32\" or platform_machine == \"WIN32\" or platform_machine == \"AMD64\" or platform_machine == \"amd64\" or platform_machine == \"x86_64\" or platform_machine == \"ppc64le\" or platform_machine == \"aarch64\""} +greenlet = {version = "!=0.4.17", markers = "platform_machine == \"aarch64\" or platform_machine == \"ppc64le\" or platform_machine == \"x86_64\" or platform_machine == \"amd64\" or platform_machine == \"AMD64\" or platform_machine == \"win32\" or platform_machine == \"WIN32\""} typing-extensions = ">=4.2.0" [package.extras] @@ -2193,4 +2201,4 @@ watchdog = ["watchdog (>=2.3)"] [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "7277197e6e87ea9a15846ef166b439ea1f22601273388dcc0af5de97e160a753" +content-hash = "3f4cca09051fb09edb4cdf71ba09f936199924ad1fcbaf836a93deec616d5792" diff --git a/queue_services/entity-pay/pyproject.toml b/queue_services/entity-pay/pyproject.toml index 753343fda1..02d5ca92e4 100644 --- a/queue_services/entity-pay/pyproject.toml +++ b/queue_services/entity-pay/pyproject.toml @@ -13,7 +13,7 @@ Flask = "^2.3.2" python-dotenv = "^1.0.0" sentry-sdk = "^1.27.1" launchdarkly-server-sdk = "^8.1.4" -legal_api = { git = "https://github.com/bcgov/lear.git", subdirectory = "legal-api", branch = "dev_legal_name_changes" } +legal_api = { git = "https://github.com/bcgov/lear.git", subdirectory = "legal-api", branch = "feature-legal-name" } simple_cloudevent = { git = "https://github.com/daxiom/simple-cloudevent.py" } requests = "^2.31.0" google-auth = "^2.21.0" diff --git a/queue_services/entity-pay/src/entity_pay/config.py b/queue_services/entity-pay/src/entity_pay/config.py index af1750053a..4c229ef85e 100644 --- a/queue_services/entity-pay/src/entity_pay/config.py +++ b/queue_services/entity-pay/src/entity_pay/config.py @@ -56,18 +56,18 @@ class Config: # pylint: disable=too-few-public-methods PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__)) - PAYMENT_SVC_URL = os.getenv("PAYMENT_SVC_URL", "") + ENVIRONMENT = os.getenv("APP_ENV", "prod") SENTRY_DSN = os.getenv("SENTRY_DSN", None) SQLALCHEMY_TRACK_MODIFICATIONS = False - # POSTGRESQL DB_USER = os.getenv("DATABASE_USERNAME", "") DB_PASSWORD = os.getenv("DATABASE_PASSWORD", "") DB_NAME = os.getenv("DATABASE_NAME", "") DB_HOST = os.getenv("DATABASE_HOST", "") DB_PORT = os.getenv("DATABASE_PORT", "5432") + # POSTGRESQL if DB_UNIX_SOCKET := os.getenv("DATABASE_UNIX_SOCKET", None): SQLALCHEMY_DATABASE_URI = f"postgresql+pg8000://{DB_USER}:{DB_PASSWORD}@/{DB_NAME}?unix_sock={DB_UNIX_SOCKET}/.s.PGSQL.5432" @@ -76,8 +76,13 @@ class Config: # pylint: disable=too-few-public-methods f"postgresql+pg8000://{DB_USER}:{DB_PASSWORD}@{DB_HOST}:{DB_PORT}/{DB_NAME}" ) - ENVIRONMENT = os.getenv("ENVIRONMENT", "prod") + # API Endpoints + PAY_API_URL = os.getenv("PAY_API_URL", "") + PAY_API_VERSION = os.getenv("PAY_API_VERSION", "") + + PAYMENT_SVC_URL = f"{PAY_API_URL + PAY_API_VERSION}/payment-request" + # pub/sub GCP_AUTH_KEY = os.getenv("GCP_AUTH_KEY", None) ENTITY_MAILER_TOPIC = os.getenv("ENTITY_MAILER_TOPIC", "mailer") ENTITY_FILER_TOPIC = os.getenv("ENTITY_FILER_TOPIC", "filer")