Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
a3a2205
feat: created transfer branch for cloud build
jirhiker Sep 3, 2025
1e4665b
Formatting changes
jirhiker Sep 3, 2025
d9b0488
feat: update asset transfer logic to handle filenames correctly
jirhiker Sep 3, 2025
0689d77
Formatting changes
jirhiker Sep 3, 2025
37d691b
Merge branch 'pre-production' into transfer
jirhiker Sep 3, 2025
0b6e98c
feat: update contact transfer logic to extract roles from OwnerCommen…
jirhiker Sep 3, 2025
3cdd19b
Formatting changes
jirhiker Sep 3, 2025
197c061
feat: update contact and group transfer logic to use new CSV filename…
jirhiker Sep 4, 2025
3907d7a
Formatting changes
jirhiker Sep 4, 2025
ff6c51b
feat: add health check endpoint and middleware for improved service m…
jirhiker Sep 4, 2025
bdad4d9
Formatting changes
jirhiker Sep 4, 2025
6398a02
feat: add FastAPI entrypoint with trigger endpoint for transfer service
jirhiker Sep 4, 2025
5cc8fae
Formatting changes
jirhiker Sep 4, 2025
fda9d27
feat: add main entry point for FastAPI application with configurable …
jirhiker Sep 4, 2025
9ca5c14
Formatting changes
jirhiker Sep 4, 2025
a4dce0c
feat: remove uvicorn entrypoint and add Procfile for Gunicorn deployment
jirhiker Sep 4, 2025
0fdb227
Formatting changes
jirhiker Sep 4, 2025
9f515b5
feat: update Procfile to use UvicornWorker for Gunicorn deployment
jirhiker Sep 4, 2025
007bdc7
feat: add requirements_transfer.txt for transfer service dependencies
jirhiker Sep 4, 2025
53e8f6d
feat: add requirements.txt for transfer service dependencies
jirhiker Sep 4, 2025
d316cd7
feat: add psycopg-binary dependency to pyproject.toml and update lock…
jirhiker Sep 4, 2025
e182688
feat: simplify requirements.txt by removing direct file references
jirhiker Sep 4, 2025
3c1b91a
feat: use uv requirements
jirhiker Sep 4, 2025
b19e53f
feat: update psycopg dependencies to use psycopg2-binary and remove p…
jirhiker Sep 4, 2025
64e36c0
Merge branch 'pre-production' into transfer
jirhiker Sep 4, 2025
986e6b2
Formatting changes
jirhiker Sep 5, 2025
7f06627
feat: update Procfile to use transfers.entrypoint for web server
jirhiker Sep 5, 2025
db8967d
Merge branch 'pre-production' into transfer
jirhiker Sep 5, 2025
14a9961
feat: enhance contact transfer logic and reduce batch limit
jirhiker Sep 5, 2025
a182088
Formatting changes
jirhiker Sep 5, 2025
bd9bc86
feat: add wells endpoint and health check to transfer service
jirhiker Sep 5, 2025
936814e
Formatting changes
jirhiker Sep 5, 2025
0b09d6b
feat: add wells endpoint and health check to transfer service
jirhiker Sep 5, 2025
ee11ade
feat: update wells endpoint to support pagination with start index an…
jirhiker Sep 5, 2025
6bc8f69
Formatting changes
jirhiker Sep 5, 2025
764e39f
feat: update health check endpoint to use POST method with JSON payload
jirhiker Sep 5, 2025
37543c4
feat: add multiple transfer endpoints for assets, contacts, groups, a…
jirhiker Sep 9, 2025
c6d8836
Formatting changes
jirhiker Sep 9, 2025
909ee35
Merge branch 'transfer' into jab-transfer-logging
jacob-a-brown Sep 11, 2025
49225bf
fix: set dtype for OSEWelltagID
jacob-a-brown Sep 11, 2025
b0d1338
feat: redirect errors to log
jacob-a-brown Sep 11, 2025
8087192
fix: set limit correctly for well transfer
jacob-a-brown Sep 11, 2025
076c024
fix: remove print debugging statement
jacob-a-brown Sep 11, 2025
3a8c042
Merge branch 'transfer' into jab-transfer-logging
jacob-a-brown Sep 11, 2025
5e7a2c2
feat: validate addresses with pydantic
jacob-a-brown Sep 11, 2025
1565bef
Merge branch 'pre-production' into jab-transfer-logging
jacob-a-brown Sep 11, 2025
d19fc51
Merge pull request #128 from DataIntegrationGroup/jab-transfer-logging
jirhiker Sep 12, 2025
6a3e68a
feat: update deployment configuration to trigger on staging branch
jirhiker Sep 12, 2025
8c058dd
feat: comment out old version cleanup step in deployment configuration
jirhiker Sep 12, 2025
f159b3a
feat: version cleanup
jirhiker Sep 12, 2025
c1cc3f9
feat: update deployment configuration to use vars for non-sensitive i…
jirhiker Sep 12, 2025
08d7fb8
feat: rename staging_deploy.yml to CD_staging.yml
jirhiker Sep 12, 2025
ab633ac
feat: add production deployment configuration for Google Cloud
jirhiker Sep 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions .github/workflows/CD_production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: CD (Staging)

