Import your own code

Configure services

In the previous step, you created a collection of empty configuration files that have given your project the following structure:

├── .platform
│   ├── routes.yaml
│   └── services.yaml
├── .platform.app.yaml
└── < application code >

Now you will need to include information that will tell Platform.sh how you want your application to connect to its services. An example .platform/services.yaml will look something like this:

.platform/services.yaml

# This file defines services you want available to your application.

elasticsearch:
    type: elasticsearch:5.4
    disk: 256
    size: S
influxdb:
    type: influxdb:1.3
    disk: 256
    size: S
kafka:
    type: kafka:2.1
    disk: 512
    size: S
memcached:
    type: memcached:1.4
    size: S
mongodb:
    type: mongodb:3.6
    disk: 1024
    size: S
mysql:
    type: mysql:10.2
    disk: 256
    size: S
postgresql:
    type: postgresql:11
    disk: 256
    size: S
redis:
    type: redis:5.0
    size: S
rabbitmq:
    type: rabbitmq:3.5
    disk: 256
    size: S
solr:
    type: solr:7.6
    disk: 256
    size: S

If you're application does not use any services at this point then you can leave it blank, but it must exist in your repository to run on Platform.sh. If your application does use a database or other services, you can configure them with the following attributes:

  • name: Provide a name for the service, so long as it is alphanumeric. If your application requires multiple services of the same type, make sure to give them different names so that your data from one service is never overwritten by another.

  • type: This specifies the service type and its version using the format

    type:version
    

    Consult the table below that lists all Platform.sh maintained services, along with their type and supported versions. The links will take you to each service's dedicated page in the documentation.

Service type Supported version
Elasticsearch elasticsearch 5.3, 5.4, 6.5
Headless Chrome chrome-headless 73
InfluxDB influxdb 1.2, 1.3, 1.7
Kafka kafka 2.1
Memcached memcached 1.4
MongoDB mongodb 3.0, 3.2, 3.4, 3.6
MariaDB mysql 10.0, 10.1, 10.2
MySQL oracle-mysql 5.7, 8.0
Network Storage network-storage 1.0
PostgreSQL postgresql 9.6, 10, 11
RabbitMQ rabbitmq 3.5, 3.6, 3.7
Redis redis 3.2, 4.0, 5.0
Solr solr 3.6, 4.10, 6.3, 6.6, 7.6, 7.7, 8.0
Varnish varnish 5.2, 6.0
  • disk: The disk attribute configures the amount of persistent disk that will be allocated between all of your services. Projects by default are allocated 5 GB (5120 MB), and that space can be distributed across all of your services. Note that not all services require disk space. If you specify a disk attribute for a service that doesn't use it, like Redis, you will receive an error when trying to push your changes.

Each language and framework may have additional attributes that you will need to include in .platform/services.yaml depending on the needs of your application. To find out what else you may need to include to configure your services, consult

  • The Services documentation for Platform.sh

    The documentation goes into far more extensive detail of which attributes can also be included for service configuration, and should be used as your primary reference.

  • Language-specific templates for Platform.sh Projects

    Compare the .platform/services.yaml file from the simple template above to other templates when writing your own.

Platform.sh provides managed services, and each service comes with considerable default configuration that you will not have to include yourself in .services.yaml.

Next, you will next need to tell Platform.sh how to build and deploy your application using the .platform.app.yaml file.