Deploy WordPress with MySQL
Deploy a WordPress site with a MySQL database using Docker Compose on Vardo.
WordPress is a natural fit for Vardo — a docker-compose.yml with WordPress and MySQL, deployed from a GitHub repo. This tutorial gets you from zero to a running WordPress site with a custom domain and TLS.
Prerequisites
- A running Vardo instance (installation guide)
- GitHub connected to Vardo (setup instructions)
- A GitHub repo (can be a new, empty one — we'll add the compose file)
1. Create the compose file
Add a docker-compose.yml to your repo:
services:
wordpress:
image: wordpress:6-apache
restart: unless-stopped
ports:
- "80"
environment:
WORDPRESS_DB_HOST: mysql
WORDPRESS_DB_USER: ${MYSQL_USER}
WORDPRESS_DB_PASSWORD: ${MYSQL_PASSWORD}
WORDPRESS_DB_NAME: ${MYSQL_DATABASE}
volumes:
- wp-content:/var/www/html/wp-content
depends_on:
- mysql
mysql:
image: mysql:8.0
restart: unless-stopped
environment:
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
volumes:
- mysql-data:/var/lib/mysql
volumes:
wp-content:
mysql-data:Commit and push this to your repo.
2. Create a project and app
- Go to Projects → New Project
- Name it — e.g.,
my-wordpress-site - Click Create
- Inside the project, click New App
- Choose GitHub as the source
- Select your repo and branch
- Set deploy type to Compose
- Click Create App
3. Set environment variables
- Open the app detail page
- Click the Environment tab
- Add these variables:
MYSQL_DATABASE=wordpress MYSQL_USER=wp_user MYSQL_PASSWORD=a-strong-password-here MYSQL_ROOT_PASSWORD=an-even-stronger-password - Click Save
Use real passwords. These are encrypted at rest and injected at runtime.
4. Deploy
- Click Deploy
- Watch the build log — Vardo pulls the images, creates the volumes and starts both containers
- When the status shows Running, WordPress is live
The first time you visit the site, you'll see the WordPress installation wizard. Pick your language, set an admin user and you're in.
5. Add a custom domain
- Go to the app's Domains tab
- Click Add Domain
- Enter your domain — e.g.,
blog.mycompany.com - Add a DNS record:
CNAME blog.mycompany.com → vardo.example.com - Click Verify — Vardo checks DNS and provisions TLS automatically
After the domain is verified, update your WordPress Site URL and Home settings under Settings → General in the WordPress admin to match your new domain.
6. Set up backups
WordPress data lives in two places — the MySQL database and the wp-content volume (uploads, themes, plugins). Set up backups for both:
- Go to Backups → New Job
- Select your WordPress app
- Vardo backs up both volumes and databases automatically — set a schedule like
0 3 * * *(3am daily) - Configure a retention policy
- Click Save
See the full backup tutorial for storage target setup and restore testing.
Customizing the stack
Adding a theme or plugin via the repo:
Mount your custom theme or plugin into the container by adding to the wordpress service:
volumes:
- wp-content:/var/www/html/wp-content
- ./themes/my-theme:/var/www/html/wp-content/themes/my-theme
- ./plugins/my-plugin:/var/www/html/wp-content/plugins/my-pluginAdding Redis for object caching:
services:
redis:
image: redis:7-alpine
restart: unless-stopped
wordpress:
environment:
# ... existing vars
WORDPRESS_CONFIG_EXTRA: |
define('WP_REDIS_HOST', 'redis');Install the Redis Object Cache plugin and activate it.
Troubleshooting
"Error establishing a database connection"
MySQL might not be ready yet. Check the MySQL container's logs — it takes a few seconds on first boot to initialize. If the error persists, verify your MYSQL_* environment variables match between both services.
File upload errors / permission denied
The wp-content volume needs to be writable by the www-data user (UID 33). If you're mounting host directories instead of named volumes, check permissions.
Can't install plugins or themes from the admin
This is expected with the default WordPress image. Plugins installed via the admin are stored in the wp-content volume and persist across deploys. If you want version-controlled plugins, mount them from your repo instead.
Next steps
- Set up automatic backups — don't skip this for WordPress
- Add a custom domain with automatic TLS
- Monitor site health under Metrics in the sidebar