The following describes the steps necessary to deploy a Symfony-based (version 6.x/LTS) API. If you want to skip the project setup, head over to our Github repository to find the code.
Create the project using Composer:
$ composer create-project symfony/skeleton:"6.1.*" example-symfony-api
Creating a "symfony/skeleton:6.1.*" project at "./example-symfony-api"
Info from https://repo.packagist.org: #StandWithUkraine
Installing symfony/skeleton (v6.1.99)
...
The next step is to initialize the project (with git
) and delete .env
:
$ cd example-symfony-api
$ rm .env
$ git init
$ git commit -a -m 'my symfony app'
...
The reason why we delete the .env
file is because we don’t need them as these settings should be provided by the environment. The next step includes how to achieve this. Besides, runtime secrets should not be committed to version control.
Therefor we disable DotEnv and update the lock:
$ composer config --json extra.runtime.disable_dotenv 'true'
$ composer update --lock
$ git commit -a -m 'Done'
Create an application on Runway:
$ runway app create
INFO created app "fair-emission"
create app fair-emission: done
next steps:
* commit your changes
* runway app deploy
* runway open
… and set the necessary environment variables:
$ runway app config set APP_ENV=production
INFO configuring app "fair-emission"
configure app fair-emission: done
Name Value
APP_ENV production
$ runway app config set APP_SECRET=YOUR-SUPER-SECRET-HERE
INFO configuring app "fair-emission"
configure app fair-emission: done
Name Value
APP_ENV production
APP_SECRET YOUR-SUPER-SECRET-HERE
Finish with: runway app deploy
.