urltocmd/README.md

28 lines
1.6 KiB
Markdown
Raw Permalink Normal View History

2024-02-03 11:13:20 +01:00
# URL to CMD app
A tiny web server that runs a specific command on the server when a specific URL is reached. A use case can be to update production code on a server, but without giving arbitrary command access to the server to external parties.
## Dependencies and installation
To build a new binary, you need to have Go 1.21 or later installed and then run `./build.sh`. All binaries lands in the `bin` folder.
To "install" this app, simply copy the binary to a folder in your $path, or run it directly.
There is no dependencies except for a supported architecture for the binary. If your architecture is not present, please add it and make a PR.
## Running and configuration
Either copy `.env.example` to `.env` and modify the settings to your likings, or modify the ENV in your shell according to `.env.example`. Modify `urlstocmd.example.json` to your liking and rename it to match your ENV `URLS_CMDS_JSON_PATH`. Then run the application.
## Installing as a system.d service in compatible Linux systems (Debian etc)
1. Configure the app according to the above instructions somewhere on your filesystem.
2. Copy `urltocmd.service` to `/etc/systemd/system/urltocmd.service`.
3. Modify `/etc/systemd/system/urltocmd.service` to match your needs (especially check User, ExecStart and WorkingDirectory)
4. `sudo systemctl daemon-reload && sudo systemctl enable urltocmd && sudo service urltocmd start`
5. Profit!
You can watch the log from urltocmd like this: `sudo journalctl -u urltocmd -f`.
See more information about how to work with system.d services [here](https://wiki.ubuntu.com/SystemdForUpstartUsers).