Skip to content

Deployment

  • PHP 8.2 or higher
  • Mysql or MariaDB
  • Composer 2
  • Node 20
  1. In RunCloud, create a Web Application for your site. Set the web root to web.

  2. Under the web app, go to Git and connect your repository. Set the branch to deploy (e.g. main).

  3. Create an auth.json in the app root:

    auth.json
    {
    "http-basic": {
    "connect.advancedcustomfields.com": {
    "username": "b3JkZXJfaWQ9Njc3OTl8dHlwZT1kZXZlbG9wZXJ8ZGF0ZT0yMDE1LTEwLTMxIDEzOjE3OjA4",
    "password": "https://localhost"
    }
    }
    }

    There is no need to change the values

  4. Copy .env.prod.example to .env and fill in variables.

  5. Add the .htaccess file to the web folder:

    web/.htaccess
    <IfModule mod_rewrite.c>
    # BEGIN WordPress
    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    # END WordPress
    </IfModule>
  6. Under Deployment Script in RunCloud, replace the default script with:

    Terminal window
    git checkout origin/{branch} --force
    composer install --no-dev --prefer-dist --no-interaction --optimize-autoloader
    npm ci
    npm run build
    wp timber clear-cache
    # wp w3tc flush all # optional: only if W3 Total Cache is installed
  7. Enable Auto Deployment (webhook) in RunCloud’s Git tab. Add the generated webhook URL to your repository’s webhook settings (GitHub/GitLab → Settings → Webhooks).

  8. Push to your deploy branch to trigger a deployment, or click Deploy manually in RunCloud.

  9. Import your database file.

  1. Clone your site onto the server.

  2. Create a file called auth.json and paste the following content, this file is used for installing Advanced Custom Fields:

    auth.json
    {
    "http-basic": {
    "connect.advancedcustomfields.com": {
    "username": "b3JkZXJfaWQ9Njc3OTl8dHlwZT1kZXZlbG9wZXJ8ZGF0ZT0yMDE1LTEwLTMxIDEzOjE3OjA4",
    "password": "https://localhost"
    }
    }
    }

    There is no need to change the values

  3. Run composer install in the root.

  4. Copy .env.example to .env and fill in the missing variables.

  5. Add the .htaccess file to the web folder:

    web/.htaccess
    <IfModule mod_rewrite.c>
    # BEGIN WordPress
    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    # END WordPress
    </IfModule>
  6. Run npm install in the project root.

  7. Run npm run build in the project root.

  8. Import your database file.

Once the site is deployed, set up wp-manage to sync content between remote and local environments.