Skip to content

About

The official command-line tool for SpinupWP.

Topics

Resources

Contributing

Stars

12 stars

Watchers

6 watching

Forks

Repository files navigation

SpinupWP CLI

Tests Total Downloads Latest Stable Version License

Installation

To get started, require the package globally via Composer:

composer global require spinupwp/spinupwp-cli

In addition, you should make sure the /vendor/bin directory in your global Composer home directory is in your system's "PATH". Depending on your operating system this could be either ~/.composer/ or ~/.config/composer/. You can use the composer config --global home command to check this location.

Usage

Installing the SpinupWP CLI provides access to the spinupwp command.

spinupwp <command>

You will need to generate an API token to interact with the SpinupWP CLI. After you have generated an API token, you should configure your default profile:

spinupwp configure

You can configure multiple profiles, which is useful if you're a member of multiple teams:

spinupwp configure --profile=hellfishmedia

To run a command using a specific profile, pass the profile option:

spinupwp servers:list --profile=hellfishmedia

If no profile is supplied, your default profile will be used (if configured).

Servers

# Delete a server
spinupwp servers:delete <server_id>

# Provision a server on DigitalOcean, Hetzner, Linode or Vultr
spinupwp servers:create

# Provision a server without prompts, using a provider account saved in SpinupWP
spinupwp servers:create --provider=digitalocean --provider-id=<provider_id> --region=nyc3 \
  --size=s-2vcpu-4gb --hostname=<hostname> --force

# Provision a custom server
spinupwp servers:create-custom

# Get a server
spinupwp servers:get <server_id> --fields=id,name,ip_address,ubuntu_version,database.server

# List all servers
spinupwp servers:list --fields=id,name,ip_address,ubuntu_version,database.server

# Reboot a server
spinupwp servers:reboot <server_id>

# Reboot all servers
spinupwp servers:reboot --all

# Start an SSH session
spinupwp servers:ssh <server_id> <user>

You can pass any properties of the Server Schema to the --fields flag. Nested properties should use dot notation, for example, database.server.

Services

# Restart MySQL on a server
spinupwp services:mysql <server_id>

# Restart MySQL on all servers
spinupwp services:mysql --all

# Restart Nginx on a server
spinupwp services:nginx <server_id>

# Restart Nginx on all servers
spinupwp services:nginx --all

# Restart PHP on a server
spinupwp services:php <server_id>

# Restart PHP on all servers
spinupwp services:php --all

# Restart Redis on a server
spinupwp services:redis <server_id>

# Restart Redis on all servers
spinupwp services:redis --all

Sites

# Create a site
spinupwp sites:create <server_id>

# Delete a site
spinupwp sites:delete <site_id>

# Run a Git deployment
spinupwp sites:deploy <site_id>

# Get a site
spinupwp sites:get <site_id> --fields=id,server_id,domain,site_user,php_version,page_cache,https

# List all sites
spinupwp sites:list --fields=id,server_id,domain,site_user,php_version,page_cache,https

# Purge the page cache for a site
spinupwp sites:purge <site_id> --cache=page

# Purge the page cache for all sites
spinupwp sites:purge --all --cache=page

# Purge the object cache for a site
spinupwp sites:purge <site_id> --cache=object

# Purge the object cache for all sites
spinupwp sites:purge --all --cache=object

# Start an SSH session as the site user
spinupwp sites:ssh <site_id>

# Connect a Git repository
spinupwp sites:git:connect <site_id> --repo=<repo> --branch=<branch> --push-to-deploy

# Connect a Git repository using a unique deploy key for the site
spinupwp sites:git:connect <site_id> --repo=<repo> --branch=<branch> \
  --private-key=~/.ssh/deploy_key --public-key=~/.ssh/deploy_key.pub

# Update Git settings
spinupwp sites:git:update <site_id> --branch=production --push-to-deploy=false

# Disconnect Git
spinupwp sites:git:disconnect <site_id>

# Enable, update, or disable the page cache
spinupwp sites:page-cache:enable <site_id>
spinupwp sites:page-cache:update <site_id> --duration=1 --duration-unit=h --path-exclusion=/cart/ --path-exclusion=/checkout/
spinupwp sites:page-cache:update <site_id> --cookie-exclusion=none --ignored-query-param=none
spinupwp sites:page-cache:disable <site_id>

# Update Nginx settings
spinupwp sites:nginx <site_id> --uploads-directory-protected=true --xmlrpc-protected=true

# Enable, update, or disable the server-level WP cron
spinupwp sites:cron:enable <site_id> --interval=5
spinupwp sites:cron:update <site_id> --interval=15
spinupwp sites:cron:disable <site_id>

