Vardo
Tutorials

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


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

  1. Go to ProjectsNew Project
  2. Name it — e.g., my-wordpress-site
  3. Click Create
  4. Inside the project, click New App
  5. Choose GitHub as the source
  6. Select your repo and branch
  7. Set deploy type to Compose
  8. Click Create App

3. Set environment variables

  1. Open the app detail page
  2. Click the Environment tab
  3. Add these variables:
    MYSQL_DATABASE=wordpress
    MYSQL_USER=wp_user
    MYSQL_PASSWORD=a-strong-password-here
    MYSQL_ROOT_PASSWORD=an-even-stronger-password
  4. Click Save

Use real passwords. These are encrypted at rest and injected at runtime.


4. Deploy

  1. Click Deploy
  2. Watch the build log — Vardo pulls the images, creates the volumes and starts both containers
  3. 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

  1. Go to the app's Domains tab
  2. Click Add Domain
  3. Enter your domain — e.g., blog.mycompany.com
  4. Add a DNS record:
    CNAME  blog.mycompany.com  →  vardo.example.com
  5. 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:

  1. Go to BackupsNew Job
  2. Select your WordPress app
  3. Vardo backs up both volumes and databases automatically — set a schedule like 0 3 * * * (3am daily)
  4. Configure a retention policy
  5. 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-plugin

Adding 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

On this page