Platform.sh User Documentation

Platform.sh YAML structure

Sign up for Upsun

Get your free trial by clicking the link below.

Get your Upsun free trial

In addition to the basic functions you should be familiar with, YAML structure is important. Platform.sh accepts a certain structure for YAML configuration files.

When you run the platform project:init command, three default YAML configuration files are generated in the .platform folder and at the root of your source code. They contain the minimum default configuration based on your detected local stack. These YAML files are a good starting point before customization.

.
โ”œโ”€โ”€ .platform
|ย ย  โ”œโ”€โ”€ routes.yaml
|ย ย  โ””โ”€โ”€ services.yaml
โ”œโ”€โ”€ .platform.app.yaml
โ””โ”€โ”€ <source code>

These three YAML files configure the following:

Examples Anchor to this heading

.platform.app.yaml

# Complete list of all available properties

# A unique name for the app. Must be lowercase alphanumeric characters.
# Changing the name destroys data associated with the app.
name: "app"

# The runtime the application uses.

# Complete list of available runtimes
type: "php:8.2"
...
.platform/services.yaml
# The services of the project.
#
# Each service listed will be deployed
# to power your Platform.sh project.
# Full list of available services

mariadb:
  # All available versions are: 10.6, 10.5, 10.4, 10.3
  type: mariadb:10.6
.platform/routes.yaml
# The routes of the project.
#
# Each route describes how an incoming URL is going
# to be processed by Platform.sh.
# More information

"https://{default}/":
  type: upstream
  upstream: "app:http"

# A basic redirect definition
# More information

"https://www.{default}":
  type: redirect
  to: "https://{default}/"

In these files, you can use any of the available YAML tags you need.

Multi-app Anchor to this heading

In a multiple application context, you can also group all of your app configurations in a global .platform/applications.yaml file. This file contains a list of app configurations, such as:

.platform/applications.yaml
app1:
  type: php:8.3
  source:
    root: app1

app2:
  type: nodejs:20
  source:
    root: app2

Is this page helpful?