-
Notifications
You must be signed in to change notification settings - Fork 41
feat: service deployments #1668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,16 @@ name: Production Deploy | |
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| service: | ||
| description: Service to deploy | ||
| required: true | ||
| type: choice | ||
| default: frontend | ||
| options: | ||
| - frontend | ||
| - package-downloads-worker | ||
| - search-volume-worker | ||
|
|
||
| env: | ||
| CLOUD_ENV: lf-oracle-production | ||
|
|
@@ -21,6 +31,36 @@ jobs: | |
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - name: Set service config | ||
| id: config | ||
| run: | | ||
| case "${{ inputs.service }}" in | ||
| frontend) | ||
| echo "dockerfile=frontend/Dockerfile" >> $GITHUB_OUTPUT | ||
| echo "image_name=insights-app" >> $GITHUB_OUTPUT | ||
| echo "k8s_deployment=insights-app-dpl" >> $GITHUB_OUTPUT | ||
|
Comment on lines
+40
to
+44
|
||
| echo "k8s_container=frontend" >> $GITHUB_OUTPUT | ||
| ;; | ||
| package-downloads-worker) | ||
| echo "dockerfile=workers/temporal/package_downloads_worker/Dockerfile" >> $GITHUB_OUTPUT | ||
| echo "image_name=package-downloads-worker" >> $GITHUB_OUTPUT | ||
| echo "k8s_deployment=package-downloads-worker-dpl" >> $GITHUB_OUTPUT | ||
| echo "k8s_container=package-downloads-worker" >> $GITHUB_OUTPUT | ||
| ;; | ||
| search-volume-worker) | ||
| echo "dockerfile=workers/temporal/search_volume_worker/Dockerfile" >> $GITHUB_OUTPUT | ||
| echo "image_name=insights-search-volume-worker" >> $GITHUB_OUTPUT | ||
| echo "k8s_deployment=search-volume-worker-dpl" >> $GITHUB_OUTPUT | ||
| echo "k8s_container=search-volume-worker" >> $GITHUB_OUTPUT | ||
| ;; | ||
| *) | ||
| echo "::error::Unknown service: ${{ inputs.service }}" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| - name: Setup OCI CLI and Kubectl | ||
| run: | | ||
|
|
@@ -64,17 +104,21 @@ jobs: | |
| id: build-docker-image | ||
| with: | ||
| app-env: production | ||
| env: | ||
| NUXT_REDIS_URL: ${{ env.NUXT_REDIS_URL }} | ||
| dockerfile: ${{ steps.config.outputs.dockerfile }} | ||
| image-name: ${{ steps.config.outputs.image_name }} | ||
| build-args: '' | ||
|
|
||
| - name: Update Deployment Image | ||
| run: | | ||
| kubectl set image deployment/insights-app-dpl frontend=${{ steps.build-docker-image.outputs.image }} -n insights | ||
| kubectl rollout status deployment/insights-app-dpl -n insights --timeout=300s | ||
| kubectl set image deployment/${{ steps.config.outputs.k8s_deployment }} \ | ||
| ${{ steps.config.outputs.k8s_container }}=${{ steps.build-docker-image.outputs.image }} \ | ||
| -n insights | ||
| kubectl rollout status deployment/${{ steps.config.outputs.k8s_deployment }} -n insights --timeout=300s | ||
|
|
||
| - name: Flush Redis cache | ||
| if: inputs.service == 'frontend' | ||
| run: | | ||
| REDIS_URL=$(kubectl get configmap insights-config-map -n insights -o jsonpath="{.data.NUXT_REDIS_URL}") | ||
| PASSWORD=$(echo "$REDIS_URL" | sed -n 's|.*://:\([^@]*\)@.*|\1|p') | ||
| kubectl exec -i redis-client -n insights -- \ | ||
| redis-cli -h redis-svc -a "$PASSWORD" FLUSHALL | ||
| redis-cli -h redis-svc -a "$PASSWORD" FLUSHALL | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,16 @@ name: Staging Deploy | |
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| service: | ||
| description: Service to deploy | ||
| required: true | ||
| type: choice | ||
| default: frontend | ||
| options: | ||
| - frontend | ||
| - package-downloads-worker | ||
| - search-volume-worker | ||
|
|
||
| env: | ||
| CLOUD_ENV: lf-oracle-staging | ||
|
|
@@ -21,6 +31,36 @@ jobs: | |
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - name: Set service config | ||
| id: config | ||
| run: | | ||
| case "${{ inputs.service }}" in | ||
| frontend) | ||
| echo "dockerfile=frontend/Dockerfile" >> $GITHUB_OUTPUT | ||
| echo "image_name=insights-app" >> $GITHUB_OUTPUT | ||
| echo "k8s_deployment=insights-app-dpl" >> $GITHUB_OUTPUT | ||
|
Comment on lines
+40
to
+44
|
||
| echo "k8s_container=frontend" >> $GITHUB_OUTPUT | ||
| ;; | ||
| package-downloads-worker) | ||
| echo "dockerfile=workers/temporal/package_downloads_worker/Dockerfile" >> $GITHUB_OUTPUT | ||
| echo "image_name=package-downloads-worker" >> $GITHUB_OUTPUT | ||
| echo "k8s_deployment=package-downloads-worker-dpl" >> $GITHUB_OUTPUT | ||
| echo "k8s_container=package-downloads-worker" >> $GITHUB_OUTPUT | ||
| ;; | ||
| search-volume-worker) | ||
| echo "dockerfile=workers/temporal/search_volume_worker/Dockerfile" >> $GITHUB_OUTPUT | ||
| echo "image_name=insights-search-volume-worker" >> $GITHUB_OUTPUT | ||
| echo "k8s_deployment=search-volume-worker-dpl" >> $GITHUB_OUTPUT | ||
| echo "k8s_container=search-volume-worker" >> $GITHUB_OUTPUT | ||
| ;; | ||
| *) | ||
| echo "::error::Unknown service: ${{ inputs.service }}" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| - name: Setup OCI CLI and Kubectl | ||
| run: | | ||
|
|
@@ -64,10 +104,13 @@ jobs: | |
| id: build-docker-image | ||
| with: | ||
| app-env: staging | ||
| env: | ||
| NUXT_REDIS_URL: ${{ env.NUXT_REDIS_URL }} | ||
| dockerfile: ${{ steps.config.outputs.dockerfile }} | ||
| image-name: ${{ steps.config.outputs.image_name }} | ||
| build-args: '' | ||
|
|
||
| - name: Update Deployment Image | ||
| run: | | ||
| kubectl set image deployment/insights-app-dpl frontend=${{ steps.build-docker-image.outputs.image }} -n insights | ||
| kubectl rollout status deployment/insights-app-dpl -n insights --timeout=300s | ||
| kubectl set image deployment/${{ steps.config.outputs.k8s_deployment }} \ | ||
| ${{ steps.config.outputs.k8s_container }}=${{ steps.build-docker-image.outputs.image }} \ | ||
| -n insights | ||
| kubectl rollout status deployment/${{ steps.config.outputs.k8s_deployment }} -n insights --timeout=300s | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,4 +15,4 @@ scripts/ | |
| .flake8 | ||
| *.md | ||
| Makefile | ||
| backend/ | ||
| backend/ | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docker/build-push-actionis invoked withcontext: ., which uses the repo-root.dockerignore. That.dockerignorecurrently excludesworkersandsubmodules, but the worker Dockerfiles copy those paths, so builds for the worker services will fail with missing files. Consider updating the root.dockerignoreto include these directories (or make the build context/dockerignore configurable per service) so worker builds have access to required sources.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is a valid comment, but might be worth checking out