A command line interface is one of SpinupWP’s most frequently requested features. The wait is finally over!

Visit the SpinupWP CLI project on GitHub for complete installation and usage instructions. The first step is to require the package globally via Composer:

composer global require spinupwp/spinupwp-cli

Make sure the /vendor/bin directory in your global Composer home directory is in your system’s PATH. This could be ~/.composer/ or ~/.config/composer/, depending on your operating system. You can use the composer config --global home command to check this location.

Once you’ve finished installation, you’ll have access to the spinupwp command:

spinupwp <subcommand>

You will need to generate an API token to interact with the SpinupWP CLI. You can create a personal API access token in the “API” tab under “Account Settings” in SpinupWP. Team admins can also generate access tokens from the “API” tab on the “Team Settings” page of any team they manage. API tokens can only be used on resources associated with the team or personal account used to generate them. Generating an API token for team use on SpinupWP. After generating an API token, use the command below to configure your default profile. We strongly recommend configuring a default profile. Otherwise, you’ll need to specify a profile with every command, adding more keystrokes and slowing you down.

spinupwp configure

The same command can be used to configure multiple profiles by adding the --profile switch. This can be very useful if you’re a member of multiple teams.

abraham@macbookpro:~$ spinupwp configure --profile=hellfishmedia

SpinupWP API token:

Default output format (json/table) [table]:
> table

Profile configured successfully.
To use this profile, add the --profile option to your command:
`spinupwp servers:list --profile=hellfishmedia`

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

$ spinupwp servers:list --profile=hellfishmedia

| ID  | Name                        | IP Address          | Ubuntu | Database Server |
| 246 | staging.hellfish.media      |      | 20.04  | mysql-8.0       |
| 245 | hellfish.media              |        | 20.04  | mysql-8.0       |

The CLI tool is great for viewing details about your server and site resources. It also puts some powerful tools to your fingertips. With it, you can easily perform many common tasks, such as rebooting MySQL on any server with a single command:

abraham@macbookpro:~$ spinupwp services:mysql 245

Are you sure you want to restart MySQL on "hellfish.media"? (yes/no) [yes]:
> yes

==> Server queued for MySQL restart.
Event ID    Server
3184        hellfish.media

The same command allows you to reboot Nginx or PHP by replacing mysql with nginx or php. You can even apply the reboot to all of your servers at the same time by replacing the <server_id> with --all.

abraham@macbookpro:~$ spinupwp services:mysql --all

Are you sure you want to restart MySQL on all servers? (yes/no) [yes]:

> yes

==> Servers queued for MySQL restart.
Event ID    Server
3185        staging.hellfish.media 
3186        hellfish.media

You can also use the CLI to SSH into any of your servers:

abraham@macbookpro:~$ spinupwp servers:ssh

Which server would you like to start an SSH session for:
[246] staging.hellfish.media 
[245] hellfish.media

> 246

Which user would you like to connect as:

> abraham

Establishing a secure connection to [staging.hellfish.media] as [abraham]...
Last login: Thu Mar 31 14:31:46 2022 from
To run a command as administrator (user "root"), use "sudo ".
See "man sudo_root" for details.

The SpinupWP CLI also simplifies the process of adding sites to an existing server with interactive prompts to gather all the same details you’d normally provide:

abraham@macbookpro:~$ spinupwp sites:create 246

 Are you sure you want to deploy to "staging.hellfish.media "? (yes/no) [yes]:
 > yes

 What files would you like SpinupWP to install? [WordPress]:
  [wp   ] WordPress
  [blank] Don't Install Any Files
 > wp

 Primary Domain:
 > staging.hellfish.media

 Enable HTTPS (yes/no) [yes]:
 > no

 Site User [staginghellfishmedia]:
 > staging

 Database Name [staginghellfishmedia]:
 > staging

 Database Username [staginghellfishmedia]:
 > staging

 Database Password [XXXXXXXXXXXX]:

 WordPress Title:
 > Hellfish Media

 WordPress Admin Email:
 > abraham@hellfish.media

 WordPress Admin Username:
 > abraham

 WordPress Admin Password [XXXXXXXXXXXX]:

 PHP Version [8.0]:
  [0] 8.0
  [1] 7.4
 > 0

 Enable Page Cache (yes/no) [yes]:
 > yes

==> Site queued for creation.
    Event ID    Site                      Database Password    WordPress Admin Password
    3190        staging.hellfish.media    XXXXXXXXXXXX         XXXXXXXXXXXX
spinupwp sites:create 

The same site creation can be achieved using arguments instead of interactive prompts:

abraham@macbookpro:~$ spinupwp sites:create 246  --installation-method=”wp” --domain="staging.hellfish.media" --https-enabled --site-user="staging" --db-name="staging" --db-user="staging" --db-pass="XXXXXXXXXXXX" --wp-title="Hellfish Media" --wp-admin-email="abraham@hellfish.media" --wp-admin-user="abraham" --wp-admin-pass="XXXXXXXXXXXX" --php-version="8.0" --page-cache-enabled –force

Deleting sites is just as easy:

abraham@macbookpro:~$ spinupwp sites:delete 1204
*     You're about to delete "staging.hellfish.media"     *

 Do you wish to continue? (yes/no) [no]:
 > yes

==> Site queued for deletion.
    Event ID    Domain
    3191        staging.hellfish.media

Currently, the SpinupWP CLI also has commands for purging page and object caches, running Git deployments, and more. For a full list of commands, please visit the documentation on GitHub.

We’ll continue to build on the SpinupWP CLI and add functionality. Let us know about features you’d like to see!