freighthop 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/Puppetfile +1 -1
  2. data/Puppetfile.lock +1 -1
  3. data/README.md +9 -16
  4. data/lib/freighthop/config.rb +2 -2
  5. data/lib/freighthop/version.rb +1 -1
  6. data/lib/freighthop.rb +1 -1
  7. data/local_modules/freighthop/manifests/{postgres.pp → database/postgres.pp} +2 -2
  8. data/local_modules/freighthop/manifests/database.pp +12 -0
  9. data/local_modules/freighthop/manifests/init.pp +33 -32
  10. data/local_modules/freighthop/manifests/language/clojure.pp +36 -0
  11. data/{modules/freighthop/manifests/rbenv.pp → local_modules/freighthop/manifests/language/ruby.pp} +8 -8
  12. data/local_modules/freighthop/manifests/language.pp +14 -0
  13. data/local_modules/freighthop/manifests/packages.pp +22 -0
  14. data/local_modules/freighthop/manifests/params.pp +14 -10
  15. data/{modules/freighthop/manifests/nginx.pp → local_modules/freighthop/manifests/web.pp} +2 -2
  16. data/local_modules/freighthop/templates/profile/leiningen.sh.erb +4 -0
  17. data/modules/freighthop/manifests/{postgres.pp → database/postgres.pp} +2 -2
  18. data/modules/freighthop/manifests/database.pp +12 -0
  19. data/modules/freighthop/manifests/init.pp +33 -32
  20. data/modules/freighthop/manifests/language/clojure.pp +36 -0
  21. data/{local_modules/freighthop/manifests/rbenv.pp → modules/freighthop/manifests/language/ruby.pp} +8 -8
  22. data/modules/freighthop/manifests/language.pp +14 -0
  23. data/modules/freighthop/manifests/packages.pp +22 -0
  24. data/modules/freighthop/manifests/params.pp +14 -10
  25. data/{local_modules/freighthop/manifests/nginx.pp → modules/freighthop/manifests/web.pp} +2 -2
  26. data/modules/freighthop/templates/profile/leiningen.sh.erb +4 -0
  27. metadata +20 -26
  28. data/local_modules/freighthop/files/bundler/freighthop.gemfile +0 -3
  29. data/local_modules/freighthop/manifests/bundler.pp +0 -34
  30. data/local_modules/freighthop/manifests/pkgs.pp +0 -7
  31. data/local_modules/freighthop/manifests/ppas.pp +0 -9
  32. data/local_modules/freighthop/manifests/redis.pp +0 -9
  33. data/local_modules/freighthop/templates/profile/custom_bundler_gemfile.sh.erb +0 -1
  34. data/local_modules/freighthop/templates/puma/upstart/puma-manager.conf.erb +0 -33
  35. data/local_modules/freighthop/templates/puma/upstart/puma.conf.erb +0 -53
  36. data/modules/freighthop/files/bundler/freighthop.gemfile +0 -3
  37. data/modules/freighthop/manifests/bundler.pp +0 -34
  38. data/modules/freighthop/manifests/pkgs.pp +0 -7
  39. data/modules/freighthop/manifests/ppas.pp +0 -9
  40. data/modules/freighthop/manifests/redis.pp +0 -9
  41. data/modules/freighthop/templates/profile/custom_bundler_gemfile.sh.erb +0 -1
  42. data/modules/freighthop/templates/puma/upstart/puma-manager.conf.erb +0 -33
  43. data/modules/freighthop/templates/puma/upstart/puma.conf.erb +0 -53
data/Puppetfile CHANGED
@@ -1,6 +1,6 @@
1
1
  forge 'http://forge.puppetlabs.com'
2
2
 
3
- mod 'puppetlabs/stdlib'
3
+ mod 'puppetlabs/stdlib', '4.1.0'
4
4
  mod 'puppetlabs/apt'
5
5
  mod 'gdsoperations/rbenv'
6
6
  mod 'nginx', :git => 'https://github.com/jfryman/puppet-nginx'
data/Puppetfile.lock CHANGED
@@ -33,5 +33,5 @@ DEPENDENCIES
33
33
  nginx (>= 0)
34
34
  puppetlabs/apt (>= 0)
35
35
  puppetlabs/postgresql (>= 0)
36
- puppetlabs/stdlib (>= 0)
36
+ puppetlabs/stdlib (= 4.1.0)
37
37
 
data/README.md CHANGED
@@ -1,17 +1,16 @@
1
- # Freighthop: Vagrant on Rails
2
-
1
+ # Freighthop: Hitch a Ride on Vagrant
3
2
 
4
3
  Don't you hate how your dev machine inevitably becomes the superset of all the dependencies of every project you ever worked on? Nobody wants to live in a war zone of data stores fighting for resources.
5
4
 
6
- Vagrant is suppose to help us with this. Package everything in virtual machines, and your life will be amazing! That's the idea at least; but the actual mechanics of getting to that promised land are not all that clear.
5
+ Vagrant is supposed to help us with this. Package everything in virtual machines, and your life will be amazing! That's the idea at least; but the actual mechanics of getting to that promised land are not all that clear.
7
6
 
8
7
  ## What is Freighthop?
9
8
 
10
9
  Freighthop is based around this simple goal:
11
10
 
