This page follows a deployment from end to end: from the push to the page shown to a visitor, then what Webgune does when something goes down. Each part links to the page that details it.
From code to a live service
- 01Buildisolated machine, 1 h at most
- 02Imageproject registry, unique ID
- 03Startone micro-VM per instance
- 04Checkthe port accepts a connection
- 05Switchtraffic moves to the new version
- Not ready within 15 min, or crash loop : the previous image is put back into service
1. The build
The builder clones the repository (10 minutes at most), detects the language and framework, installs dependencies from your lock file, then builds the application. If you chose Dockerfile mode, it builds the repository's Dockerfile instead.
The build runs in its own isolated machine, without privileges. It has Internet access to download dependencies and no access to any internal service: neither your database nor your API. It is stopped after one hour. An already built Docker image skips this step (How builds work).
2. The image
The build's result is an image. It gets a unique identifier, taken from the commit, and joins the project's registry. The project's Registry tab lists each service's images. One of these images is put back online during a rollback, with no new build.
3. Startup
Each instance of the service starts in its own lightweight virtual machine, with its own Linux kernel. It sees neither the server that hosts it nor other customers' services. Three cases stay in a standard container, including services that mount a persistent volume (One microVM per service).
4. The check
Webgune considers an instance ready when its port accepts a connection. The first attempt happens 5 seconds after startup, then every 10 seconds. The deployment succeeds when all instances run the new version and are ready.
This check does not know your application's state: a port opened before initialization finishes counts as ready. Connect to the database before opening the port (Health check).
5. The switchover
For a site or an API, the new instance starts while the old one still serves visitors. Traffic switches over when the new one is ready. The old one then receives SIGTERM and has 30 seconds to finish its in-flight requests.
For a bot or a worker, the old instance stops completely before the new one starts. The pause lasts a few seconds.
If the new version does not start
Webgune puts the previous image back in service in two cases: the new version crashes in a loop at startup, or it is not ready after 15 minutes. During all that time, a site or an API keeps responding with the old version. The deployment is marked as failed and the panel gives the reason.
If your application changed its database schema before failing, the old version may no longer be able to read it. This case is covered in Database migrations.
Service types
| Type | Examples | Instances | Update | Entry point |
|---|---|---|---|---|
| Site | showcase site, Next.js, portfolio | 1 at rest, more depending on load; always 1 in "Simple service" | no downtime | domain name |
| API | REST backend, GraphQL | 1 at rest, more depending on load; always 1 in "Simple service" | no downtime | domain name |
| Bot | Discord bot | always 1 (one per shard) | the old one stops first | none, the bot connects on its own |
| Worker | sending email, processing queues | always 1 | the old one stops first | none |
| Database | PostgreSQL, MySQL, MariaDB, MongoDB, Redis | 1 | maintenance window | internal address in the project |
A bot never has two instances: two connections to Discord with the same token get disconnected or answer twice. The pause during its update is therefore intended.
A site or an API that mounts a persistent volume also runs as a single instance, because a volume attaches to only one instance at a time.
The path of a visit
- The visitor enters the site's address.
- The request reaches the entry point, the only server visible from the Internet. Its firewall lets through only the public ports.
- The router reads the domain name, finds the matching service and terminates the HTTPS connection with the domain's certificate.
- The request reaches one of the service's instances, which sends back the response.
- Visitorbrowser or app
- Firewallonly server visible from the Internet
- Routerreads the domain, terminates HTTPS
- Instance 1service micro-VM
- Instance 2service micro-VM
Between the entry point and the servers, traffic travels through an encrypted tunnel. The visitor's real address is passed to your application in the X-Forwarded-For header.
With several instances, two successive requests from the same visitor do not necessarily reach the same one. Sessions kept in memory therefore do not work: put them in the database or in Redis.
A service's resources
Each instance receives your plan's CPU and memory, with a cap of 2 CPUs and 4 GB. A quarter of the CPU and half of the memory are reserved for it, even when the server is busy. It rises to its maximum as soon as it needs to.
At the CPU maximum, the service slows down. At the memory maximum, it is stopped with code 137 then restarted (Limits and resources).
When something goes down
| Event | What Webgune does |
|---|---|
| The service crashes | It is restarted. If it crashes in a loop, the delay between two restarts increases |
| The service crashes in a loop after a deployment | Webgune tries a repair based on the cause (wrong port, insufficient memory, missing variable), then puts back the last healthy image. As a last resort, the service is stopped and marked as failing |
| The service exceeds its memory | It is stopped (code 137) then restarted |
| The service exceeds its CPU | It slows down, without being stopped |
| A server goes down | Its services are restarted on another server. A service with several instances keeps responding in the meantime |
| The new version does not start | The previous version is put back in service |
A service's availability mode is set in Availability and scaling.
Sleep mode
A staging or development service with no visits is stopped after a delay that depends on your plan, from 15 minutes to 8 hours. The next visit wakes it in a few seconds. Production services, bots, workers and databases do not go to sleep (Sleep mode).
What remains your responsibility
- An up-to-date lock file in the repository.
- An application that listens on
PORTand0.0.0.0, and opens its port only once ready (Health check). - Database migrations compatible with the previous version.
- No data to keep on the service disk: a volume or a database.
- Secrets in environment variables, never in the repository.
The full list is in Best practices. If something goes wrong, start with Troubleshooting.