# Spec swiss armyknife # GroundControl toolchain ​ ## Databases ​ ### Command: `copy` ​ Copies data from one database to another. ​ Usage: ​ ``` gc db copy <from:uri> <to:uri> [-v] [--copy-users] [--copy-runtime] [--project=<code>] ``` ​ Where `uri` is a reference to a database. It can be any of: ​ - `gc:<stack>/<env>`, e.g. `gc:groundcontrol/live` or `gc:aldi/acc`. As a shorthand, `gc:<env>` means `gc:groundcontrol/<env>`, e.g. `gc:live` or `gc:acc`. - Special case: `gc:groundcontrol/int` (or short `gc:int`) is our integration server. - `mongodb:<uri>` uris: a direct reference to a mongodb - `local` is a shorthand for `mongodb://localhost:27017` ​ Options: ​ - `--copy-users`: Specify to copy user accounts. Note that passwords are invalid if the `APP_SECRET` environment variable differs. The acceptance and live servers for one stack should have the same `APP_SECRET` so there it's ok. The `super@groundcontrol` user is never copied. If this flag is not specified, users are *not* copied. - `--copy-runtime`: Specify to copy runtime collections in addition to project structures. See below which collections are considered runtime colletions. - `--project=<code>`: Copy only information from the project with the given code. This will also merge the information into the target DB, rather than dropping the target DB / collections. This is only allowed if the source and target DBs have the exact same migrations. Note that everything related to that project in the target DB is first removed. - `-v`: be verbose ​ > Note 1: participants' push devices are *never* copied. > Note 2: when `<to>` refers to a live environment, users must confirm with `y/n`. ​ Examples: ​ - Pull DB from live: `gc db copy gc:live local` - Push DB to live: `gc db copy local gc:live` - Copy live DB to acc, copying users as well: `gc db copy gc:live gc:acc --copy-users` - Copy live DB to acc from server: `gc db copy mongodb://localhost:29002 mongodb://localhost:29012 --copy-users` - Copy ALDI live DB to integration: `gc db copy gc:aldi/live gc:int` - Copy a single project from the ALDI stack to the GC stack: `gc db copy gc:aldi/live gc:live --project=beone` ​ ### Command: `pull` ​ Usage: ​ ``` gc db pull <from:uri> ``` ​ Shorthand for `gc db copy <from> local` ​ ### Command: `push` ​ Usage: ​ ``` gc db push <to:uri> ``` ​ Shorthand for `gc db copy local <to>` ​ ### Appendix: runtime collections ​ The following collections are considered to be part of the runtime of a project: ​ - `messages` - `answers` - `*_states` - `*_logs` ​ All other collections are considered to be a part of the project structure. ​ ## Deployments ​ ### Command: `deploy` ​ Deploys some part of the infrastructure. ​ Usage: ​ ``` gc deploy <from:uri> <to:uri> [--app=<app>,<app>*] ``` ​ Where `<uri>` is a reference to an installation. It can be any of: ​ - `gc:<stack>/<env>`, e.g. `gc:groundcontrol/live` or `gc:aldi/acc`. As a shorthand, `gc:<env>` means `gc:groundcontrol/<env>`, e.g. `gc:live` or `gc:acc`. - Special case: `gc:groundcontrol/int` (or short `gc:int`) is our integration server. - If no `:` is present, it is assumed to be the path to your local installation of GroundControl. This directory should contain the subdirectories `web`, `mission` and `server`. ​ Options: ​ - `--app=<app>,<app>*`: Migrate only the specified apps, instead of the entire infrastructure. ​ Examples: ​ - Deploy the integration server to acceptance on the ALDI stack: `gc deploy gc:int aldi:acc` - Deploy the ALDI acceptance server to live: `gc deploy aldi:acc aldi:live` - Perform a hotfix from your local computer (Mission Control and Web Client only): `gc deploy . gc:live --app=mission,web`. This assumes you're in the GroundControl base directory. ​ > Note 1: our CI runners deploy the apps automatically to `gc:int`, so you should never deploy *to* `gc:int`. > Note 2: whenever deploying *to* an `acc` environment, the toolchain subsequently invokes `gc copy <stack>:live <stack>:acc`.