Docs menu

Moving an app from Heroku

A walkthrough for moving a running Heroku app to Primcloud with zero downtime.

On this page

Before you start#

You'll need a Primcloud account with GitHub connected (the Quickstart walks you through it) and the Heroku CLI, so you can read your config vars.

A few things go by different names here:

On Heroku On Primcloud
Process type Pod formation
Dyno count Instances
Dyno type Compute size
Config vars Secrets
heroku run Tasks
*.herokuapp.com *.primcloud.app

The guide follows one app, hack-the-planet, from start to finish.

1. Bring your Procfile as it is#

You don't need to change it.

Procfile
release: perl bin/release.pl
web: perl bin/board.pl --port=$PORT
worker: ./bin/queued -d

No Procfile? Most languages start a sensible web process on their own, and your language's page under Language Support says what it runs.

Note

The build ignores an Aptfile. Move those packages into a project.toml, as the Customizing the build page for your language under Language Support shows.

2. Pull up your config vars#

Terminal
heroku config -a hack-the-planet

Leave PORT out, since Primcloud sets it for you. Add-on vars come over like any other, as long as the add-on accepts connections from outside Heroku.

3. Import your repo#

From your applications list, hit Import Git Repository. Pick the repo, then on the Configure step choose your branch and region.

That Configure step also has a Secrets list. Add your config vars there and they're saved before the first build.

The Secrets list with paired key/value rows, one value revealed and the rest masked, per-row remove buttons, Add More, and Save

Check the commit and hit Import. The first deploy starts right away.

A deployment's detail page with its Build and Rollout phases both complete, the Build phase expanded to its log

Once Rollout shows Complete, open your app at hack-the-planet-production.primcloud.app. Forgot a secret? Add it under Settings → Secrets and save. Once your app is running, saving redeploys it with the new value, no rebuild needed. If the first deploy failed, save the secret, then hit Redeploy on that deployment.

4. Turn your workers on#

Important

After the first deploy, only web is running. Every other process starts at 0 instances, so your workers are off until you scale them up.

Open Pod Formations on your app's dashboard and expand a formation. Instances is your dyno count. Formation Size is your dyno type: the memory and CPU each instance gets.

The Pod Formations panel with web expanded at 2 instances on Standard 2x, showing the Formation Size selector and the Instances slider, and worker below it at 1 instance on Standard 1x

Everything starts on Standard 1x, our smallest size. Memory is a hard limit, so pick a size with at least as much memory as your app uses on Heroku. Scaling formations has the details.

5. Swap heroku run for tasks#

Anything you'd run with heroku run becomes a task. It runs your command on a fresh instance of your current build, with the same secrets as your app, and streams the output while it runs.

A task run with the command across the top, a succeeded badge with its exit code, and the run's output below

A task isn't an interactive shell. Give it a command and it runs until that command exits.

6. Move your domain#

  1. Add your domain in your app's Settings. We'll show you the two DNS records to add, a CNAME and a TXT record.
  2. Add the TXT record at your DNS provider.
  3. Change your CNAME from Heroku to the target we showed you. For a root domain like example.com, use an ALIAS, ANAME or flattened CNAME; DNS setup explains why.
  4. Wait for the domain to show Success. We keep checking DNS for up to 72 hours, and once it verifies, your app is served over HTTPS.
  5. Make it your primary domain. Your primcloud.app URL then redirects to it.
A pending custom domain showing its status with the exact CNAME and TXT DNS records to add, each with a copy-to-clipboard button

7. Switch Heroku off#

Delete your Heroku app:

Terminal
heroku apps:destroy -a hack-the-planet