mina-serverbuild 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 39e750dc30780bbd2ab4481e680091c8510fecf2
4
+ data.tar.gz: eedcf95aa5ca8b9931996cb89919de1c0812199a
5
+ SHA512:
6
+ metadata.gz: c843a192920473f9626dbbdf30f4ed6fc72581b8638a29f9c6f7b327cf37294f2c271f5e329102a8898c23efe7507349a59a75211d26bdc5e5a7cc4d49adf9c5
7
+ data.tar.gz: 0d9be8015e6ce44f4c63a664b730a495c1044c430e025e52a06c81d99bd96c27796a2c67d8babffac72e79864c1c263a9c953168110e45228337656cbf532984
data/.gitignore ADDED
@@ -0,0 +1,31 @@
1
+ *.rbc
2
+ capybara-*.html
3
+ .rspec
4
+ /log
5
+ /tmp
6
+ /db/*.sqlite3
7
+ /public/system
8
+ /coverage/
9
+ /spec/tmp
10
+ **.orig
11
+ rerun.txt
12
+ pickle-email-*.html
13
+
14
+ # TODO Comment out these rules if you are OK with secrets being uploaded to the repo
15
+ config/initializers/secret_token.rb
16
+ config/secrets.yml
17
+
18
+ ## Environment normalisation:
19
+ /.bundle
20
+ /vendor/bundle
21
+
22
+ # these should all be checked in to normalise the environment:
23
+ # Gemfile.lock, .ruby-version, .ruby-gemset
24
+
25
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
26
+ .rvmrc
27
+
28
+ # if using bower-rails ignore default bower_components path bower.json files
29
+ /vendor/assets/bower_components
30
+ *.bowerrc
31
+ bower.json
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in mina-serverbuild.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,24 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ mina-serverbuild (0.0.1)
5
+ mina (~> 0.3)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ mina (0.3.0)
11
+ open4
12
+ rake
13
+ minitest (5.4.1)
14
+ open4 (1.3.4)
15
+ rake (10.3.2)
16
+
17
+ PLATFORMS
18
+ ruby
19
+
20
+ DEPENDENCIES
21
+ bundler (~> 1.6)
22
+ mina-serverbuild!
23
+ minitest (~> 5.0)
24
+ rake (~> 10)
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Mike Simkins
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,60 @@
1
+ [![Inline docs](http://inch-ci.org/github/msimkins/mina-serverbuild.svg?branch=master)](http://inch-ci.org/github/msimkins/mina-serverbuild)
2
+
3
+ # Mina::Serverbuild
4
+
5
+ This is a set of Mina TASKS that can help you provision a Rails Server
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'mina-serverbuild'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install mina-serverbuild
20
+
21
+ ## Usage
22
+
23
+ In your config/deploy.rb file, please add the following line
24
+
25
+ require 'mina/serverbuild'
26
+
27
+ This will add a set of tasks, allowing installation of various 'standard' packages to build a server
28
+
29
+ You should now be able to run
30
+
31
+ mina serverbuild:part1
32
+ mina serverbuild:part2
33
+
34
+ to give you a server ready for deployment
35
+
36
+ You can add the following variables to your deploy.rb file to customise the installation, the default values
37
+ are currently for an Ubuntu 14.04 installation
38
+
39
+ set :deployment_platform, 'ubuntu'
40
+ set :platform_codename, 'trusty'
41
+ set :database_server, 'postgresql'
42
+ set :ruby_manager, 'rbenv'
43
+ set :ruby_version, '2.1.2'
44
+
45
+ * deployment_platform
46
+ * ubuntu
47
+ * ubuntu_codename
48
+ Supported platforms are 12.04 (precise), and 14.04 (trusty)
49
+
50
+ * ruby_manager
51
+ * rbenv
52
+
53
+
54
+ ## Contributing
55
+
56
+ 1. Fork it ( https://github.com/msimkins/mina-serverbuild/fork )
57
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
58
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
59
+ 4. Push to the branch (`git push origin my-new-feature`)
60
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,63 @@
1
+
2
+ # ## Settings
3
+ # Any and all of these settings can be overriden in your `deploy.rb`.
4
+
5
+ set_default :deployment_platform, "ubuntu"
6
+ set_default :platform_codename, "trusty"
7
+ set_default :database_server, "postgresql"
8
+ set_default :web_server, "nginx"
9
+ set_default :ruby_manager, "rbenv"
10
+ set_default :ruby_version, "2.1.2"
11
+
12
+ namespace :serverbuild do
13
+ if "#{deployment_platform}".strip.downcase == "ubuntu"
14
+ load "mina/serverbuild/ubuntu.rake"
15
+
16
+ desc "Install Essential Server Software - Phase 1"
17
+ task :part1 do
18
+ invoke :"serverbuild:build_ubuntu:apt_update"
19
+ invoke :"serverbuild:build_ubuntu:apt_upgrade"
20
+ invoke :"serverbuild:build_ubuntu:apt_install_essential"
21
+ end
22
+
23
+ desc "Install Essential Server Software - Phase 2"
24
+ task :part2 do
25
+ if "#{database_server}".strip.downcase == "postgresql"
26
+ invoke :"serverbuild:build_ubuntu:apt_install_postgresql"
27
+ end
28
+ invoke :"serverbuild:build_ubuntu:apt_install_nodejs"
29
+ if "#{web_server}".strip.downcase == 'nginx'
30
+ invoke :"serverbuild:build_ubuntu:apt_install_nginx"
31
+ end
32
+ invoke :"serverbuild:build_ubuntu:apt_autoremove"
33
+ if "#{ruby_manager}".strip.downcase == "rbenv"
34
+ invoke :"serverbuild:build_ubuntu:build_rbenv"
35
+ end
36
+ queue "echo \"------------------------------------------------------------------------\""
37
+ queue "echo \"-- At this point you should have a working Database, NodeJS, NGINX --\""
38
+ queue "echo \"-- and Ruby Environment installed in your deployment users home --\""
39
+ queue "echo \"-- directory. You should now be able to remove the line --\""
40
+ queue "echo \"-- --\""
41
+ queue "echo \"-- require \"mina/serverbuild\" --\""
42
+ queue "echo \"-- --\""
43
+ queue "echo \"-- from your config/deploy.rb file, and you can uncomment the line --\""
44
+ queue "echo \"-- --\""
45
+ if "#{ruby_manager}".strip.downcase == "rbenv"
46
+ queue "echo \"-- # invoke :\"rbenv:load\" --\""
47
+ end
48
+ queue "echo \"-- --\""
49
+ queue "echo \"-- in the environment task - Thanks for using this setup script --\""
50
+ queue "echo \"------------------------------------------------------------------------\""
51
+ end
52
+ end
53
+
54
+ desc "Check Installed Versions (after installation)"
55
+ task :check_versions do
56
+ node_version = capture("node --version")
57
+ puts "NodeJS Version: #{node_version}" unless "#{node_version}".index(/not found/)
58
+ pgsql_version = capture("psql --version")
59
+ puts "PostgreSQL Version: #{pgsql_version}" unless "#{pgsql_version}".index(/not found/)
60
+ mysql_version = capture("mysql --version")
61
+ puts "MySQL Version: #{mysql_version}" unless "#{mysql_version}".index(/not found/)
62
+ end
63
+ end
@@ -0,0 +1,77 @@
1
+ # # Modules: server_build/ubuntu
2
+ # Adds tasks for building Ubuntu Servers
3
+
4
+
5
+ namespace :build_ubuntu do
6
+ desc "Update APT Software Cache"
7
+ task :apt_update do
8
+ queue "sudo apt-get -y update"
9
+ end
10
+
11
+ desc "Upgrade Installed Packages"
12
+ task :apt_upgrade do
13
+ queue "sudo apt-get -y upgrade"
14
+ end
15
+
16
+ desc "Upgrade Distribution"
17
+ task :apt_distupgrade do
18
+ queue "sudo apt-get -y dist-upgrade"
19
+ end
20
+
21
+ desc "Install Essential Packages"
22
+ task :apt_install_essential do
23
+ queue "sudo apt-get -y install wget curl git-core python-software-properties build-essential"
24
+ end
25
+
26
+ desc "Remove Unreferenced Packages"
27
+ task :apt_autoremove do
28
+ queue "sudo apt-get -y autoremove"
29
+ end
30
+
31
+ desc "Install PostgreSQL Database"
32
+ task :apt_install_postgresql do
33
+ queue "wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -"
34
+ queue "sudo apt-add-repository -y \"deb http://apt.postgresql.org/pub/repos/apt/ #{platform_codename}-pgdg main\" "
35
+ queue "sudo apt-get -y update"
36
+ queue "sudo apt-get install -y postgresql-9.3 pgadmin3 libpq-dev"
37
+ end
38
+
39
+ desc "Install NodeJS"
40
+ task :apt_install_nodejs do
41
+ queue "sudo add-apt-repository -y ppa:chris-lea/node.js"
42
+ queue "sudo apt-get -y update"
43
+ queue "sudo apt-get -y install nodejs"
44
+ end
45
+
46
+ desc "Install NGINX"
47
+ task :apt_install_nginx do
48
+ queue "sudo add-apt-repository -y ppa:nginx/stable"
49
+ queue "sudo apt-get -y update"
50
+ queue "sudo apt-get -y install nginx"
51
+ end
52
+
53
+ desc "Install RBENV Ruby Manager"
54
+ task :build_rbenv do
55
+ queue "if [ ! -d ~/.rbenv ]; then"
56
+ queue "curl https://raw.githubusercontent.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash"
57
+ queue "fi"
58
+ queue "cat /dev/null > ~/.bash_profile.saved"
59
+ queue "cat ~/.bash_profile ~/.bash_profile.saved"
60
+ queue "echo \"# ~/.bash_profile:\" > ~/.bash_profile"
61
+ queue "echo \"export RBENV_ROOT=\"${HOME}/.rbenv\"\" >> ~/.bash_profile"
62
+ queue "echo \"if [ -d \"${HOME}/.rbenv\" ]; then\" >> ~/.bash_profile"
63
+ queue "echo \"export PATH=\"${HOME}/.rbenv/bin:${PATH}\"\" >> ~/.bash_profile"
64
+ queue "echo 'eval \"\$\(rbenv init -\)\"' >> ~/.bash_profile"
65
+ queue "echo \"fi\" >> ~/.bash_profile"
66
+ queue "cat ~/.bash_profile.saved >> ~/.bash_profile"
67
+ if "#{platform_codename}".strip == "precise"
68
+ queue ". ~/.bash_profile; rbenv bootstrap-ubuntu-12-04"
69
+ end
70
+ if "#{platform_codename}".strip == "trusty"
71
+ queue "sudo apt-get -y install tklib zlib1g-dev libssl-dev libreadline-gplv2-dev"
72
+ queue "sudo apt-get -y install libxml2 libxml2-dev libxslt1-dev"
73
+ end
74
+ queue ". ~/.bash_profile; rbenv install #{ruby_version}"
75
+ queue ". ~/.bash_profile; rbenv global #{ruby_version}"
76
+ end
77
+ end
@@ -0,0 +1,5 @@
1
+ module Mina
2
+ module Serverbuild
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ require "mina/serverbuild/version"
2
+
3
+ module Mina
4
+ module Serverbuild
5
+ load File.expand_path("../serverbuild/serverbuild.rake", __FILE__)
6
+ end
7
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'mina/serverbuild/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "mina-serverbuild"
8
+ spec.version = Mina::Serverbuild::VERSION
9
+ spec.authors = ["Mike Simkins"]
10
+ spec.email = ["software@g7obs.com"]
11
+ spec.summary = %q{Common Server Build Tasks for MINA}
12
+ spec.description = %q{Common Server (VPS) Build Tasks for the MINA Deployement System}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake", "~> 10"
23
+ spec.add_development_dependency "minitest", "~> 5.0"
24
+ spec.add_dependency "mina", "~> 0.3"
25
+ end
metadata ADDED
@@ -0,0 +1,111 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mina-serverbuild
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Mike Simkins
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-09-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '5.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '5.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: mina
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.3'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.3'
69
+ description: Common Server (VPS) Build Tasks for the MINA Deployement System
70
+ email:
71
+ - software@g7obs.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - Gemfile
78
+ - Gemfile.lock
79
+ - LICENSE
80
+ - README.md
81
+ - Rakefile
82
+ - lib/mina/serverbuild.rb
83
+ - lib/mina/serverbuild/serverbuild.rake
84
+ - lib/mina/serverbuild/ubuntu.rake
85
+ - lib/mina/serverbuild/version.rb
86
+ - mina-serverbuild.gemspec
87
+ homepage: ''
88
+ licenses:
89
+ - MIT
90
+ metadata: {}
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubyforge_project:
107
+ rubygems_version: 2.2.2
108
+ signing_key:
109
+ specification_version: 4
110
+ summary: Common Server Build Tasks for MINA
111
+ test_files: []