deploy_mate 0.2 → 0.11

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.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/Gemfile.lock +7 -9
  4. data/README.md +37 -46
  5. data/deploy-mate.gemspec +7 -4
  6. data/lib/capistrano/configs/logrotate.erb +2 -2
  7. data/lib/capistrano/configs/nginx_app.conf.erb +4 -9
  8. data/lib/capistrano/configs/nginx_base.conf.erb +1 -1
  9. data/lib/capistrano/configs/unicorn.pill.erb +28 -0
  10. data/lib/capistrano/configs/upstart.conf.erb +1 -1
  11. data/lib/capistrano/deploy_mate_capfile.rb +2 -2
  12. data/lib/capistrano/deploy_mate_defaults.rb +4 -5
  13. data/lib/capistrano/helpers.rb +2 -4
  14. data/lib/capistrano/scripts/set_defaults.sh +1 -2
  15. data/lib/capistrano/tasks/bluepill.rake +5 -29
  16. data/lib/capistrano/tasks/logrotate.rake +0 -1
  17. data/lib/capistrano/tasks/machine.rake +17 -91
  18. data/lib/capistrano/tasks/nginx.rake +4 -7
  19. data/lib/capistrano/tasks/unicorn.rake +17 -1
  20. data/lib/capistrano/tasks/upstart.rake +0 -2
  21. data/lib/deploy_mate/tasks.rake +50 -49
  22. data/lib/deploy_mate/templates/Capfile.erb +1 -7
  23. data/lib/deploy_mate/templates/deploy.rb.erb +5 -22
  24. data/lib/deploy_mate/templates/deploy/stage.rb.erb +4 -4
  25. metadata +5 -19
  26. data/CHANGELOG.md +0 -19
  27. data/lib/capistrano/configs/application.pill.erb +0 -59
  28. data/lib/capistrano/configs/fail2ban-nginx-request-limit-filter.conf.erb +0 -13
  29. data/lib/capistrano/configs/fail2ban-nginx-request-limit-jail.conf.erb +0 -494
  30. data/lib/capistrano/configs/puma.rb.erb +0 -64
  31. data/lib/capistrano/modules/shell.rb +0 -7
  32. data/lib/capistrano/modules/user_management.rb +0 -11
  33. data/lib/capistrano/scripts/create_ubuntu_user.sh +0 -9
  34. data/lib/capistrano/tasks/elasticsearch.rake +0 -18
  35. data/lib/capistrano/tasks/fail2ban.rake +0 -22
  36. data/lib/capistrano/tasks/puma.rake +0 -18
  37. data/lib/deploy_mate.rb +0 -9
  38. data/lib/deploy_mate/templates/deploy_mate.yml.erb +0 -79
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ec32c8e52b90f88a44633352ed01087acea7343f
4
- data.tar.gz: 327d9df9c6fcb3de20af741a7415add88de714f4
3
+ metadata.gz: 331e342b761f203348e39e17f3deb3ea338eb868
4
+ data.tar.gz: 3a0ea8e0bc854d1569c799c7ff602221fb56f258
5
5
  SHA512:
6
- metadata.gz: 81d39a9da921f0b483e5e5f5a9684d1f9e8bea2d5b93d6701d7f584da05b77c4511a195552d39d2fccea132f9a27397a3d051d60f754211f102946130ea6f287
7
- data.tar.gz: ff6de13126be717222170a8556ceb61d8e6b8fe5b9d53beb1455bfbc795d57d9442bdffbdd7c309815b26eddbc1d744ad68c2de90acd178794481858225761ca
6
+ metadata.gz: 9956a9f6494627990d13e8394ffbc394ac7cbe83b42d6b071dab50e8f2a865df5dcd0e7a1ac3e3a16011d3fc60bd09229224cf803815ccb9fc252b0535198b8a
7
+ data.tar.gz: 1c74e9cde74a5fe37f2f2404a378442194472f30d323b6f852ff06dfb582898122a56369e430695f187d330904240fb6c673bd93e1ac3ad8b218d91d50b475d9
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.2.3
1
+ ruby-2.2.0
data/Gemfile.lock CHANGED
@@ -1,11 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- deploy_mate (0.18.4)
4
+ deploy_mate (0.1)
5
5
  capistrano (~> 3.0)
