Deployment And Production

Choosing a host

Your image runs on any host that runs Docker, so you can choose on price, location, and how much of the server you want to manage, and move later without rebuilding your app.

Types of hosting

TypeYou manageGood fit
VPSThe server, Docker, updates, and backupsMost PHP apps, on one server or a few
PaaSOnly your appTeams that don't want to manage servers
Managed KubernetesYour cluster configurationApps that need many servers and automatic failover

A VPS costs the least per CPU and gigabyte of memory, but you are responsible for the server. A PaaS costs more and runs your containers for you. Start with the simplest option that fits: one VPS, then Docker Swarm across a few servers as you grow, and Kubernetes only when you need many servers. Your image runs the same on all three.

What to look for

  • Docker support. Any Linux VPS can run Docker. On a PaaS, check that it runs your own image and lets you set environment variables and health checks.
  • Resources. Plan on at least 1 GB of memory and one CPU, and 2 GB or more for most production apps. Leave room for PHP-FPM workers: each one can use up to PHP_MEMORY_LIMIT (256M by default). See PHP-FPM workers.
  • Data center location. Close to your users, and in the regions your data must stay in.
  • Backups. Provided by the host or easy to run yourself. Keep at least one copy off the host.
  • Pricing you can predict. Usage-based billing should come with alerts before you hit a limit.
  • Logs and access. You should be able to read container logs and get a shell when something breaks.
  • No lock-in. Prefer hosts that run standard images, so you can move.

Hosts we use

Some links include a referral code that gives you starting credit.

VPS

Hetzner

Low-cost VPS servers in Europe, the US, and Singapore.

Vultr

VPS servers in data centers around the world.

DigitalOcean

VPS servers with managed databases, load balancers, and object storage.

PaaS

Sevalla

A PaaS with usage-based pricing. Sevalla sponsors this project.

Set up a VPS with Spin

Spin is a free, open source tool from the same maintainers. It provisions servers on Hetzner, DigitalOcean, and Vultr and sets up Docker Swarm for zero-downtime deployments with these images. You don't need Spin to use the images.