To run the app within a FreeBSD jail I recommend using the convenient iocage jail management tool. With this, one may execute commands similar to those shown below to run an instance of librarian inside a jail. Currently this as only been tested on 12.0-RELEASE.
iocage create -r LATEST -n <jail-name>
iocage set ip4_addr="<interface-name>|<ip-address>/<cidr-subnet-mask>" <jail-name>
iocage set boot=on <jail-name>
iocage exec <jail-name> 'fetch --no-verify-peer https://raw.githubusercontent.com/jwfh/librarian/master/jailup -o - | sh'
The jailup
script executed in line four above does a number of things:
- Bootstraps the
pkg
package manager - Installs required dependencies
- Clones the librarian repository to
/app
- Copies the
librariand
rc.d script to/etc/rc.d
and enables the librariand service to start at boot - Creates a user called
librariand
whose account will be used withdaemon(8)
to run Gunicorn
Use in Docker is also supported for deployment on Linux or development on macOS. A Dockerfile is provided.
From within the root project directory, run the docker build
command, specifying any optional parameters you wish to
include. For example,
docker build -t jwhouse/librarian:latest .
Commits to the master
branch of this repository trigger automatic rebuilds of the Docker image. These may be pulled
from Docker Hub.