remotemon v2.1.8

Install
sudo npm i -g remotemon
sudo yarn global add remotemon # OR
sudo pnpm add -g remotemon # ORremotemon is a cli automation tool for building/copying/executing code on remote machines and monitoring the result.
Its main use-case is for developing / running scripts on remote machines like the raspberry pi ..
.. but can also be used for purposes that would normally be done using make / nodemon 😀.
remotemon reboot # reboot remote machine 😏
remotemon ssh45 # to change default ssh port to 45 👮🏼♂️# Example Config File
reboot:
remote:
- sudo reboot
shutdown:
remote:
- shutdown -h now
ssh45:
local:
- scp sshd_config ${remotehost}:/tmp/sshd_config
remote:
- sudo mv /tmp/sshd_config /etc/ssh/sshd_config
- sudo systemctl restart ssh.service🟡 How to Use
A local configuration files (.remotemon.yaml) is used to organize different sub-commands to run in a project.
⛔️ In remotemon lingo a project is top level folder name in your service directory. ⛔️
First argument to remotemon is the name of the build routine to use, subsequent arguments can be used internally as variables using handlebar syntax (eg. ${0}), or .global variables using = ( eg. file=main.js ).
~/app:(dev*) remotemon shutdownRunning remotemon without any arguments makes remotemon execute default routine present in provided configuration file.
~/app:(dev*) remotemonremotemon has taken inspiration from runit in how to structure projects, just like in runit, you have to provide a service directory name ( can be any folder in your disk ), each folder within that directory is considered a project.
remotemon also stores it's configuration data in your home folder's .config folder ( ~/.config/config.remotemon.yaml ).
🟡 Creating Configuration YAML File
- Quick Example
remotehost: pi@192.152.65.12
remotefold: ~/test
local: make local
remote: make remote remotehost: pi@192.152.65.12
remotefold: ~/test
local: make local
remote: make remote remotehost: pi@192.152.65.12
remotefold: ~/test
local: make local
remote: make remote
rsync: # rsync options
- recursive
- exclude:
- .gitignore
- .ls
- .git remotehost: pi@192.152.65.12
remotefold: ~/test
local: make local
remote: make remote
rsync:
- recursive
- exclude:
- .gitignore
- .ls
- .git
test1: # custom routine
remotefold: ~/test1Creating custom named builds
Named builds can be created at top-level as long as the name does not clash with reserved keyword, they cannot also contain
/character in their name ( e.gmybui/ld1would be considered incorrect ):
mybuild1:
remotehost: pi@192.152.65.12
remotefold: ~/test
local: make pi1
remote: make mybuild1
mybuild2:
remotehost: pi@192.168.43.51
remotefold: ~/build
local: make pi2
remote: make mybuild2values not provided in a build are merged with default provided at top-level, in case defaults don't exist at top level then values are extracted from module's internal defaults.
rsync:
- recursive
- exclude:
- .gitignore
- .ls
- .git
mybuild1:
remotehost: pi@192.152.65.12
remotefold: ~/test
local: make pi1
remote: make mybuild1
mybuild2:
remotehost: pi@192.152.65.12
remotefold: ~/build
local: make pi2
remote: make mybuild2In the above config file for example, mybuild1 and mybuild2 get their rsync values from the common rsync field.
Since rsync's default src and des are not provided by user in our config file, they are derived from remotemon's internal defaults.
🟡 all configuration options
remotehost-{username}@{ipaddress}/ ssh name of remote client.remotefold- folder in remote client where we want to execute our script.watch- local file(s) or folders(s) to watch for changes.ignore- files to not watch.pre- local commands to run before setting up watch, *runs only once*.local- local commands to run after a change in file is detected.remote- command to execute in remote client.final- command to execute afterremotereturnsexit 0.ssh- customsshconfig optionsstartwith- command(s) to run for each ssh session.option- ssh options (default is-tt -o LogLevel=QUIET).
verbose- hardcode verbose level of printing for command.silent- hardcode commandline--silentoption ( use sparsely ).pwd- specify if the command is run in the directory of the project, or in the working directory, by default(false) it runs in project directory.description- provide a brief description of what the command does.defarg- default values for empty commandline arguments, for enforcing minimum commandline arguments, a number can be provided.initialize- boolean value to specify if a first run is performed or not when command is run, default istrue.rsync- rsync options ( currently supported ) :src- source folder(s) to sync.des- destination folder in remote client.recursive▪️verbose▪️quiet▪️no-motd▪️exclude:▪️checksum▪️archive▪️relative▪️no-OPTION▪️no-implied-dirs▪️backup▪️update▪️inplace▪️append▪️append-verify▪️dirs▪️links▪️copy-links▪️copy-unsafe-links▪️safe-links▪️copy-dirlinks▪️keep-dirlinks▪️hard-links▪️perms▪️executability▪️chmod:▪️acls▪️xattrs▪️owner▪️group▪️devices▪️specials▪️devices▪️specials▪️times▪️omit-dir-times▪️super▪️fake-super▪️sparse▪️dry-run▪️whole-file▪️one-file-system▪️existing▪️ignore-existing▪️remove-soucre-files▪️del▪️delete▪️delete-before▪️delete-during▪️delete-delay▪️delete-after▪️delete-excluded▪️ignore-errors▪️force▪️partial▪️delay-updates▪️prune-empty-dirs▪️numeric-ids▪️ignore-times▪️size-only▪️compress▪️cvs-exclude▪️F▪️from0▪️protect-args▪️blocking-io▪️stats▪️8-bit-output▪️human-readable▪️progress▪️P▪️itemize-changes▪️list-onlyblock-size:▪️rsh:▪️rsync-path:▪️max-delete:▪️max-size:▪️max-size:▪️partial-dir:▪️timeout:▪️contimeout:▪️modify-window:▪️temp-dir:▪️fuzzy:▪️compare-dest:▪️copy-dest:▪️link-dest:▪️compress-level:▪️skip-compress:▪️filter:▪️exclude:▪️exclude-from:▪️include:▪️include-from:▪️files-from:▪️address:▪️port:▪️sockopts:▪️out-format:▪️log-file:▪️log-file-format:▪️password-file:▪️bwlimit:▪️write-batch:▪️only-write-batch:▪️read-batch:▪️protocol:▪️iconv:▪️checksum-seed:
🟡 cli variables
Named
In
makewe can change internal variables (eg.env,file) from the command line in this way:make file=/dist/main.js make env=prod file=/dist/main.js make compile env=prod file=/dist/main.jsin remotemon the same thing can do done :
remotemon file=/dist/main.jsit changes the internal value(s) of associated key in
global:val: file: /dist/main.js # <-- old value replaced with value taken from commandline remotehost: pi@192.152.65.12 remotefold: ~/test local: make local ${global.file} remote: make remotethis way we can edit the values of our makefile without opening either
.remotemon.yamlormakefile.Unnamed
Sometimes it's more convenient to not have to name your variables.
Instead of
remotemon file=/dist/main.jswe would like to doremotemon /dist/main.js.We can in situation like that use numbered templating
${0},${1}in our config file.defargfield can also be used to provide default values if the user does not specify them.If we know the most common file name is
/dist/main.jswe could usedefarg: [/dist/main.js]to not have to always provide the filename as an argument.
When not to use remotemon ?
when your build process gets complicated enough to warrant the use of gulpfiles, makefiles, etc.
remotemonis meant for situations where you are constantly having to configure linux system files, but also developing and running code on remote machines, that involves complicatedrsyncandsshcommands, but prefer to change those files from the comfort of your favorite local text editor - not everybody uses vim.--editIt's possible to make permanent edits on
.remotemon.yamlwithout opening them using the-e/--editflag.For example if the IP address of the host has changed, you could do :
remotemon -e remotehost=user@192.168.43.52and the remotehost field would have value of
user@192.168.43.52It's also possible to change inner values of custom defined tasks ( using
/to define nesting ) :remotemon -e mybuild1/remotehost=user@192.168.43.52
🟡 all commandline options
--watch-config-fileor-wrestarts on config file change by default.--dry-runor-dwould disable all execution, used for checking and making sure all the commands are accurate.--verbose,-v( also-vv) would show all the command in their full form.-l,--listto see all the different commands from the command line itself.-m --auto-make-directorymake remote directory if it doesn't exist.-mm( with root permission )-V --versiondisplays version number-n --no-watchforce disable any and all watches-s --silentdo not showremotemonmessage-e --editmake permanent edits to.remotemon.yamlvalues.-p --projectfolder name ( in service directory ) to look for.remotemon.yaml-c --catdump the output of the current config file being used.-ccsame as -c but with comments-cccshow raw json for final process state
🔴 Bugs
For now it's not possible for remotemon to do two levels of referencing in config file, as remotemon uses tampax, and the issue is with tampax, write your config files to work around the issue ( for now ).
LICENCE
- Code released under BSD-3-Clause.
- Documentation and images released under CC BY-NC-ND 4.0.
- details can be found here.
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago