LanguageGB
App Deployment

Run a reliable backend on App Hosting

What the platform expects from an app server, and the habits that keep deploys uneventful: listen on PORT, answer a health path, keep data out of the app folder, and stay within your plan's memory.

What this covers

Each deploy builds your app from a fresh copy of your repository, starts it beside the version that is running, checks its health path, and only then moves traffic to it. The previous version keeps serving until the new one is healthy, and a release that never turns healthy is rolled back. Your app runs under its own system user behind nginx, which handles TLS. That design suits apps that start quickly, keep no data on local disk, and can briefly run as two copies during the swap.

Before you start

Deploy the starter for your runtime once, so you have a working reference to compare your app with.

How to do it

  1. Listen on 127.0.0.1 and the port in the PORT environment variable. Don't hard-code a port and don't bind 0.0.0.0; nginx is the only thing that should be reachable from outside.
  2. Give your app a cheap health endpoint, such as /_runtime/health or /api/health, that answers 200 without calling the database or other services, and set it as the Health path. A slow or failing health check stops the deploy.
  3. Keep data out of the app's folder. Each deploy starts from a fresh copy of your repository, so files your app writes there (uploads, caches, a SQLite file of your own) are gone after the next deploy. Keep data in managed PostgreSQL or a PocketBase backend, and uploads in an S3-compatible bucket. Django's MEDIA_ROOT and Laravel's default SQLite database are the exceptions: the platform keeps them across deploys.
  4. Make startup work safe to repeat. Migrations, seed scripts and collection setup run on every deploy, while the previous version is still serving, so write them to be safe to run twice and compatible with the version that is still running.
  5. Stay within your plan's memory: 1 GB on App Starter, 2 GB on App Business, 4 GB on App Pro. Close to the limit the app is slowed down; past it, the app is stopped and restarted. This is why Java needs App Business or higher.
  6. Write logs to standard output. What your app prints appears in the Runtime logs panel on the service page, the first place to look when something fails.
  7. Shut down cleanly. When a new version takes over, the old one receives SIGTERM: finish requests in progress and close database connections rather than exiting mid-request.
  8. Laravel: the platform keeps one APP_KEY per app and the default SQLite database between deploys, and runs migrations before traffic moves. For anything with real traffic, use managed PostgreSQL: set DB_CONNECTION=pgsql and DB_URL to the DATABASE_URL from your Database tab.
  9. Flask: the platform serves your app with gunicorn and 3 workers. To tune it, set your own Start command, for example venv/bin/gunicorn app:app --bind 127.0.0.1:$PORT --workers 5.
  10. Use the deploy hook for continuous deployment: every push to your branch redeploys, with the same health check and rollback.

Starter code and references

What our team checks

Support can go through your deploy and runtime logs with you and tell you which step failed. Support does not change your application code.

Next step

Check your app against this list, then redeploy and watch the deploy log.

Contact Support