Introduction
This guide moves a Heroku app to Shard Cloud. Every part of a Heroku app has a direct counterpart:
Things that get simpler:
$PORTkeeps working. Every Shard Cloud container setsPORT=80, so an app that listens onprocess.env.PORT(oros.environ["PORT"]) needs no change. It must listen on0.0.0.0, as on Heroku.- The disk is persistent. Unlike Heroku’s ephemeral filesystem, files your app writes under
/appsurvive restarts (up to the storage limit). - No dyno sleeping. Apps run all the time and restart automatically if they crash.
Before You Start
What you need
- The Heroku CLI, logged in to the account that owns the app
- The app’s code (
git cloneof your repository, orheroku git:clone -a YOUR_APP) - A Shard Cloud account. Each Procfile process becomes an application, and each add-on database a database, so check that their RAM fits in your plan (see the minimums on the limits page)
- To restore the database: Docker, or
pg_restoreinstalled locally
Take stock of the app
Run these from the code folder, replacingYOUR_APP:
Step 1: Export the Config Vars
heroku.env now holds every config var as KEY=value. Open it and:
- Delete the ones the add-ons manage, such as
DATABASE_URL,HEROKU_POSTGRESQL_*,REDIS_URLandREDIS_TLS_URL: you’ll set them to the new databases in step 4. - Leave everything else as it is.
Step 2: Create the Databases
1
2
Redis (if you use Heroku Redis)
Create a Redis database. Heroku Redis is usually a cache or a job queue, so it starts empty: there’s nothing to copy.
3
Copy the connection URLs
Each database’s page shows its connection URL. You’ll use them in steps 3 and 4.
Step 3: Move the Postgres Data
Capture a fresh backup and download it:pg_restore of your Shard Cloud database’s major version, for example with Docker (postgres:17 for a PostgreSQL 17 database):
pg_restore installed locally:
--no-owner --no-acl drops Heroku’s roles and grants, which don’t exist on Shard Cloud. pg_restore may report errors about Heroku-specific objects (such as the heroku_ext schema or an extension that isn’t available); check that your tables and their row counts are all there:
MySQL (JawsDB, ClearDB)
MySQL (JawsDB, ClearDB)
Create a MySQL database, then copy the data with Take the old values from the add-on’s URL (
mysqldump and the mysql client:heroku config:get JAWSDB_URL -a YOUR_APP) and the new ones from the database page.MongoDB
MongoDB
Create a MongoDB database, then copy the data with the MongoDB Database Tools:
Step 4: Set the Environment Variables
Add the new databases’ URLs toheroku.env, under the names your code reads:
heroku.env
Heroku Postgres requires SSL, so many apps already connect with
ssl: { rejectUnauthorized: false } (Node) or sslmode=require. That keeps working: Shard Cloud databases only accept encrypted connections. To verify the certificate instead, see Verifying the Certificate.Step 5: Translate the Procfile
Each line of theProcfile becomes one application, configured by a .shardcloud file. The start command goes in CUSTOM_COMMAND, and a release command goes in front of the web command, so it runs each time the app starts.
Heroku runs your build (npm run build, collectstatic…) during the deploy. Shard Cloud installs the dependencies but doesn’t run a build, so put the build in the start command too.
- Node.js
- Python
- Other languages
Procfile
.shardcloud
npm run build if your package.json has no build script. Dependencies are installed with npm, yarn, pnpm or bun, following your lockfile. Set VERSION to the Node.js major version in your engines field if it isn’t the recommended one.Workers and other processes
Aworker (or any process that doesn’t receive web traffic) is an application without SUBDOMAIN, so it needs only 256 MB:
.shardcloud
release command in the web app only.
Heroku Scheduler
Shard Cloud has no job scheduler of its own. Run the jobs from a small application instead (or from your worker), with a scheduling library such as node-cron for Node.js or APScheduler for Python:scheduler.js
Step 6: Deploy
1
Upload the web app
Add the web app’s
.shardcloud to the root of your code, zip it without node_modules/, virtualenvs or build output (100 MB at most), and upload it in the Dashboard.2
Import the environment variables
On the application’s page, open Environment Variables, choose Import .env and pick
heroku.env. Check the values, then restart the application.3
Repeat for each other process
Upload the same code with that process’s
.shardcloud (no SUBDOMAIN), and import the same heroku.env.4
Connect GitHub (optional)
To deploy on every push, like Heroku’s GitHub integration, connect each application to your repository on its Deploy page. See Git integration.
Step 7: Test, Then Switch the Domain
1
Test on the free subdomain
Open
https://myapp.shardweb.app, log in, and check pages that read and write data. Check the workers’ logs on their pages.2
Add your domain
Add your domain to the web app and point its DNS at Shard Cloud, replacing the Heroku DNS target. See Custom Domain. HTTPS is set up for you.
3
Shut down Heroku
Once traffic is on Shard Cloud and you’ve checked the data, scale the Heroku dynos to zero (
heroku ps:scale web=0 worker=0 -a YOUR_APP). Keep the Heroku database until you’re sure nothing is missing, then remove the add-ons to stop the charges.Troubleshooting
The app starts but the site doesn't load
The app starts but the site doesn't load
The server must listen on
0.0.0.0 and on $PORT (80). A hardcoded port such as 3000 or 5000, or listening on localhost only, makes the site unreachable.gunicorn: not found (or celery, uvicorn)
gunicorn: not found (or celery, uvicorn)
Use
python -m gunicorn (or python -m celery, python -m uvicorn) in CUSTOM_COMMAND.Out of memory during the build
Out of memory during the build
The build runs when the app starts, inside the app’s RAM. Raise
MEMORY (1024 MB is a safe start for frontend builds) or build locally and upload the built files.pg_restore: unsupported version in file header
pg_restore: unsupported version in file header
The
pg_restore you used is older than Heroku’s Postgres. Use a newer one, for example the postgres:17 or postgres:18 Docker image.Changed an environment variable and nothing happened
Changed an environment variable and nothing happened
Environment variables are read when the app starts: restart the application after changing them.