deploy_mate 0.12 → 0.13

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: df92af3b0b6a83b873bfee7b3b530e587c36c25a
4
- data.tar.gz: d22321dbdc778da42189d9675d2bb9d6dc021311
3
+ metadata.gz: ecff54aca5c2d8f35ce98fbfd84d318298d67e4b
4
+ data.tar.gz: 1ab1844832d1b169399e08391d1359689e76ce55
5
5
  SHA512:
6
- metadata.gz: fdd8f006ea0e5438a65cee27a31a142126341476ff7674b1c25f40ba7b0a6da796b3e4db9bf825b9b2a03715d96ff0ccfb0609afe17d7af998f375898669bb80
7
- data.tar.gz: 932117d4c5e14a6961569ce72f3e3deaf8cdfe0fe08a902b9d100d72532fb2e13d769eedc4da37968d562c0f0fa10a187c1175d3a56e2f430285f511365275cf
6
+ metadata.gz: a671312408425d9c58d9493d2b875065dc8ea2b9193e663b6a36750dbc3b6edd682580568e856da694e91f93e7afe822e1f10dbd96a79b1b721a5e493762cf0e
7
+ data.tar.gz: 739d9c612e3b5285dda0a4b52131efd85d5d559fe1df63dae8ebfd7015b0c36ab47c40306a6dc0c75bda08aee3619e8aa9f6efc063e15b88dbabe109a8008c41
data/README.md CHANGED
@@ -20,6 +20,7 @@ You can choose Database:
20
20
  - Postgres
21
21
 
22
22
  ## Changelog
23
+ * **2015-06-23**: Support creation of working `ubuntu` user. Error out if another user than `ubuntu` is used.
23
24
  * **2015-06-22**: Support for choosing your Ruby-version when creating the `Capfile`. Suggestions come from `.ruby-version` and `Gemfile`.
24
25
  * **2015-04-29**: Load custom rake tasks from lib/capistrano/tasks directory.
25
26
  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.
data/deploy-mate.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "deploy_mate"
3
- s.version = "0.12"
3
+ s.version = "0.13"
4
4
 
5
5
  s.authors = ["Tim Adler"]
6
- s.date = %q{2015-06-22}
6
+ s.date = %q{2015-06-23}
7
7
  s.description = %q{This is how we deploy around here.}
8
8
  s.summary = s.description
9
9
  s.email = %q{tim.adler (at) hanseventures (dot) com}
@@ -23,7 +23,7 @@ require 'capistrano/bundler'
23
23
  require "capistrano/helpers.rb"
24
24
 
25
25
  # Load custom modules with helper functions
26
- %w(aptitude bluepill upstart).each do |m|
26
+ %w(aptitude bluepill upstart user_management).each do |m|
27
27
  load File.expand_path("../modules/#{m}.rb", __FILE__)
28
28
  end
29
29
 
@@ -0,0 +1,11 @@
1
+ module UserManagement
2
+
3
+ def whoami
4
+ capture(:whoami)
5
+ end
6
+
7
+ def am_i?(user_name)
8
+ whoami == user_name
9
+ end
10
+
11
+ end
@@ -0,0 +1,9 @@
1
+ #!/bin/bash
2
+ sudo mkdir -p /home/ubuntu/.ssh/
3
+ sudo groupadd ubuntu
4
+ sudo useradd ubuntu -g ubuntu -d /home/ubuntu -s /bin/bash
5
+ sudo adduser ubuntu sudo
6
+ sudo cp ~/.ssh/authorized_keys /home/ubuntu/.ssh/
7
+ sudo chown -R ubuntu:ubuntu /home/ubuntu
8
+ sudo echo "ubuntu ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/ubuntu_no_sudo_password
9
+ sudo chmod 0440 /etc/sudoers.d/ubuntu_no_sudo_password
@@ -1,3 +1,4 @@
1
1
  #!/bin/bash
2
2
  source ~/.rvm/scripts/rvm
3
- rvm --default $1
3
+ rvm --default $1
4
+ echo "gem: --no-rdoc --no-ri" >> ~/.gemrc
@@ -1,5 +1,6 @@
1
1
  namespace :machine do
2
2
  include Aptitude
3
+ include UserManagement
3
4
 
4
5
  desc "Sets up a blank Ubuntu to run our Rails-setup"
5
6
  task :init do
@@ -22,6 +23,26 @@ namespace :machine do
22
23
  invoke "machine:install:postgres_dev" if fetch(:db_engine) == "postgresql"
23
24
  end
24
25
  end
26
+ before "machine:init", "machine:check_ubuntu_user"
27
+ before "deploy", "machine:check_ubuntu_user"
28
+
29
+ desc "Check if we are doing things as the correct user"
30
+ task :check_ubuntu_user do
31
+ on roles(:app) do
32
+ unless am_i?("ubuntu")
33
+ invoke "machine:create_ubuntu_user"
34
+ error "Please use a use a user named 'ubuntu' to login to the machine."
35
+ fail
36
+ end
37
+ end
38
+ end
39
+
40
+ desc "Creates an Amazon AWS-style 'ubuntu'-user on machines with only 'root'"
41
+ task :create_ubuntu_user do
42
+ on roles(:app) do
43
+ execute_script("create_ubuntu_user.sh")
44
+ end
45
+ end
25
46
 
26
47
  desc "Install configs"
27
48
  task :setup do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deploy_mate
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.12'
4
+ version: '0.13'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Adler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-22 00:00:00.000000000 Z
11
+ date: 2015-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -94,6 +94,8 @@ files:
94
94
  - lib/capistrano/modules/aptitude.rb
95
95
  - lib/capistrano/modules/bluepill.rb
96
96
  - lib/capistrano/modules/upstart.rb
97
+ - lib/capistrano/modules/user_management.rb
98
+ - lib/capistrano/scripts/create_ubuntu_user.sh
97
99
  - lib/capistrano/scripts/install_ruby.sh
98
100
  - lib/capistrano/scripts/install_rvm.sh
99
101
  - lib/capistrano/scripts/set_defaults.sh