on:
push:
branches: [production]

permissions:
contents: write

jobs:
staging-deploy:

runs-on: ubuntu-latest
environment: production

steps:
- name: Check out source repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install uv in container
uses: astral-sh/setup-uv@v6
with:
version: "latest"

- name: Generate requirements.txt
run: |
uv export -o requirements.txt

- name: Authenticate to Google Cloud
uses: 'google-github-actions/auth@v2'
with:
credentials_json: ${{ secrets.CLOUD_DEPLOY_SERVICE_ACCOUNT_KEY }}

# Uses Google Cloud Secret Manager to store secret credentials
- name: Create app.yaml
run: |
echo "service: ocotillo-api" > app.yaml
echo "runtime: python313" >> app.yaml
echo "entrypoint: gunicorn -w 4 -k uvicorn.workers.UvicornWorker main:app" >> app.yaml
echo "instance_class: F4" >> app.yaml
echo "inbound_services:" >> app.yaml
echo " - warmup" >> app.yaml
echo "automatic_scaling:" >> app.yaml
echo " min_instances: 0" >> app.yaml
echo " max_instances: 10" >> app.yaml
echo "" >> app.yaml
echo "env_variables:" >> app.yaml
echo " MODE: \"production\"" >> app.yaml
echo " DB_DRIVER: \"cloudsql\"" >> app.yaml
echo " CLOUD_SQL_INSTANCE_NAME: \"${{ secrets.CLOUD_SQL_INSTANCE_NAME }}\"" >> app.yaml
echo " CLOUD_SQL_DATABASE: \"${{ vars.CLOUD_SQL_DATABASE }}\"" >> app.yaml
echo " CLOUD_SQL_USER: \"${{ secrets.CLOUD_SQL_USER }}\"" >> app.yaml
echo " CLOUD_SQL_PASSWORD: \"${{ secrets.CLOUD_SQL_PASSWORD }}\"" >> app.yaml
echo " GCS_SERVICE_ACCOUNT_KEY: \"${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}\"" >> app.yaml
echo " GCS_BUCKET_NAME: \"${{vars.GCS_BUCKET_NAME}}\"" >> app.yaml
echo " AUTHENTIK_URL: \"${{vars.AUTHENTIK_URL}}\"" >> app.yaml
echo " AUTHENTIK_CLIENT_ID: \"${{vars.AUTHENTIK_CLIENT_ID}}\"" >> app.yaml
echo " AUTHENTIK_AUTHORIZE_URL: \"${{vars.AUTHENTIK_AUTHORIZE_URL}}\"" >> app.yaml
echo " AUTHENTIK_TOKEN_URL: \"${{vars.AUTHENTIK_TOKEN_URL}}\"" >> app.yaml


- name: Deploy to Google Cloud
run: |
gcloud app deploy app.yaml --quiet --project ${{ vars.GCP_PROJECT_ID }}

# Clean up old versions - delete only the oldest version, one created and one destroyed
- name: Clean up oldest version
run: |
OLDEST_VERSION=$(gcloud app versions list --service=ocotillo-api --project=${{ vars.GCP_PROJECT_ID}} --format="value(id)" --sort-by="version.createTime" | head -n 1)
if [ ! -z "$OLDEST_VERSION" ]; then
echo "Deleting oldest version: $OLDEST_VERSION"
gcloud app versions delete $OLDEST_VERSION --service=ocotillo-api --project=${{ vars.GCP_PROJECT_ID }} --quiet
echo "Deleted oldest version: $OLDEST_VERSION"
else
echo "No versions to delete"
fi

- name: Remove app.yaml
run: |
rm app.yaml

# Use PR author's username as git user name
- name: Set up git user
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"

# ":" are not alloed in git tags, so replace with "-"
- name: Tag commit
run: |
git tag -a "production-deploy-$(date -u +%Y-%m-%d)T$(date -u +%H-%M-%S%z)" -m "staging gcloud deployment: $(date -u +%Y-%m-%d)T$(date -u +%H:%M:%S%z)"
git push origin --tags
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CD (Staging)

on:
push:
branches: [pre-production]
branches: [staging]

