Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 0 additions & 6 deletions jobs/permanent/ppr-registrations-historical/.gcloudignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,12 @@ __pycache__

venv

streaming_pull.py
test_run.py

.env
.env*
.eggs
Makefile
devops
k8s
manage.py
migrations
requirements
test_data
tests

Expand Down
53 changes: 43 additions & 10 deletions jobs/permanent/ppr-registrations-historical/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# platform=linux/amd64
FROM python:3.11-buster
FROM python:3.12-bullseye AS development_build

ARG VCS_REF="missing"
ARG BUILD_DATE="missing"
Expand All @@ -14,22 +14,55 @@ 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 .
ARG APP_ENV \
UID=1000 \
GID=1000

ENV APP_ENV=${APP_ENV} \
PYTHONFAULTHANDLER=1 \
PYTHONUNBUFFERED=1 \
PYTHONHASHSEED=random \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_DEFAULT_TIMEOUT=100 \
PIP_ROOT_USER_ACTION=ignore \
POETRY_VERSION=2.1.3 \
POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_CREATE=false \
POETRY_CACHE_DIR=/var/cache/pypoetry \
POETRY_HOME=/usr/local \
POETRY_INSTALLER_PARALLEL=false

SHELL ["/bin/bash", "-eo", "pipefail", "-c"]

RUN pip install --upgrade pip
#RUN pip install pip==22.1.2
RUN pip install --no-cache-dir -r requirements.txt
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
bash \
build-essential \
curl \
git \
&& curl -sSL https://install.python-poetry.org | python - \
&& poetry --version \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /opt/app-root

COPY . .
COPY ./poetry.lock ./pyproject.toml /opt/app-root/
COPY ./src /opt/app-root/src
COPY ./README.md /opt/app-root/
COPY ./run.sh /opt/app-root/

RUN pip install .
RUN --mount=type=cache,target="${POETRY_CACHE_DIR}" \
poetry run pip install -U pip \
&& poetry install --only main --no-interaction --no-ansi \
&& chmod 755 /opt/app-root/run.sh

USER 1001

# Set Python path
ENV PYTHONPATH=/opt/app-root/src

CMD [ "python", "-m", "ppr_registrations_historical" ]
CMD ["./run.sh"]
2 changes: 1 addition & 1 deletion jobs/permanent/ppr-registrations-historical/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ BC Registries PPR Account Registrations Historical Service

## Technology Stack Used
* Python
* Postgres - psycopg2-binary
* Postgres
* GCP Artifact Registry
* GCP Cloud Run Jobs
* GCP Cloud Scheduler
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Copyright 2026 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: DeliveryPipeline
metadata:
name: ppr-reg-historical-pipeline
description: Deployment pipeline
serialPipeline:
stages:
- targetId: eogruh-dev
profiles: [dev]
strategy:
standard:
verify: false
deployParameters:
- values:
deploy-env: "development"
deploy-project-id: "eogruh-dev"
job-name: "ppr-registrations-historical-dev"
run-command: "/opt/app-root/run.sh"
cloudsql-instances: "eogruh-dev:northamerica-northeast1:ppr-dev-cloudsql"
service-account: "sa-job@eogruh-dev.iam.gserviceaccount.com"
- targetId: eogruh-test
profiles: [test]
strategy:
standard:
verify: false
deployParameters:
- values:
deploy-env: "test"
deploy-project-id: "eogruh-test"
job-name: "ppr-registrations-historical-test"
run-command: "/opt/app-root/run.sh"
app-env: "test"
cloudsql-instances: "eogruh-test:northamerica-northeast1:ppr-test-cloudsql"
service-account: "sa-job@eogruh-test.iam.gserviceaccount.com"
- targetId: eogruh-sandbox
profiles: [sandbox]
strategy:
standard:
verify: false
deployParameters:
- values:
deploy-env: "sandbox"
deploy-project-id: "eogruh-sandbox"
job-name: "ppr-registrations-historical-sandbox"
run-command: "/opt/app-root/run.sh"
app-env: "sandbox"
cloudsql-instances: "eogruh-sandbox:northamerica-northeast1:ppr-sandbox-pgdb"
service-account: "sa-job@eogruh-sandbox.iam.gserviceaccount.com"
- targetId: eogruh-prod
profiles: [prod]
strategy:
standard:
verify: false
deployParameters:
- values:
deploy-env: "production"
deploy-project-id: "eogruh-prod"
job-name: "ppr-registrations-historical-prod"
run-command: "/opt/app-root/run.sh"
app-env: "production"
cloudsql-instances: "eogruh-prod:northamerica-northeast1:ppr-prod"
service-account: "sa-job@eogruh-prod.iam.gserviceaccount.com"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DATABASE_NAME="op://database/$APP_ENV/ppr-db-gcp/DATABASE_NAME"
DATABASE_USERNAME="op://database/$APP_ENV/ppr-db-gcp/JOB_DATABASE_USERNAME"
CLOUDSQL_INSTANCE_CONNECTION_NAME="op://database/$APP_ENV/ppr-db-gcp/DATABASE_INSTANCE_CONNECTION_NAME"
START_DATE_OFFSET="op://ppr/$APP_ENV/registrations-historical/START_DATE_OFFSET"
VPC_CONNECTOR="op://CD/$APP_ENV/ppr-reg-historical/VPC_CONNECTOR"
Loading