spinupwp / spinupwp-cli
SpinupWP CLI
v1.1.0
2023-04-27 16:00 UTC
Requires
- php: ^8.0
- spinupwp/spinupwp-php-sdk: ^1.0.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.2
- laravel-zero/framework: <=9.2.0
- mockery/mockery: ^1.4.3
- pestphp/pest: ^1.3
- phpstan/phpstan: ^1.8
README
安装
要开始使用,请通过Composer全局安装包。
composer global require spinupwp/spinupwp-cli
此外,您应确保全局Composer家目录下的/vendor/bin
目录已添加到系统“PATH”中。根据您的操作系统,这可能为~/.composer/
或~/.config/composer/
。您可以使用composer config --global home
命令来检查此位置。
使用方法
安装SpinupWP CLI提供对spinupwp
命令的访问。
spinupwp <command>
您需要生成一个API令牌以与SpinupWP CLI交互。在生成API令牌后,您应配置您的默认配置文件
spinupwp configure
您可以配置多个配置文件,如果您是多个团队的成员,这非常有用
spinupwp configure --profile=hellfishmedia
要使用特定配置文件运行命令,请传递配置文件选项
spinupwp servers:list --profile=hellfishmedia
如果没有提供配置文件,将使用默认配置文件(如果已配置)。
服务器
# Delete a server
spinupwp servers:delete <server_id>
# 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>
您可以将服务器模式的任何属性传递给--fields
标志。嵌套属性应使用点表示法,例如,database.server
。
服务
# 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
站点
# 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>
您可以将站点模式的任何属性传递给--fields
标志。嵌套属性应使用点表示法,例如,backups.next_run_time
或git.branch
。
# Create a site using field flags instead of interactive prompts
spinupwp sites:create <server_id> --installation-method="<installation_method>" \
--domain="<domain>" --https-enabled --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
任何可用的标志的完整参考随时可用。
# Display available Arguments and Options for site:create
spinupwp sites:create --help
升级
要更新SpinupWP CLI到最新版本,运行
composer global update