Document alternative method to deploy schema

This commit is contained in:
Weimin Yu 2022-11-01 12:58:11 -04:00 committed by GitHub
parent deada2aaee
commit 5df9a2e4aa

View file

@ -55,7 +55,7 @@ following steps:
one. The generated SQL file from the previous step should help. New create
table statements can be used as is, whereas alter table statements should be
written to change any existing tables.
Note that each incremental file MUST be limited to changes to a single
table (otherwise it may hit deadlock when applying on sandbox/production
where it'll be competing against live traffic that may also be locking said
@ -218,7 +218,49 @@ To test unsubmitted schema changes in the alpha or crash environments, use the
following command to deploy the local schema,
```shell
./nom_build :db:flywayMigrate --dbServer=[alpha|crash] --environment=[alpha|crash]
./nom_build :db:flywayMigrate --dbServer=[alpha|crash] \
--environment=[alpha|crash]
```
If you run into problems due to incompatible dependency versions, you may try
the dependencies used by our releases:
```
./nom_build :db:flywayMigrate --dbServer=[alpha|crash] \
--environment=[alpha|crash] \
--mavenUrl=https://storage.googleapis.com/domain-registry-maven-repository/maven \
--pluginsUrl=https://storage.googleapis.com/domain-registry-maven-repository/plugins
```
#### Alternative way to push to non-production
The following method can be used to deploy schema to ALPHA and CRASH
environments. Use this only when the Flyway task is broken.
From the root of the repository:
```
$ TARGET_ENV=[alpha|crash]
$ ./nom_build :db:schema
$ mkdir -p release/schema-deployer/flyway/jars release/schema-deployer/secrets
$ gcloud secrets versions access latest \
--secret nomulus-tool-cloudbuild-credential \
--project domain-registry-alpha \
> release/schema-deployer/secrets/cloud_sql_credential.json
$ nomulus -e ${TARGET_ENV} \
--credential release/schema-deployer/secrets/cloud_sql_credential.json \
get_sql_credential --user schema_deployer \
--output release/schema-deployer/secrets/schema_deployer_credential.dec
$ cp db/build/libs/schema.jar release/schema-deployer/flyway/jars
$ cd release/schema-deployer
$ docker build -t schema_deployer .
$ docker run -v `pwd`/secrets:/secrets \
-v `pwd`/flyway/jars:/flyway/jars -w `pwd` \
schema_deployer:latest \
migrate
$ rm -r -f secrets flyway
```
#### Glass breaking