Skip to content

How to perform a Bugs Import

Roger Mähler edited this page Mar 13, 2020 · 17 revisions

Introduction

This guide gives instructions on how to perform a complete Bugs import; starting from downloading the BugsCEP database and all the way to committing an incremental data change to the SEAD staging databas via the SEAD change control system.

Overview of steps

  1. xxx

Prerequisites

You will need the following:

  • A system user on the SEAD production server (seadserv.humlab.umu.se).
  • The system user must be member of the docker group.
  • An understanding of the SEAD change control system.
  • A database system user with somewhat elevated privileges (create database).
  • A window of time where the SEAD staging database is frozen.

Create target database

Create a new Bugs SEAD staging database. Note that this will overwrite the target database. Normally you would want to use current production database as the source. If there are pending change requests that can affect the Bugs import, then it would be better to use the current, soon-to-be-production, staging database where those changes have been deployed.

~/source/sead_change_control$ ./copydb.sh --source sead_production --target sead_staging_bugs --force --sync-sequences

Update Docker image and the bugsimport script

  • Make sure that the Bugs Import docker image is up-to-date. If not you need to compile a new image using instructions in appendix.
  • Download the bugsimport script (put it in a separate folder of your chosing).
wget https://raw.githubusercontent.com/humlab-sead/sead_bugs_import/master/docker/bugsimport
chmod +x bugsimport

Run the Bugs import

Use the bugsimportscript to run an import: ``´bash usage: bugsimport [--database NAME] [--port PORT] [--user DATABASE-USER ] [--image IMAGE-NAME ] [--sync-sequences]

The following variables need to be set either as command line options, environment variables or set in a .env file that resides in the same folder as the `bugsimport` script.
```bash
BUGSIMPORT_DBHOST=name-of-sead-production-server
BUGSIMPORT_DBPORT=5432
BUGSIMPORT_DBNAME=target-staging-database
BUGSIMPORT_DBUSER=database-user
BUGSIMPORT_DBPASSWORD=database-password
  • Set the mandatory configuration elements used by the Bugs import script (and docker image). These settings must be specified as environment variables passed on to the Docker image, either as environment variables set on the host system, or in a .env file residing in the import directory from where you start the import. You can also specify the values as command line options to the bugsimport script.

The import script reads the files

Appendix

Optional: Compile Bugs import Docker image from source

The following assumes that you are logged on to the SEAD production server. Note that these

  • Use git fetch the latest versions of sead_bugs_import. If you have the code on disk than go to that folder and execute:
~/source/sead_bugs_import% git pull

If you don't have the code on disk you can execute:

~% mkdir -p ~/source && cd ~/source
~/source% git clone https://github.com/humlab-sead/sead_bugs_import.git
  • Go to the docker folder and build the Docker image.
~/source/sead_bugs_import/docker$ make
Clone this wiki locally