GithubHelp home page GithubHelp logo

isabella232 / wp-cli-ssh Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xwp/wp-cli-ssh

0.0 0.0 0.0 130 KB

[OBSOLETE] Seamlessly run WP-CLI commands on a remote server via SSH

PHP 100.00%

wp-cli-ssh's Introduction

DEPRECATED: This feature is now part of WP-CLI itself as of v0.24.0. See wp-cli#2754.

WP-CLI SSH

Seamlessly run WP-CLI commands on a remote server via SSH

Running wp plugin status on production

WP-CLI is an extremely useful tool for managing WordPress installs, but it requires you to invoke it on the same server where WordPress is installed. This means you have to SSH into the server, navigate to the install, and then run the command. It would be much more convenient if you could remain on your local shell and invoke WP-CLI remotely; this is especially the case when using Vagrant.

The WP-CLI SSH script is also TTY-aware, so if you try piping the results of a WP-CLI SSH command to another program, it will return the machine-formatted output (e.g. no colors or table cells).

Configuration

Assuming you have a clone of your WordPress install on your machine, add an ssh section to your wp-cli.yml config file. In this section you define the remote servers which host the other environments for your site, e.g. vagrant, staging, and production. Then you just invoke WP-CLI normally, but supply an additional --host argument with host you want to connect to:

wp ssh plugin status --host=production

You can also provide Bash aliases to supply this argument by default:

alias wp="wp ssh --host=vagrant"
alias wpprod="wp ssh --host=production"

Add an ssh section to your wp-cli.yml/wp-cli.local.yml, as seen in the sample config. You indicate the ssh command templates for each host you want to connect to. The template variable %cmd% is replaced with the full command to run on the server; the %pseudotty% template variable is replaced with -t/-T depending on whether you're on a TTY or piping the command output.

For a step-by-step guide, please refer to the wiki.

Installation

Note that you do not necessarily need WP-CLI installed on your server to use this. If the wp command is not recognized on the server, the script will download the wp-cli.phar file and use that at runtime.

Installing WP-CLI-SSH on your machine can be done either by installation as a Composer package, or by adding a require config to a wp-cli.local.yml.

For global composer installation:

composer global require x-team/wp-cli-ssh dev-master

Alternatives

wp-cli-ssh's People

Contributors

gmagicscott avatar jonathanbardo avatar scribu avatar timweprovide avatar westonruter avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.