Simple web app to run scripts
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
assets
cmd/pushabutton
docs
vendor
.gitignore
CHANGELOG.md
LICENSE
Makefile
README.md
setup.go
vendor.yml
web.go

README.md

Pushabutton

Minimal web app to run scripts.

Put anything executable in the buttons dir. It'll show up as a button in the web UI. Then, you can push a button!

Get started

In a shell, run the following:

mkdir smalltasks && cd smalltasks
curl -L -o pushabutton https://github.com/engagespark/pushabutton/releases/download/0.0.2/pushabutton-0.0.2-x86-64-glibc
chmod u+x pushabutton
./pushabutton setup
./pushabutton serve

Now, visit http://localhost:8080/.

For more info, run ./pushabutton --help

Introduction

For example, let's create a “date” button that runs the date command. To do this, we create a link to the executable in the buttons dir:

smalltasks$ cd buttons && ln -s $(which date)

Looking at the web-UI, you immediately get a button that you can click.

Pushabutton automatically renders a button for you

After clicking, the executable is run and you get a log:

Pushabutton shows you what is happening on pushing the button

Remember what command you ran yesterday? No worries, Pushabutton remembers.

Pushabutton remembers your button pushes

Simple Parameters

Oh, and then there's parameters! Let's say you're interested in running the id command from the web, to find the IDs of users:

$ ln -s $(which id)

Now, you need to pass a username. Add a textfile id.parameters:

$ cat id.parameters
username

When clicking the button, you'll get a modal asking for the username:

Pushabutton automatically asks for the username!

More features

  • Add descriptions to parameters
  • Make the user choose a value for a parameter with a drop-down list.
  • Determine the valid choice at runtime (by running a script).

How to configure these, see the examples after running setup.

What it is and what it's not

Pushabutton is about enabling non-techies to use your simple helper scripts, too. You copy the binary, you dump the script in the buttons dir, you run the webserver. Then you paste the link in the mail to your colleague, and that's it — done. You can do simple parameters, you have a simple log — but that's it. Pushabutton fills a gap at the low-effort, simple-need end of the spectrum.

It will not be enough for many use cases, and in fact it is not meant to be. Pushabutton does not care about:

  • Authorization (this user can do this, the other one cannot)
  • Scheduling (at 5pm tomorrow do this and at every 2nd Sunday do that)
  • Editing from the web
  • Pipelining
  • Conditional logic
  • Branding and themes

If you need any of those, then Pushabutton is not for you. There are other tools where you can run something from a web-UI, and that do those things well:

Setup & Running & Uninstalling

Run the setup command:

$ ./pushabutton setup

This will setup the necessary directories and some demo scripts:

$ tree
.
├── buttons
│   ├── what_is_the_current_date.sh
│   ├── write-message-to-logged-in-user.sh
│   ├── write-message-to-logged-in-user.sh.parameters
│   └── write-message-to-logged-in-user.sh.parameters.user-tty.choices.sh
├── logs
└── pushabutton

What did we get?

  • buttons is where your scripts live. Link them or drop them there — as long as it's executable, Pushabutton will make a button out of it. At the beginning, two scripts demonstrate how to create your own buttons.
  • logs that's where, for every button push, log files are stored. The journal.log is the file that indexes the rest.

Run the server:

$ ./pushabutton serve Running server on :8080

Want to uninstall? Simple. Just delete the entire directory. There's nothing else.

License

MIT, see LICENSE file

Dependencies, their license & thanks!

We're using the following libraries directly:

gouuid and kingpin.v2

Thru the vendor directory, we're redistributing source code of the following projects:

$ govend -tv