Deploy WordPress on Upsun Fixed
Back to home
On this page
WordPress is a popular Content Management System written in PHP. The recommended way to deploy WordPress on Upsun Fixed is by using Composer, the PHP package management suite. The most popular and supported way to do so is with the John Bloch Composer fork script. This guide assumes from the beginning that you’re migrating a Composer-flavored WordPress repository.
Note
With some caveats, it’s possible to deploy WordPress to Upsun Fixed without using Composer, though not recommended. You can consult the “WordPress without Composer on Upsun Fixed” guide to set that up, but do consider upgrading to use Composer.
To get WordPress running on Upsun Fixed, you have two potential starting places:
-
You already have a Composer-flavored WordPress site you are trying to deploy. Go through this guide to make the recommended changes to your repository to prepare it for Upsun Fixed.
-
You have no code at this point.
If you have no code, you have two choices:
-
Generate a basic Composer-flavored WordPress site. See an example for doing this under initializing a project.
-
Use a ready-made WordPress template.
-
A template is a starting point for building your project. It should help you get a project ready for production.
Note
All of the examples in this deployment guide use the wordpress-composer
template maintained by the Upsun Fixed team. That template is built using the John Bloch Composer fork of WordPress, which is meant to facilitate managing WordPress with Composer, but the template comes with its own assumptions. One is that WordPress core is downloaded by default into a wordpress
subdirectory when installed, but other teams would rather specify another subdirectory along with many more assumptions.
An alternative approach is shown in Upsun Fixed’s Bedrock template, which installs core into web/wp
, exports environment customization to a separate config/environments
directory, and largely depends on setting environment variables to configure the database. Your are free to follow that template as an example with this guide, though there are slight differences. For its ease of use, the Bedrock approach is often used as a substitute starting point in some of the other WordPress guides in this documentation.
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 Fixed 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 Fixed account later.
- The Upsun Fixed CLI. This lets you interact with your project from the command line. You can also do most things through the Web Console.
Initialize a project
You can start with a basic code base or push a pre-existing project to Upsun Fixed.
-
Create your first project by running the following command:
platform create --title PROJECT_TITLE
Then choose the region you want to deploy to, such as the one closest to your site visitors. You can also select more resources for your project through additional flags, but a Development plan should be enough for you to get started.
Copy the ID of the project you've created.
-
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
.If you don’t have code, create a new WordPress project from scratch. The following command creates a brand new WordPress project.
git clone https://github.com/johnpbloch/wordpress && cd wordpress
-
Connect your Upsun Fixed project with Git. You can use Upsun Fixed as your Git repository or connect to a third-party provider: GitHub, GitLab, or BitBucket.
Add a Git remote for the Upsun Fixed project you just created by running the following command from your repository:
platform project:set-remote PROJECT_ID
That creates an upstream called
platform
for your Git repository.When you choose to use a third-party Git hosting service the Upsun Fixed 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 Fixed. 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 Fixed that contains a number of open pull requests, don’t use the default integration options. Projects are limited to three* preview environments (active and deployed branches or pull requests) and you would need to deactivate them individually to test this guide’s migration changes. Instead, each service integration should be made with the following flag:
platform integration:add --type=<service> ... --build-pull-requests=false
You can then go through this guide and activate the environment when you’re ready to deploy
* You can purchase additional preview environments at any time in the Console. Open your project and select Edit plan. Add additional Environments, view a cost estimate, and confirm your changes.
Now you have a local Git repository, a Upsun Fixed project, and a way to push code to that project. Next you can configure your project to work with Upsun Fixed.