bosh-gen 0.21.2 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 220370bb8fce75c26a0efc1b700f1f06e0b3074e
4
- data.tar.gz: 302b3326a5e96e42a7b8030b4d2aa257021bc173
3
+ metadata.gz: 0f17041e4f4a608b4955a09e655c62d200689525
4
+ data.tar.gz: 47bb082f621ca64763a7a19cacc10323415fcb3c
5
5
  SHA512:
6
- metadata.gz: 3743eb084477e1742a2b70e6561011ef7990a729a403fab4fa37700cd9df0213f304a8b705e8b2042b8a8c585af20302a1f0447c68c5685d4d2ddfc35a1e85e0
7
- data.tar.gz: 032cea4dc24395c9518e5b5af0c7f4d7a2d547931bee166a47ef01404c11732be6ce2763610980bf1f75202381a2568a790a4fdfb2d2a0f3210bde5bd4a0d585
6
+ metadata.gz: 70495c5c389f7692dfef781d6c95993195cb8f2fea2cf73e80e550469a06cd56590bbe4f3ccac7485f44b0e1815f2debd8f399dadfd8bcbe845534af5cc42925
7
+ data.tar.gz: 03a70228d6950940a1f525b64443ba550b4f235df569be262e7dba4781ceeaf99437defb5fc1c0489f216bf8f8233a57d84f7b51d6f41621cc63c4e86f1fcd83
@@ -1,6 +1,15 @@
1
1
  Change Log
2
2
  ==========
3
3
 
4
+ v0.22.0
5
+
6
+ Thanks to James Hunt, Quintessence Anx, and Long Nguyen for this version!
7
+
8
+ - Fixed stemcell URLs from `bosh public stemcells` to https://bosh.io
9
+ - Randomize Warden Network definitions so they don't always clash
10
+ - Unify stdout/stderr log files everywhere
11
+ - Fixed issue where dir cpi was found as `warden_cpi' not`warden'
12
+
4
13
  v0.21.0
5
14
 
