You need to install docker and optionally docker compose in order to use this tool.
git clone [email protected]:lazy-ants/remote-manager.git
cd remote-manager
make init
or in case of updating in the future:
make update
Open config.json with the editor of your choice and add server connections. It means "user@domain:port", however the port is optional.
With docker:
docker run -it --rm -v "$PWD":/usr/src/remote-manager -v ~/.ssh/id_rsa:/root/.ssh/id_rsa -v ~/.ssh/id_rsa.pub:/root/.ssh/id_rsa.pub -v ~/.ssh/id_rsa:/root/.ssh/known_hosts remote-manager ./run app:validate-config
With docker-compose:
docker-compose run remote-manager ./run app:validate-config
To test this setup run
With docker
docker run -it --rm -v "$PWD":/usr/src/remote-manager -v ~/.ssh/id_rsa:/root/.ssh/id_rsa -v ~/.ssh/id_rsa.pub:/root/.ssh/id_rsa.pub -v ~/.ssh/id_rsa:/root/.ssh/known_hosts remote-manager ./run app:uptime
with docker composer:
docker-compose run remote-manager ./run app:uptime
Get docket compose version
Prune old docker data
Show docker process status
Get server kernels
Run ls command on all servers
app:ls
default value, with -lha argumetns list the current directoryapp:ls './ -la'
list the current directoryapp:ls '../ -la'
list the up directoryapp:ls '/ -la'
list the root directory
Get server OS
Checks whether a reboot is required Use option "--reboot" or "-r" to immediately reboot if required
- note: [sudo required]
- Get system information
- note: [sudo required]
- Get UFW status
- note: [sudo required]
- Upgrade server packages
Get server uptime
Validate server instances config
You can add to each server instance in the config.json tags, e.g.
{
"instances": [
{
"name": "example.com",
"connection-string": "[email protected]",
"tags": "staging,client1"
},
{
"name": "example.org",
"connection-string": "[email protected]",
"tags": "live,client1"
},
{
"name": "example.net",
"connection-string": "[email protected]",
"tags": "staging,client3"
}
]
}
and call every command with tags of servers you need:
app:uptime -t client1
app:uptime -t client2,staging
If you want to login into the docker container:
reman-cli bash
Prepare servers you want to manage:
First of all, you need a possibility to provide the sudo password in a secure way as an environment variable to your server (for sure in case you need the possibility of running commands with sudo). Therefore, On each server you want to manage edit
sudo nano /etc/ssh/sshd_config
add at the end of the config:
AcceptEnv PASSWORD
reload the sshd server e.g.
sudo service sshd reload
After that you either need to provide the sudo password in the .env.local file in case the most of your servers use the same sudo password or you can add in the config.json file in each configuration sectiona using the key "sudo-ppassword".
In case you want to simplify using this tool you may want to add aliases.
In case you have OS specific options like "UseKeychain yes" on MacOS in your .ssh/config:
alias reman-cli='docker run -it --rm -v "$PWD":/usr/src/remote-manager -v ~/.ssh/id_rsa:/root/.ssh/id_rsa -v ~/.ssh/id_rsa.pub:/root/.ssh/id_rsa.pub -v ~/.ssh/id_rsa:/root/.ssh/known_hosts remote-manager'
alias reman-console='docker run -it --rm -v "$PWD":/usr/src/remote-manager -v ~/.ssh/id_rsa:/root/.ssh/id_rsa -v ~/.ssh/id_rsa.pub:/root/.ssh/id_rsa.pub -v ~/.ssh/id_rsa:/root/.ssh/known_hosts remote-manager ./run'
Otherwise you can simple map the whole .ssh directory:
alias reman-cli='docker run -it --rm -v "$PWD":/usr/src/remote-manager -v ~/.ssh:/root/.ssh remote-manager'
alias reman-console='docker run -it --rm -v "$PWD":/usr/src/remote-manager -v ~/.ssh:/root/.ssh remote-manager ./run'
Or if you prefer docker-compose:
alias reman-cli='docker-compose run remote-manager bash'
alias reman-console='docker-compose run remote-manager ./run'
Remote Manager is an open source project. If you find bugs or have proposal please create issue or Pull Request
Copyright 2021 Lazy Ants
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.