freighthop 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -29,34 +29,15 @@ This is a little involved at the moment (cuz alpha). Should simplify as the proj
29
29
  ### Get the prerequisites
30
30
 
31
31
  * Vagrant 1.3.1
32
- * VMWare Fusion (for now; will support VirtualBox soon)
33
- * Vagrant Plugins (install with `vagrant plugin install $pluginname`):
34
- * landrush (for DNS)
35
- * note you'll need to run `vagrant landrush install` to finish this installation procedure
36
- * vagrant-cachier (for apt caching; will eventually be optional)
37
- * vagrant-vmware-fusion (for now)
32
+ * And for DNS magic:
33
+ * `vagrant plugin install landrush`
34
+ * `vagrant landrush install`
38
35
 
39
36
 
40
- ### Clone the project
37
+ ### Install the gem
41
38
 
42
39
  ```
43
- git clone https://github.com/phinze/freighthop
44
- ```
45
-
46
- ### Gems and puppet modules
47
-
48
- ```
49
- bundle install
50
- librarian-puppet install
51
- ```
52
-
53
- ### Get the executable on your $PATH
54
-
55
- This is a hacky symlink for now; eventually we'll wrap the project up in a distributable package that will do this for you.
56
-
57
- ```
58
- cd freighthop
59
- ln -s bin/fh /usr/local/bin/fh
40
+ gem install freighthop
60
41
  ```
61
42
 
62
43
  ### Create config
data/bin/fh CHANGED
@@ -31,12 +31,16 @@ end
31
31
  subcommand, *rest = ARGV
32
32
  case subcommand
33
33
  when 'run' then
34
- exec vagrant_ssh(rest.join(' '))
34
+ `vagrant ssh-config > /tmp/freighthop.ssh-config`
35
+ exec %Q(ssh -t -F /tmp/freighthop.ssh-config #{PROJECT_NAME} 'cd #{PROJECT_DIR}; sudo /bin/bash -l -c "#{rest.join(' ')}"')
35
36
  when 'console' then
36
37
  `vagrant ssh-config > /tmp/freighthop.ssh-config`
37
- exec "ssh -t -F /tmp/freighthop.ssh-config #{PROJECT_NAME} 'sudo /bin/bash -l -c 'cd #{PROJECT_DIR}; #{console_command} #{rest.join(' ')}'"
38
+ exec %Q(ssh -t -F /tmp/freighthop.ssh-config #{PROJECT_NAME} 'sudo /bin/bash -l -c "cd #{PROJECT_DIR}; #{console_command} #{rest.join(' ')}"')
38
39
  when 'rake' then
39
40
  exec vagrant_ssh("bundle exec rake #{rest.join(' ')}")
41
+ when 'ssh' then
42
+ `vagrant ssh-config > /tmp/freighthop.ssh-config`
43
+ exec %Q(ssh -t -F /tmp/freighthop.ssh-config #{PROJECT_NAME} 'cd #{PROJECT_DIR}; sudo /bin/bash -l -i')
40
44
  else
41
45
  exec "/usr/bin/vagrant #{ARGV.join(' ')}"
42
46
  end
@@ -1,3 +1,3 @@
1
1
  module Freighthop
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -6,50 +6,32 @@ class freighthop(
6
6
  $app_name = $freighthop::params::app_name,
7
7
  $app_root = $freighthop::params::app_root,
8
8
  $web_root = $freighthop::params::web_root,
9
- $socket_dir = $freighthop::params::socket_dir,
10
- $socket_path = $freighthop::params::socket_path,
9
+ $web_port = $freighthop::params::web_port,
11
10
  $server_name = $freighthop::params::server_name,
12
11
  $ssl_cert_path = $freighthop::params::ssl_cert_path,
13
12
  $ssl_key_path = $freighthop::params::ssl_key_path,
14
13
  ) inherits freighthop::params {
15
- file { $socket_dir:
16
- ensure => directory,
17
- owner => 'vagrant',
18
- group => 'vagrant',
19
- mode => '0755'
20
- }
14
+ include apt
15
+
21
16
  class { 'freighthop::pkgs':
22
17
  packages => $packages,
23
- }
18
+ } ->
24
19
  class { 'freighthop::rbenv':
25
20
  ruby_version => $ruby_version
26
- }
21
+ } ->
27
22
  class { 'freighthop::nginx':
28
- upstream_socket_path => $socket_path,
29
- server_name => $server_name,
30
- web_root => $web_root,
31
- ssl_cert_path => $ssl_cert_path,
32
- ssl_key_path => $ssl_key_path,
33
- }
23
+ upstream_web_port => $web_port,
24
+ server_name => $server_name,
25
+ web_root => $web_root,
26
+ ssl_cert_path => $ssl_cert_path,
27
+ ssl_key_path => $ssl_key_path,
28
+ } ->
34
29
  class { 'freighthop::postgres':
35
30
  databases => $databases,
36
31
  database_users => $database_users,
37
- }
32
+ } ->
38
33
  class { 'freighthop::bundler':
39
34
  ruby_version => $ruby_version,
40
35
  app_root => $app_root,
41
36
  }