6
15
  - `new` assumes using [spruce](https://github.com/geofffranks/spruce) instead of spiff. Yay!
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ require "rspec/core/rake_task"
6
6
 
7
7
  desc "Run Tests"
8
8
  RSpec::Core::RakeTask.new(:spec) do |t|
9
- t.pattern = "spec/unit/**/*_spec.rb"
9
+ t.pattern = "spec/{generators,models}/**/*_spec.rb"
10
10
  t.rspec_opts = %w(--format progress --color)
11
11
  end
12
12
 
@@ -38,8 +38,7 @@ link_job_file() {
38
38
  redirect_output() {
39
39
  SCRIPT=$1
40
40
  mkdir -p /var/vcap/sys/log/monit
41
- exec 1>> /var/vcap/sys/log/monit/$SCRIPT.log
42
- exec 2>> /var/vcap/sys/log/monit/$SCRIPT.err.log
41
+ exec 1>> /var/vcap/sys/log/monit/$SCRIPT.log 2>&1
43
42
  }
44
43
 
45
44
  pid_guard() {
@@ -34,14 +34,12 @@ then
34
34
  MIN_THREADS=<%= (puma_threads && puma_threads.min) || 0 %>
35
35
  MAX_THREADS=<%= (puma_threads && puma_threads.max) || 16 %>
36
36
  exec bundle exec puma --pidfile $PIDFILE -p $PORT -t $MIN_THREADS:$MAX_THREADS \
37
- >>$LOG_DIR/webapp.stdout.log \
38
- 2>>$LOG_DIR/webapp.stderr.log || exit 1
37
+ >>$LOG_DIR/webapp.stdout.log 2>&1 || exit 1
39
38
 
40
39
  elif [[ "${appstack}" = "rackup" ]]
41
40
  then
42
41
  exec bundle exec rackup -D -P $PIDFILE -p $PORT \
43
- >>$LOG_DIR/webapp.stdout.log \
44
- 2>>$LOG_DIR/webapp.stderr.log || exit 1
42
+ >>$LOG_DIR/webapp.stdout.log 2>&1 || exit 1
45
43
 
46
44
  elif [[ "${appstack}" = "phpfpm" || "${appstack}" = "php-fpm" ]]
47
45
  then
@@ -30,8 +30,7 @@ link_job_file_to_package() {
30
30
  redirect_output() {
31
31
  SCRIPT=$1
32
32
  mkdir -p /var/vcap/sys/log/monit
33
- exec 1>> /var/vcap/sys/log/monit/$SCRIPT.log
34
- exec 2>> /var/vcap/sys/log/monit/$SCRIPT.err.log
33
+ exec 1>> /var/vcap/sys/log/monit/$SCRIPT.log 2>&1
35
34
  }
36
35
 
37
36
  pid_guard() {
@@ -24,8 +24,7 @@ case $1 in
24
24
 
25
25
  exec /var/vcap/packages/nginx_next/sbin/nginx \
26
26
  -c $JOB_DIR/config/nginx.conf \
27
- >>$LOG_DIR/nginx.stdout.log \
28
- 2>>$LOG_DIR/nginx.stderr.log
27
+ >>$LOG_DIR/nginx.log 2>&1
29
28
  ;;
30
29
 
31
30
  stop)
@@ -28,8 +28,7 @@ function run_migrations() {
28
28
 
29
29
  echo "Running migrations"
30
30
  bundle exec ${migration_command} \
31
- >>$LOG_DIR/db_migrate.stdout.log \
32
- 2>>$LOG_DIR/db_migrate.stderr.log
31
+ >>$LOG_DIR/db_migrate.log 2>&1
33
32
  if [ $? != 0 ]; then
34
33
  echo "Migrations failed"
35
34
  exit 1
@@ -18,8 +18,7 @@ case $1 in
18
18
  echo $$ > $PIDFILE
19
19
 
20
20
  exec chpst -u vcap:vcap <%= job_name %> \
21
- >>$LOG_DIR/$JOB_NAME.stdout.log \
22
- 2>>$LOG_DIR/$JOB_NAME.stderr.log
21
+ >>$LOG_DIR/$JOB_NAME.log 2>&1
23
22
 
24
23
  ;;
25
24
 
@@ -38,8 +38,7 @@ link_job_file() {
38
38
  redirect_output() {
39
39
  SCRIPT=$1
40
40
  mkdir -p /var/vcap/sys/log/monit
41
- exec 1>> /var/vcap/sys/log/monit/$SCRIPT.log
42
- exec 2>> /var/vcap/sys/log/monit/$SCRIPT.err.log
41
+ exec 1>> /var/vcap/sys/log/monit/$SCRIPT.log 2>&1
43
42
  }
44
43
 
45
44
  pid_guard() {
@@ -191,6 +191,10 @@ module Bosh::Gen
191
191
  @project_name ||= File.basename(proposed_app_path).gsub(/-(?:boshrelease|release)$/, '')
192
192
  end
193
193
 
194
+ def warden_net
195
+ @warden_net ||= "10.244.#{rand(255) + 1}"
196
+ end
197
+
194
198
  def job_name
195
199
  project_name_underscored
196
200
  end
@@ -29,8 +29,8 @@ networks:
29
29
  - name: <%= project_name_underscored %>1
30
30
  type: manual
31
31
  subnets:
32
- - range: 10.244.2.0/24
32
+ - range: <%= warden_net %>.0/24
33
33
  name: <%= project_name_underscored %>1
34
- gateway: 10.244.2.1
34
+ gateway: <%= warden_net %>.1
35
35
  static:
36
- - 10.244.2.2-10.244.2.60
36
+ - <%= warden_net %>.2 - <%= warden_net %>.60
@@ -7,32 +7,41 @@ STEMCELL_OS=${STEMCELL_OS:-ubuntu}
7
7
 
8
8
  infrastructure=$1
9
9
 
10
- if [ "$infrastructure" != "aws-ec2" ] && \
11
- [ "$infrastructure" != "warden" ] ; then
12
- echo "usage: ./make_manifest <aws-ec2|warden>"
10
+ fail() {
11
+ echo >&2 $*
12
+ }
13
+
14
+ if [[ "$infrastructure" != "aws-ec2" && "$infrastructure" != "warden" ]] ; then
15
+ fail "usage: ./make_manifest <aws-ec2|warden>"
13
16
  exit 1
14
17
  fi
15
18
 
19
+ case "${infrastructure}/${STEMCELL_OS}" in
20
+ (warden/*) STEMCELL_URL="https://bosh.io/d/stemcells/bosh-warden-boshlite-ubuntu-trusty-go_agent" ;;
21
+ (aws-ec2/ubuntu) STEMCELL_URL="https://bosh.io/d/stemcells/bosh-aws-xen-ubuntu-trusty-go_agent" ;;
22
+ (aws-ec2/centos) STEMCELL_URL="https://bosh.io/d/stemcells/bosh-aws-xen-centos-7-go_agent" ;;
23
+ (*)
24
+ fail "Invalid infrastructure or OS specified."
25
+ exit 1
26
+ ;;
27
+ esac
28
+
16
29
  shift
17
30
 
18
31
  BOSH_STATUS=$(bosh status)
19
32
  DIRECTOR_UUID=$(echo "$BOSH_STATUS" | grep UUID | awk '{print $2}')
20
- DIRECTOR_CPI=$(echo "$BOSH_STATUS" | grep CPI | awk '{print $2}')
33
+ DIRECTOR_CPI=$(echo "$BOSH_STATUS" | grep CPI | awk '{print $2}' | sed -e 's/_cpi//')
21
34
  DIRECTOR_NAME=$(echo "$BOSH_STATUS" | grep Name | awk '{print $2}')
22
35
  NAME=$template_prefix-$infrastructure
23
36
 
24
- if [[ $DIRECTOR_NAME = "warden" ]]; then
25
- if [[ $infrastructure != "warden" ]]; then
26
- echo "Not targeting bosh-lite with warden CPI. Please use 'bosh target' before running this script."
27
- exit 1
28
- fi
37
+ if [[ $DIRECTOR_NAME = "warden" && ${infrastructure} != "warden" ]]; then
38
+ fail "Not targeting bosh-lite with warden CPI. Please make sure you have run 'bosh target' and are targeting a BOSH lite before running this script."
39
+ exit 1
29
40
  fi
30
41
 
31
- if [[ $infrastructure = "aws-ec2" ]]; then
32
- if [[ $DIRECTOR_CPI != "aws" ]]; then
33
- echo "Not targeting an AWS BOSH. Please use 'bosh target' before running this script."
34
- exit 1
35
- fi
42
+ if [[ $infrastructure = "aws-ec2" && ${DIRECTOR_CPI} != "aws" ]]; then
43
+ fail "Not targeting an AWS BOSH. Please make sure you have run 'bosh target' and are targeting an AWS BOSH before running this script."
44
+ exit 1
36
45
  fi
37
46
 
38
47
  function latest_uploaded_stemcell {
@@ -40,7 +49,7 @@ function latest_uploaded_stemcell {
40
49
  }
41
50
 
42
51
  STEMCELL=${STEMCELL:-$(latest_uploaded_stemcell)}
43
- if [[ "${STEMCELL}X" == "X" ]]; then
52
+ if [[ -z ${STEMCELL} ]]; then
44
53
  echo
45
54
  echo "Uploading latest $DIRECTOR_CPI/$STEMCELL_OS stemcell..."
46
55
  STEMCELL_URL=$(bosh public stemcells --full | grep $DIRECTOR_CPI | grep $STEMCELL_OS | sort -nr | head -n1 | awk '{ print $4 }')
@@ -19,9 +19,8 @@ case $1 in
19
19
 
20
20
  time docker \
21
21
  --host unix:///var/vcap/sys/run/docker/docker.sock \
22
- load -i /var/vcap/packages/<%= package_name %>/<%= image_filename %>
23
- >>$LOG_DIR/$JOB_NAME.stdout.log \
24
- 2>>$LOG_DIR/$JOB_NAME.stderr.log
22
+ load -i /var/vcap/packages/<%= package_name %>/<%= image_filename %> \
23
+ >>$LOG_DIR/$JOB_NAME.log 2>&1
25
24
 
26
25
  # do nothing forever
27
26
  exec tail -f /dev/null
@@ -38,8 +38,7 @@ link_job_file() {
38
38
  redirect_output() {
39
39
  SCRIPT=$1
40
40
  mkdir -p /var/vcap/sys/log/monit
41
- exec 1>> /var/vcap/sys/log/monit/$SCRIPT.log
42
- exec 2>> /var/vcap/sys/log/monit/$SCRIPT.err.log
41
+ exec 1>> /var/vcap/sys/log/monit/$SCRIPT.log 2>&1
43
42
  }
44
43
 
45
44
  pid_guard() {
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module Gen
3
- VERSION = "0.21.2"
3
+ VERSION = "0.22.0"
4
4
  end
5
5
  end
@@ -18,7 +18,7 @@ describe Bosh::Gen::Generators::JobGenerator do
18
18
  generate_job("mywebapp")
19
19
  expect(File.exist?("jobs/mywebapp/monit")).to eq(true)
20
20
  expect(File.exist?("jobs/mywebapp/spec")).to eq(true)
21
- job_template_exists "mywebapp", "bin/mywebapp_ctl", "bin/mywebapp_ctl"
21
+ job_template_exists "mywebapp", "bin/ctl", "bin/ctl"
22
22
  job_template_exists "mywebapp", "bin/monit_debugger", "bin/monit_debugger"
23
23
  job_template_exists "mywebapp", "data/properties.sh.erb", "data/properties.sh"
24
24
  job_template_exists "mywebapp", "helpers/ctl_setup.sh", "helpers/ctl_setup.sh"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh-gen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.2
4
+ version: 0.22.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dr Nic Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-09 00:00:00.000000000 Z
11
+ date: 2015-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor