diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4f30d36..d8d0d63 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -57,13 +57,6 @@ jobs: run: | lttle login --api "https://eu.lttle.cloud" "$LTTLE_JWT_TOKEN" - - uses: actions/setup-node@v3 - with: - node-version: 22.18.0 - - name: "Setting up environment variables into .env.production file" - run: | - echo "TYPESENSE_API_KEY='$TYPESENSE_API_KEY'" >> .env.production - - name: "Setting deployment" id: deploymentUrl run: | @@ -77,6 +70,8 @@ jobs: # https://docs.docker.com/build/ci/github-actions/ - name: "Deploying the application" run: ./deploy.sh + env: + TYPESENSE_API_KEY: ${{ vars.TYPESENSE_API_KEY }} # NOTE: This has been added because we need to wait for the application to be fully up before proceeding # The status of the machine does not reflect the readiness of the service + machine to receive traffic @@ -84,5 +79,9 @@ jobs: - name: "Waiting for the application to be ready" run: ./wait-for-app.sh + # IMPORTANT: Why do we need to wait for 5s here? + - name: "Waiting for 30s for typesense-scraper to be ready" + run: sleep 30s + - name: "Restarting the application" run: ./restart.sh scraper diff --git a/deploy.sh b/deploy.sh index a99c4a9..8f624fc 100755 --- a/deploy.sh +++ b/deploy.sh @@ -4,10 +4,6 @@ set -e source ./deploy/utilities.bash -if [[ -f .env.production ]]; then - export $(xargs < .env.production) -fi - if [ -z "${GITHUB_HEAD_REF+x}" ]; then GITHUB_HEAD_REF=$(git rev-parse --abbrev-ref HEAD) export GITHUB_HEAD_REF diff --git a/deploy/utilities.bash b/deploy/utilities.bash index d7bc40f..3970927 100644 --- a/deploy/utilities.bash +++ b/deploy/utilities.bash @@ -50,8 +50,6 @@ deployTypeSense() { echo "Deploying only the typesense-search" lttle deploy ./lttle/typesense.lttle.yaml - - restartMachines "$ns" } restartMachines() { diff --git a/lttle/typesense.lttle.yaml b/lttle/typesense.lttle.yaml index e97c4b1..af3eb43 100644 --- a/lttle/typesense.lttle.yaml +++ b/lttle/typesense.lttle.yaml @@ -25,8 +25,7 @@ machine: environment: # FIXME: Since this is exposed to the public we need to find a way to make # a rolling API KEY that changes every-so-often - # TODO: Must get this from an environment variable - TYPESENSE_API_KEY: uVnR&EtnaLDfhTgLK$~'n#.NX>z + TYPESENSE_API_KEY: ${{ env.TYPESENSE_API_KEY }} TYPESENSE_DATA_DIR: /data --- machine: @@ -53,7 +52,6 @@ machine: - name: nginx-docs - name: typesense-search environment: - # TODO: Must get this from an environment variable TYPESENSE_API_KEY: ${{ env.TYPESENSE_API_KEY }} # This is service-name.namespace.svc.lttle.local TYPESENSE_HOST: "typesense-search-internal.docs-${{ git.ref == 'main'? 'main' : env.GITHUB_HEAD_REF.toSlug() + '-branch' }}.svc.lttle.local"