This utility is used to migrate the basic schema changes from one backend to another.
We have outlined the basic integration steps below.
Requirements
- This tool requires a NodeJS environment. Support for more platforms is coming soon.
- NodeJS v6 or above.
Installation
-
You can install with npm or yarn package manager.
npm install --save @bitpod/schema-migrate
yarn add @bitpod/schema-migrate
Setup
- You should have accesskey for the both backends source and destination.
- Access keys should be bound with the user having developer role.
- Create schema-migration.json file in root directory of your project using following json.
- dataonly flag in the schema-migration.json will take you to the data mode, in which only roles will migrate.
{
"tempPath" : "./tmp",
"autodeploy": false,
"loglevel": "error",
"testonly" : false,
"rolesonly" : false,
"createapp": false,
"exportDataAndMeta":false,
"orgId":1
"skipMissingModels": false
"export": {
"serverApiUrl": "test.p10.io",
"instanceId": "SJeyHdUkV",
"deploymentVersion": "2",
"accessKey": "2dc3cb6fe6dd43a1f2e7b5d9e2c3d2b1476ee0d09272f045e7e7b1669a99c6e5",
"accessSecret": "2dc3cb6fe6dd43a1f2e7b5d9e2c3d2b1476ee0d09272f045e7e7b1669a99c6e5",
"models": []
},
"import": {
"serverApiUrl": "test.p10.io",
"instanceId": "ByriHk2kN",
"accessKey": "9baf2af8a88e6a31e0cede2900e8bafe073f84655bb6abba3969912372519fe9",
"accessSecret": "9baf2af8a88e6a31e0cede2900e8bafe073f84655bb6abba3969912372519fe9",
"comment": "Deployment through cli tool."
}
}
- Configure commnand schema-migrate in a seperate json file package.json in root directory of your project using following json.
{
"name": "your project/folder name",
"description": "A directory to configure schema-migrate tool.",
"main": "index.js",
"scripts": {
"migrate": "schema-migrate migrate --export-instanceid SJNtKJ9cM --export-apiurl https://test.p10.io/api --export-deploymentversion 7 --export-accesskey 247ffb7a03b7d8ebc2a9b2e94f31a34958e00df8c44e8dcd6289467fd5f325a561029cc9633d4595d2bf4c5fc3a738f1 --loglevel info "
}
}
- For going into app gallery packager mode, make createapp field to true in schema-migration.json .
- For export data and meta file use flag exportDataAndMeta.
{"createapp": false/true/'zip'}
{"exportDataAndMeta":true/false}
-
For app gallery packager configuration (screenshots image validations)
IMAGE_VALIDATION: size required
| xs | Min | Max | | ----------- | ----------- | ------- | | width | 640 | 1024 | | height | 480 | 768 | | sm | Min | Max | | ----------- | ----------- | ------- | | width | 1024 | 1322 | | height | 768 | 992 | | md | Min | Max | | ----------- | ----------- | ------- | | width | 1322 | 1620 | | height | 992 | 1200 | | lg | Min | Max | | ----------- | ----------- | ------- | | width | 1620 | 2590 | | height | 1200 | 1920 | | xl | Min | Max | | ----------- | ----------- | ------- | | width | 2590 | - | | height | 1920 | - |
-
app.json needed for app gallery configuration.
{
"backendId": "SJCyyAjl7",
"organizationId": "bitpod",
"outputpath": "./omkar",
"accessToken": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6ImpTcEJjejBIdW01dVlGYnV2T2pQMGdkRml3VSIsImtpZCI6ImpTcEJjejBIdW01dVlGYnV2T2pQMGdkRml3VSJ9.eyJpc3MiOiJodHRwczovL2RldmF1dGgucDEwLmlvL2F1dGgiLCJhdWQiOiJodHRwczovL2RldmF1dGgucDEwLmlvL2F1dGgvcmVzb3VyY2VzIiwiZXhwIjoxNTI5MDY3ODI1LCJuYmYiOjE1Mjg5ODE0MjUsImNsaWVudF9pZCI6Imd0ditxMDRsdS9sNVpmS3kwdldGSmpEcjlHN0dzRGFXUGlWaXdwSjBZSnM9Iiwic2NvcGUiOlsib3BlbmlkIiwicHJvZmlsZSIsIm9mZmxpbmVfYWNjZXNzIiwiZW1haWwiLCJub3RpZmljYXRpb24iLCJiYWFzIl0sInN1YiI6Im9raGVuZXdhckBwYXJhZ3l0ZS5jb20iLCJhdXRoX3RpbWUiOjE1Mjg5ODE0MjQsImlkcCI6InAxME9BdXRoIiwiYW1yIjpbImV4dGVybmFsIl19.aUrW2TioHWS7e2IQnefCvudk55hHt98YAkoFqILyBd5Vzay-KXpMiBGNchZyBIep9besPhwCMiqcfcGJRAkJUHlVLpxq2kE4qvJEyCLGf9augfmQlWopetKLxhieqihgoppZlNSCLSxSZFwfF3HGvVEH7hxHDy0vpGyTTWWkPeVXbVPl5JXity8evNPXddIIYVh1TcYpTZ3FDeJjYStV1_17m6Gi2RRf0qKvzV6bj3hTbSMoGuvkNIW1QImKQ6gdAJNjarfUKSswOloM6RnZ1gTvXa55cDiX5ItKxKdwbuStgdFqNk8al9qAoeUM7iVfM6BK8MjctOMos5WIc9p7Wg",
"name": "TestCareApp",
"description": "Test App Packager",
"logo": "./images/logo_care.png",
"screenshots": [
{
"_id": "SkUWWCmke",
"xs": {
"uri": "./images/testcare_xs641_481.jpg",
"description": ""
},
"sm": {
"uri": "./images/testcare_sm1025_769.png",
"description": ""
},
"md": {
"uri": "./images/testcare_md1323_993.png",
"description": ""
},
"lg": {
"uri": "./images/testcare_lg1621_1201.png",
"description": ""
},
"xl": {
"uri": "./images/testcare_xl2589_1919.png",
"description": ""
}
}
],
"version": "1.0.0",
"categories": ["ok"],
"unitOfPrice" : "USD",
"publisher" : {
"name" : "Bitpod",
"website" : "https://bitpod.io/",
"verified" : true,
"email": "digital@bitpod.com"
}
}
you can provide options in the package json file in the schema-migrate command so that you can directly fire a command yarn migrate.
schema-migration.json configuration params
-
Schema Migrate schema details
Required Description tempPath ✔ working path for export and import operation autodeploy ✔ Whether to deploy after migration is completed loglevel ✔ Which level of logs to display testonly ✔ Test mode in which only export part will be done rolesonly ✔ Roles mode in which only roles will be migrated createapp ✔ passed structure will be packaged for app gallary exportDataAndMeta ✔ passed structure will be export meta and data files OrgId ✔ Oragnization Id export ✔ configuration related to export serverApiUrl ✔ base url of bitpod deployment api, e.g. test.p10.io instanceId ✔ unique id of the backend deploymentVersion ✔ deployment version no to be exported accessKey ✔ access key of the backend to exported accessSecret ✔ access Secrets of the backend to exported models - optionally used when we have to export models selectively import ✔ configuration related to import serverApiUrl ✔ base url of bitpod deployment api, e.g. test.p10.io instanceId ✔ unique id of the backend accessKey ✔ access key of the backend in which schema to be imported accessSecret ✔ access Secrets of the backend to exported comment - optionally used when we have to deploy the backend after import is completed
run the cli tool
After doing the configuration you can simply run the cli by using following command.
npm run migrate
yarn migrate