Import your own code

Configuring projects

In the previous step, you created a new project on Platform.sh using the CLI. Now, there are a few configuration steps left that will help Platform.sh know what to do with your application during builds and deployments.

  1. Consult a template alongside this guide

    As you go through this guide, example files will be provided that will give you a good impression of how to configure applications on Platform.sh in the programming language they use. However, since they are simple examples and your own application may require more detailed configuration than those examples address, it is recommended that you take a look at our maintained templates for additional guidance.

    Select a language and choose one or more templates that most closely resemble your application and keep the template in another tab as you continue through this guide. Using these two resources together is the fastest way to correctly configure your project for Platform.sh.

  2. Create empty configuration files

    You will notice that each of the templates above contain the following structure around their application code:

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

    In order to successfully deploy to Platform.sh you must add three YAML files:

    • A .platform/routes.yaml file, which configures the routes used in your environments. That is, it describes how an incoming HTTP request is going to be processed by Platform.sh.
    • A .platform/services.yaml file, which configures the services that will be used by the application. Connecting to Platform.sh's maintained services only requires properly writing this file. While this file must be present, if your application does not require services it can remain empty.
    • At least one .plaform.app.yaml file, which configures the application itself. It provides control over the way the application will be built and deployed on Platform.sh.

      When you set Platform.sh as a remote for your repository in the previous step, the CLI automatically created the hidden configuration directory .platform for you. The next steps will explore in more detail what each configuration files must include, but for now create empty files in their place.

      touch .platform/routes.yaml
      touch .platform/services.yaml
      touch .platform.app.yaml
      

With the empty configuration files in place, you will need to specify your service configuration in .platform/services.yaml.