Name: godo
Owner: Namshi
Description: Remote and local execution level 9000: go and do stuff.
Created: 2015-04-17 10:55:48.0
Updated: 2018-05-02 08:49:44.0
Pushed: 2015-07-09 05:47:46.0
Size: 2586
Language: Go
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Local and remote execution level 9000: go and do stuff.
godo
is a very simple yet powerful tool that
let's you specify a list of repetitive / useful
commands you run on remote hosts or even locally,
and run them with ease, without having to remember
them or, even worse, login on each server and
execute them manually.
Grab the latest release and simply run the executable:
ojects/namshi/godo (master ?)? ? ./godo
:
odo - Stop SSHing into your server and run the same old commands. Automate. Automate. Automate.
E:
odo [global options] command [command options] [arguments...]
ION:
.Y.Z
OR(S):
ANDS:
elp, h Shows a list of commands or help for one command
ptime Retrieves uptime info for all machines
low-queries mysql-log -n 10
ginx-logs sudo tail -10f /var/log/nginx/access.log
AL OPTIONS:
-help, -h show help
-version, -v print the version
ojects/namshi/godo (master ?)? ? ./godo uptime
uting 'uptime'
and: 'uptime'
uting on servers web, db
Create a godo.yml
file and put it in your home directory:
ers:
b:
address: "xxx.xxx.xx.xxx:22"
user: "me"
:
address: "xxx.xxx.xx.xxx:22"
tunnel: "tunnel.yourcompany.com:22"
user: "me"
ps:
l: [web, db]
ands:
time:
target: all
exec: "uptime"
description: "Retrieves uptime info for all machines"
ow-queries:
target: db
exec: "mysql-log -n 10"
inx-logs:
target: web
exec: "sudo tail -10f /var/log/nginx/access.log"
-uptime:
target: local
exec: "uptime"
description: "Retrieves uptime info for the current machine"
file: "/home/YOU/.ssh/known_hosts"
out: 2
There are a few sections to keep in mind:
servers
: this is a dictionary of servers on which you can run commands ongroups
: a list of grouped servers (ie. you might want to group by role, AWS zone, etc)commands
: the commands are the actual remote commands you would be executing on the servers,
they have a target (which can be a server or a group), the command that you would execute (exec
)
and an optional description (which is printed when you do godo help
or godo
)hostfile
: you can omit it, it's used not to always ask you to trust SSH hostGodo will try to read the godo.yml
configuration file
from 3 different directories:
but you can also specify the path to a different
configuration file with the -c
or --config
flags:
-c ./../my-config.yml mysql-log
Sometimes, though, you might want to run a command that you usually execute on some servers on a different server, and you can do it by simply specifying it from the command line:
uptime @ db
uptime@db
Godo provides some special groups:
all
, represents all servers, so you can
always run something like godo uptime @ all
local
, which references the current machine,
so you will be running the command locally (godo uptime @ local
)You can run the docs through godoc -http=:6060 -path=.
.
Currently all servers need to be in your known_hosts
file (ie. you
have to have SSHed into them at least once before using them with godo).
Alternatively, you can run and compile godo on
your own machine with a simple go build -o godo main.go
.
At the same time, we provide a simple docker container to run and compile it so that you don't have to go to crazy if you don't have Go running on your system:
clone https://github.com/namshi/godo.git
odo
er-compose run godo gox --output=build/{{.OS}}_{{.Arch}}/{{.Dir}}
do
The above command will compile the godo
executables
(for various platforms) in the build
folder.
We use a simple makefile to create new releases and
yoou can probably do the same: just run make
in the
root of the repo and check the build
folder. This
requires that docker
and docker-compose
are installed
on your system.