Skip to content
Skip to Content

Link and deploy

Tie a folder to a project and service with openpanel link, then deploy, follow and roll back from that folder.

openpanel link ties a folder, usually your app's repository, to a project and one of its services. From then on, commands run in that folder or below it need no --project or --service.

cd ~/code/shop
openpanel link --project shop --service web

The CLI checks that both exist and writes .openpanel.json in the folder:

{
  "projectId": "01a2332b-243d-7006-9138-bd2ba39d4170",
  "serviceId": "01a2332b-7e96-7004-b727-8f80a8d5cb49"
}

The file holds only ids, no secrets. Commit it, and your teammates and your CI use the same service without naming it. Each person still signs in as themselves, and each sees the project only with their own access.

--project or --service on a command still wins over the link, and openpanel link again replaces it. Without --service, the folder is linked to the project only, and commands that work on a service ask for --service.

Deploy

openpanel deploy --wait

A deploy takes the service as it is set now, and makes a deployment of it:

  • From an image, it runs the image and tag the service names. The deployment starts at once.
  • From Git, it builds the newest commit of the service's branch on one of your servers first. --commit <sha> builds that commit instead.

Settings and variables you change take effect at the next deploy, never before. A typical change is two commands:

openpanel services update --image nginx:1.28
openpanel deploy --wait

Without --wait, the CLI prints the new deployment's id and status, and returns. With it, the CLI prints each new status and returns when the deployment runs, fails, is cancelled or is replaced. For a service built from Git:

Deploying web: 01a2332b-9525-7007-abb7-7d833b311635 (queued)
  building
  deploying
  running
StatusWhat it means
queuedWaiting for its server to start the build
buildingThe image is being built from Git
deployingThe new containers are starting. The deployment before keeps serving until they are ready, except for a service with a volume, which stops first
runningEvery copy runs and passed its health check, if it has one
failedThe build or the rollout failed; the service goes back to the deployment that ran before
supersededIt ran, and a newer deployment replaced it
cancelledIt was stopped before it finished

A failed deployment makes openpanel deploy --wait exit with 1 and print why. A build that takes more than 60 minutes fails, and so does a rollout that is not ready after 15 minutes. See Deployments.

Follow what happened

openpanel deployments
openpanel logs --follow

deployments lists the service's deployments, newest first, and marks the current one with *. logs prints what the service's running containers print, read live from your servers, newest last; --follow asks again every 2 seconds until you stop it. --deployment <id> prints that deployment's build log and deploy log instead (the image being pulled, containers starting, a health check failing), following it until it runs or fails.

Roll back

openpanel rollback

Without an id, this goes back to the newest deployment before the current one that has an image and did not fail or get cancelled. It asks you to confirm, then makes a new deployment that runs that image again with the service's settings of today. To go back further, name the deployment:

openpanel rollback 01a2332b-95e0-7006-a28a-5aecb9679687

See Rollbacks and history.

From nothing to a deployed service

With a server connected, in your app's folder:

openpanel projects create shop
openpanel services create web --project shop --image nginx:1.27 --port http:80 --public --server my-server
openpanel link --project shop --service web
openpanel deploy --wait
openpanel domains

A public service with an HTTP port gets an opnl.app address as soon as it is made, such as web-shop-x7k2.opnl.app; openpanel domains shows it. To build from a repository instead of an image, connect a Git account in the console, then use --repo owner/app --git-account <id> with the id openpanel git shows. See Add a service.