12
- > When I download a rails project, I want to run a single command that spins me up a VM serving that project.
11
+ > When I download a project, I want to run a single command that spins me up a VM serving said project.
13
12
 
14
- With a few commands from the project root of any Rack-compatible app, Freighthop can spin up a VM that serves that project at `projectname.vagrant.dev`. Freighthop takes care of the bundle install, the server configuration, and the database, and it provides a helper executable that allows you to interact with the VM.
13
+ With a few commands from the project root of any `{Ruby,Clojure}` web app, Freighthop can spin up a VM that serves that project at `projectname.vagrant.dev`. Freighthop takes care of package install, the server configuration, and the database, and it provides`fh`, a friendly helper executable that allows you to interact with the VM.
15
14
 
16
15
  ----
17
16
 
@@ -24,8 +23,6 @@ With a few commands from the project root of any Rack-compatible app, Freighthop
24
23
 
25
24
  ## Try it out
26
25
 
27
- This is a little involved at the moment (cuz alpha). Should simplify as the project evolves.
28
-
29
26
  ### Get the prerequisites
30
27
 
31
28
  * Vagrant 1.3.1
@@ -46,16 +43,10 @@ A Freighthop-enabled project just needs to include a `.freighthop.json` somethin
46
43
 
47
44
  ```json
48
45
  {
46
+ "freighthop::languages": ["ruby"],
49
47
  "freighthop::ruby_version": "2.0.0-p247",
50
- "freighthop::databases": [
51
- "myproject_development",
52
- "myproject_test"
53
- ],
54
- "freighthop::database_users": [
55
- "myproject"
56
- ],
48
+ "freighthop::web_port": 9292,
57
49
  "freighthop::packages": [
58
- "git-core",
59
50
  "libpq-dev",
60
51
  "libsqlite3-dev",
61
52
  "libxml2-dev",
@@ -72,6 +63,8 @@ A Freighthop-enabled project just needs to include a `.freighthop.json` somethin
72
63
  fh up
73
64
  # run your migrations
74
65
  fh rake db:migrate
66
+ # spin up your server
67
+ fh run rackup
75
68
  ```
76
69
 
77
70
  ### Win
@@ -85,7 +78,7 @@ curl http://myproject.vagrant.dev
85
78
  ### Shut 'er down
86
79
 
87
80
  ```
88
- fh down
81
+ fh halt
89
82
  ```
90
83
 
91
84
  And your host system is none the wiser! No databases lying around, no daemons hanging out forever in the background; squeaky clean!
@@ -7,7 +7,7 @@ class Freighthop::Config
7
7
  @config = JSON.parse(file.read)
8
8
  end
9
9
 
10
- def self.fetch(key)
11
- config[key]
10
+ def self.fetch(*args)
11
+ config.fetch(*args)
12
12
  end
13
13
  end
@@ -1,3 +1,3 @@
1
1
  module Freighthop
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/lib/freighthop.rb CHANGED
@@ -41,7 +41,7 @@ module Freighthop
41
41
  end
42
42
 
43
43
  def mounts
