Skip to content
Permalink
Browse files

Add control script and nginx.conf templates. Update spec and monit fi…

…les.
  • Loading branch information...
krasio committed Dec 19, 2018
1 parent c98ea39 commit 5e95eefff8545b1bbcac22672a5cbfb25fd82879
Showing with 57 additions and 1 deletion.
  1. +5 −0 jobs/nginx/monit
  2. +3 −1 jobs/nginx/spec
  3. +26 −0 jobs/nginx/templates/ctl.erb
  4. +23 −0 jobs/nginx/templates/nginx.conf
@@ -0,0 +1,5 @@
check process nginx
with pidfile /var/vcap/sys/run/nginx/nginx.pid
start program "/var/vcap/jobs/nginx/bin/ctl start"
stop program "/var/vcap/jobs/nginx/bin/ctl stop"
group vcap
@@ -1,7 +1,9 @@
---
name: nginx

templates: {}
templates:
ctl.erb: bin/ctl
nginx.conf: conf/nginx.conf

packages: []

@@ -0,0 +1,26 @@
#!/bin/bash -e

RUN_DIR=/var/vcap/sys/run/nginx
LOG_DIR=/var/vcap/sys/log/nginx
CONFIG_DIR=/var/vcap/jobs/nginx/conf

PIDFILE=${RUN_DIR}/nginx.pid
CONFIG_FILE=$CONFIG_DIR/nginx.conf

case $1 in

start)
mkdir -p $RUN_DIR $LOG_DIR
chown -R vcap:vcap $RUN_DIR $LOG_DIR

/var/vcap/packages/nginx-1.14/sbin/nginx -g "pid $PIDFILE;" -c $CONFIG_FILE
;;

stop)
kill -QUIT $(cat $PIDFILE)
rm -f $PIDFILE
;;
*)
echo "Usage: ctl {start|stop}"
;;
esac
@@ -0,0 +1,23 @@
user nobody vcap; # group vcap can read most directories
worker_processes 8;

error_log /var/vcap/sys/log/nginx/error.log info;

events {
worker_connections 1024;
}

http {
include /var/vcap/packages/nginx-1.14/conf/mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server_names_hash_bucket_size 512;

server {
listen 80;
access_log /var/vcap/sys/log/nginx/access.log;

return 200 "\nKia Ora!\n";
}
}

0 comments on commit 5e95eef

Please sign in to comment.
You can’t perform that action at this time.