diff options
author | Steve Manuel <nilslice@gmail.com> | 2017-06-10 17:09:47 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-10 17:09:47 -0600 |
commit | e3fb3aba33645ef1c7ba1d1556c806d7c0eb853b (patch) | |
tree | e65b5a0dc7579b0af904c487570c5c5ade742f7b /docs/src/System-Deployment | |
parent | 427dff52c3db481dff38dd1eee83f93e54ea8065 (diff) | |
parent | 4d767c13f15b24fdbfcb610589e757a98c931d70 (diff) |
Merge pull request #159 from ponzu-cms/ponzu-dev
[cli] adding documentation server for local use
Diffstat (limited to 'docs/src/System-Deployment')
-rw-r--r-- | docs/src/System-Deployment/Docker.md | 34 | ||||
-rw-r--r-- | docs/src/System-Deployment/SysV-Style.md | 76 |
2 files changed, 110 insertions, 0 deletions
diff --git a/docs/src/System-Deployment/Docker.md b/docs/src/System-Deployment/Docker.md new file mode 100644 index 0000000..a998a38 --- /dev/null +++ b/docs/src/System-Deployment/Docker.md @@ -0,0 +1,34 @@ +## Ponzu Docker build + +Ponzu is distributed as a [docker image](https://hub.docker.com/r/ponzu/ponzu/), +which aids in ponzu deployment. The Dockerfile in this directory is used by Ponzu +to generate the docker image which contains the ponzu executable. + +If you are deploying your own Ponzu project, you can write a new Dockerfile that +is based from the `ponzu/ponzu` image of your choice. For example: +```docker +FROM ponzu/ponzu:latest + +# your project set up ... +# ... +# ... +``` + +### The following are convenient commands during development of Ponzu core: + +#### Build the docker image. Run from the root of the project. +```bash +# from the root of ponzu: +docker build -t ponzu-dev +``` + +#### Start the image, share the local directory and pseudo terminal (tty) into for debugging: +```bash +docker run -v $(pwd):/go/src/github.com/ponzu-cms/ponzu -it ponzu-dev +pwd # will output the go src directory for ponzu +ponzu version # will output the ponzu version +# make an edit on your local and rebuild +go install ./... +``` + +Special thanks to [**@krismeister**](https://github.com/krismeister) for contributing this!
\ No newline at end of file diff --git a/docs/src/System-Deployment/SysV-Style.md b/docs/src/System-Deployment/SysV-Style.md new file mode 100644 index 0000000..565b399 --- /dev/null +++ b/docs/src/System-Deployment/SysV-Style.md @@ -0,0 +1,76 @@ +title: Deploying Ponzu on Linux with System-V style init + +For reference, here is an example init script to run Ponzu servers. You must +define the `PROJECT_DIR` & `RUNAS` variables by replacing `<PROJECT DIRECTORY>` +& `<USER>` in the script below: + +```bash +#!/bin/sh +### BEGIN INIT INFO +# Provides: ponzu-server +# Required-Start: $local_fs $network $named $time $syslog +# Required-Stop: $local_fs $network $named $time $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Description: Ponzu API & Admin server +### END INIT INFO + +PROJECT_DIR=<PROJECT DIRECTORY> +SCRIPT='cd $PROJECT_DIR && ponzu run --port=80' # add --https here to get TLS/HTTPS +RUNAS=<USER> + +PIDFILE=/var/run/ponzu-server.pid +LOGFILE=/var/log/ponzu-server.log + +start() { + if [ -f /var/run/$PIDNAME ] && kill -0 $(cat /var/run/$PIDNAME); then + echo 'Service already running' >&2 + return 1 + fi + echo 'Starting serviceā¦' >&2 + local CMD="$SCRIPT &> \"$LOGFILE\" & echo \$!" + su -c "$CMD" $RUNAS > "$PIDFILE" + echo 'Service started' >&2 +} + +stop() { + if [ ! -f "$PIDFILE" ] || ! kill -0 $(cat "$PIDFILE"); then + echo 'Service not running' >&2 + return 1 + fi + echo 'Stopping serviceā¦' >&2 + kill -15 $(cat "$PIDFILE") && rm -f "$PIDFILE" + echo 'Service stopped' >&2 +} + +uninstall() { + echo -n "Are you really sure you want to uninstall this service? That cannot be undone. [yes|No] " + local SURE + read SURE + if [ "$SURE" = "yes" ]; then + stop + rm -f "$PIDFILE" + echo "Notice: log file is not be removed: '$LOGFILE'" >&2 + update-rc.d -f <NAME> remove + rm -fv "$0" + fi +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + uninstall) + uninstall + ;; + restart) + stop + start + ;; + *) + echo "Usage: $0 {start|stop|restart|uninstall}" +esac +```
\ No newline at end of file |