<your-mysql-app-name>.internal), the database name and the database credentials.
Ready? Let’s get started!
Launch a new WordPress application
To launch a new WordPress application, we can use the official WordPress docker image. To do so, run the following command:n if you’re happy with the defaults listed, otherwise type y to open the Fly Launch web page and edit your settings, including:
- Name: Keep the default app name or enter your own. This name will be part of the URL for your app, unless you use a custom domain.
-
Region: Keep the fastest region (the value of
primary_regionin thefly.tomlfile) as chosen by Fly Launch, or select a different region to deploy to.
fly.toml file for your project with the settings.
The reason we added the --no-deploy flag is so that the App doesn’t get deployed right away. This way, we can set up things like secrets and environment variables before the first deployment.
Configure & deploy the WordPress application
Before deploying, we’ll need to configure a couple of things. In your newly created fly.toml file, change theinternal_port under [http_service] from 8080 to 80. This setting lets Fly know on what port your App will respond, which is 80 in our case.
After that, set up these environment variables by adding this to the end of your fly.toml:
WORDPRESS_DB_NAME and WORDPRESS_DB_HOST are needed for the WordPress application to connect to the database. The WORDPRESS_CONFIG_EXTRA makes sure that the application serves everything from the https://... address.
Here’s how the total fly.toml should look now:
WORDPRESS_DB_USER and WORDPRESS_DB_PASSWORD variables. Since these are sensitive, let’s use the fly secrets command:
fly secrets list. For example:
Deploy your app
The last step is to deploy the App with the deploy command:Set up a custom domain
You probably want to set up a custom domain for your WordPress application. You can find all you need to know (and more!) in this handy guide.Open your app
Runfly apps open, or just go to the URL specified in the output of the deploy command, to open your deployed App in a browser.
If you have any questions, need help, or want to talk about what you’re building, visit our community forum.