Giter VIP home page Giter VIP logo

webproc's Introduction

webproc

Wrap any program in a simple web-based user-interface

Install

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

Usage

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.

screen shot 2016-09-22 at 1 39 01 am

For more features, see the Configuration file

CLI

$ 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

Configuration

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"

Contributing

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

MIT License

Copyright © 2017 Jaime Pillora <[email protected]>

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.

webproc's People

Contributors

dchidell avatar gcristofol avatar jpillora avatar rinex20 avatar zjengjie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

webproc's Issues

Handle or strip ANSI color

Hey!

On log view, is it possible to support ansi colors?
If too complicated, why not to strip it first, and manage it later?

Example:

\u001b[40m\u001b[37mdbug\u001b[39m\u001b[22m\u001b[49m

display
capture d ecran 2018-05-23 a 09 38 00

Says "No change" even when there is a change

Nice utility! I have it set up with dnsmasq, with everything running as root. When I make a modification to the configuration file through the web UI, and try to save it, I get a red box that says "No change", even though a change was made.

Second config file

Hi there!

I am trying webproc -c /etc/dnsmasq.conf -c /etc/hosts -- dnsmasq --no-daemon
But the web UI only shows /etc/hosts and the logs.

Am I missing something?

I would like to be able to edit both files:

  • /etc/dnsmasq.conf
  • /etc/hosts

Cheers!
Gus

Add option to avoid restart on file save

Currently when saving config files it auto-restarts the process, this is often undesirable, especially as there is a restart button right next to it which can be used.

Some configuration files are picked up automatically by services without a restart being required. Alternatively it's often useful to ensure that a service won't be disrupted so the change can be made and a restart issued later.

BUG:Abnormal high CPU usage

When I used it with dnsmasq for a while, I observed abnormal high CPU usage, as shown in the screenshot.

image

I use strace to try to track PID 13544, which shows that the program is blocking the waitid system call, and there is no other information. Through the top command, I learned that CPU time is basically spent in us state, not sys state.

This situation has been going on for 24 hours, and it doesn't seem to be a problem of 'dnsmasq'. What happened to 'webproc'?

I can not build it successfully

#$GOPATH/bin/webproc

Usage: webproc [options]

Options:
--host listening interface
--port listening port
--user basic auth username
--pass basic auth password

Version:
0.0.0-src

Error:
field 'ProgramArgs' invalid opts mode 'arglist'

During the install step:

go generate ./...

agent/agent.go:1: running "statik": exec: "statik": executable file not found in $PATH

I got this error.

How to build it perfectly?

Can not find package jsonpatch

I highly want to test this fine piece of software, but go stops on installing:

FROM golang:latest 
RUN go get github.com/jpillora/webproc

package gomodules.xyz/jsonpatch/v2: cannot find package "gomodules.xyz/jsonpatch/v2" in any of:
	/usr/local/go/src/gomodules.xyz/jsonpatch/v2 (from $GOROOT)
	/go/src/gomodules.xyz/jsonpatch/v2 (from $GOPATH)

Not really experienced in Go ... some dependency declaration missed ?

Memory leak with lots of on screen log updates

I'm running docker-dnsmasq and it works great, however if I keep a tab open it will quickly begin to eat up all of my RAM.

Dnsmasq works perfectly, so it appears this is only an issue with webproc.

Here's my initial report of this issue against docker-dnsmasq.

Only clue at this point is lots of entries for run.js:55 in the browser console:

screenshot from 2018-04-26 23-57-28

"no change" error with multiple files

I am using webproc 0.2.2 on alpine linux in a docker container. When I have webproc configured to edit multiple files, it appears to save my changes but I frequently will receive a "no change" error message. If I configure it to only edit 1 file, I dont have this problem

Is there any way to send sighup?

dnsmasq supports a cache drop/cleanup with when receives a sighup signal.
Is there any way to add such a signal to the webui?

Multiple ProgramArgs

Please consider to insert multiple "ProgramArgs" on config.toml
for to use only one port bind and a single web page to interact with all programs.

embed all static files

  • i.e. ensure no external network requests are made
  • makes it easier to run a local dns server (chicken and egg, cant resolve assets without the server running)

FR: Manage files, but not run daemons.

I really like webproc. But in case, if i want to expose to LAN nginx.conf and i don't want to run it with webproc. It could be awesome to just have editor for selected files and (start/stop/restart) using systemd or w/e.

recommend a warehouse [推荐一个仓库]

This repository is based on docker_sdk, webproc, dnsmasq

When a container state change is detected, dnsmaq is automatically restarted (currently a scheduled task)

Since the dns scheme is adopted, the problem of nginx not parsing dns is indirectly fixed.

The warehouse is open source, everyone is welcome to maintain it together!


此存储库基于 docker_sdk, webproc, dnsmasq

当检测到容器状态变化时,自动重启 dnsmaq(目前为定时任务)

由于采用了dns方案,间接修复了nginx不解析dns的问题。

仓库开源,欢迎大家一起维护!

Github:AUDCH


nginx

sopp

dns

adminer

cmd

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.