Guide to Deploying Laravel on Upsun
Back to home
On this page
Laravel is an open-source PHP Framework.
Tip
To get your Laravel project up and running as quickly as possible, experiment with the Upsun demo app before following this guide.
Before you begin
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.
- Required: the Upsun 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.
Initialize a project
You can start with a basic code base or push a pre-existing project to Upsun.
- Get your code ready locally.
If your code lives in a remote repository, clone it to your computer.
If your code isn’t in a Git repository, initialize it by running git init.
Note
We recommend you initialize a Git repository before creating an
Upsun project as this one will then your main environment track
your main branch. Otherwise, the main environment might track a main branch
while your default branch may be master and therefore handled as a secondary
environment.
- Create your first Upsun project by running the following command:
upsun project:createThen choose the region you want to deploy to, such as the one closest to your site visitors. You will explicitely configure the resource allocation for your project at a later step.
Copy the ID of the project you’ve created.
- Connect your Upsun project with Git. You can use Upsun as your Git repository or connect to a third-party provider: GitHub, GitLab, or BitBucket.
Using Upsun
The upsun project:create interactive command asked
Set the new project <YOUR PROJECT NAME> as the remote for this repository? [y/N]Run the following command from your repository if you had chosen no at this step,
but wish to add a Git remote for the Upsun project you just created:
upsun project:set-remote PROJECT_IDThat creates an upstream called upsun for your Git repository.
Using a third-party provider
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.
The process varies a bit for each supported service, so check the specific pages for each one.
Accept the default options or modify to fit your needs.
All of your existing branches are automatically synchronized to Upsun. You get a deploy failure message because you haven’t provided configuration files yet. You add them in the next step.
If you’re integrating a repository to Upsun that contains a number of open pull requests, don’t use the default integration options.
Instead, each service integration should be made with the following flag:
upsun integration:add --type=<service> ... --build-pull-requests=falseYou can then go through this guide and activate the environment when you’re ready to deploy.
Now you have a local Git repository, a Upsun project, and a way to push code to that project. Next you can configure your project to work with Upsun.