Structure
Back to home
On this page
Note
This page describes how things work on Grid projects. Dedicated Gen 3 projects are similar, but they run on dedicated hosts and each container is replicated three times.
For Dedicated Gen 2 projects, read about how Dedicated Gen 2 projects are structured.
Each environment you deploy on Platform.sh is built as a set of containers. Each container is an isolated instance with specific resources.
Each environment has 2 to 4 types of containers:
- One router (configured in a
.platform/routes.yaml
file) - One or more app containers (configured in
.platform.app.yaml
files) - Zero or more service containers (configured in a
.platform/services.yaml
file) - Zero or more worker containers (configured in the files for apps)
If you have two app containers, two services (a database and a search engine), and a worker, requests to your environment might look something like this:
If you have only one app container, your repository might look like this:
project
โโโ .git
โโโ .platform
โ โโโ routes.yaml
โ โโโ services.yaml
โโโ .platform.app.yaml
โโโ <YOUR_APP_FILES>
Router
Each environment always has exactly one router.
This router maps incoming requests to the appropriate app container and provides basic caching of responses, unless configured otherwise.
The router is configured in a .platform/routes.yaml
file.
If you don’t include configuration, a single default route is deployed.
Read more about how to define routes.
Apps
You always need at least one app container, but you can have more.
App containers run the code you provide via your Git repository. They handle requests from the outside world and can communicate with other containers within the environment. Each app container is built from a specific language image with a given version for the language.
To configure your apps, you usually create one .platform.app.yaml
file for each app container.
A basic app generally has only one such file placed in the repository root.
Read more about how to configure apps.
Services
You don’t need any service containers, but you can add them as you like.
Service containers run predefined code for specific purposes, such as a database or search service. You don’t need to add their code yourself, just set up how your apps communicate with them.
Service containers are configured by the .platform/services.yaml
file.
Read more about how to add services.
Workers
You don’t need any worker containers, but you can add them as you like.
Worker containers are copies of an app containers that have no access to the outside world and can have a different start command. They’re useful for continually running background processes.
Read more about how to work with workers.