2015-12-26 14:01:50 -08:00
|
|
|
# docker-nexus
|
|
|
|
|
2018-10-07 13:50:47 -07:00
|
|
|
**A nginx + cgi + sshd server for prototyping services or data hubs.**
|
|
|
|
|
2015-12-26 14:01:50 -08:00
|
|
|
|
|
|
|
## Quick start
|
|
|
|
|
2018-10-07 13:50:47 -07:00
|
|
|
* Clone: `git clone ssh://git@git.davepedu.com:222/dave/docker-nexus.git`
|
2015-12-26 14:01:50 -08:00
|
|
|
* Build: `cd docker-nexus ; docker build -t nexus .`
|
|
|
|
* Run: `docker run nexus`
|
|
|
|
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
Nexus offers a couple services:
|
|
|
|
|
2018-10-07 13:50:47 -07:00
|
|
|
|
2015-12-26 14:01:50 -08:00
|
|
|
### SSHD
|
|
|
|
|
2015-12-26 21:13:13 -08:00
|
|
|
For shell related activities, an sshd daemon runs on the standard port. Username and password, by default, is `nexus`.
|
2015-12-26 14:01:50 -08:00
|
|
|
|
2018-10-07 15:21:44 -07:00
|
|
|
Mount `/data/keys` to persist host keys. Ssh public keys in `/data/nexus_authorized_keys` will be authorized for the
|
|
|
|
`nexus` user.
|
2018-10-07 13:50:47 -07:00
|
|
|
|
|
|
|
|
2015-12-26 14:01:50 -08:00
|
|
|
### Nginx
|
|
|
|
|
2018-10-07 13:50:47 -07:00
|
|
|
For accessing data or calling CGI scripts via nginx on port 80.
|
|
|
|
|
|
|
|
The document root is `/data/data/`.
|
|
|
|
|
2015-12-26 14:01:50 -08:00
|
|
|
|
|
|
|
### CGI
|
|
|
|
|
2018-10-07 13:50:47 -07:00
|
|
|
CGI scripts can be placed in `/data/scripts/`. Some sample scripts exist in `./examples/cgi-scripts/`.
|
|
|
|
|
|
|
|
The library in `scripts/nexus/cgi.py` can be imported like:
|
|
|
|
|
|
|
|
```
|
|
|
|
>>> from nexus.cgi import *
|
|
|
|
>>> start_response()
|
|
|
|
Status: 200 OK
|
|
|
|
Content-Type: text/html
|
|
|
|
|
|
|
|
>>>
|
|
|
|
```
|
|
|
|
|
2015-12-26 14:01:50 -08:00
|
|
|
|
|
|
|
### Cron
|
|
|
|
|
2018-10-07 13:50:47 -07:00
|
|
|
Cron is present in the container. Place tabs in `/etc/cron.d`.
|
|
|
|
|
2015-12-26 14:01:50 -08:00
|
|
|
|
2015-12-26 21:13:13 -08:00
|
|
|
## Protips
|
|
|
|
|
2018-10-07 13:50:47 -07:00
|
|
|
* Drop executable scripts into `/startup.d/` for startup tasks
|
|
|
|
* Persistance - mount `/data/` somewhere persistent.
|
|
|
|
|
2015-12-26 21:13:13 -08:00
|
|
|
|
2015-12-26 14:01:50 -08:00
|
|
|
## TODO
|
|
|
|
|
|
|
|
* Allow ssh password to be set by passing an env var
|
|
|
|
* More sample CGI scripts
|