Skip to content

Experimental repository with deployment examples for a postgres database, based on the Quick Start Openshift Template

License

Notifications You must be signed in to change notification settings

bcgov/nr-rfc-db

MIT License Lifecycle

Merge Analysis Scheduled

River Forecast Centre Postgres Analytical Database

Using the quickstart openshift template, this repository contains a pull request based deployment pipeline for configuration and setup of a hydrological analytical database.

This is a work in progress, and is in early days for development.

Initially its attempting to implement similar functionality as the Yukon Governments github repo

Functionality Overview

Includes:

  • docker-compose file for setting up an environment locally for development.
  • pull request pipeline with dev/test deployments

Requirements

  1. Windows subsystem for linux, ideally running ubuntu
  2. Docker and Docker compose
  3. Openshift cli tools
  4. Access to an openshift namespace

A link to how I configure WSL / Docker / Docker compose, don't bother with the brew or anything other than WSL / Docker / Docker comose sections

The openshift CLI tools can be downloaded from the openshift console, then go to the ? icon at the top right, and select the option command line tools

Access to openshift

Other optional installs that are likely to help:

  1. VSCode
  2. VSCode docker extension

Local Development

Create the database and run the migrations:

docker compose up migrations

Once the command has completed, you should be able to connect to the database using the credentals described in the docker-compose.yaml file.

The docker compose will create a postgres database, and run the migrations using flyway.

Migration files are stored in the directory: /migrations/sql

To add more migrations simply follow the naming convention. V__.sql Note: there are two underscore characters between number and description.

Working with the 'Dev' deployed version

  1. go to openshift web app and login

  2. authenticate your cli by clicking your username icon at the top right corner and selecting copy login command

  3. having copied the login command, paste it into a wsl terminal to authenticate

  4. make sure you are in the correct namespace oc projects to change to a new project it will be oc project <project license plate>

  5. list the running pods oc get pods

    look for a database pod that will have a name like nr-rfc-db-<pr number>-bitnamei-pg-0

  6. create a ssl tunnel to the openshift database oc port-forward <pod with bitnami-pg name in it> <localport>:<remote port>

    usually I change the local port to something like 5433 in case i already have a postgres instance running via docker compose on port 5432. In this scenario the command would look something like:

    oc port-forward nr-rfc-db-3-bitnami-pg-0 5433:5432

About

Experimental repository with deployment examples for a postgres database, based on the Quick Start Openshift Template

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages