1. Home
  2. Docs
  3. Engineering
  4. WordPress
  5. WordOps

WordOps

We use WordOps to manage WordPress/WooCommerce installations.

Installation

  1. Create AWS Lightsail instance (1 GiB for one site, 2 GiB for two or more sites), using Ubuntu latest LTS version.
  2. Create static IP address, and assign to the Lightsail instance.
  3. Using AWS Lightsail Firewall, deny HTTP port 80 and allow HTTPS port 443.
  4. SSH to Ubuntu
  5. Enable Byobu: byobu-enable
  6. Install WordOps: wget -qO wo wops.cc && sudo bash wo

Preparing WordOps Configuration

WordOps configuration, include application level debugging, is available at /etc/wo/wo.conf.

The most important one is remote MySQL/MariaDB database configuration, as we are using AWS RDS MariaDB.

Install MySQL client: sudo wo stack install --mysqlclient

Edit MySQL client configuration at /etc/mysql/conf.d/my.cnf: (change the host and password)

[client]
host = ***.ap-southeast-1.rds.amazonaws.com
user = root
password = your-very-strong-password

Edit the [mysql] section, set grant-host to %:

[mysql]

### MySQL database grant host name
grant-host = %

### Ask for MySQL db name while site creation
db-name = False

### Ask for MySQL user name while site creation
db-user = False

Edit the section and set version to latest stable PHP as follows:



### Default PHP version
version = 7.4

Creating A WordPress Site

Before you start, make sure you configure DNS verification, e.g. CloudFlare.

export CF_Key="..."
export CF_Email="your@email.com"

Since we’re using AWS RDS MariaDB, apply the GRANT patch first.

sudo nano /usr/local/lib/python3.6/dist-packages/wo/cli/plugins/site_functions.py

replace “grant all privileges on” line with:

                    "grant select, insert, update, delete, create, drop, references, index, alter, create temporary tables, lock tables, execute, create view, show view, create routine, alter routine, event, trigger on `{0}`.* to `{1}`@`{2}`"

Create the WordOps Dashboard site first:

sudo -E wo stack install --dashboard --netdata
sudo -E wo site create server-cname.domain.tld -le --dns=dns_cf

Then create a WordPress site:

sudo -E wo site create subdomain.lovia.life --wpfc --php74 --letsencrypt=on --dns=dns_cf --user sysadmin --email your@email.com

Moving A WordOps Site to Another Server

  1. Backup using UpdraftPlus to AWS S3
  2. Install WordOps (as above)
  3. Prepare WordOps configuration (as above)
  4. Create the WordPress site with DNS verification and AWS RDS MariaDB GRANT patch (as above)
  5. Change the DNS record or CloudFront to point to new server

Option 1: rsync way (old database)

  1. Generate ssh-keygen on new server
  2. Add key to old server’s authorized_keys
  3. In new server, in /var/www/example.com, sudo rsync -Pza from old server
  4. Remove key from old server’s authorized_keys
  5. Remove all WordPress files from old server: sudo wo site delete --files subdomain.example.com
  6. In MariaDB, drop the “new” (unused) WordPress database and user

Option 2: UpdraftPlus way (new database)

  1. Copy parts of the wp-config.php file (SES config, etc.)
  2. Sign in to new WordPress
  3. Install UpdraftPlus
  4. Link AWS S3
  5. Restore from AWS S3 backup
  6. Delete old site

Operations

Update WordOps

sudo -E wo update

Perform Maintenance

sudo -E wo maintenance

Upgrade Stack

This is needed to upgrade files like /etc/nginx/common/wpcommon-php74.conf and others.

sudo -E wo stack upgrade

Was this article helpful to you? Yes No

How can we help?

Leave a Reply

Your email address will not be published. Required fields are marked *