Deploys
In order to get the integrations you've defined in your project to work, you have to deploy them to an environment.
Deploying to Development
To deploy to development, you should generally use the dev server. To run in your project directory, use the following command:
npm run dev
1. Compile project source on file changes
The dev server will monitor your project for any changes to the source code. Upon detection, it will begin the deploy process by compiling your source.
2. Run the deploy
operation locally
Once the source is compiled, the server will create a VM and will execute the deploy
operation on your project.
3. Build the deployList
As a result of executing your script, all of the imported defineAction
and defineWebhook
functions are immediately run. If there are no errors, a deployList
is created.
4. Begin to instantiate the deployList
The dev server then posts the deployList
to the development environment, which starts the server portion of the deploy.
5. Disable all existing objects
In a transaction, the server disables all existing objects in preparation for the next step.
6. Create or update objects from the deploy list
In the same transaction, the server looks for any existing objects referenced in the deployList
by the name
prop. If found, the existing objects are re-enable and updated as necessary. If not found, then new objects are created. Then all relationships between objects are established.
7. Calculate webhook subscriptionProps
Loop through all the webhooks with subscriptions, run the subscriptionProps
method to determine the current props, and use to determine which have changed.
8. Update subscriptions
First, for any webhooks with subscriptions that have been removed, run the unsubscribe
operation (on which code? Previous deploy? Last successful deploy? Deploy where subscription was last updated?).
Second, for any webhooks with subscription props that have been changed, run the unsubscribe
operation on the old code, then run the subscribe
operation on the new code.
Third, for any new webhooks with subscriptions, run the subscribe
operation on the new code.
9. Upload the status and logs
The dev server then captures the status and the logs from the deploy and uploads them so you can review them in your dashboard.
Deploying to Production
To deploy to production,
npm run deploy
1. Compile project source
The CLI compiles your project source.
2. Upload the code and store in production environment.
The CLI uploads you code to the server, which in turn stores it in your production environment where operations can be called on it. (We use an AWS Lambda to implement this)
3. Dev server requests a production deploy
The CLI triggers a production deploy request.
4. Run the deploy
operation in the production environment.
The server executes your script in the production environment.
5. Build the deployList
As a result of executing your script, all of the imported defineAction
and defineWebhook
functions are immediately run. If there are no errors, a deployList
is created.
6. Disable all existing objects
In a transaction, the server disables all existing objects in preparation for the next step.
7. Create or update objects from the deploy list
In the same transaction, the server looks for any existing objects referenced in the deployList
by the name
prop. If found, the existing objects are re-enable and updated as necessary. If not found, then new objects are created. Then all relationships between objects are established.