Skip to content

Redeploy

Push a new version of an existing app from updated files.

Update an existing app by passing a new files map and setting allowExistingApp / allow_existing_app to true.

Start a deployment

allowExistingApp / allow_existing_app is required when the app name already exists in your namespace.

redeployFromFiles.jsredeploy.py
// Request: appName, owner, files, allowExistingApp: true
const deployment = await client.deployments.create({
  appName: "hello-stackmachine",
  owner: "stackmachine",
  allowExistingApp: true, // required when redeploying an app that already exists
  files: {
    "index.html": "<html><body><h1>Updated</h1></body></html>",
  },
});
// Should return: {
console.log(deployment.buildId, deployment.status);
deployment = client.deployments.create(
    app_name="hello-stackmachine",
    owner="stackmachine",
    allow_existing_app=True,  # required when redeploying an app that already exists
    files={"index.html": "<html><body><h1>Updated</h1></body></html>"},
)
# Should return: {
print(deployment.build_id, deployment.status)

Wait for the build

Same as a first deploy: call wait() on the returned deployment until the new version is live.

redeployFromFiles.jsredeploy.py
const appVersion = await deployment.wait({
  onProgress: ({ kind, message }) => console.log(kind, message),
});
// Should return: {
console.log(appVersion.app.url);
app_version = deployment.wait(on_progress=lambda e: print(e.kind, e.message))
# Should return: {
print(app_version.app.url)

Source: stackmachine/sdks examples.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close