# Enable, update, or disable basic auth
spinupwp sites:basic-auth:enable <site_id> --username=<username> --password=<password>
spinupwp sites:basic-auth:update <site_id> --username=<username>
spinupwp sites:basic-auth:disable <site_id>

# Manage path redirects
spinupwp sites:redirects:list <site_id>
spinupwp sites:redirects:add <site_id> --from=/old-path --to=/new-path --type=permanent
spinupwp sites:redirects:delete <site_id> --from=/old-path --to=/new-path

# Update backup settings
spinupwp sites:backups:settings <site_id> --storage-provider-id=1 --bucket=<bucket> --region=nyc3 --exclude-path=node_modules

# Update the backup schedule (daily at 2am and 2pm, monthly on the first Monday at 4am)
spinupwp sites:backups:schedule <site_id> --daily-times=2,14 --daily-database=true --daily-files=true \
  --daily-retention=30 --monthly-days=first:1 --monthly-time=4

# Disable weekly backups
spinupwp sites:backups:schedule <site_id> --weekly-days=none

# Update the site user's SSH authentication
spinupwp sites:site-user <site_id> --authentication=publickey --ssh-key-id=1 --ssh-key-id=2

# Correct the file permissions for a site
spinupwp sites:correct-permissions <site_id>

# Disable a site so it stops serving traffic, or enable it again
spinupwp sites:disable <site_id>
spinupwp sites:enable <site_id>

# Enable or disable the SpinupWP subdomain for a site
spinupwp sites:subdomain:enable <site_id>
spinupwp sites:subdomain:disable <site_id>

# Change the PHP version for a site
spinupwp sites:php <site_id> --php-version=8.4

# Enable HTTPS with a Let's Encrypt certificate, or with your own certificate
spinupwp sites:https:enable <site_id> --type=letsencrypt
spinupwp sites:https:enable <site_id> --type=custom --certificate=<certificate_file> --private-key=<private_key_file>

# Switch a site's HTTPS certificate, or replace its custom certificate
spinupwp sites:https:update <site_id> --type=custom --certificate=<certificate_file> --private-key=<private_key_file>

# Disable HTTPS for a site
spinupwp sites:https:disable <site_id>

# Manage additional domains for a site
spinupwp sites:domains:list <site_id>
spinupwp sites:domains:add <site_id> --domain=www.<domain> --redirect --redirect-type=301
spinupwp sites:domains:update <site_id> <domain> --redirect=false
spinupwp sites:domains:delete <site_id> <domain>

You can pass any properties of the Site Schema to the --fields flag. Nested properties should use dot notation, for example, backups.next_run_time or git.branch.

# Create a site using field flags instead of interactive prompts
spinupwp sites:create <server_id> --installation-method="<installation_method>" \
  --domain="<domain>" --site-user="<site_user>" --db-name="<database_name>" \
  --db-user="<database_user>" --db-pass="<database_password>" --wp-title="<wordpress_site_title>" \
  --wp-admin-email="<wordpress_admin_user_email>" --wp-admin-user="<wordpress_admin_user_username>" \
  --wp-admin-pass="<wordpress_admin_user_password>" --php-version="<php_version>" --page-cache-enabled

# Create a site from a Git repository
spinupwp sites:create <server_id> --installation-method=git --domain="<domain>" \
  --git-repo="git@github.com:<org>/<repo>.git" --git-branch=main --public-folder=/public \
  --deploy-script="composer install --no-dev" --push-to-deploy

The installation method can be wp, wp_subdirectory or wp_subdomain (WordPress Multisite), git or blank. HTTPS isn't set up when a site is created. Enable it with sites:https:enable once the site has deployed.

Update commands only change the settings you pass. Boolean flags accept true or false, and repeatable flags such as --path-exclusion can be passed multiple times.

A full reference of the available flags is available anytime.

# Display available Arguments and Options for site:create 
spinupwp sites:create --help

Events

# List your team's most recent events
spinupwp events:list --limit=20

# Get an event, for example to check on an event ID another command printed
spinupwp events:get <event_id>

Providers

# List the regions a server provider offers (digitalocean, hetzner, linode or vultr)
spinupwp providers:regions <provider>

# List the server sizes a provider offers, optionally only those in one region
spinupwp providers:sizes <provider> --region=<region>

SSH Keys

# Get SpinupWP's SSH key
spinupwp ssh-key:get

# List your team's SSH keys
spinupwp ssh-key:list

Storage Providers

# List your team's storage providers
spinupwp storage-providers:list

Upgrade

To update the SpinupWP CLI to the latest version, run:

composer global update

About

The official command-line tool for SpinupWP.

Topics

Resources

Contributing

Stars

12 stars

Watchers

6 watching

Forks

Releases

Packages

Used by

Contributors

Languages