bosh-gen 0.8.2 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.md +13 -0
- data/lib/bosh/gen/cli.rb +45 -29
- data/lib/bosh/gen/generators/deployment_manifest_generator.rb +7 -3
- data/lib/bosh/gen/generators/extract_job_generator.rb +37 -6
- data/lib/bosh/gen/generators/extract_package_generator.rb +23 -5
- data/lib/bosh/gen/generators/job_generator.rb +34 -16
- data/lib/bosh/gen/generators/job_generator/templates/examples/%job_name%_nginx_rack/nginx_puma_migrate.yml +14 -0
- data/lib/bosh/gen/generators/job_generator/templates/examples/%job_name%_nginx_rack/nginx_rackup.yml.tt +8 -0
- data/lib/bosh/gen/generators/job_generator/templates/examples/%job_name%_simple/default.yml +2 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/monit.tt +13 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/%job_name%_rack_ctl.tt +59 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/ctl_db_utils.sh.erb +54 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/ctl_nginx.sh.erb +17 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/ctl_redis_utils.sh.erb +18 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/ctl_setup.sh.erb +48 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/ctl_start.sh.erb +59 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/ctl_utils.sh +148 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/monit_debugger +13 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/nginx_ctl.tt +41 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/rails_ctl_setup.sh.erb +40 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/config/database.yml.erb +17 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/config/mime.types +73 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/config/nginx.conf.erb +150 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/config/nginx_proxy.conf +11 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/config/redis.yml.erb +6 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/monit.tt +5 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/templates/bin/%job_name%_ctl.tt +36 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/templates/bin/monit_debugger +13 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/templates/data/properties.sh.erb +10 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/templates/helpers/ctl_setup.sh +81 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/templates/helpers/ctl_utils.sh +156 -0
- data/lib/bosh/gen/generators/package_generator.rb +56 -10
- data/lib/bosh/gen/models.rb +1 -0
- data/lib/bosh/gen/models/bosh_config.rb +15 -0
- data/lib/bosh/gen/models/deployment_manifest.rb +5 -0
- data/lib/bosh/gen/version.rb +1 -1
- data/spec/fixtures/bosh_config/multiple_boshes.yml +34 -0
- data/spec/fixtures/deployment_manifests/2_jobs_1_ip_8196_disk.yml +2 -2
- data/spec/fixtures/deployment_manifests/2_jobs_2_ips_no_disk.yml +2 -2
- data/spec/generators/generator_spec_helper.rb +102 -0
- data/spec/generators/jobs/webapp_job_generator_spec.rb +68 -0
- data/spec/models/bosh_config_spec.rb +11 -0
- metadata +38 -8
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%/monit.tt +0 -5
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%/templates/%job_name%_ctl.tt +0 -62
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_rubyrack/monit.tt +0 -5
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_rubyrack/templates/%job_name%_ctl.tt +0 -64
data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%/templates/%job_name%_ctl.tt
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
|
3
|
-
# Control script to start/stop ruby/rack <%= job_name %> job on a BOSH controlled VM
|
4
|
-
#
|
5
|
-
# In local development, this script can be run manually. Examples below assume you are in the root of this release project.
|
6
|
-
#
|
7
|
-
# Start process example:
|
8
|
-
# APP_DIR=/path/to/<%= job_name %> RACK_ENV=development COMMAND=shotgun PORT=9393 jobs/<%= job_name %>/templates/<%= job_name %>_ctl start
|
9
|
-
#
|
10
|
-
# View STDOUT/STDERR logs:
|
11
|
-
# jobs/<%= job_name %>/templates/<%= job_name %>_ctl logs
|
12
|
-
#
|
13
|
-
# Clear logs:
|
14
|
-
# jobs/<%= job_name %>/templates/<%= job_name %>_ctl clearlogs
|
15
|
-
<% if command == "EXECUTABLE_SERVER" %>
|
16
|
-
# TODO - change "EXECUTABLE_SERVER" to the command to run
|
17
|
-
<% end %>
|
18
|
-
RUN_DIR=/var/vcap/sys/run/<%= job_name %>
|
19
|
-
LOG_DIR=/var/vcap/sys/log/<%= job_name %>
|
20
|
-
STORE=/var/vcap/store/<%= job_name %>
|
21
|
-
PIDFILE=$RUN_DIR/<%= job_name %>.pid
|
22
|
-
|
23
|
-
export PATH=/var/vcap/packages/ruby/bin:$PATH
|
24
|
-
|
25
|
-
COMMAND=${COMMAND:-/var/vcap/packages/<%= job_name %>/bin/<%= command %>}
|
26
|
-
HOME=${HOME:-/home/vcap}
|
27
|
-
|
28
|
-
case $1 in
|
29
|
-
|
30
|
-
start)
|
31
|
-
mkdir -p $RUN_DIR
|
32
|
-
mkdir -p $LOG_DIR
|
33
|
-
mkdir -p $STORE
|
34
|
-
|
35
|
-
echo $$ > $PIDFILE
|
36
|
-
|
37
|
-
exec $COMMAND >>$LOG_DIR/<%= job_name %>.stdout.log 2>>$LOG_DIR/<%= job_name %>.stderr.log
|
38
|
-
;;
|
39
|
-
|
40
|
-
stop)
|
41
|
-
PID=$(head -1 $PIDFILE)
|
42
|
-
kill $PID
|
43
|
-
while [ -e /proc/$PID ]; do sleep 0.1; done
|
44
|
-
rm -f $PIDFILE
|
45
|
-
;;
|
46
|
-
|
47
|
-
logs)
|
48
|
-
cat $LOG_DIR/*
|
49
|
-
;;
|
50
|
-
|
51
|
-
tail)
|
52
|
-
tail -f $LOG_DIR/*
|
53
|
-
;;
|
54
|
-
|
55
|
-
clearlogs)
|
56
|
-
rm $LOG_DIR/*
|
57
|
-
;;
|
58
|
-
|
59
|
-
*)
|
60
|
-
echo "Usage: <%= job_name %>_ctl {start|stop|logs|tail|clearlogs}" ;;
|
61
|
-
esac
|
62
|
-
exit 0
|
@@ -1,64 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
|
3
|
-
# Control script to start/stop ruby/rack <%= job_name %> job on a BOSH controlled VM
|
4
|
-
#
|
5
|
-
# In local development, this script can be run manually. Examples below assume you are in the root of this release project.
|
6
|
-
#
|
7
|
-
# Start process example:
|
8
|
-
# APP_DIR=/path/to/<%= job_name %> RACK_ENV=development COMMAND=shotgun PORT=9393 jobs/<%= job_name %>/templates/<%= job_name %>_ctl start
|
9
|
-
#
|
10
|
-
# View STDOUT/STDERR logs:
|
11
|
-
# jobs/<%= job_name %>/templates/<%= job_name %>_ctl logs
|
12
|
-
#
|
13
|
-
# Clear logs:
|
14
|
-
# jobs/<%= job_name %>/templates/<%= job_name %>_ctl clearlogs
|
15
|
-
|
16
|
-
RUN_DIR=/var/vcap/sys/run/<%= job_name %>
|
17
|
-
LOG_DIR=/var/vcap/sys/log/<%= job_name %>
|
18
|
-
STORE=/var/vcap/store/<%= job_name %>
|
19
|
-
PIDFILE=$RUN_DIR/<%= job_name %>.pid
|
20
|
-
|
21
|
-
export PATH=/var/vcap/packages/ruby/bin:$PATH
|
22
|
-
|
23
|
-
COMMAND=${COMMAND:-/var/vcap/packages/ruby/bin/bundle exec rackup}
|
24
|
-
APP_DIR=${APP_DIR:-/var/vcap/packages/<%= job_name %>/}
|
25
|
-
PORT=${PORT:-5000}
|
26
|
-
RACK_ENV=${RACK_ENV:-production}
|
27
|
-
HOME=${HOME:-/home/vcap}
|
28
|
-
|
29
|
-
case $1 in
|
30
|
-
|
31
|
-
start)
|
32
|
-
mkdir -p $RUN_DIR
|
33
|
-
mkdir -p $LOG_DIR
|
34
|
-
mkdir -p $STORE
|
35
|
-
|
36
|
-
echo $$ > $PIDFILE
|
37
|
-
|
38
|
-
cd $APP_DIR
|
39
|
-
exec ${COMMAND} -p $PORT -E $RACK_ENV >>$LOG_DIR/<%= job_name %>.stdout.log 2>>$LOG_DIR/<%= job_name %>.stderr.log
|
40
|
-
;;
|
41
|
-
|
42
|
-
stop)
|
43
|
-
PID=$(head -1 $PIDFILE)
|
44
|
-
kill $PID
|
45
|
-
while [ -e /proc/$PID ]; do sleep 0.1; done
|
46
|
-
rm -f $PIDFILE
|
47
|
-
;;
|
48
|
-
|
49
|
-
logs)
|
50
|
-
cat $LOG_DIR/*
|
51
|
-
;;
|
52
|
-
|
53
|
-
tail)
|
54
|
-
tail -f $LOG_DIR/*
|
55
|
-
;;
|
56
|
-
|
57
|
-
clearlogs)
|
58
|
-
rm $LOG_DIR/*
|
59
|
-
;;
|
60
|
-
|
61
|
-
*)
|
62
|
-
echo "Usage: <%= job_name %>_ctl {start|stop|logs|tail|clearlogs}" ;;
|
63
|
-
esac
|
64
|
-
exit 0
|