How to deploy Sylius to


We’re sorry but this documentation section is outdated. Please have that in mind when trying to use it. You can help us making documentation up to date via Sylius Github. Thank you!


Start with reading documentation. Also Symfony provides a guide on deploying projects to

The process of deploying Sylius to is based on the guidelines prepared for Symfony projects in general. In this guide you will find sufficient instructions to have your application up and running on

1. Prepare a project

If you do not have it yet, go to the store, choose development plan and go through checkout. Then, when you will have a project ready, give it a name and proceed to Import an existing site.


To investigate if suits your needs, you can use their free trial, which you can choose as a development plan.

2. Make the application ready to deploy

  • Add the file at the root of your project repository

This is how this file should look like for Sylius (tuned version of the default example):

name: app

type: "php:7.2"

    flavor: composer

    database: "mysql:mysql"
    redis: "redis:redis"

        APP_ENV: 'prod'
        APP_DEBUG: 0

        - msgpack
        - igbinary
        - memcached
        - redis

        yarn: "*"
        gulp-cli: "*"

            root: "public"
            passthru: "/index.php"
            allow: true
            expires: -1
            scripts: true
            expires: 2w
            passthru: true
            allow: false
                # Only allow static files from the assets directories.
                    allow: true
            expires: 2w
            passthru: true
            allow: false
                # Only allow static files from the assets directories.
                    allow: true
            passthru: "/index.php"
            expires: -1
            allow: true
            scripts: true
            expires: 2w
            passthru: true
            allow: false
                # Only allow static files from the assets directories.
                    allow: true

disk: 4096

    "/var/cache": "shared:files/cache"
    "/var/log": "shared:files/logs"
    "/public/uploads": "shared:files/uploads"
    "/public/media": "shared:files/media"

    build: |
        rm public/index.php
        rm -rf var/cache/*
        php bin/console --env=prod --no-debug --ansi cache:clear --no-warmup
        php bin/console --env=prod --no-debug --ansi cache:warmup
        php bin/console --env=prod --no-debug --ansi assets:install
        # Next command is only needed if you are using themes
        php bin/console --env=prod --no-debug --ansi sylius:theme:assets:install
        yarn install
        GULP_ENV=prod yarn build
    deploy: |
        rm -rf var/cache/*
        php bin/console --env=prod doctrine:migrations:migrate --no-interaction

The above configuration includes tuned cache expiration headers for static files. The cache lifetimes can be adjusted for your site if desired.

  • Add .platform/routes.yaml file:
# .platform/routes.yaml
    type: upstream
    upstream: "app:http"

    type: redirect
    to: "http://{default}/"
  • Add .platform/services.yaml file:

This file will load mysql and redis on your server.

# .platform/services.yaml
    type: mysql
    disk: 1024

    type: redis:3.0
  • Configure the access to the database:

In the app/config/parameters_platform.php file, put the following code:

// app/config/parameters_platform.php

$relationships = getenv("PLATFORM_RELATIONSHIPS");

if (!$relationships) {

$relationships = json_decode(base64_decode($relationships), true);

foreach ($relationships['database'] as $endpoint) {
    if (empty($endpoint['query']['is_master'])) {

    $container->setParameter('database_driver', 'pdo_' . $endpoint['scheme']);
    $container->setParameter('database_host', $endpoint['host']);
    $container->setParameter('database_port', $endpoint['port']);
    $container->setParameter('database_name', $endpoint['path']);
    $container->setParameter('database_user', $endpoint['username']);
    $container->setParameter('database_password', $endpoint['password']);
    $container->setParameter('database_path', '');
foreach ($relationships['redis'] as $endpoint) {
    $container->setParameter('redis_dsn', 'redis://'.$endpoint['host'].':'.$endpoint['port']);

ini_set('session.save_path', '/tmp/sessions');

    $container->setParameter('secret', getenv('PLATFORM_PROJECT_ENTROPY'));

Remember to have it imported in the config:

# app/config/config.yml
    # - { resource: parameters.yml } <- Has to be placed before our new file
    - { resource: parameters_platform.php }


It is important to place newly created file after importing regular parameters.yml file. Otherwise your database connection will not work. Also this will be the file where you should set your required parameters. Its value will be fetched from environmental variables.

The application secret is used in several places in Sylius and Symfony. allows you to deploy an environment for each branch you have, and therefore it makes sense to have a secret automatically generated by the system. The last 3 lines in the sample above will use the random value as the application secret.

3. Add as a remote to your repository:

Use the below command to add your project as the platform remote:

$ git remote add platform [PROJECT-ID]@git.[CLUSTER][PROJECT-ID].git

The PROJECT-ID is the unique identifier of your project, and CLUSTER can be eu or us - depending on where are you deploying your project.

4. Commit the specific files:

$ git add
$ git add .platform/*
$ git add app/config/parameters_platform.php
$ git add app/config/config.yml
$ git commit -m " deploy configuration files."

5. Push your project to the platform remote:

$ git push platform master

The output of this command shows you on which URL your online store can be accessed.

6. Connect to the project via SSH and install Sylius

The SSH command can be found in your project data on Alternatively use the Platform CLI tool.

When you get connected please run:

$ php bin/console sylius:install --env prod


By default creates only one instance of a database with the main name. works with the concept of an environment per branch if activated. The idea is to mimic production settings per each branch.

7. Dive deeper

Learn some more specific topics related to Sylius & Symfony on our Advanced Cookbook

Learn more