CLI util to run code and infrastructure migrations for condo-based applications.
NOTE: The documentation below describes how to use these package, but does not describe which migrations you need to run and why. For this information, go to our Migration Guides.
You can use package in your condo monorepo fork by running the following command to build package:
yarn workspace @open-condo/migrator build
And then the one to run it:
npx @open-condo/migrator --help
You can use migrator on remote instances without installing additional packages by running:
npx @open-condo/migrator@latest --help
Or alternatively you can install it with:
yarn add -D @open-condo/migrator
And then run with:
npx @open-condo/migrator --help
You can use the following command to explore list of all available commands:
npx @open-condo/migrator --help
Then you can explore command arguments / description by running the following:
npx @open-condo/migrator <command> --help
You can migrate whole monorepo by running command from monorepo root. For example:
npx @open-condo/migrator add-apps-kv-prefixes
Or you can more precisely run it for single / multiple apps:
npx @open-condo/migrator add-apps-kv-prefixes -f condo address-service
You can also run migration commands on deployed applications where access .env
files is not possible,
since environment variables are passed from external tools and apps are deployed "one per pod".
For this scenarios you can migrate single app at a time by running commands like this:
REDIS_URL=redis://remote_user:*******@127.0.0.1:6379/6 npx @open-condo/migrator add-apps-kv-prefixes -f condo
NOTE: You can remove REDIS_URL=** part if environment variables are already set (from
export
or other external tool)
You can also run migrator from specific app folder instead of using --filter
arg:
cd apps/condo
npx @open-condo/migrator add-apps-kv-prefixes
This command will add keyPrefix
to all your keys of your KV database (Redis).
For example, for condo
app new keys will look like this:
my_key
->condo:my_key
sess:asd123ghj
->condo:sess:asd123ghj
bull:low:importMeters:123
->{condo:bull:low}:importMeters:123
You can read more about our motivation and key format in our Migration Guides