Level up[sun] your Symfony skills ✨

celestevanderwatt

Celeste van der Watt

Posted on May 17, 2024

Level up[sun] your Symfony skills ✨

Discover a quick and simple two step tutorial to get your Symfony demo application up and running on the Upsun PaaS


Step one: Create an Upsun-ready Symfony Demo

Creating a new Symfony Demo application is simple. Use the following commands to get your Symfony Demo project Upsun-ready, and don’t forget to add --upsun option to your command to auto-configure your local project for our PaaS:

symphony new my-symfony-app --demo --upsun
cd my-symfony-app
symfony server:start -d #optional
Enter fullscreen mode Exit fullscreen mode

🚨 Important: If you’re starting from an existing local Symfony project, you can generate the Upsun config by using the following command: 🚨

symphony project:init --upsun
Enter fullscreen mode Exit fullscreen mode

The --upsun option generates an Upsun YAML configuration file —.upsun/config.yaml— to manage how your application behaves when deployed on Upsun. This YAML configuration file is located in an .upsun/ folder, at the root of your source code, the architecture of which will look like this:

my-symfony-app
├── .upsun
│   └── config.yaml
└── <project sources>
Enter fullscreen mode Exit fullscreen mode

There are a few basic rules for Upsun configuration:

1️⃣ The YAML format is used for config files.
2️⃣ The .upsun/ folder, containing a config.yaml file, with routes, services, and application configuration shared across all applications, must stay at the root of your project.

Finally, for this step, you need to create an Upsun project using the Symfony CLI.

Step two: Create an Upsun project and deploy

The next step in setting up your Symfony Demo application on Upsun is to create a project that is simple to do via the Upsun CLI in your terminal. Use this command and follow the prompts to choose the name of your project, region, and many other options:

symphony project: create
Enter fullscreen mode Exit fullscreen mode

🚨 Important: During project creation, you are asked if you want to set the local remote to your new project. Enter Yes (y). Your local source code is automatically linked to your newly created Upsun project by creating a .upsun/local/project.yaml file. This file will contain the corresponding <projectId> and set a Git remote to upsun.🚨


Then, deploy your local code to your Upsun project by using the following command:

symphony deploy
Enter fullscreen mode Exit fullscreen mode

When the deployment is complete, browse your website using your favorite browser by using the following command:

symfony environment:url
Enter fullscreen mode Exit fullscreen mode

You’re all set! 💪 Hosting a Symfony application on Upsun has never been so easy—with just the 5 commands detailed above, you can be Up(sun) and running in no time. 🥳


Originally published on Upsun.com

💖 💪 🙅 🚩
celestevanderwatt
Celeste van der Watt

Posted on May 17, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related