Upsun User Documentation

Get Started

Upsun Beta access

Test and provide feedback for our newest offering - Upsun!

You can register for the Beta by clicking here and completing the form.

Sign up for Beta access

Upsun is the official Symfony PaaS. This guide provides instructions for deploying, and working with, Symfony on Upsun.

Before you begin Anchor to this heading

You need:

  • Git. Git is the primary tool to manage everything your app needs to run. Push commits to deploy changes and control configuration through YAML files. These files describe your infrastructure, making it transparent and version-controlled.
  • A Upsun account. If you don’t already have one, register for a trial account. You can sign up with an email address or an existing GitHub, Bitbucket, or Google account. If you choose one of these accounts, you can set a password for your Upsun account later.
  • The Symfony CLI. This lets you interact with your project from the command line. You can also do most things through the Web Console, but this guide focuses on using the CLI.

Create your Symfony app Anchor to this heading

To get familiar with Upsun, create a new Symfony project from scratch. The present tutorial uses the Symfony Demo app as an example :

symfony new PROJECT_NAME --demo --upsun
cd PROJECT_NAME

The --demo flag pulls the Symfony Demo skeleton.
The --upsun flag automatically generates the Upsun configuration file.

Upsun manages the entire infrastructure of your project, from code to services (such as databases, queues, or search engines), all the way to email sending, cron jobs, and workers. This infrastructure is described through configuration files stored alongside your code.

Create the project Anchor to this heading

To create the project on Upsun, run the following command from within the project’s directory:

symfony upsun:create --title PROJECT_TITLE --set-remote

The --set-remote flag sets the new project as the remote for this repository.

Deploy your project Anchor to this heading

To deploy your project, run the following command:

symfony upsun:deploy

Congratulations, your first Symfony app has been deployed on Upsun!

Now that your app is deployed in production mode, you can define a custom domain for your live website. To do so, see how to set up a custom domain on Upsun, or run the following command:

symfony upsun:domain:add YOUR_DOMAIN

Make changes to your project Anchor to this heading

Now that your project is deployed, you can start making changes to it. For example, you might want to fix a bug or add a new feature.

In your project, the main branch always represents the production environment. Other branches are for developing new features, fixing bugs, or updating the infrastructure.

To make changes to your project, follow these steps:

  1. Create a new environment (a Git branch) to make changes without impacting production:

    symfony upsun:branch feat-a

    This command creates a new local feat-a Git branch based on the main Git branch and activates a related environment on Upsun. The new environment inherits the data (service data and assets) of its parent environment (the production environment here).

  2. Make changes to your project.

    For example, if you created a Symfony Demo app, edit the templates/default/homepage.html.twig template and make the following visual changes:

    templates/default/homepage.html.twig
    {% block body %}
        <div class="page-header">
    -        <h1>{{ 'title.homepage'|trans|raw }}</h1>
    +        <h1>Welcome to the Upsun Demo</h1>
        </div>
    
        <div class="row">
  3. Commit your changes:

    git commit -a -m "Update text"
  4. Deploy your changes to the feat-a environment:

    symfony upsun:deploy

    Note that each environment has its own domain name. To view the domain name of your new environment, run the following command:

    symfony upsun:url --primary
  5. Iterate by changing the code, committing, and deploying. When satisfied with your changes, merge them to the main branch, deploy, and remove the feature branch:

    git checkout main
    git merge feat-a
    symfony environment:delete feat-a
    git branch -d feat-a
    symfony upsun:deploy

    For a long running branch, to keep the code up-to-date with the main branch, use git merge main or git rebase main. You can also keep the data in sync with the production environment by using symfony upsun:env:sync.

Use a third-party Git provider Anchor to this heading

When you choose to use a third-party Git hosting service, the Upsun Git repository becomes a read-only mirror of the third-party repository. All your changes take place in the third-party repository.

Add an integration to your existing third-party repository:

Next steps Anchor to this heading

Symfony integration Anchor to this heading

Learn more about the Symfony integration, a set of tools and auto-configurations that makes it easier to use Upsun for Symfony projects.

Environment variables Anchor to this heading

When you use the Symfony integration, more environment variables related to Symfony are defined.

Local development Anchor to this heading

Once Symfony has been deployed on Upsun, you might want to set up a local development environment.

Symfony CLI tips Anchor to this heading

You might find the following commands useful when using the Symfony CLI.

  • Open the web administration console:

    symfony upsun:web
  • Open the URL of the current environment:

    symfony upsun:url
  • Open an SSH connection to your environment:

    symfony upsun:ssh
  • Configure a project for Upsun:

    symfony project:init --upsun
  • Get a list of all the domains:

    symfony upsun:domains
  • Create a new environment:

    symfony upsun:branch new-branch
  • Get a list of all the environments:

    symfony upsun:environments
  • Push code to the current environment:

    symfony upsun:push
  • Get a list of all the active projects:

    symfony upsun:projects
  • Add a user to the project:

    symfony upsun:user:add
  • List variables:

    symfony upsun:variables

You might find the following commands useful when using the Symfony CLI with a database.

  • Create a local dump of the remote database:

    symfony upsun:db:dump --relationship database
  • Run an SQL query on the remote database:

    symfony upsun:sql 'SHOW TABLES'
  • Import a local SQL file into a remote database:

    symfony upsun:sql < my_database_backup.sql

Is this page helpful?