44
- Freighthop::Config.fetch("freighthop::mounts").map do |host, guest|
44
+ Freighthop::Config.fetch('freighthop::mounts', []).map do |host, guest|
45
45
  [
46
46
  File.expand_path(host_root.join(host)),
47
47
  File.expand_path(guest_root.join(guest)),
@@ -1,6 +1,6 @@
1
- class freighthop::postgres(
1
+ class freighthop::database::postgres(
2
2
  $databases,
3
- $database_users
3
+ $database_users,
4
4
  ) {
5
5
  include postgresql::server
6
6
 
@@ -0,0 +1,12 @@
1
+ class freighthop::database(
2
+ $database_flavors,
3
+ $databases,
4
+ $database_users
5
+ ) {
6
+ if (member($database_flavors, 'postgres')) {
7
+ class { 'freighthop::database::postgres':
8
+ databases => $databases,
9
+ database_users => $database_users,
10
+ }
11
+ }
12
+ }
@@ -1,41 +1,42 @@
1
1
  class freighthop(
2
- $databases,
3
- $database_users,
4
- $packages = $freighthop::params::packages,
5
- $ppas = $freighthop::params::ppas,
6
- $ruby_version = $freighthop::params::ruby_version,
7
- $app_name = $freighthop::params::app_name,
8
- $app_root = $freighthop::params::app_root,
9
- $web_root = $freighthop::params::web_root,
10
- $web_port = $freighthop::params::web_port,
11
- $server_name = $freighthop::params::server_name,
12
- $ssl_cert_path = $freighthop::params::ssl_cert_path,
13
- $ssl_key_path = $freighthop::params::ssl_key_path,
2
+ $ppas = $freighthop::params::ppas,
3
+ $packages = $freighthop::params::packages,
4
+ $languages = $freighthop::params::languages,
5
+ $database_flavors = $freighthop::params::database_flavors,
6
+ $databases = $freighthop::params::databases,
7
+ $database_users = $freighthop::params::database_users,
8
+ $ruby_version = $freighthop::params::ruby_version,
9
+ $app_name = $freighthop::params::app_name,
10
+ $app_root = $freighthop::params::app_root,
11
+ $web_root = $freighthop::params::web_root,
12
+ $web_port = $freighthop::params::web_port,
13
+ $server_name = $freighthop::params::server_name,
14
+ $ssl_cert_path = $freighthop::params::ssl_cert_path,
15
+ $ssl_key_path = $freighthop::params::ssl_key_path,
14
16
  ) inherits freighthop::params {
15
- include apt
16
17
 
17
- class { 'freighthop::ppas':
18
- ppas => $ppas,
18
+ class { 'freighthop::packages':
19
+ ppas => $ppas,
20
+ packages => $packages,
21
+ languages => $languages,
19
22
  } ->
20
- class { 'freighthop::pkgs':
21
- packages => $packages,
22
- } ->
23
- class { 'freighthop::rbenv':
23
+
24
+ class { 'freighthop::language':
25
+ languages => $languages,
24
26
  ruby_version => $ruby_version
25
27
  } ->
26
- class { 'freighthop::nginx':
27
- upstream_web_port => $web_port,
28
- server_name => $server_name,
29
- web_root => $web_root,
30
- ssl_cert_path => $ssl_cert_path,
31
- ssl_key_path => $ssl_key_path,
32
- } ->
33
- class { 'freighthop::postgres':
34
- databases => $databases,
35
- database_users => $database_users,
28
+
29
+ class { 'freighthop::web':
30
+ upstream_web_port => $web_port,
31
+ server_name => $server_name,
32
+ web_root => $web_root,
33
+ ssl_cert_path => $ssl_cert_path,
34
+ ssl_key_path => $ssl_key_path,
36
35
  } ->
37
- class { 'freighthop::bundler':
38
- ruby_version => $ruby_version,
39
- app_root => $app_root,
36
+
37
+ class { 'freighthop::database':
38
+ database_flavors => $database_flavors,
39
+ databases => $databases,
40
+ database_users => $database_users,
40
41
  }
41
42
  }
@@ -0,0 +1,36 @@
1
+ class freighthop::language::clojure(
2
+ ){
3
+ $lein_url = 'https://github.com/technomancy/leiningen/raw/stable/bin/lein'
4
+ $lein_home = '/usr/local/lein'
5
+
6
+ package { 'leiningen/java':
7
+ name => 'openjdk-6-jdk'
8
+ } ->
9
+
10
+ package { 'leiningen/install-wget':
11
+ name => 'wget',
12
+ } ->
13
+
14
+ exec { 'leiningen/download-script':
15
+ cwd => '/usr/local/bin',
16
+ command => "wget ${lein_url} && chmod 755 lein",
17
+ creates => '/usr/local/bin/lein',
18
+ } ->
19
+
20
+ file { '/etc/profile.d/leiningen.sh':
21
+ content => template('freighthop/profile/leiningen.sh.erb'),
22
+ owner => 'root',
23
+ group => 'root',
24
+ mode => '0755',
25
+ }
26
+
27
+ Exec {
28
+ path => [
29
+ '/usr/local/bin',
30
+ '/usr/bin',
31
+ '/usr/sbin',
32
+ '/bin',
33
+ '/sbin',
34
+ ]
35
+ }
36
+ }
@@ -1,20 +1,20 @@
1
- class freighthop::rbenv(
2
- $ruby_version
3
- ) {
1
+ class freighthop::language::ruby(
2
+ $version
3
+ ){
4
4
  class { '::rbenv':
5
- global_version => $ruby_version,
5
+ global_version => $version,
6
6
  }
7
7
 
8
- rbenv::version { $ruby_version: }
8
+ rbenv::version { $version: }
9
9
 
10
10
  # The rbenv puppet module drops $RBENV_ROOT/version but the package from
11
11
  # ppa:gds/govuk is an older version of rbenv that expects $RBENV_ROOT/global;
12
12
  # this is a workaround that uses the installed CLI to fix it.
13
13
  exec { 'fix-rbenv-global-version':
14
- command => "rbenv global ${ruby_version}",
15
- unless => "rbenv global | grep '${ruby_version}'",
14
+ command => "rbenv global ${version}",
15
+ unless => "rbenv global | grep '${version}'",
16
16
  environment => 'RBENV_ROOT=/usr/lib/rbenv',
17
- require => Rbenv::Version[$ruby_version]
17
+ require => Rbenv::Version[$version]
18
18
  }
19
19
 
20
20
  Exec {
@@ -0,0 +1,14 @@
1
+ class freighthop::language(
2
+ $languages,
3
+ $ruby_version
4
+ ) {
5
+ if (member($languages, 'ruby')) {
6
+ class { 'freighthop::language::ruby':
7
+ version => $ruby_version,
8
+ }
9
+ }
10
+ if (member($languages, 'clojure')) {
11
+ class { 'freighthop::language::clojure':
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,22 @@
1
+ class freighthop::packages(
2
+ $ppas,
3
+ $packages,
4
+ $languages,
5
+ ) {
6
+ if (member($languages, 'ruby')) {
7
+ apt::ppa { 'ppa:gds/govuk': }
8
+ apt::ppa { 'ppa:phinze/rbenv': }
9
+ }
10
+ apt::ppa { $ppas: }
11
+
12
+ package { [
13
+ 'build-essential',
14
+ 'git-core',
15
+ ]:
16
+ ensure => installed,
17
+ }
18
+
19
+ package { $packages:
20
+ ensure => installed,
21
+ }
22
+ }
@@ -1,12 +1,16 @@
1
1
  class freighthop::params {
2
- $packages = ['git-core']
3
- $ppas = []
4
- $ruby_version = '1.9.3-p392'
5
- $app_name = $::hostname
6
- $app_root = "/srv/${app_name}"
7
- $web_root = "${app_root}/public"
8
- $web_port = 9292
9
- $server_name = $::fqdn
10
- $ssl_cert_path = "/etc/ssl/certs/${app_name}.pem"
11
- $ssl_key_path = "/etc/ssl/private/${app_name}.key"
2
+ $database_flavors = []
3
+ $databases = []
4
+ $database_users = []
5
+ $packages = ['git-core']
6
+ $ppas = []
7
+ $languages = ['ruby']
8
+ $ruby_version = '1.9.3-p392'
9
+ $app_name = $::hostname
10
+ $app_root = "/srv/${app_name}"
11
+ $web_root = "${app_root}/public"
12
+ $web_port = 3000
13
+ $server_name = $::fqdn
14
+ $ssl_cert_path = "/etc/ssl/certs/${app_name}.pem"
15
+ $ssl_key_path = "/etc/ssl/private/${app_name}.key"
12
16
  }
@@ -1,11 +1,11 @@
1
- class freighthop::nginx(
1
+ class freighthop::web(
2
2
  $upstream_web_port,
3
3
  $server_name,
4
4
  $web_root,
5
5
  $ssl_cert_path,
6
6
  $ssl_key_path,
7
7
  ) {
8
- $cert_subject = "/C=US/ST=IL/L=Chicago/O=Instructure/CN=${server_name}"
8
+ $cert_subject = "/C=US/ST=IL/L=Chicago/O=Freighthop/CN=${server_name}"
9
9
 
10
10
  class {'::nginx':
11
11
  confd_purge => true
@@ -0,0 +1,4 @@
1
+ # Point freighhop-installed leiningen to its global home
2
+ # And acknowledge that we're running everything as root
3
+ export LEIN_HOME=<%= lein_home %>
4
+ export LEIN_ROOT=1
@@ -1,6 +1,6 @@
1
- class freighthop::postgres(
1
+ class freighthop::database::postgres(
2
2
  $databases,
3
- $database_users
3
+ $database_users,
4
4
  ) {
5
5
  include postgresql::server
6
6
 
@@ -0,0 +1,12 @@
1
+ class freighthop::database(
2
+ $database_flavors,
3
+ $databases,
4
+ $database_users
5
+ ) {
6
+ if (member($database_flavors, 'postgres')) {
7
+ class { 'freighthop::database::postgres':
8
+ databases => $databases,
9
+ database_users => $database_users,
10
+ }
11
+ }
12
+ }
@@ -1,41 +1,42 @@
1
1
  class freighthop(
2
- $databases,
3
- $database_users,
4
- $packages = $freighthop::params::packages,
5
- $ppas = $freighthop::params::ppas,
6
- $ruby_version = $freighthop::params::ruby_version,
7
- $app_name = $freighthop::params::app_name,
8
- $app_root = $freighthop::params::app_root,
9
- $web_root = $freighthop::params::web_root,
10
- $web_port = $freighthop::params::web_port,
11
- $server_name = $freighthop::params::server_name,
12
- $ssl_cert_path = $freighthop::params::ssl_cert_path,
13
- $ssl_key_path = $freighthop::params::ssl_key_path,
2
+ $ppas = $freighthop::params::ppas,
3
+ $packages = $freighthop::params::packages,
4
+ $languages = $freighthop::params::languages,
5
+ $database_flavors = $freighthop::params::database_flavors,
6
+ $databases = $freighthop::params::databases,
7
+ $database_users = $freighthop::params::database_users,
8
+ $ruby_version = $freighthop::params::ruby_version,
9
+ $app_name = $freighthop::params::app_name,
10
+ $app_root = $freighthop::params::app_root,
11
+ $web_root = $freighthop::params::web_root,
12
+ $web_port = $freighthop::params::web_port,
13
+ $server_name = $freighthop::params::server_name,
14
+ $ssl_cert_path = $freighthop::params::ssl_cert_path,
15
+ $ssl_key_path = $freighthop::params::ssl_key_path,
14
16
  ) inherits freighthop::params {
15
- include apt
16
17
 
17
- class { 'freighthop::ppas':
18
- ppas => $ppas,
18
+ class { 'freighthop::packages':
19
+ ppas => $ppas,
20
+ packages => $packages,
21
+ languages => $languages,
19
22
  } ->
20
- class { 'freighthop::pkgs':
21
- packages => $packages,
22
- } ->
23
- class { 'freighthop::rbenv':
23
+
24
+ class { 'freighthop::language':
25
+ languages => $languages,
24
26
  ruby_version => $ruby_version
25
27
  } ->
26
- class { 'freighthop::nginx':
27
- upstream_web_port => $web_port,
28
- server_name => $server_name,
29
- web_root => $web_root,
30
- ssl_cert_path => $ssl_cert_path,
31
- ssl_key_path => $ssl_key_path,
32
- } ->
33
- class { 'freighthop::postgres':
34
- databases => $databases,
35
- database_users => $database_users,
28
+
29
+ class { 'freighthop::web':
30
+ upstream_web_port => $web_port,
31
+ server_name => $server_name,
32
+ web_root => $web_root,
33
+ ssl_cert_path => $ssl_cert_path,
34
+ ssl_key_path => $ssl_key_path,
36
35
  } ->
37
- class { 'freighthop::bundler':
38
- ruby_version => $ruby_version,
39
- app_root => $app_root,
36
+
37
+ class { 'freighthop::database':
38
+ database_flavors => $database_flavors,
39
+ databases => $databases,
40
+ database_users => $database_users,
40
41
  }
41
42
  }
@@ -0,0 +1,36 @@
1
+ class freighthop::language::clojure(
2
+ ){
3
+ $lein_url = 'https://github.com/technomancy/leiningen/raw/stable/bin/lein'
4
+ $lein_home = '/usr/local/lein'
5
+
6
+ package { 'leiningen/java':
7
+ name => 'openjdk-6-jdk'
8
+ } ->
9
+
10
+ package { 'leiningen/install-wget':
11
+ name => 'wget',
12
+ } ->
13
+
14
+ exec { 'leiningen/download-script':
15
+ cwd => '/usr/local/bin',
16
+ command => "wget ${lein_url} && chmod 755 lein",
17
+ creates => '/usr/local/bin/lein',
18
+ } ->
19
+
20
+ file { '/etc/profile.d/leiningen.sh':
21
+ content => template('freighthop/profile/leiningen.sh.erb'),
22
+ owner => 'root',
23
+ group => 'root',
24
+ mode => '0755',
25
+ }
26
+
27
+ Exec {
28
+ path => [
29
+ '/usr/local/bin',
30
+ '/usr/bin',
31
+ '/usr/sbin',
32
+ '/bin',
33
+ '/sbin',
34
+ ]
35
+ }
36
+ }
@@ -1,20 +1,20 @@
1
- class freighthop::rbenv(
2
- $ruby_version
3
- ) {
1
+ class freighthop::language::ruby(
2
+ $version
3
+ ){
4
4
  class { '::rbenv':
5
- global_version => $ruby_version,
5
+ global_version => $version,
6
6
  }
7
7
 
8
- rbenv::version { $ruby_version: }
8
+ rbenv::version { $version: }
9
9
 
10
10
  # The rbenv puppet module drops $RBENV_ROOT/version but the package from
11
11
  # ppa:gds/govuk is an older version of rbenv that expects $RBENV_ROOT/global;
12
12
  # this is a workaround that uses the installed CLI to fix it.
13
13
  exec { 'fix-rbenv-global-version':
14
- command => "rbenv global ${ruby_version}",
15
- unless => "rbenv global | grep '${ruby_version}'",
14
+ command => "rbenv global ${version}",
15
+ unless => "rbenv global | grep '${version}'",
16
16
  environment => 'RBENV_ROOT=/usr/lib/rbenv',
17
- require => Rbenv::Version[$ruby_version]
17
+ require => Rbenv::Version[$version]
18
18
  }
19
19
 
20
20
  Exec {
@@ -0,0 +1,14 @@
1
+ class freighthop::language(
2
+ $languages,
3
+ $ruby_version
4
+ ) {
5
+ if (member($languages, 'ruby')) {
6
+ class { 'freighthop::language::ruby':
7
+ version => $ruby_version,
8
+ }
9
+ }
10
+ if (member($languages, 'clojure')) {
11
+ class { 'freighthop::language::clojure':
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,22 @@
1
+ class freighthop::packages(
2
+ $ppas,
3
+ $packages,
4
+ $languages,
5
+ ) {
6
+ if (member($languages, 'ruby')) {
7
+ apt::ppa { 'ppa:gds/govuk': }
8
+ apt::ppa { 'ppa:phinze/rbenv': }
9
+ }
10
+ apt::ppa { $ppas: }
11
+
12
+ package { [
13
+ 'build-essential',
14
+ 'git-core',
15
+ ]:
16
+ ensure => installed,
17
+ }
18
+
19
+ package { $packages:
20
+ ensure => installed,
21
+ }
22
+ }
@@ -1,12 +1,16 @@
1
1
  class freighthop::params {
2
- $packages = ['git-core']
3
- $ppas = []
4
- $ruby_version = '1.9.3-p392'
5
- $app_name = $::hostname
6
- $app_root = "/srv/${app_name}"
7
- $web_root = "${app_root}/public"
8
- $web_port = 9292
9
- $server_name = $::fqdn
10
- $ssl_cert_path = "/etc/ssl/certs/${app_name}.pem"
11
- $ssl_key_path = "/etc/ssl/private/${app_name}.key"
2
+ $database_flavors = []
3
+ $databases = []
4
+ $database_users = []
5
+ $packages = ['git-core']
6
+ $ppas = []
7
+ $languages = ['ruby']
8
+ $ruby_version = '1.9.3-p392'
9
+ $app_name = $::hostname
10
+ $app_root = "/srv/${app_name}"
11
+ $web_root = "${app_root}/public"
12
+ $web_port = 3000
13
+ $server_name = $::fqdn
14
+ $ssl_cert_path = "/etc/ssl/certs/${app_name}.pem"
15
+ $ssl_key_path = "/etc/ssl/private/${app_name}.key"
12
16
  }
@@ -1,11 +1,11 @@
1
- class freighthop::nginx(
1
+ class freighthop::web(
2
2
  $upstream_web_port,
3
3
  $server_name,
4
4
  $web_root,
5
5
  $ssl_cert_path,
6
6
  $ssl_key_path,
7
7
  ) {
8
- $cert_subject = "/C=US/ST=IL/L=Chicago/O=Instructure/CN=${server_name}"
8
+ $cert_subject = "/C=US/ST=IL/L=Chicago/O=Freighthop/CN=${server_name}"
9
9
 
10
10
  class {'::nginx':
11
11
  confd_purge => true
@@ -0,0 +1,4 @@
1
+ # Point freighhop-installed leiningen to its global home
2
+ # And acknowledge that we're running everything as root
3
+ export LEIN_HOME=<%= lein_home %>
4
+ export LEIN_ROOT=1
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.4
4
+ version: 0.0.5
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-25 00:00:00.000000000 Z
12
+ date: 2013-09-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -134,20 +134,17 @@ files:
134
134
  - lib/freighthop.rb
135
135
  - lib/freighthop/config.rb
136
136
  - lib/freighthop/version.rb
137
- - local_modules/freighthop/files/bundler/freighthop.gemfile
138
- - local_modules/freighthop/manifests/bundler.pp
137
+ - local_modules/freighthop/manifests/database.pp
138
+ - local_modules/freighthop/manifests/database/postgres.pp
139
139
  - local_modules/freighthop/manifests/init.pp
140
- - local_modules/freighthop/manifests/nginx.pp
140
+ - local_modules/freighthop/manifests/language.pp
141
+ - local_modules/freighthop/manifests/language/clojure.pp
142
+ - local_modules/freighthop/manifests/language/ruby.pp
143
+ - local_modules/freighthop/manifests/packages.pp
141
144
  - local_modules/freighthop/manifests/params.pp
142
- - local_modules/freighthop/manifests/pkgs.pp
143
- - local_modules/freighthop/manifests/postgres.pp
144
- - local_modules/freighthop/manifests/ppas.pp
145
- - local_modules/freighthop/manifests/rbenv.pp
146
- - local_modules/freighthop/manifests/redis.pp
145
+ - local_modules/freighthop/manifests/web.pp
147
146
  - local_modules/freighthop/templates/nginx/vagrant-rails.conf.erb
148
- - local_modules/freighthop/templates/profile/custom_bundler_gemfile.sh.erb
149
- - local_modules/freighthop/templates/puma/upstart/puma-manager.conf.erb
150
- - local_modules/freighthop/templates/puma/upstart/puma.conf.erb
147
+ - local_modules/freighthop/templates/profile/leiningen.sh.erb
151
148
  - manifests/site.pp
152
149
  - modules/apt/CHANGELOG
153
150
  - modules/apt/Gemfile
@@ -264,20 +261,17 @@ files:
264
261
  - modules/firewall/spec/unit/puppet/type/firewallchain_spec.rb
265
262
  - modules/firewall/spec/unit/puppet/util/firewall_spec.rb
266
263
  - modules/firewall/spec/unit/puppet/util/ipcidr_spec.rb
267
- - modules/freighthop/files/bundler/freighthop.gemfile
268
- - modules/freighthop/manifests/bundler.pp
264
+ - modules/freighthop/manifests/database/postgres.pp
265
+ - modules/freighthop/manifests/database.pp
269
266
  - modules/freighthop/manifests/init.pp
270
- - modules/freighthop/manifests/nginx.pp
267
+ - modules/freighthop/manifests/language/clojure.pp
268
+ - modules/freighthop/manifests/language/ruby.pp
269
+ - modules/freighthop/manifests/language.pp
270
+ - modules/freighthop/manifests/packages.pp
271
271
  - modules/freighthop/manifests/params.pp
272
- - modules/freighthop/manifests/pkgs.pp
273
- - modules/freighthop/manifests/postgres.pp
274
- - modules/freighthop/manifests/ppas.pp
275
- - modules/freighthop/manifests/rbenv.pp
276
- - modules/freighthop/manifests/redis.pp
272
+ - modules/freighthop/manifests/web.pp
277
273
  - modules/freighthop/templates/nginx/vagrant-rails.conf.erb
278
- - modules/freighthop/templates/profile/custom_bundler_gemfile.sh.erb
279
- - modules/freighthop/templates/puma/upstart/puma-manager.conf.erb
280
- - modules/freighthop/templates/puma/upstart/puma.conf.erb
274
+ - modules/freighthop/templates/profile/leiningen.sh.erb
281
275
  - modules/nginx/ChangeLog
282
276
  - modules/nginx/composer.json
283
277
  - modules/nginx/Gemfile
@@ -658,7 +652,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
658
652
  version: '0'
659
653
  segments:
660
654
  - 0
661
- hash: -3032814133313184341
655
+ hash: -2753549700317476048
662
656
  required_rubygems_version: !ruby/object:Gem::Requirement
663
657
  none: false
664
658
  requirements:
@@ -667,7 +661,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
667
661
  version: '0'
668
662
  segments:
669
663
  - 0
670
- hash: -3032814133313184341
664
+ hash: -2753549700317476048
671
665
  requirements: []
672
666
  rubyforge_project:
673
667
  rubygems_version: 1.8.23
@@ -1,3 +0,0 @@
1
- eval(File.read('Gemfile'))
2
-
3
- gem 'puma'
@@ -1,34 +0,0 @@
1
- class freighthop::bundler(
2
- $ruby_version,
3
- $app_root,
4
- ){
5
- file { "${app_root}/.freighthop.gemfile":
6
- ensure => 'file',
7
- mode => '0644',
8
- source => 'puppet:///modules/freighthop/bundler/freighthop.gemfile',
9
- }
10
-
11
- file { '/etc/profile.d/custom_bundler_gemfile.sh':
12
- ensure => present,
13
- mode => '0755',
14
- content => template('freighthop/profile/custom_bundler_gemfile.sh.erb'),
15
- }
16
-
17
- exec { 'bundle install':
18
- environment => [
19
- 'BUNDLE_GEMFILE=.freighthop.gemfile',
20
- 'RBENV_ROOT=/usr/lib/rbenv',
21
- "RBENV_VERSION=${ruby_version}",
22
- ],
23
- cwd => $app_root,
24
- path => [
25
- '/usr/lib/rbenv/shims',
26
- '/usr/bin',
27
- '/bin',
28
- ],
29
- logoutput => true,
30
- timeout => 0,
31
- unless => 'bundle check',
32
- require => File["${app_root}/.freighthop.gemfile"],
33
- }
34
- }
@@ -1,7 +0,0 @@
1
- class freighthop::pkgs(
2
- $packages
3
- ) {
4
- package { $packages:
5
- ensure => installed,
6
- }
7
- }
@@ -1,9 +0,0 @@
1
- class freighthop::ppas(
2
- $ppas
3
- ) {
4
- # required ppas
5
- apt::ppa { 'ppa:gds/govuk': }
6
- apt::ppa { 'ppa:phinze/rbenv': }
7
-
8
- apt::ppa { $ppas: }
9
- }
@@ -1,9 +0,0 @@
1
- class freighthop::redis {
2
- package { 'redis-server':
3
- ensure => installed
4
- }
5
- service { 'redis-server':
6
- ensure => running,
7
- require => Package['redis-server']
8
- }
9
- }
@@ -1 +0,0 @@
1
- export BUNDLE_GEMFILE=.freighthop.gemfile
@@ -1,33 +0,0 @@
1
- # /etc/init/puma-manager.conf - manage a set of Pumas
2
-
3
- # This example config should work with Ubuntu 12.04+. It
4
- # allows you to manage multiple Puma instances with
5
- # Upstart, Ubuntu's native service management tool.
6
- #
7
- # See puma.conf for how to manage a single Puma instance.
8
- #
9
- # Use "stop puma-manager" to stop all Puma instances.
10
- # Use "start puma-manager" to start all instances.
11
- # Use "restart puma-manager" to restart all instances.
12
- # Crazy, right?
13
- #
14
-
15
- description "Manages the set of puma processes"
16
-
17
- # This starts upon bootup and stops on shutdown
18
- start on (filesystem
19
- and mounted MOUNTPOINT=<%= app_root %>
20
- and runlevel [2345])
21
- stop on runlevel [06]
22
-
23
- # Set this to the number of Puma processes you want
24
- # to run on this machine
25
- env PUMA_CONF="/etc/puma.conf"
26
-
27
- pre-start script
28
- for i in `cat $PUMA_CONF`; do
29
- app=`echo $i | cut -d , -f 1`
30
- logger -t "puma-manager" "Starting $app"
31
- start puma app=$app
32
- done
33
- end script
@@ -1,53 +0,0 @@
1
- # /etc/init/puma.conf - Puma config
2
-
3
- # This example config should work with Ubuntu 12.04+. It
4
- # allows you to manage multiple Puma instances with
5
- # Upstart, Ubuntu's native service management tool.
6
- #
7
- # See workers.conf for how to manage all Puma instances at once.
8
- #
9
- # Save this config as /etc/init/puma.conf then manage puma with:
10
- # sudo start puma app=PATH_TO_APP
11
- # sudo stop puma app=PATH_TO_APP
12
- # sudo status puma app=PATH_TO_APP
13
- #
14
- # or use the service command:
15
- # sudo service puma {start,stop,restart,status}
16
- #
17
-
18
- description "Puma Background Worker"
19
-
20
- # no "start on", we don't want to automatically start
21
- stop on (stopping puma-manager or runlevel [06])
22
-
23
- # change apps to match your deployment user if you want to use this as a less privileged user (recommended!)
24
- # setuid vagrant
25
- # setgid vagrant
26
-
27
- respawn
28
- respawn limit 3 30
29
-
30
- instance ${app}
31
-
32
- script
33
- # this script runs in /bin/sh by default
34
- # respawn as bash so we can source in rbenv/rvm
35
- # quoted heredoc to tell /bin/sh not to interpret
36
- # variables
37
- exec /bin/bash <<'EOT'
38
- # set HOME to the setuid user's home, there doesn't seem to be a better, portable way
39
- export HOME="$(eval echo ~$(id -un))"
40
-
41
- cd $app
42
-
43
- source /etc/profile.d/rbenv.sh
44
-
45
- source /etc/profile.d/custom_bundler_gemfile.sh
46
-
47
- logger -t puma "Starting server: $app"
48
-
49
- mkdir -p <%= socket_dir %>
50
-
51
- exec bundle exec puma -b unix://<%= socket_path %>
52
- EOT
53
- end script
@@ -1,3 +0,0 @@
1
- eval(File.read('Gemfile'))
2
-
3
- gem 'puma'
@@ -1,34 +0,0 @@
1
- class freighthop::bundler(
2
- $ruby_version,
3
- $app_root,
4
- ){
5
- file { "${app_root}/.freighthop.gemfile":
6
- ensure => 'file',
7
- mode => '0644',
8
- source => 'puppet:///modules/freighthop/bundler/freighthop.gemfile',
9
- }
10
-
11
- file { '/etc/profile.d/custom_bundler_gemfile.sh':
12
- ensure => present,
13
- mode => '0755',
14
- content => template('freighthop/profile/custom_bundler_gemfile.sh.erb'),
15
- }
16
-
17
- exec { 'bundle install':
18
- environment => [
19
- 'BUNDLE_GEMFILE=.freighthop.gemfile',
20
- 'RBENV_ROOT=/usr/lib/rbenv',
21
- "RBENV_VERSION=${ruby_version}",
22
- ],
23
- cwd => $app_root,
24
- path => [
25
- '/usr/lib/rbenv/shims',
26
- '/usr/bin',
27
- '/bin',
28
- ],
29
- logoutput => true,
30
- timeout => 0,
31
- unless => 'bundle check',
32
- require => File["${app_root}/.freighthop.gemfile"],
33
- }
34
- }
@@ -1,7 +0,0 @@
1
- class freighthop::pkgs(
2
- $packages
3
- ) {
4
- package { $packages:
5
- ensure => installed,
6
- }
7
- }
@@ -1,9 +0,0 @@
1
- class freighthop::ppas(
2
- $ppas
3
- ) {
4
- # required ppas
5
- apt::ppa { 'ppa:gds/govuk': }
6
- apt::ppa { 'ppa:phinze/rbenv': }
7
-
8
- apt::ppa { $ppas: }
9
- }
@@ -1,9 +0,0 @@
1
- class freighthop::redis {
2
- package { 'redis-server':
3
- ensure => installed
4
- }
5
- service { 'redis-server':
6
- ensure => running,
7
- require => Package['redis-server']
8
- }
9
- }
@@ -1 +0,0 @@
1
- export BUNDLE_GEMFILE=.freighthop.gemfile
@@ -1,33 +0,0 @@
1
- # /etc/init/puma-manager.conf - manage a set of Pumas
2
-
3
- # This example config should work with Ubuntu 12.04+. It
4
- # allows you to manage multiple Puma instances with
5
- # Upstart, Ubuntu's native service management tool.
6
- #
7
- # See puma.conf for how to manage a single Puma instance.
8
- #
9
- # Use "stop puma-manager" to stop all Puma instances.
10
- # Use "start puma-manager" to start all instances.
11
- # Use "restart puma-manager" to restart all instances.
12
- # Crazy, right?
13
- #
14
-
15
- description "Manages the set of puma processes"
16
-
17
- # This starts upon bootup and stops on shutdown
18
- start on (filesystem
19
- and mounted MOUNTPOINT=<%= app_root %>
20
- and runlevel [2345])
21
- stop on runlevel [06]
22
-
23
- # Set this to the number of Puma processes you want
24
- # to run on this machine
25
- env PUMA_CONF="/etc/puma.conf"
26
-
27
- pre-start script
28
- for i in `cat $PUMA_CONF`; do
29
- app=`echo $i | cut -d , -f 1`
30
- logger -t "puma-manager" "Starting $app"
31
- start puma app=$app
32
- done
33
- end script
@@ -1,53 +0,0 @@
1
- # /etc/init/puma.conf - Puma config
2
-
3
- # This example config should work with Ubuntu 12.04+. It
4
- # allows you to manage multiple Puma instances with
5
- # Upstart, Ubuntu's native service management tool.
6
- #
7
- # See workers.conf for how to manage all Puma instances at once.
8
- #
9
- # Save this config as /etc/init/puma.conf then manage puma with:
10
- # sudo start puma app=PATH_TO_APP
11
- # sudo stop puma app=PATH_TO_APP
12
- # sudo status puma app=PATH_TO_APP
13
- #
14
- # or use the service command:
15
- # sudo service puma {start,stop,restart,status}
16
- #
17
-
18
- description "Puma Background Worker"
19
-
20
- # no "start on", we don't want to automatically start
21
- stop on (stopping puma-manager or runlevel [06])
22
-
23
- # change apps to match your deployment user if you want to use this as a less privileged user (recommended!)
24
- # setuid vagrant
25
- # setgid vagrant
26
-
27
- respawn
28
- respawn limit 3 30
29
-
30
- instance ${app}
31
-
32
- script
33
- # this script runs in /bin/sh by default
34
- # respawn as bash so we can source in rbenv/rvm
35
- # quoted heredoc to tell /bin/sh not to interpret
36
- # variables
37
- exec /bin/bash <<'EOT'
38
- # set HOME to the setuid user's home, there doesn't seem to be a better, portable way
39
- export HOME="$(eval echo ~$(id -un))"
40
-
41
- cd $app
42
-
43
- source /etc/profile.d/rbenv.sh
44
-
45
- source /etc/profile.d/custom_bundler_gemfile.sh
46
-
47
- logger -t puma "Starting server: $app"
48
-
49
- mkdir -p <%= socket_dir %>
50
-
51
- exec bundle exec puma -b unix://<%= socket_path %>
52
- EOT
53
- end script