6
6
  capistrano-bundler
7
7
  capistrano-rails
8
- rake
9
8
 
10
9
  GEM
11
10
  remote: https://rubygems.org/
@@ -17,15 +16,17 @@ GEM
17
16
  capistrano-bundler (1.1.4)
18
17
  capistrano (~> 3.1)
19
18
  sshkit (~> 1.2)
20
- capistrano-rails (1.1.6)
19
+ capistrano-rails (1.1.2)
21
20
  capistrano (~> 3.1)
22
21
  capistrano-bundler (~> 1.1)
22
+ colorize (0.7.5)
23
23
  i18n (0.7.0)
24
24
  net-scp (1.2.1)
25
25
  net-ssh (>= 2.6.5)
26
- net-ssh (3.0.2)
27
- rake (10.5.0)
28
- sshkit (1.8.1)
26
+ net-ssh (2.9.2)
27
+ rake (10.4.2)
28
+ sshkit (1.7.1)
29
+ colorize (>= 0.7.0)
29
30
  net-scp (>= 1.1.2)
30
31
  net-ssh (>= 2.8.0)
31
32
 
@@ -34,6 +35,3 @@ PLATFORMS
34
35
 
35
36
  DEPENDENCIES
36
37
  deploy_mate!
37
-
38
- BUNDLED WITH
39
- 1.11.2
data/README.md CHANGED
@@ -4,74 +4,65 @@
4
4
 
5
5
  This little gem can be added to your ruby-projects in order to **set up a working ruby-server** and **deploy** to it.
6
6
 
