Skip to content

PHP tool for managing WordPress sites on CloudPlatform k8s clusters

License

Notifications You must be signed in to change notification settings

ministryofjustice/worm

Repository files navigation

Wordpress Online Resource Manager (WORM)

WORM cli interface

Apply linting and code sniffer

WORM is a command line tool that helps manage databases and media assets generated by WordPress between different environments on CloudPlatform.

It is based off the Laravel-Zero framework.

Environments

WORM targets the following environments, Local, Demo, Dev, Staging & Prod.

Features

  • Download database or media assets from any environment.
  • Upload database or media assets from any environment.
  • Check WordPress sites installed on multisite and their blog ids.
  • Display secrets worm status --secrets
  • Display list of sites on multisite cluster worm listSites
  • Setup AWS Profiles for s3, rds and ecr list for current namespace worm setup:createProfiles
  • Migrate - worm migrate <source> <target> will move the database and s3 assets from one environment to another. Todo: currently only works with staging, dev, demo migrating to local.

Required

Installation

Step 1: Download the WORM repository to your local machine, either via SSH - git clone git@github.com:ministryofjustice/worm.git or GH - gh repo clone ministryofjustice/worm.

Step 2: cd into this repository's root directory on your local machine and run the following commands.

Step 3: Run composer install. This will install WORM and create the required vendor folder.

Step 4: Run make install. This will install WORM globally on your machine. It will compile the WORM app into a binary and system link it so that it is available in any directory you want to run worm. You will be prompted to enter your Mac OS password so the system links can be established. You will also need to have AWS, kubectl, cloud-platform and php installed on your command line.

If successfull, you should be able to run worm in your terminal window and see it load the worm command options.

Step 5: Run worm create:profiles. This creates a standard and unique set of aws profiles in your computer's root directory in the .aws folder. Make sure to run this in each kubernetes namespace. To change namespace you need to be authenticated to the CloudPlatform already and have the program kubens installed. Then you can run kubens <namespace> to swap around to your desired namespace.

Quick guide

Make sure you are in the hale-platform repo root on your local machine and you are in the correct namespace ie kubens hale-platform-dev.

Database download

worm db:export [environment] or a specific site db worm db:export --blogID[=BLOGID]

Database upload

worm db:import <target env> <path of sql> or upload to specific site add --blogID[=BLOGID]

Download s3 media locally

worm s3:download <s3 bucket> <aws profile name>

Upload s3 media to cloud environment

worm s3:upload <bucket> <profile>

Migrate command examples:

Migrate entire multisite from staging to demo: worm migrate staging demo

Migrate single site from staging to demo worm migrate staging demo --blogID=2 (Every site has its own blogID)

Move an entire ms migration from staging to local worm migrate staging local

Move a single site from staging to demo but change the domain to its production URL. This would move CCRC to demo with the domain ccrc.gov.uk: worm migrate staging demo --blogID=5 --keepProdDomain=true

To change it back you would run: worm migrate staging demo --blogID=5 --keepProdDomain=false

License

Open-source software licensed under the MIT license.

About

PHP tool for managing WordPress sites on CloudPlatform k8s clusters

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •  

Languages