A tool for simple installation, configuration and monitoring of services on linux servers.
Disclaimer: This is an experimental project and is not meant to be used in production at all, there are known issues such as lack of ability to scale, so please, read, get inspired and move on 😁
The idea behind this experiment was to run scripts on servers, not by sending the script/binary to the server and executing it, but rather by simulating the server on the local (or as we call it, the host) and letting the script run in the simulated environment.
Well, the main reason was to avoid writing the configuration scripts in bash. Bash is not very suitable, in my opinion, for writing deterministic and predictable configuration scripts; I'm not saying Bash is bad, it's just hard to write an script that detects the distro, checks lots of stuff, checks files before writing them, does a good job at logging, etc.
Imagine using a language like Haskell for writing these configurations, you can import the functions you need and have a good time handling errors and edge cases, but Bash? not so well.
On the other hand, it's possible to build the binary of a Haskell script, send it to the server and execute it, but it requires handling of library dependencies, anyways, I'm not going that path, it's an experiment, right?
How does serverman simulate the server's environment and execute the script on the local machine?
Magic! 🔮 no but really, there are a few steps to getting this done:
-o sftp_server=sudo /usr/lib/openssh/sftp-serveror
/usr/lib/ssh/sftp-serverfor Debian and Archlinux respectively
ssh ADDR envworks, for example)
sshto the server (you could in practice batch the requests to avoid redundancy)
usingPortfunction which given a required port, returns a forwarded port that the script can use from there on to access that specific port.
Now this is probably not an exhaustive list, there are other factors that need simulation, but these worked for my experiment.
After setting up the environment, the service script is chrooted into the directory (which allows file system modifications to happen as they would normally do), environment variables are temporarily set for it, and it's commands are executed on the server, and that's it, the script is modifying the server while running on the local machine. ✌️
Clone and install serverman:
git clone https://github.com/mdibaiee/serverman cd serverman stack build && stack install
Serverman runs command and scripts on your local machine unless given a list of remote servers to work on. I will briefly touch on different commands and then tell you how to run them on remote servers.
serverman repository list
You can check out the repository here, there are a few services available already such as nginx and vsftpd.
serverman repository update
serverman install <SERVICE_NAME> serverman install vsftpd serverman install nginx
serverman service status <SERVICE_NAME> serverman service status vsftpd
serverman service start <SERVICE_NAME> serverman service start vsftpd serverman service stop <SERVICE_NAME> serverman service stop vsftpd
serverman service logs <SERVICE_NAME> serverman service logs vsftpd
serverman <SERVICE_NAME> serverman <SERVICE_NAME> -h serverman <SERVICE_NAME> --help
Now in order to run the commands remotely, you have to first create a file containing a list of remote servers to connect to, in the format of
username@ip:port, port defaults to SSH's default port if unspecified.
At first run, serverman asks for the user's password, and then creates an account for itself in the name of
serverman, giving it root access.
I advice you first test serverman on a virtual machine (QEMU or VirtualBox or anything).
Example file (
Then, append the option
--remote ~/remote_list to your commands, and they will be run on the server.
See the help entry for more:
PyBotNet framework, high level remote control
A list of awesome lightweight websites without all the bloat
Wait4X allows you to wait for a port or a service to enter the requested state.
🚀 @1995parham Linux / OSx configurations files
SharpWorker is a multi-platform execution environment and helper library for scheduled, API controlled tasks. (examples: Bots, Data Miners, Web Crawlers, API Services, etc)
A tool for converting dictionary files aka glossaries. Mainly to help use our offline glossaries in any Open Source dictionary we like on any modern operating system / device.
Service to keep secrets of applications