Remote Command Runner
Go application for running shell and PostgreSQL commands via SSH on remote servers.
- No live demo
- Closed source, but free-to-use
Remote Command Runner is a a lightweight local DevOps tool for running shell or PostgreSQL commands on a number of remote servers simultaneously.
The tool is intended to run on an admin's local machine. It uses the local SSH config file to find out which connections are possible, then automatically starts a local web server, which can be viewed on a configurable localhost port, in order to provide a UI for server connection and issuing of commands, as shown above. Further usage details and download links are below.
- Pretty and responsive web frontend (designed by AdminLTE, based on Bootstrap and jQuery)
- Minimum configuration: reads the local SSH config file in order to provide the list of possible hosts
- Clearly highlights which servers are connected
- Runs a specified shell commands on all connected servers and returns the results in a clear way in the lower-right panel
- Runs a specified PostgreSQL command on all connected servers on a configurable database and returns the results in a clear way in the lower-right panel
Language and 3rd party libraries
The program is written in Go. It uses several external packages in addition to the standard library:
- You need to have a SSH config file on your computer (see here for more details). The location is configurable
- The SSH config file may have a single wildcard host (*), but may not have attributes shared by multiple named hosts
- The tool is most effectively used if the hosts in the config file are named consistently, with a group designation suffixed with a hyphen, e.g. server1-test, server1-live, server2-test, etc
- In order to run remote database commands, the database must be Postgres and the database name must be the same on all servers
Download and setup
- Download the zipped config and frontend files and unpack them into a directory
- Download the appropriate executable for your OS (Linux, Mac, Windows) and move it into the same directory
- Open config.toml in a text editor to make these changes:
- If your SSH config file is not under the standard location, "~/.ssh/config", change it using the setting "SSHConfigFile"
- If you have named the hosts using the method shown above, e.g. server1-test, server1-live, server2-test, then change the setting "ServerGroups" to match the suffixes (groups) you have defined
- Change the setting "RemoteDb" to the name of the Postgres database on which the commands should be run
- In the command prompt,
cd to the directory containing the executable and the unpacked config and frontend files
- Run the executable:
- Your SSH config file will be read and processed and the prompt will say
- In your browser, go to localhost:8000 to view the results
- If desired, select a server group to filter the list of servers
- Select one or more servers and press Connect. This will establish an SSH connection to those servers using the information from the SSH config file. A connected server will appear with a green background
- Either: enter a shell command and press Execute shell; or enter an SQL command and press Execute SQL. This will attempt to run the command on all connected servers
- You may continue to run commands via the open connections
- Select the connected servers and press Disconnect, or simply terminate the process with Ctrl-C
Failed to run command: Process exited with status x
- If a command fails to run, the full error message from the remote session is unfortunately not shown. In this case, check the spelling of the command / the validity of the SQL. If it still fails, manually SSH to the server on which it fails and run the command manually, to see what the problem is
Configuration of the tool is handled by the file config.toml, which was part of the zipped archive and can be edited with any text editor. This file is read upon each execution of the program. Each of the settings has a comment for explanation.