Wrap any program in a simple web-based user-interface
Binaries
See the latest release or download it now with curl https://i.jpillora.com/webproc | bash
Source
$ go get -v github.com/jpillora/webproc
Let's use webproc
to run dnsmasq
:
webproc --configuration-file /etc/dnsmasq.conf -- dnsmasq --no-daemon
Multiple config files can be specified:
webproc -c /etc/dnsmasq.conf -c /etc/hosts -- dnsmasq --no-daemon
Visit http://localhost:8080 and view the process configuration, status and logs.
For more features, see the Configuration file
$ webproc --help
Usage: webproc [options] <arg> [arg] ...
args can be either a command with arguments or a webproc file
Options:
--host, -h listening interface (default 0.0.0.0)
--port, -p listening port (default 8080, env PORT)
--user, -u basic auth username (env HTTP_USER)
--pass basic auth password (env HTTP_PASS)
--allow-ip, -a allow ip or cidr block (allows multiple)
--allow-country, -y allow ip range by 2-letter ISO country code (allows multiple)
--trust-proxy, -t trust proxy HTTP headers to provide remote ip address
--log, -l log mode (must be 'webui' or 'proxy' or 'both' defaults to 'both')
--on-exit, -o process exit action (default ignore)
--on-save, -s process save action (default restart)
--configuration-file, -c writable configuration file (allows multiple)
--restart-timeout, -r restart timeout controls when to perform a force kill (default 30s)
--max-lines, -m maximum number of log lines to show in webui (default 5000)
--version, -v display version
--help display help
Version:
X.Y.Z
Read more:
https://github.com/jpillora/webproc
The CLI interface only exposes a subset of the configuration, to further customize
webproc, create a program.toml
file and then load it with:
webproc program.toml
Here is a complete configuration with the defaults, only ProgramArgs
is required:
# Program to execute (with optional Arguments). Note: the process
# must remain in the foreground (i.e. do NOT fork/run as daemon).
# example: ["/usr/bin/dnsmasq","-config","/etc/dnsmasq.conf"]
ProgramArgs = []
# Interface to serve web UI. Warning: defaults to ALL interfaces.
Host = "0.0.0.0"
# Port to serve web UI
Port = 8080
# Basic authentication settings for web UI
User = ""
Pass = ""
# IP addresses which should be allowed to access the web UI
# For example, ["10.0.0.0/8"]
AllowedIPs = []
# Log settings for the process:
# "both" - log to both, webproc standard out/error and to the web UI log.
# "webui" - only log to the web UI. Note, the web UI only keeps the last 10k lines.
# "proxy" - only log to webproc standard out/error.
Log = "both"
# OnExit dictates what action to take when the process exits:
# "ignore" - ignore and wait for manual restart via the web UI
# "proxy" - also exit webproc with the same exit code
# "restart" - automatically restart with exponential backoff time delay between failed restarts
OnExit = "ignore"
# OnSave dictates what action to take when saving a configuration file via the UI:
# "restart" - instantly restart the process
# "continue" - do not restart the process (restart button must be used)
OnSave = "restart"
# Configuration files to be editable by the web UI.
# For example, dnsmasq would include "/etc/dnsmasq.conf"
ConfigurationFiles = []
# After the restart signal (SIGINT) has been sent, webproc will wait for RestartTimeout before
# forcibly restarting the process (SIGKILL).
RestartTimeout = "30s"
Install Go and setup your GOPATH
# setup go, get go-bindata and webproc
$ go get -u github.com/jteeuwen/go-bindata/...
$ go get -u -v github.com/jpillora/webproc
$ cd $GOPATH/src/github.com/jpillora/webproc
# ... edit source ...
$ go generate ./...
$ go install -v
$ $GOPATH/bin/webproc
Copyright © 2017 Jaime Pillora <dev@jpillora.com>
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.