permissions:
contents: write
Expand Down Expand Up @@ -50,28 +50,28 @@ jobs:
echo " MODE: \"production\"" >> app.yaml
echo " DB_DRIVER: \"cloudsql\"" >> app.yaml
echo " CLOUD_SQL_INSTANCE_NAME: \"${{ secrets.CLOUD_SQL_INSTANCE_NAME }}\"" >> app.yaml
echo " CLOUD_SQL_DATABASE: \"${{ secrets.CLOUD_SQL_DATABASE }}\"" >> app.yaml
echo " CLOUD_SQL_DATABASE: \"${{ vars.CLOUD_SQL_DATABASE }}\"" >> app.yaml
echo " CLOUD_SQL_USER: \"${{ secrets.CLOUD_SQL_USER }}\"" >> app.yaml
echo " CLOUD_SQL_PASSWORD: \"${{ secrets.CLOUD_SQL_PASSWORD }}\"" >> app.yaml
echo " GCS_SERVICE_ACCOUNT_KEY: \"${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}\"" >> app.yaml
echo " GCS_BUCKET_NAME: \"${{secrets.GCS_BUCKET_NAME}}\"" >> app.yaml
echo " AUTHENTIK_URL: \"${{secrets.AUTHENTIK_URL}}\"" >> app.yaml
echo " AUTHENTIK_CLIENT_ID: \"${{secrets.AUTHENTIK_CLIENT_ID}}\"" >> app.yaml
echo " AUTHENTIK_AUTHORIZE_URL: \"${{secrets.AUTHENTIK_AUTHORIZE_URL}}\"" >> app.yaml
echo " AUTHENTIK_TOKEN_URL: \"${{secrets.AUTHENTIK_TOKEN_URL}}\"" >> app.yaml
echo " GCS_BUCKET_NAME: \"${{vars.GCS_BUCKET_NAME}}\"" >> app.yaml
echo " AUTHENTIK_URL: \"${{vars.AUTHENTIK_URL}}\"" >> app.yaml
echo " AUTHENTIK_CLIENT_ID: \"${{vars.AUTHENTIK_CLIENT_ID}}\"" >> app.yaml
echo " AUTHENTIK_AUTHORIZE_URL: \"${{vars.AUTHENTIK_AUTHORIZE_URL}}\"" >> app.yaml
echo " AUTHENTIK_TOKEN_URL: \"${{vars.AUTHENTIK_TOKEN_URL}}\"" >> app.yaml


- name: Deploy to Google Cloud
run: |
gcloud app deploy app.yaml --quiet --project ${{ secrets.GCP_PROJECT_ID }}
gcloud app deploy app.yaml --quiet --project ${{ vars.GCP_PROJECT_ID }}

# Clean up old versions - delete only the oldest version, one created and one destroyed
- name: Clean up oldest version
run: |
OLDEST_VERSION=$(gcloud app versions list --service=ocotillo-api-staging --project=${{ secrets.GCP_PROJECT_ID}} --format="value(id)" --sort-by="version.createTime" | head -n 1)
OLDEST_VERSION=$(gcloud app versions list --service=ocotillo-api-staging --project=${{ vars.GCP_PROJECT_ID}} --format="value(id)" --sort-by="version.createTime" | head -n 1)
if [ ! -z "$OLDEST_VERSION" ]; then
echo "Deleting oldest version: $OLDEST_VERSION"
gcloud app versions delete $OLDEST_VERSION --service=ocotillo-api-staging --project=${{ secrets.GCP_PROJECT_ID }} --quiet
gcloud app versions delete $OLDEST_VERSION --service=ocotillo-api-staging --project=${{ vars.GCP_PROJECT_ID }} --quiet
echo "Deleted oldest version: $OLDEST_VERSION"
else
echo "No versions to delete"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: Tests

on:
pull_request:
branches: [ "main",'pre-production']
branches: [ "main",'pre-production', 'transfer']

permissions:
contents: read
Expand Down
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: gunicorn -b :8080 transfers.entrypoint:app -k uvicorn.workers.UvicornWorker
2 changes: 2 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os
import sentry_sdk
from dotenv import load_dotenv
from starlette.middleware.base import BaseHTTPMiddleware
from uvicorn.middleware.proxy_headers import ProxyHeadersMiddleware

load_dotenv()

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ dependencies = [
"propcache==0.3.2",
"proto-plus==1.26.1",
"protobuf==6.32.0",
"psycopg2==2.9.10",
"psycopg2-binary>=2.9.10",
"pyasn1==0.6.1",
"pyasn1-modules==0.4.2",
"pycparser==2.22",
Expand Down
Loading
Loading