42
- class { 'freighthop::puma':
43
- app_root => $app_root,
44
- socket_path => $socket_path,
45
- }
46
-
47
- File[$socket_dir] ->
48
- Class['freighthop::pkgs'] ->
49
- Class['freighthop::rbenv'] ->
50
- Class['freighthop::nginx'] ->
51
- Class['freighthop::postgres'] ->
52
- Class['freighthop::bundler'] ->
53
- Class['freighthop::puma']
54
-
55
37
  }
@@ -1,5 +1,5 @@
1
1
  class freighthop::nginx(
2
- $upstream_socket_path,
2
+ $upstream_web_port,
3
3
  $server_name,
4
4
  $web_root,
5
5
  $ssl_cert_path,
@@ -3,8 +3,7 @@ class freighthop::params {
3
3
  $app_name = $::hostname
4
4
  $app_root = "/srv/${app_name}"
5
5
  $web_root = "${app_root}/public"
6
- $socket_dir = "/var/run/${app_name}"
7
- $socket_path = "${socket_dir}/puma.sock"
6
+ $web_port = 9292
8
7
  $server_name = $::fqdn
9
8
  $ssl_cert_path = "/etc/ssl/certs/${app_name}.pem"
10
9
  $ssl_key_path = "/etc/ssl/private/${app_name}.key"
@@ -2,6 +2,6 @@ class freighthop::pkgs(
2
2
  $packages
3
3
  ) {
4
4
  package { $packages:
5
- ensure => installed
5
+ ensure => installed,
6
6
  }
7
7
  }
@@ -1,7 +1,6 @@
1
1
  class freighthop::rbenv(
2
2
  $ruby_version
3
3
  ) {
4
- include apt
5
4
  apt::ppa { 'ppa:gds/govuk': }
6
5
  apt::ppa { 'ppa:phinze/rbenv': }
7
6
 
@@ -1,8 +1,5 @@
1
1
  upstream app_server {
2
- # fail_timeout=0 means we always retry an upstream even if it failed
3
- # to return a good HTTP response (in case the Unicorn master nukes a
4
- # single worker for timing out).
5
- server unix:<%= upstream_socket_path %> fail_timeout=0;
2
+ server localhost:<%= upstream_web_port %> fail_timeout=0;
6
3
  }
7
4
 
8
5
  server {
@@ -15,7 +15,9 @@
15
15
  description "Manages the set of puma processes"
16
16
 
17
17
  # This starts upon bootup and stops on shutdown
18
- start on runlevel [2345]
18
+ start on (filesystem
19
+ and mounted MOUNTPOINT=<%= app_root %>
20
+ and runlevel [2345])
19
21
  stop on runlevel [06]
20
22
 
21
23
  # Set this to the number of Puma processes you want
@@ -46,6 +46,8 @@ exec /bin/bash <<'EOT'
46
46
 
47
47
  logger -t puma "Starting server: $app"
48
48
 
49
+ mkdir -p <%= socket_dir %>
50
+
49
51
  exec bundle exec puma -b unix://<%= socket_path %>
50
52
  EOT
51
53
  end script
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: freighthop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-13 00:00:00.000000000 Z
12
+ date: 2013-09-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -118,18 +118,17 @@ files:
118
118
  - lib/freighthop.rb
119
119
  - lib/freighthop/version.rb
120
120
  - local_modules/freighthop/files/bundler/freighthop.gemfile
121
- - local_modules/freighthop/files/puma/upstart/puma-manager.conf
122
121
  - local_modules/freighthop/manifests/bundler.pp
123
122
  - local_modules/freighthop/manifests/init.pp
124
123
  - local_modules/freighthop/manifests/nginx.pp
125
124
  - local_modules/freighthop/manifests/params.pp
126
125
  - local_modules/freighthop/manifests/pkgs.pp
127
126
  - local_modules/freighthop/manifests/postgres.pp
128
- - local_modules/freighthop/manifests/puma.pp
129
127
  - local_modules/freighthop/manifests/rbenv.pp
130
128
  - local_modules/freighthop/manifests/redis.pp
131
129
  - local_modules/freighthop/templates/nginx/vagrant-rails.conf.erb
132
130
  - local_modules/freighthop/templates/profile/custom_bundler_gemfile.sh.erb
131
+ - local_modules/freighthop/templates/puma/upstart/puma-manager.conf.erb
133
132
  - local_modules/freighthop/templates/puma/upstart/puma.conf.erb
134
133
  - manifests/site.pp
135
134
  - modules/apt/CHANGELOG
@@ -149,6 +148,7 @@ files:
149
148
  - modules/apt/manifests/ppa.pp
150
149
  - modules/apt/manifests/release.pp
151
150
  - modules/apt/manifests/source.pp
151
+ - modules/apt/manifests/unattended_upgrades.pp
152
152
  - modules/apt/manifests/update.pp
153
153
  - modules/apt/metadata.json
154
154
  - modules/apt/Modulefile
@@ -160,6 +160,7 @@ files:
160
160
  - modules/apt/spec/classes/debian_unstable_spec.rb
161
161
  - modules/apt/spec/classes/params_spec.rb
162
162
  - modules/apt/spec/classes/release_spec.rb
163
+ - modules/apt/spec/classes/unattended_upgrades_spec.rb
163
164
  - modules/apt/spec/defines/builddep_spec.rb
164
165
  - modules/apt/spec/defines/conf_spec.rb
165
166
  - modules/apt/spec/defines/force_spec.rb
@@ -168,6 +169,8 @@ files:
168
169
  - modules/apt/spec/defines/ppa_spec.rb
169
170
  - modules/apt/spec/defines/source_spec.rb
170
171
  - modules/apt/spec/spec_helper.rb
172
+ - modules/apt/templates/10periodic.erb
173
+ - modules/apt/templates/50unattended-upgrades.erb
171
174
  - modules/apt/templates/pin.pref.erb
172
175
  - modules/apt/templates/source.list.erb
173
176
  - modules/apt/tests/builddep.pp
@@ -181,6 +184,7 @@ files:
181
184
  - modules/apt/tests/ppa.pp
182
185
  - modules/apt/tests/release.pp
183
186
  - modules/apt/tests/source.pp
187
+ - modules/apt/tests/unattended-upgrades.pp
184
188
  - modules/concat/CHANGELOG
185
189
  - modules/concat/files/concatfragments.sh
186
190
  - modules/concat/lib/facter/concat_basedir.rb
@@ -243,18 +247,17 @@ files:
243
247
  - modules/firewall/spec/unit/puppet/util/firewall_spec.rb
244
248
  - modules/firewall/spec/unit/puppet/util/ipcidr_spec.rb
245
249
  - modules/freighthop/files/bundler/freighthop.gemfile
246
- - modules/freighthop/files/puma/upstart/puma-manager.conf
247
250
  - modules/freighthop/manifests/bundler.pp
248
251
  - modules/freighthop/manifests/init.pp
249
252
  - modules/freighthop/manifests/nginx.pp
250
253
  - modules/freighthop/manifests/params.pp
251
254
  - modules/freighthop/manifests/pkgs.pp
252
255
  - modules/freighthop/manifests/postgres.pp
253
- - modules/freighthop/manifests/puma.pp
254
256
  - modules/freighthop/manifests/rbenv.pp
255
257
  - modules/freighthop/manifests/redis.pp
256
258
  - modules/freighthop/templates/nginx/vagrant-rails.conf.erb
257
259
  - modules/freighthop/templates/profile/custom_bundler_gemfile.sh.erb
260
+ - modules/freighthop/templates/puma/upstart/puma-manager.conf.erb
258
261
  - modules/freighthop/templates/puma/upstart/puma.conf.erb
259
262
  - modules/nginx/ChangeLog
260
263
  - modules/nginx/composer.json
@@ -636,7 +639,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
636
639
  version: '0'
637
640
  segments:
638
641
  - 0
639
- hash: -1509348936166327177
642
+ hash: 4257660574366765380
640
643
  required_rubygems_version: !ruby/object:Gem::Requirement
641
644
  none: false
642
645
  requirements:
@@ -645,7 +648,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
645
648
  version: '0'
646
649
  segments:
647
650
  - 0
648
- hash: -1509348936166327177
651
+ hash: 4257660574366765380
649
652
  requirements: []
650
653
  rubyforge_project:
651
654
  rubygems_version: 1.8.23
@@ -1,36 +0,0 @@
1
- class freighthop::puma(
2
- $app_root,
3
- $socket_path,
4
- ) {
5
- package { 'puma':
6
- ensure => 'installed',
7
- provider => 'gem'
8
- }
9
- file { '/etc/init/puma.conf':
10
- owner => 'root',
11
- group => 'root',
12
- mode => '0644',
13
- content => template('freighthop/puma/upstart/puma.conf.erb')
14
- }
15
- file { '/etc/puma.conf':
16
- owner => 'root',
17
- group => 'root',
18
- mode => '0644',
19
- content => "${app_root}\n"
20
- }
21
- file { '/etc/init/puma-manager.conf':
22
- owner => 'root',
23
- group => 'root',
24
- mode => '0644',
25
- source => 'puppet:///modules/freighthop/puma/upstart/puma-manager.conf',
26
- require => [
27
- File['/etc/init/puma.conf'],
28
- File['/etc/puma.conf'],
29
- ],
30
- notify => Service['puma-manager']
31
- }
32
- service { 'puma-manager':
33
- ensure => 'running',
34
- provider => 'upstart'
35
- }
36
- }