execute local commands remotely via http requests
Find a file
2022-04-06 15:23:45 +02:00
.vscode optimized stuff, implemented command timeouts 2022-04-06 15:20:08 +02:00
libs removed unnecessary 'require' statement 2022-04-06 15:23:45 +02:00
.gitignore move to node version 17, updated readme and renamed example config 2022-04-06 10:10:56 +02:00
.nvmrc move to node version 17, updated readme and renamed example config 2022-04-06 10:10:56 +02:00
example_config.json optimized stuff, implemented command timeouts 2022-04-06 15:20:08 +02:00
package-lock.json add and modify files for easier setup 2022-03-18 16:05:10 +01:00
package.json updated documentation, made minor changes to the config 2022-03-18 14:51:01 +01:00
README.md fixed typo 2022-04-06 10:15:01 +02:00
remex.js optimized stuff, implemented command timeouts 2022-04-06 15:20:08 +02:00
remex.service added systemd-service file 2022-03-18 16:07:13 +01:00

remex

execute local commands remotely via http requests

requirements

setup (as root)

  • install nvm

  • to load nvm restart your terminal or source ~/.nvm/nvm.sh

  • clone the project (to '/opt/remex')
    git clone https://git.velvettear.de/velvettear/remex.git /opt/remex

  • install and switch to a supported node.js version (automatically done via .nvmrc file) nvm install

  • install the required modules
    npm install

  • switch back to your system's default node.js version nvm deactivate

  • execute remex
    nvm run remex.js

systemd

for security reasons it is highly recommended to not run remex with root permissions!

  • create a new system user
    useradd -U -r -s /usr/bin/nologin node

  • make your install of nvm available to the new user
    cp -R ~/.nvm /opt/nvm
    chown -R node /opt/nvm

  • symlink the provided systemd-service file and modify it according to your needs
    ln -s /opt/remex/remex.service /etc/systemd/system/remex.service

  • reload systemd-services
    systemctl daemon-reload

  • enable and start remex as a systemd-service
    systemctl enable --now remex

configuration

configuration is done entirely within the file config.json.

server: [object]

  • address: [string] server address to listen on (0.0.0.0 to listen on all interfaces)
  • port: [number] port to listen on

log: [object]

  • level: [string] verbosity of the log; either debug, info, warning or error
  • timestamp: [string] format string for the timestamp; review moment.js for further information

api: [object-array]

  • url: [string] url of the endpoint
  • type: [string] http request method for the endpoint (either get or post)
  • command: [string] command / path to script to execute
  • args: [string-array] arguments to pass to the executed command
  • timeout [number] max amount of time in milliseconds until the executed command times out and gets killed
  • detach [boolean] detach from the executed command
  • unique [boolean or string] if set to true the command can not be executed again until it has finished; if set to restart the command will be killed (if active) and started again; if set to toggle the command will either be killed if active or started if not active