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.
Files changed (47) hide show
  1. data/ChangeLog.md +13 -0
  2. data/lib/bosh/gen/cli.rb +45 -29
  3. data/lib/bosh/gen/generators/deployment_manifest_generator.rb +7 -3
  4. data/lib/bosh/gen/generators/extract_job_generator.rb +37 -6
  5. data/lib/bosh/gen/generators/extract_package_generator.rb +23 -5
  6. data/lib/bosh/gen/generators/job_generator.rb +34 -16
  7. data/lib/bosh/gen/generators/job_generator/templates/examples/%job_name%_nginx_rack/nginx_puma_migrate.yml +14 -0
  8. data/lib/bosh/gen/generators/job_generator/templates/examples/%job_name%_nginx_rack/nginx_rackup.yml.tt +8 -0
  9. data/lib/bosh/gen/generators/job_generator/templates/examples/%job_name%_simple/default.yml +2 -0
  10. data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/monit.tt +13 -0
  11. data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/%job_name%_rack_ctl.tt +59 -0
  12. data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/ctl_db_utils.sh.erb +54 -0
  13. data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/ctl_nginx.sh.erb +17 -0
  14. data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/ctl_redis_utils.sh.erb +18 -0
  15. data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/ctl_setup.sh.erb +48 -0
  16. data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/ctl_start.sh.erb +59 -0
  17. data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/ctl_utils.sh +148 -0
  18. data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/monit_debugger +13 -0
  19. data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/nginx_ctl.tt +41 -0
  20. data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/rails_ctl_setup.sh.erb +40 -0
  21. data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/config/database.yml.erb +17 -0
  22. data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/config/mime.types +73 -0
  23. data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/config/nginx.conf.erb +150 -0
  24. data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/config/nginx_proxy.conf +11 -0
  25. data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/config/redis.yml.erb +6 -0
  26. data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/monit.tt +5 -0
  27. data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/templates/bin/%job_name%_ctl.tt +36 -0
  28. data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/templates/bin/monit_debugger +13 -0
  29. data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/templates/data/properties.sh.erb +10 -0
  30. data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/templates/helpers/ctl_setup.sh +81 -0
  31. data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/templates/helpers/ctl_utils.sh +156 -0
  32. data/lib/bosh/gen/generators/package_generator.rb +56 -10
  33. data/lib/bosh/gen/models.rb +1 -0
  34. data/lib/bosh/gen/models/bosh_config.rb +15 -0
  35. data/lib/bosh/gen/models/deployment_manifest.rb +5 -0
  36. data/lib/bosh/gen/version.rb +1 -1
  37. data/spec/fixtures/bosh_config/multiple_boshes.yml +34 -0
  38. data/spec/fixtures/deployment_manifests/2_jobs_1_ip_8196_disk.yml +2 -2
  39. data/spec/fixtures/deployment_manifests/2_jobs_2_ips_no_disk.yml +2 -2
  40. data/spec/generators/generator_spec_helper.rb +102 -0
  41. data/spec/generators/jobs/webapp_job_generator_spec.rb +68 -0
  42. data/spec/models/bosh_config_spec.rb +11 -0
  43. metadata +38 -8
  44. data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%/monit.tt +0 -5
  45. data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%/templates/%job_name%_ctl.tt +0 -62
  46. data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_rubyrack/monit.tt +0 -5
  47. data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_rubyrack/templates/%job_name%_ctl.tt +0 -64
@@ -1,5 +0,0 @@
1
- check process <%= job_name %>
2
- with pidfile /var/vcap/sys/run/<%= job_name %>/<%= job_name %>.pid
3
- start program "/var/vcap/jobs/<%= job_name %>/bin/<%= job_name %>_ctl start"
4
- stop program "/var/vcap/jobs/<%= job_name %>/bin/<%= job_name %>_ctl stop"
5
- group vcap
@@ -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,5 +0,0 @@
1
- check process <%= job_name %>
2
- with pidfile /var/vcap/sys/run/<%= job_name %>/<%= job_name %>.pid
3
- start program "/var/vcap/jobs/<%= job_name %>/bin/<%= job_name %>_ctl start"
4
- stop program "/var/vcap/jobs/<%= job_name %>/bin/<%= job_name %>_ctl stop"
5
- group vcap
@@ -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