-
Notifications
You must be signed in to change notification settings - Fork 24
Deployment Process
Alejandro Sanchez edited this page Sep 8, 2021
·
3 revisions
In any case where it is not possible to do an automated migration via EF, the target database must be wiped, and the keycloak sync tool must be ran against the new environment to ensure that the database is up to date with the code changes. Note that the following steps must be executed in the order presented here.
- Login to the appropriate database for the deployment, this may require vpn.
- Open a new query editor window within the target database.
- Copy the script stored here: https://raw.githubusercontent.com/bcgov/PSP/dev/database/mssql/scripts/clear-objects.sql and paste into the query editor
- Execute the script.
- Validate that all tables and db objects have been removed in SSMS.
- In order to complete this step, you must have the PSP repository checked out locally on your device. See the developer setup documentation for more details on this.
- Update (or create) the .env file located in <PSP_ROOT>/backend/dal. Replace the <> values below with appropriate values for the target environment.
ConnectionStrings__PIMS=Server=<PIMS_SERVER_NAME>,<PORT>;Database=<PIMS_DATABASE_NAME>;User Id=<PIMS_USERNAME>
DB_PASSWORD=<PIMS_DB_PASSWORD>
- Open a terminal within the root of the PSP repository. Execute
make db-update
. This should execute the migration(s) against the database. - Validate that the expected DB objects were created as a result of running the script (at least verify the tables exist).
- In order to complete this step, you must have the PSP repository checked out locally on your device. See the developer setup documentation for more details on this.
- Update (or create) the .env file located in <PSP_ROOT>/tools/keycloak/sync. Replace the <> values below with appropriate values for the target environment. Alternatively update the appsettings.{env}.json file to point to the correct URLs for this environment.
ASPNETCORE_ENVIRONMENT=<EITHER_Development_Test_OR_UNSET>
Auth__Keycloak__Secret=<SECRET_FROM_PIMS_SERVICE_ACCOUNT_IN_THIS_ENVIRONMENT>
- Open a terminal within the root of the PSP repository. execute
make keycloak-sync
. This should synchronize the PSP database with keycloak.