7
- The resulting server will work with this setup:
8
- - [NGINX](http://nginx.org/) Webserver
9
- - [Unicorn](http://unicorn.bogomips.org/) Rack App Server / [Puma](http://puma.io/) Rack App Server
10
- - [Bluepill](https://github.com/bluepill-rb/bluepill) Process Monitoring
11
- - [RVM](http://rvm.io) as user-install
12
- - [Optional] [ImageMagick](http://www.imagemagick.org)
7
+ The resulting server will work with this setup:
8
+ - NGINX Webserver (http://nginx.org/)
9
+ - Unicorn Rack App Server (http://unicorn.bogomips.org/)
10
+ - Bluepill Process Monitoring (https://github.com/bluepill-rb/bluepill)
11
+ - RVM as user-install (http://rvm.io)
13
12
 
14
13
  Other stuff taken care of:
15
14
  - Logration
16
15
  - Automatic updates
17
16
  - NTP
18
17
 
19
- You can choose a Database-Engine:
18
+ You can choose Database:
20
19
  - MySQL
21
20
  - Postgres
22
21
 
23
- **If you are not using Amazon AWS as a host:** The GEM needs a working Amazon AWS-style `ubuntu`-user on the system in order to work properly. It will create one, if needed.
24
-
25
- It uses the following Capistrano-roles to divide the installed components:
26
- - **web**: Machines with this role run NGINX as proxy
27
- - **app**: Machines with this role run the Ruby-webapp
28
- - **search**: [OPTIONAL] Machines with this role run ElasticSearch
29
- - **cronjobs**: [OPTIONAL] For environments where `whenever` should manage/run cronjobs
22
+ ## Changelog
23
+ * **2015-04-29**: Load custom rake tasks from lib/capistrano/tasks directory.
24
+ You need to run the generator ```rake deploy_mate:install``` again or add ```Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }``` to your Capfile.
30
25
 
31
26
  ## Installation
32
- * Add the gem to your Gemfile (`gem 'deploy_mate'`) and run `bundle install`.
33
- * Spawn yourself a basic **Ubuntu 14** at the provider of your choice.
34
- * Create a working SSH-configuration for that server and try it out using `ssh <your-server-name>`.
35
-
36
- ## Generate the Capistrano files
37
- * Generate the configuration file: `bundle exec rake deploy_mate:default_config`
38
- * Edit the configuration file: `open config/deploy_mate.yml`
39
- * Generate the Capistrano files out of the config: `bundle exec rake deploy_mate:install`
27
+ Add this to your project's `Gemfile`:
40
28
 
41
- **NOTE** for non-rails applications:
42
- Since rails supports auto-loading rake tasks, any non-rails application must load the deploy mate rake tasks manually.
43
- At **the end** of the your project's `Rakefile`:
44
29
  ```
45
- load 'deploy_mate/tasks.rake'
30
+ gem 'deploy_mate'
46
31
  ```
47
- When done: **Remove** `load 'deploy_mate/tasks.rake'` from your `Rakefile`. It is not needed anymore and will otherwise only cause problems.
32
+ and run `bundle install`.
48
33
 
49
- ## Using deploy mate
34
+ After installing the gem you need to generate the files needed to be able to deploy with **capistrano**.
50
35
 
51
- ### Initialize needed server packages
52
- ```
53
- bundle exec cap <your-stage> machine:init
36
+ Add this at **the end** of your project's `Rakefile`:
54
37
  ```
55
-
56
- ### Copy needed templates
38
+ load 'deploy_mate/tasks.rake'
57
39
  ```
58
- bundle exec cap <your-stage> machine:setup
40
+ then run
59
41
  ```
42
+ rake deploy_mate:install
43
+ ````
60
44
 
61
- ### Deploy the application
62
- ```
63
- bundle exec cap <your-stage> deploy
64
- ```
45
+ Follow the instructions.
65
46
 
66
- ### Reinstalling SSH-Keys
67
- If you need to redeploy SSH Keys to your server (e.g. somebody leaves your team),you can
68
- always come back to your configuration file at `config/deploy_mate.yml`, change the
69
- values and generate the Capistrano files again with `bundle exec rake deploy_mate:install`.
70
- To setup just the ssh keys run:
47
+ This will create the following files for you:
71
48
 
72
49
  ```
73
- bundle exec cap <your-stage> machine:install:ssh_keys
50
+ Capfile
51
+ config/deploy.rb
52
+ config/deploy/<your-stage>.rb
74
53
  ```
54
+ When done: **Remove** `load 'deploy_mate/tasks.rake'` from your `Rakefile`. It is not needed anymore and will otherwise only cause problems.
75
55
 
76
- ### Overwriting Templates
77
- You can overwrite the templates used to setup the server. Just place the desired template in your project under `lib/capistrano/configs` and rerun the setup task. All existing templates can be found in this repo under [lib/capistrano/configs](https://github.com/hanseventures/deploy-mate/tree/master/lib/capistrano/configs).
56
+ ## Updating the gem
57
+ Should you need to update your `deploy_mate`-version (e.g. because somebody fixed a bug in the gem), run:
58
+ ```
59
+ bundle update deploy_mate
60
+ ```
61
+ This will bump you up to the latest repo-version.
62
+
63
+ ## Setting up a server
64
+ 1. Spawn yourself a basic **Ubuntu 14** at the provider of your choice.
65
+ 2. Create a working SSH-configuration for that server and try it our using `ssh <your-server-name>`
66
+ 3. Run `cap <your-stage> machine:init` to install the needed packages.
67
+ 4. Run `cap <your-stage> machine:setup` the setup all needed configuration-files on the server
68
+ 5. Run `cap <your-stage> deploy` and be done.
data/deploy-mate.gemspec CHANGED
@@ -1,12 +1,12 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "deploy_mate"
3
- s.version = "0.2"
3
+ s.version = "0.11"
4
4
 
5
- s.authors = ["Tim Adler", "Marcus Geißler", "Johannes Strampe"]
6
- s.date = %q{2016-03-22}
5
+ s.authors = ["Tim Adler"]
6
+ s.date = %q{2015-04-02}
7
7
  s.description = %q{This is how we deploy around here.}
8
8
  s.summary = s.description
9
- s.email = %q{development (at) hanseventures (dot) com}
9
+ s.email = %q{tim.adler (at) hanseventures (dot) com}
10
10
  s.license = "MIT"
11
11
 
12
12
  s.files = `git ls-files`.split("\n")
@@ -19,4 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.add_dependency 'capistrano-bundler'
20
20
  s.add_dependency 'capistrano-rails'
21
21
  s.add_dependency 'rake'
22
+
23
+ # s.add_development_dependency 'rake', '~> 10.1.0'
24
+
22
25
  end
@@ -17,6 +17,6 @@
17
17
  [ ! -f /var/run/nginx.pid ] || kill -USR1 `cat /var/run/nginx.pid`
18
18
  endscript
19
19
  lastaction
20
- [ ! -f <%= shared_path %>/system/pids/<%= fetch(:app_server) %>.pid ] || kill -USR1 `cat <%= shared_path %>/system/pids/<%= fetch(:app_server) %>.pid`
20
+ [ ! -f <%= shared_path %>/system/pids/unicorn.pid ] || kill -USR1 `cat <%= shared_path %>/system/pids/unicorn.pid`
21
21
  endscript
22
- }
22
+ }
@@ -1,9 +1,7 @@
1
- upstream appserver_upstream {
2
- server unix:<%= shared_path %>/system/sockets/<%= fetch(:app_server) %>.sock;
1
+ upstream unicorn_upstream {
2
+ server unix:<%= shared_path %>/system/sockets/unicorn.sock;
3
3
  }
4
4
 
5
- limit_req_zone $binary_remote_addr zone=rate_limit:10m rate=10r/s;
6
-
7
5
  server {
8
6
  listen 80;
9
7
  server_name <%= fetch(:nginx_server_name) %>;
@@ -18,15 +16,12 @@ server {
18
16
  root <%= current_path %>/public;
19
17
 
20
18
  location @<%= fetch(:application) %> {
21
- limit_req zone=rate_limit burst=20;
22
- limit_req_status 444;
23
-
24
19
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
25
- proxy_set_header X-Forwarded-Proto $scheme;
20
+ proxy_set_header X-Forwarded-Proto http;
26
21
  proxy_set_header Host $http_host;
27
22
  proxy_redirect off;
28
23
 
29
- proxy_pass http://appserver_upstream;
24
+ proxy_pass http://unicorn_upstream;
30
25
  break;
31
26
  }
32
27
 
@@ -25,7 +25,7 @@ http {
25
25
  gzip_comp_level 6;
26
26
  gzip_proxied any;
27
27
  gzip_types text/plain text/css text/xml text/javascript text/comma-separated-values
28
- application/json application/x-javascript application/xml application/xml+rss image/svg+xml;
28
+ application/json application/x-javascript application/xml application/xml+rss;
29
29
 
30
30
  # see http://blog.leetsoft.com/2007/7/25/nginx-gzip-ssl
31
31
  gzip_buffers 16 8k;
@@ -0,0 +1,28 @@
1
+ shared_path = "<%= shared_path %>"
2
+ current_path = "<%= current_path %>"
3
+
4
+ Bluepill.application("<%= fetch(:application) %>", :log_file => "#{shared_path}/log/bluepill.log") do |app|
5
+
6
+ app.working_dir = current_path
7
+ app.uid = 'ubuntu'
8
+ app.gid = 'www-data'
9
+ app.process("unicorn") do |process|
10
+ process.pid_file = "#{shared_path}/system/pids/unicorn.pid"
11
+ process.environment = { 'BUNDLE_GEMFILE' => "#{current_path}/Gemfile" }
12
+
13
+ process.start_command = "/home/ubuntu/.rvm/wrappers/default/bundle exec unicorn -c #{shared_path}/config/unicorn.rb -E <%= fetch(:environment) %> -D"
14
+ process.stop_command = "kill -QUIT {{PID}}"
15
+ process.restart_command = "kill -USR2 {{PID}}"
16
+
17
+ process.start_grace_time = 10.seconds
18
+ process.stop_grace_time = 10.seconds
19
+ process.restart_grace_time = 10.seconds
20
+
21
+ process.monitor_children do |child_process|
22
+ child_process.stop_command = "kill -9 {{PID}}"
23
+
24
+ child_process.checks :mem_usage, :every => 30.seconds, :below => 500.megabytes, :times => [3,4], :fires => :stop
25
+ end
26
+ end
27
+
28
+ end
@@ -4,6 +4,6 @@ start on runlevel [2]
4
4
  stop on runlevel [016]
5
5
 
6
6
  expect daemon
7
- exec /home/ubuntu/.rvm/wrappers/default/bluepill load <%= shared_path %>/config/<%= fetch(:application)%>.pill
7
+ exec /home/ubuntu/.rvm/wrappers/default/bluepill load <%= shared_path %>/config/unicorn.pill
8
8
 
9
9
  respawn
@@ -23,11 +23,11 @@ require 'capistrano/bundler'
23
23
  require "capistrano/helpers.rb"
24
24
 
25
25
  # Load custom modules with helper functions
26
- %w(aptitude bluepill upstart user_management shell).each do |m|
26
+ %w(aptitude bluepill upstart).each do |m|
27
27
  load File.expand_path("../modules/#{m}.rb", __FILE__)
28
28
  end
29
29
 
30
30
  # Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
31
- %w(bluepill fail2ban logrotate machine elasticsearch nginx rvm unicorn puma upstart).each do |t|
31
+ %w(bluepill logrotate machine nginx rvm unicorn upstart).each do |t|
32
32
  import File.expand_path("../tasks/#{t}.rake", __FILE__)
33
33
  end
@@ -9,7 +9,7 @@ set :rvm_ruby_version, "ruby-2.2.0"
9
9
  set :rvm_map_bins, %w{gem rake ruby rvmsudo bundle}
10
10
 
11
11
  set :deploy_to, "/srv/#{fetch(:application)}"
12
- set :linked_dirs, fetch(:linked_dirs, []).push(*%w{log vendor/bundle system/pids system/sockets public/assets})
12
+ set :linked_dirs, %w{log vendor/bundle system/pids system/sockets public/assets}
13
13
 
14
14
  set :keep_releases, 3
15
15
  set :ssh_options, { forward_agent: true }
@@ -19,13 +19,12 @@ set :bundle_flags, "--deployment"
19
19
  set :bundle_without, %w{development test}.join(' ')
20
20
  set :bundle_exec, "bundle exec"
21
21
 
22
- # app server
23
- set :app_server, "unicorn" # default to unicorn if nothing set
24
-
25
22
  namespace :deploy do
26
23
  desc 'Restart application'
27
24
  task :restart do
28
- invoke "bluepill:restart"
25
+ on roles(:app), in: :sequence, wait: 5 do
26
+ invoke "unicorn:phased_restart"
27
+ end
29
28
  end
30
29
 
31
30
  desc 'Ensure that the app folder is present'
@@ -2,9 +2,7 @@
2
2
  # This file is loaded before the tasks
3
3
 
4
4
  def template(from, to)
5
- path = File.expand_path("lib/capistrano/configs/#{from}", ENV['PWD'])
6
- path = File.expand_path("../configs/#{from}", __FILE__) unless File.exists?(path)
7
- erb = File.read(path)
5
+ erb = File.read(File.expand_path("../configs/#{from}", __FILE__))
8
6
  compiled = ERB.new(erb).result(binding)
9
7
  io = StringIO.new(compiled)
10
8
  upload! io, to
@@ -19,4 +17,4 @@ def execute_script(name, params = "")
19
17
  execute "chmod 755 #{name}"
20
18
  execute "./#{name} #{params}"
21
19
  execute "rm #{name}"
22
- end
20
+ end
@@ -1,4 +1,3 @@
1
1
  #!/bin/bash
2
2
  source ~/.rvm/scripts/rvm
3
- rvm --default $1
4
- echo "gem: --no-rdoc --no-ri" >> ~/.gemrc
3
+ rvm --default $1
@@ -1,51 +1,27 @@
1
1
  namespace :bluepill do
2
- include Shell
3
2
 
4
3
  desc "Installs the application pill"
5
4
  task :setup do
6
5
  on roles(:app) do
7
6
  execute "mkdir -p #{shared_path}/config"
8
- template "application.pill.erb", "#{shared_path}/config/#{fetch(:application)}.pill"
7
+ template "unicorn.pill.erb", "#{shared_path}/config/unicorn.pill"
9
8
  end
10
9
  end
11
10
 
12
11
  desc "Starts bluepill"
13
12
  task :start do
14
13
  on roles(:app) do
15
- if !bluepill_running?
16
- sudo "start bluepill"
17
- else
18
- info "No need to start bluepill, it is running!"
19
- end
14
+ sudo "start bluepill"
20
15
  end
21
16
  end
22
17
 
23
- desc "Stops app server"
18
+ desc "Stops unicorn"
24
19
  task :stop do
25
20
  on roles(:app) do
26
- if bluepill_running?
27
- sudo "stop bluepill"
28
- else
29
- "Can't stop bluepill because it's not running!"
30
- end
21
+ sudo "stop bluepill"
31
22
  end
32
23
  end
33
24
 
34
- desc "Restarts/Reloads app gracefully"
35
- task :restart do
36
- invoke "bluepill:start"
37
25
 
38
- on roles(:app) do
39
- if bluepill_running?
40
- if pill_running?(fetch(:app_server))
41
- execute :rvmsudo, :bluepill, fetch(:application), :restart
42
- else
43
- execute :rvmsudo, :bluepill, fetch(:application), :start
44
- end
45
- end
46
- end
47
-
48
- invoke "nginx:reload"
49
- end
50
- before :restart, 'rvm:hook'
51
26
  end
27
+
@@ -1,5 +1,4 @@
1
1
  namespace :logrotate do
2
- include Shell
3
2
 
4
3
  desc "Install the logrotate config"
5
4
  task :setup do
@@ -1,59 +1,38 @@
1
1
  namespace :machine do
2
2
  include Aptitude
3
- include UserManagement
4
3
 
5
4
  desc "Sets up a blank Ubuntu to run our Rails-setup"
6
5
  task :init do
7
6
  on roles(:app) do
8
7
  apt_get_update
9
- end
10
- invoke "machine:install:ssh_keys"
11
- invoke "machine:install:htop"
12
- invoke "machine:install:language_pack_de"
13
- invoke "machine:install:unattended_upgrades"
14
- invoke "machine:install:ntp"
15
- invoke "machine:install:git"
16
- invoke "machine:install:nginx"
17
- invoke "machine:install:fail2ban"
18
- invoke "machine:install:rvm"
19
- invoke "machine:install:ruby"
20
- invoke "machine:install:set_defaults"
21
- invoke "machine:install:bluepill"
22
- invoke "machine:install:bundler"
23
- invoke "machine:install:nodejs"
24
- invoke "machine:install:elasticsearch"
25
- invoke "machine:install:imagemagick" if fetch(:imagemagick)
26
- invoke "machine:install:memcached" if fetch(:memcached)
27
- invoke "machine:install:mysql_dev" if fetch(:db_engine) == "mysql"
28
- invoke "machine:install:postgres_dev" if fetch(:db_engine) == "postgresql"
29
- end
30
- before "machine:init", "machine:check_ubuntu_user"
31
- before "deploy", "machine:check_ubuntu_user"
32
-
33
- desc "Check if we are doing things as the correct user"
34
- task :check_ubuntu_user do
35
- on roles(:app) do
36
- unless am_i?("ubuntu")
37
- execute_script("create_ubuntu_user.sh") # Creates an Amazon AWS-style 'ubuntu'-user on machines with only 'root'
38
- error "Please use a use a user named 'ubuntu' to login to the machine."
39
- fail
40
- end
8
+ invoke "machine:install:htop"
9
+ invoke "machine:install:language_pack_de"
10
+ invoke "machine:install:unattended_upgrades"
11
+ invoke "machine:install:ntp"
12
+ invoke "machine:install:git"
13
+ invoke "machine:install:nginx"
14
+ invoke "machine:install:fail2ban"
15
+ invoke "machine:install:rvm"
16
+ invoke "machine:install:ruby"
17
+ invoke "machine:install:set_defaults"
18
+ invoke "machine:install:bluepill"
19
+ invoke "machine:install:bundler"
20
+ invoke "machine:install:nodejs"
21
+ invoke "machine:install:mysql_dev" if fetch(:db_engine) == "mysql"
22
+ invoke "machine:install:postgres_dev" if fetch(:db_engine) == "postgresql"
41
23
  end
42
24
  end
43
25
 
44
26
  desc "Install configs"
45
27
  task :setup do
46
28
  invoke "nginx:setup"
47
- invoke "unicorn:setup" if fetch(:app_server) == "unicorn"
48
- invoke "puma:setup" if fetch(:app_server) == "puma"
29
+ invoke "unicorn:setup"
49
30
  invoke "upstart:setup"
50
31
  invoke "logrotate:setup"
51
- invoke "fail2ban:setup"
52
32
  invoke "bluepill:setup"
53
33
  end
54
34
  before :setup, "deploy:ensure_folder"
55
35
 
56
- desc "Install all dependencies"
57
36
  namespace :install do
58
37
  task :set_defaults do
59
38
  on roles(:app) do
@@ -64,10 +43,6 @@ namespace :machine do
64
43
  end
65
44
  end
66
45
 
67
- task :elasticsearch do
68
- invoke 'elasticsearch:install'
69
- end
70
-
71
46
  task :language_pack_de do
72
47
  on roles(:app) do
73
48
  apt_get_install("language-pack-de") unless is_package_installed?("language-pack-de")
@@ -102,18 +77,6 @@ namespace :machine do
102
77
  end
103
78
  end
104
79
 
105
- task :imagemagick do
106
- on roles(:app) do
107
- apt_get_install("imagemagick") unless is_package_installed?("imagemagick")
108
- end
109
- end
110
-
111
- task :memcached do
112
- on roles(:app) do
113
- apt_get_install("memcached") unless is_package_installed?("memcached")
114
- end
115
- end
116
-
117
80
  task :mysql_dev do
118
81
  on roles(:app) do
119
82
  apt_get_install("libmysqlclient-dev") unless is_package_installed?("libmysqlclient-dev")
@@ -142,10 +105,6 @@ namespace :machine do
142
105
  task :ntp do
143
106
  on roles(:app) do
144
107
  apt_get_install("ntp") unless is_package_installed?("ntp")
145
- sudo "chmod 666 /etc/timezone"
146
- execute 'echo "Europe/Berlin" > /etc/timezone'
147
- sudo "chmod 644 /etc/timezone"
148
- sudo "dpkg-reconfigure -f noninteractive tzdata"
149
108
  end
150
109
  end
151
110
 
@@ -172,7 +131,6 @@ namespace :machine do
172
131
  unless is_package_installed?("imagemagick")
173
132
  apt_get_install("imagemagick")
174
133
  apt_get_install("libmagickcore-dev")
175
- apt_get_install("libmagickwand-dev")
176
134
  end
177
135
  end
178
136
  end
@@ -185,41 +143,9 @@ namespace :machine do
185
143
  end
186
144
  end
187
145
 
188
- desc "Installs new SSH Keys"
189
- task :ssh_keys do
190
- on roles(:app) do
191
- file_patterns = fetch(:ssh_file_names)
192
-
193
- next puts("Skip SSH key installation") if file_patterns == []
194
-
195
- puts "Installing SSH Keys from #{file_patterns.join(',')}..."
196
-
197
- keys = []
198
- file_patterns.each do |file_pattern|
199
- Dir.glob(File.expand_path(file_pattern)).each do |file_name|
200
- next if File.directory?(file_name)
201
- key_as_string = File.read(file_name)
202
-
203
- if key_as_string.start_with?("ssh-rsa")
204
- keys << key_as_string
205
- puts file_name
206
- else
207
- warn "#{file_name} is NO publickey"
208
- end
209
- end
210
- end
211
-
212
- fail "No ssh-keys found in #{file_patterns.join(',')}." unless keys.any?
213
-
214
- upload!(StringIO.new(keys.join("")), 'new_keys')
215
- sudo "rm ~/.ssh/authorized_keys"
216
- sudo "mv new_keys ~/.ssh/authorized_keys"
217
- end
218
- end
219
-
220
146
  task :update_rvm_key do
221
147
  on roles(:app) do
222
- execute :gpg, "--keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3"
148
+ execute :gpg, "--keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3"
223
149
  end
224
150
  end
225
151
  before "machine:install:rvm", "machine:install:update_rvm_key"