Skip to content
Open
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
17 changes: 17 additions & 0 deletions doc-legacy-migration/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Dockerfile
.dockerignore
.pytest_cache
__pycache__
venv
.env
.env*
.eggs
Makefile
devops
k8s
manage.py
migrations
pre-hook-update-db.sh
requirements
test_data
tests
15 changes: 15 additions & 0 deletions doc-legacy-migration/.gcloudignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.pytest_cache
__pycache__
venv
.env
.env*
.eggs
Makefile
devops
k8s
manage.py
migrations
pre-hook-update-db.sh
requirements
test_data
tests
84 changes: 84 additions & 0 deletions doc-legacy-migration/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
FROM python:3.12-bullseye AS development_build

USER root

ARG VCS_REF="missing"
ARG BUILD_DATE="missing"

ENV VCS_REF=${VCS_REF}
ENV BUILD_DATE=${BUILD_DATE}
ENV PORT=8080

LABEL org.label-schema.vcs-ref=${VCS_REF} \
org.label-schema.build-date=${BUILD_DATE}

LABEL maintainer="thorwolpert"
LABEL vendor="BCROS"

ARG APP_ENV="production" \
# Needed for fixing permissions of files created by Docker:
UID=1000 \
GID=1000

ENV APP_ENV=${APP_ENV} \
# python:
PYTHONFAULTHANDLER=1 \
PYTHONUNBUFFERED=1 \
PYTHONHASHSEED=random \
PYTHONDONTWRITEBYTECODE=1 \
# pip:
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_DEFAULT_TIMEOUT=100 \
PIP_ROOT_USER_ACTION=ignore \
# poetry:
POETRY_VERSION=1.8.3 \
POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_CREATE=false \
POETRY_CACHE_DIR='/var/cache/pypoetry' \
POETRY_HOME='/usr/local'

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

RUN apt-get update && apt-get upgrade -y \
&& apt-get install --no-install-recommends -y \
bash \
brotli \
build-essential \
curl \
gettext \
git \
libpq-dev \
wait-for-it \
&& curl -sSL 'https://install.python-poetry.org' | python - \
&& poetry --version \
# Cleaning cache:
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*

WORKDIR /code

RUN groupadd -g "${GID}" -r web \
&& useradd -d '/code' -g web -l -r -u "${UID}" web \
&& chown web:web -R '/code'

# Copy only requirements, to cache them in docker layer
COPY --chown=web:web ./poetry.lock ./pyproject.toml /code/

COPY --chown=web:web ./src /code/src
COPY --chown=web:web ./README.md /code

# Project initialization:
RUN --mount=type=cache,target="$POETRY_CACHE_DIR" \
echo "$APP_ENV" \
&& poetry version \
# Install deps:
&& poetry run pip install -U pip \
&& poetry install --only main --no-interaction --no-ansi

USER web

# Set Python path
ENV PYTHONPATH=/code/src

CMD [ "python", "-m", "doc_legacy_migration" ]
63 changes: 63 additions & 0 deletions doc-legacy-migration/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)

# Application Name

BC Registries Document Records Service (DRS) legacy documents synchronization.

## Technology Stack Used
* Python
* Postgres - psycopg2-binary
* Oracle - oracledb
* GCP Cloud Storage

## Project Status

## Documentation

## Security

## Environment Variables
Copy 'env_sample' to '.env' and replace the values

### Development Setup
Run `poetry install`

Run `poetry shell`

### Running the job (requires running VPN)
Run `python -m doc_legacy_migration`

### Running Linting
Run `poetry run isort . --check`
Run `poetry run black . --check`
Run `poetry run pylint src`
Run `poetry run flake8 src`

## Getting Help or Reporting an Issue

To report bugs/issues/feature requests, please file an [issue](../../issues).

## How to Contribute

If you would like to contribute, please see our [CONTRIBUTING](./CONTRIBUTING.md) guidelines.

Please note that this project is released with a [Contributor Code of Conduct](./CODE_OF_CONDUCT.md).
By participating in this project you agree to abide by its terms.

## License

Copyright 2025 Province of British Columbia

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.

14 changes: 14 additions & 0 deletions doc-legacy-migration/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright © 2019 Province of British Columbia
#
# 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.
"""Init."""
36 changes: 36 additions & 0 deletions doc-legacy-migration/env_example
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#
# This file contains the environment-specific settings that are read by python-dotenv. Place it somewhere above your
# source code and it will be used.
#

# ===== assets-payment ======================================================================================================

# third party Services

# GCP CS SA
GCP_AUTH_KEY=""
GCP_CS_SA_SCOPES="https://www.googleapis.com/auth/cloud-platform"

# Connection to GCP DRS postgres database.
DOC_DATABASE_URL=""
DOC_DATABASE_USERNAME=""
DOC_DATABASE_PASSWORD=""
DOC_DATABASE_NAME=""
DOC_DATABASE_HOST=""
DOC_DATABASE_PORT="5432"

# Connection to Oracle legacy GLOBAL database correspondence schema: requires VPN
ORACLE_DATABASE_USERNAME=""
ORACLE_DATABASE_PASSWORD=""
ORACLE_DATABASE_NAME=""
ORACLE_DATABASE_HOST=""
ORACLE_DATABASE_PORT="1521"

# GCP document storage buckets
GCP_CS_BUCKET_ID_BUS=""
GCP_CS_BUCKET_ID_MHR=""
GCP_CS_BUCKET_ID_PPR=""
GCP_CS_BUCKET_ID_NR=""

# Track enabled when dumping record change status to local csv file.
CSV_TRACKING="true"
Loading