2020-09-10 10:11:34 +00:00
|
|
|
# Nano-Run
|
|
|
|
|
2020-11-08 11:13:31 +00:00
|
|
|
![nano-run](https://user-images.githubusercontent.com/6597086/97143787-4f70db80-179e-11eb-9b9c-7e16bfff845e.png)
|
2020-10-26 09:19:30 +00:00
|
|
|
|
2020-09-10 10:11:34 +00:00
|
|
|
Lightweight async request runner.
|
|
|
|
|
|
|
|
A simplified version of [trusted-cgi](https://github.com/reddec/trusted-cgi) designed
|
|
|
|
for async processing extreme amount of requests.
|
|
|
|
|
2020-10-06 07:37:00 +00:00
|
|
|
Main goals:
|
2020-09-10 10:11:34 +00:00
|
|
|
|
|
|
|
* Should have semi-constant resource consumption regardless of:
|
|
|
|
* number of requests,
|
|
|
|
* size of requests,
|
|
|
|
* kind of requests;
|
|
|
|
* Should be ready to run without configuration;
|
|
|
|
* Should be ready for deploying in clouds;
|
|
|
|
* Should support extending for another providers;
|
|
|
|
* Can be used as library and as a complete solution;
|
2020-10-06 07:37:00 +00:00
|
|
|
* **Performance (throughput/latency) has less priority** than resource usage.
|
|
|
|
|
|
|
|
Please note that the project is being developed in free time, as a non-profitable hobby project.
|
|
|
|
All codes, bugs, opinions, and other related subjects should not be considered as the official position, official project,
|
|
|
|
or company-backed project to any of the companies for/with which I worked before or/and at present.
|
|
|
|
|
|
|
|
|
2020-11-08 11:13:31 +00:00
|
|
|
![sample-nano-run](https://user-images.githubusercontent.com/6597086/98463432-303e6900-21f6-11eb-9632-806b1c99813b.gif)
|
2020-10-06 07:37:00 +00:00
|
|
|
|
|
|
|
## Documentation
|
|
|
|
|
|
|
|
* [Installation](#installation)
|
|
|
|
* [Quick start](#quick-start)
|
|
|
|
* [Architecture overview](_docs/flow.md)
|
|
|
|
* [API](_docs/api.md)
|
|
|
|
* [API Authorization](_docs/authorization.md)
|
|
|
|
* [UI](_docs/ui.md)
|
|
|
|
* [UI Authorization](_docs/ui_authorization.md)
|
|
|
|
* [Unit configuration](_docs/unit.md)
|
|
|
|
* [Docker](_docs/docker.md)
|
2020-11-07 15:12:14 +00:00
|
|
|
* [Cron-like scheduler](_docs/cron.md)
|
2020-10-06 07:37:00 +00:00
|
|
|
|
|
|
|
## Stability
|
|
|
|
|
|
|
|
(After 1.0.0)
|
|
|
|
|
|
|
|
We are trying to follow semver:
|
|
|
|
|
|
|
|
* Patch releases provides fixes or light improvements without migration
|
|
|
|
* Minor releases provides new functionality and provides automatic migration if needed
|
|
|
|
* Major releases provides serious platform changes and may require manual or automatic migration
|
|
|
|
|
|
|
|
Within one major release, it guarantees forward compatibility: new versions can use data from previous versions, but not vice-versa.
|
|
|
|
|
|
|
|
## Reproducible binaries
|
|
|
|
|
|
|
|
The project tries to follow best practices providing reproducible binaries: it means, that
|
|
|
|
you can verify that complied binaries will be exactly the same (byte to byte) as if you will compile it by yourself
|
|
|
|
by following our public instructions.
|
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
|
|
The project (source code and provided official binaries) are licensed
|
|
|
|
under Apache-2.0 (see License file, or in [plain English](https://tldrlegal.com/license/apache-license-2.0-(apache-2.0))) and suitable
|
|
|
|
for personal, commercial, government, and others usage without restrictions as long as it used with abiding
|
|
|
|
license agreement.
|
|
|
|
|
|
|
|
Do not forget to bring your changes back to the project. I will
|
|
|
|
be happy to assist you with PR.
|
|
|
|
|
|
|
|
The project uses external libraries that may be distributed
|
|
|
|
under other licenses.
|
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
|
|
|
### Debian/Ubuntu
|
|
|
|
|
|
|
|
(recommended)
|
|
|
|
|
|
|
|
Tested on 20.04 and 18.04, but should good for any x64 version.
|
|
|
|
|
|
|
|
Add the repository (only once)
|
|
|
|
|
|
|
|
```bash
|
|
|
|
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 379CE192D401AB61
|
|
|
|
echo "deb https://dl.bintray.com/reddec/debian all main" | sudo tee /etc/apt/sources.list.d/reddec.list
|
|
|
|
```
|
|
|
|
|
|
|
|
Install or update nano-run
|
|
|
|
|
|
|
|
```bash
|
|
|
|
sudo apt update
|
|
|
|
sudo apt install nano-run
|
|
|
|
```
|
|
|
|
|
|
|
|
Automatically creates service `nano-run.service`.
|
|
|
|
|
|
|
|
### Binary
|
|
|
|
|
2020-10-06 11:02:32 +00:00
|
|
|
Download and unpack desired version in [releases](https://github.com/reddec/nano-run/releases).
|
2020-10-06 07:37:00 +00:00
|
|
|
|
|
|
|
### Docker
|
|
|
|
|
|
|
|
`docker pull reddec/nano-run`
|
|
|
|
|
|
|
|
### From source
|
|
|
|
|
|
|
|
Requires go 1.14+
|
|
|
|
|
|
|
|
`go get -v github.com/reddec/nano-run/cmd/...`
|
|
|
|
|
|
|
|
### Ansible for debian servers
|
|
|
|
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
- name: Add an apt key by id from a keyserver
|
|
|
|
become: yes
|
|
|
|
apt_key:
|
|
|
|
keyserver: keyserver.ubuntu.com
|
|
|
|
id: 379CE192D401AB61
|
|
|
|
- name: Add repository
|
|
|
|
become: yes
|
|
|
|
apt_repository:
|
|
|
|
repo: deb https://dl.bintray.com/reddec/debian all main
|
|
|
|
state: present
|
|
|
|
filename: reddec
|
|
|
|
- name: Install nano-run
|
|
|
|
become: yes
|
|
|
|
apt:
|
|
|
|
name: nano-run
|
|
|
|
update_cache: yes
|
|
|
|
state: latest
|
|
|
|
```
|
|
|
|
|
|
|
|
## Quick start
|
|
|
|
|
|
|
|
**(optional) initialize configuration**
|
|
|
|
|
|
|
|
nano-run server init
|
|
|
|
|
|
|
|
it will create required directories and files in a current working directory.
|
|
|
|
|
|
|
|
**define a unit file**
|
|
|
|
|
|
|
|
Create minimal unit file (date.yaml) that will return current date (by unix command `date`) and put it
|
|
|
|
in directory `run/conf.d/`
|
|
|
|
|
|
|
|
_run/conf.d/date.yaml_
|
|
|
|
```yaml
|
|
|
|
command: date
|
|
|
|
```
|
|
|
|
|
|
|
|
**start nano-run**
|
|
|
|
|
|
|
|
nano-run server run
|
|
|
|
|
|
|
|
|
|
|
|
now you can open ui over http://localhost:8989 or do API call: `curl -X POST http://localhost:8989/api/date/`
|