Updating the Deployment Cache

This API call will start a new deployment to force a Deployment Cache (DC) update. Squash will update the cache during the shutdown process of the deployment.

This is useful for relatively large applications using dynamic data in Dockerfiles, such as database dumps and other assets that need to be updated on a regular basis.

Deployments using DC usually have a faster startup time since Squash automatically skips the build process. However, updating the cache is usually slower depending on the project since Squash will run the build process from scratch. This API call can help to automate this process so you can keep your deployments running fast while updating the cache as often as needed.

API Specs

https://api.squash.io/a/dis/start/?deployment_id=<deployment_id>&expire=<expire_time>
HTTP Method: GET
Success Response Code: 200
Success Response Body: JSON data

 

expire: this argument controls how long the deployments should stay active. After the expire time is reached Squash will automatically shut down the deployment. Available options for this field:30m,1h,2h,3h,4h,5h,6h

deployment_id: this is a unique identifier generate by Squash for a given branch. This is available on any regular Squash deployment URLs, you can get this from a GitHub Pull Request comment generated by Squash or by going to the New deployment page.

This is how the unique identifier looks like, this is the alphanumeric part right after the branch name and before the squash domain:

Sample Request

$ curl -i -H 'Squash-Key: B6mtwX0htEW0HaFp9X25UtJsiX1uBNHNsxAptnum2VxgXVwmrJfmd74En1a8MwFe' \
 https://api.squash.io/a/dis/start/?deployment_id=w3sa2&expire=1h

Response Sample

{"status": "ready",
 "ssh_port": "6512",
 "ssh_ip": "18.118.25.254",
 "deployment_url": "https://cart-v2-i3fg1.squash.io",
 "execution_id": "0f0d8890-ad2f-4c38-8457-b166c36bffe3",
 "msg": "deployment is starting up"
}
  • status has the following options: “pending”, “ready” and “error”
    • pending: the deployment has started successfully and is in progress
    • ready: the deployment start up process is ready and you can now connect to the server through SSH.
    • error: an error message and error code are included within the msg field
  • ssh_port: only available when status is ready
  • ssh_ip: only available when status is ready
  • deployment_url: This is the Squash URL of this deployment that you can use for testing
  • execution_id: This is a long unique identifier that represents an specific deployment run
  • msg: Squash will display status or error messages in this field

How to SSH to a deployment VM

Once you receive an API response with status ready you can then assemble an SSH connection as follows. Always use the username test-instance when connecting to a deployment VM:

$ ssh -p <ssh_port> test-instance@<ssh_ip>

Example:

$ ssh -p 6512 test-instance@18.118.25.254

More details on the Squash deployment environment.