This walkthrough deploys an app from scratch. By the end, you'll have a running app on the publish variant. Creating an app, uploading source, and publishing are async. Each call returns an ID immediately, and you poll until the operation reaches COMPLETED.
You can follow the steps with the gddy CLI or with the Hosting REST API. The CLI is the recommended path. It signs you in through your browser and asks you to approve each scope the first time a command needs it. The API path uses a Personal Access Token and shows curl, Node, Python, and Go examples. Those examples use $BASE_URL for the API gateway host and $GODADDY_PAT for the token. Go to Hosting core concepts for the scopes involved.
gddy hosting app create returns an operationId, which is $OPERATION_ID in the poll command. After the operation reaches COMPLETED, its app.id field is the app ID, which is $APP_ID in every later command.
The following procedure creates the app and polls the operation until provisioning finishes.
gddy hosting source upload accepts a zip and returns an importId, which is $IMPORT_ID in the poll command. After the import reaches COMPLETED, your code runs on the preview variant. Preview works without a hosting plan. The preview URL is private, so sign in to your GoDaddy account to open it.
The following procedure zips your app, uploads it, polls the import, and reads the preview URL.
Zip the app, leaving out node_modules, .env files, and .git:
zip -r my-app.zip . -x "node_modules/*" -x ".env*" -x ".git/*"
Before you can publish a Node.js app, you must attach it to a web hosting subscription. gddy hosting subscription list returns your plans, and each plan has a subscriptionId and an availableSlots count. Use the subscriptionId of a plan with at least one available slot as $SUBSCRIPTION_ID. Go to Attach to a hosting plan for detailed guidance.
The following procedure finds a hosting plan and attaches the app to it.
List your web hosting plans:
gddy hosting subscription list --hosting-product WEB_HOSTING
gddy hosting deployment publish builds the latest source, deploys it to the publish variant, and returns a deploymentId, which is $DEPLOYMENT_ID in the poll command.
The following procedure publishes the app and polls the deployment until it finishes.
Publish the app:
gddy hosting deployment publish --app-id $APP_ID
Poll until the deployment reaches a terminal state:
gddy hosting deployment get --app-id $APP_ID --deployment-id $DEPLOYMENT_ID
gddy hosting app status returns the application lifecycle in status and per-environment detail in variants. The app is healthy when status is ACTIVE. The other values are CREATING, FAILED, DELETING, SUSPENDED, and UNKNOWN. UNKNOWN means the state can't be determined, so don't treat it as healthy. Each entry in variants has its own status, which is ACTIVE when that environment is healthy. It also has a lowercase lifecycleState, which is running when that environment is up. The other main lifecycleState values are provisioning, reloading, paused, deleting, and failed. Other values are possible.
The following procedure confirms the app is running.
Read the app status:
gddy hosting app status --app-id $APP_ID
Check that status is ACTIVE, and that the PUBLISH entry in variants has a status of ACTIVE and a lifecycleState of running. The CLI nests these fields under data.
Open the urls.publish address to see the live app. The next step shows how to read it.
gddy hosting app get returns the full app record, including a urls object with the URL for each environment. Open urls.publish to see the live app. Your code isn't live there until you publish.
The following procedure reads the publish URL.
Read the app record to get its URLs:
gddy hosting app get --app-id $APP_ID --fields urls
The following prerequisites are required before you can deploy your Node.js app:
a Personal Access Token with the following scopes: hosting.application:create, hosting.application:read, hosting.source:write, hosting.source:read, hosting.deployment:execute, hosting.subscription:read, hosting.subscription:write
POST /apps?appType=NODEJS accepts a name and returns 202 Accepted with an AppOperation, including a links[rel=self] URL. Poll that URL with GET /app-operations/{operationId} until the status reaches COMPLETED (success) or FAILED. The curl examples use $OPERATION_ID for the operationId in the create response and $APP_ID for app.id in the completed operation.
POST /apps/{appId}/imports accepts a zip as multipart/form-data and returns 202 Accepted with a SourceImport operation. Poll it with GET /apps/{appId}/imports/{importId} until the status reaches COMPLETED or FAILED. The curl examples use $IMPORT_ID for the importId in the response. After the import reaches COMPLETED, your code runs on the preview variant, which works without a hosting plan. The preview URL is private, so sign in to your GoDaddy account to open it. Go to Get app URLs with the API for the request that returns it.
The following procedure zips your app, uploads it, and polls the import.
Zip the app, leaving out node_modules, .env files, and .git:
zip -r my-app.zip . -x "node_modules/*" -x ".env*" -x ".git/*"
Before you can publish a Node.js app, you must attach it to a web hosting subscription. Use a valid subscription ID from your GoDaddy account (GET /subscriptions?hostingProduct=WEB_HOSTING lists the plans on it). PUT /apps/{appId}/subscription attaches the app to one, and the call is synchronous, so there's no operation to poll. The curl example uses $SUBSCRIPTION_ID for the subscriptionId of a plan with an available slot. Go to Attach to a hosting plan for detailed guidance.
POST /apps/{appId}/deployments builds the latest source, deploys it to the publish environment, and returns 202 Accepted with a Deployment. Poll it with GET /apps/{appId}/deployments/{deploymentId} until the status reaches COMPLETED or FAILED. The curl examples use $DEPLOYMENT_ID for the deploymentId in the response.
GET /apps/{appId}/status returns the application lifecycle in top-level status and per-environment detail in variants. The app is healthy when status is ACTIVE. The other values are CREATING, FAILED, DELETING, SUSPENDED, and UNKNOWN. UNKNOWN means the state can't be determined, so don't treat it as healthy. Each entry in variants has its own status, which is ACTIVE when that environment is healthy. It also has a lowercase lifecycleState, which is running when that environment is up. The other main lifecycleState values are provisioning, reloading, paused, deleting, and failed. Other values are possible.
The following procedure confirms the app is running.
GET /apps/{appId} returns the full app record, including a urls object with the URL for each environment. Your code is not live at urls.publish until you publish.
10–120 req/min per client IP depending on operation
On failure
Creating an app, uploading source, and publishing are async. Poll the status endpoint for each until it reaches a terminal state. Attaching a hosting plan is synchronous, so there is nothing to poll.
You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.