from-scratch 0.1.0
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 +7 -0
- data/.chef/knife.rb +6 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Berksfile +17 -0
- data/Berksfile.lock +19 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +58 -0
- data/Rakefile +6 -0
- data/Thorfile +5 -0
- data/bin/scratchify +6 -0
- data/chefignore +101 -0
- data/cookbooks/chef_gem/CHANGELOG.md +24 -0
- data/cookbooks/chef_gem/README.md +38 -0
- data/cookbooks/chef_gem/libraries/chef_gem.rb +72 -0
- data/cookbooks/chef_gem/metadata.json +29 -0
- data/cookbooks/chef_gem/recipes/default.rb +0 -0
- data/cookbooks/java/.gitignore +21 -0
- data/cookbooks/java/.kitchen.docker.yml +15 -0
- data/cookbooks/java/.kitchen.yml +126 -0
- data/cookbooks/java/.travis.yml +6 -0
- data/cookbooks/java/Berksfile +10 -0
- data/cookbooks/java/CHANGELOG.md +398 -0
- data/cookbooks/java/CONTRIBUTING.md +12 -0
- data/cookbooks/java/Gemfile +15 -0
- data/cookbooks/java/ISSUES.md +43 -0
- data/cookbooks/java/LICENSE +201 -0
- data/cookbooks/java/README.md +402 -0
- data/cookbooks/java/Rakefile +60 -0
- data/cookbooks/java/TESTING.md +41 -0
- data/cookbooks/java/attributes/default.rb +146 -0
- data/cookbooks/java/libraries/helpers.rb +120 -0
- data/cookbooks/java/libraries/matchers.rb +5 -0
- data/cookbooks/java/metadata.json +69 -0
- data/cookbooks/java/providers/alternatives.rb +94 -0
- data/cookbooks/java/providers/ark.rb +255 -0
- data/cookbooks/java/recipes/default.rb +22 -0
- data/cookbooks/java/recipes/default_java_symlink.rb +19 -0
- data/cookbooks/java/recipes/homebrew.rb +3 -0
- data/cookbooks/java/recipes/ibm.rb +76 -0
- data/cookbooks/java/recipes/ibm_tar.rb +70 -0
- data/cookbooks/java/recipes/openjdk.rb +74 -0
- data/cookbooks/java/recipes/oracle.rb +74 -0
- data/cookbooks/java/recipes/oracle_i386.rb +73 -0
- data/cookbooks/java/recipes/oracle_jce.rb +75 -0
- data/cookbooks/java/recipes/oracle_rpm.rb +60 -0
- data/cookbooks/java/recipes/purge_packages.rb +20 -0
- data/cookbooks/java/recipes/set_attributes_from_version.rb +55 -0
- data/cookbooks/java/recipes/set_java_home.rb +44 -0
- data/cookbooks/java/recipes/windows.rb +82 -0
- data/cookbooks/java/resources/alternatives.rb +30 -0
- data/cookbooks/java/resources/ark.rb +58 -0
- data/cookbooks/java/templates/default/ibm_jdk.installer.properties.erb +3 -0
- data/cookbooks/java/templates/default/oracle.jinfo.erb +6 -0
- data/cookbooks/rvm/.foodcritic +1 -0
- data/cookbooks/rvm/.gitignore +7 -0
- data/cookbooks/rvm/.kitchen.yml +66 -0
- data/cookbooks/rvm/.travis.yml +9 -0
- data/cookbooks/rvm/Berksfile +10 -0
- data/cookbooks/rvm/CHANGELOG.md +253 -0
- data/cookbooks/rvm/CODE_OF_CONDUCT.md +12 -0
- data/cookbooks/rvm/CONTRIBUTING.md +26 -0
- data/cookbooks/rvm/Gemfile +20 -0
- data/cookbooks/rvm/Guardfile +12 -0
- data/cookbooks/rvm/README.md +1459 -0
- data/cookbooks/rvm/Rakefile +18 -0
- data/cookbooks/rvm/attributes/.gitkeep +0 -0
- data/cookbooks/rvm/attributes/default.rb +68 -0
- data/cookbooks/rvm/attributes/gem_package.rb +23 -0
- data/cookbooks/rvm/attributes/vagrant.rb +23 -0
- data/cookbooks/rvm/libraries/chef_rvm_environment_helpers.rb +55 -0
- data/cookbooks/rvm/libraries/chef_rvm_gemset_helpers.rb +67 -0
- data/cookbooks/rvm/libraries/chef_rvm_recipe_helpers.rb +80 -0
- data/cookbooks/rvm/libraries/chef_rvm_ruby_helpers.rb +95 -0
- data/cookbooks/rvm/libraries/chef_rvm_set_helpers.rb +16 -0
- data/cookbooks/rvm/libraries/chef_rvm_shell_helpers.rb +57 -0
- data/cookbooks/rvm/libraries/chef_rvm_string_cache.rb +104 -0
- data/cookbooks/rvm/libraries/chef_rvm_string_helpers.rb +61 -0
- data/cookbooks/rvm/libraries/chef_rvm_version_helpers.rb +45 -0
- data/cookbooks/rvm/libraries/gem_package_monkeypatch.rb +34 -0
- data/cookbooks/rvm/libraries/provider_rvm_installation.rb +185 -0
- data/cookbooks/rvm/libraries/resource_rvm_installation.rb +103 -0
- data/cookbooks/rvm/libraries/rvm_chef_user_environment.rb +55 -0
- data/cookbooks/rvm/libraries/rvm_rubygems_package.rb +189 -0
- data/cookbooks/rvm/libraries/rvm_shell_chef_wrapper.rb +99 -0
- data/cookbooks/rvm/metadata.json +51 -0
- data/cookbooks/rvm/providers/default_ruby.rb +63 -0
- data/cookbooks/rvm/providers/environment.rb +78 -0
- data/cookbooks/rvm/providers/gemset.rb +118 -0
- data/cookbooks/rvm/providers/global_gem.rb +97 -0
- data/cookbooks/rvm/providers/ruby.rb +178 -0
- data/cookbooks/rvm/providers/shell.rb +121 -0
- data/cookbooks/rvm/providers/wrapper.rb +73 -0
- data/cookbooks/rvm/recipes/.gitkeep +0 -0
- data/cookbooks/rvm/recipes/default.rb +40 -0
- data/cookbooks/rvm/recipes/gem_package.rb +33 -0
- data/cookbooks/rvm/recipes/system.rb +37 -0
- data/cookbooks/rvm/recipes/system_install.rb +42 -0
- data/cookbooks/rvm/recipes/user.rb +43 -0
- data/cookbooks/rvm/recipes/user_install.rb +58 -0
- data/cookbooks/rvm/recipes/vagrant.rb +37 -0
- data/cookbooks/rvm/resources/default_ruby.rb +31 -0
- data/cookbooks/rvm/resources/environment.rb +31 -0
- data/cookbooks/rvm/resources/gem.rb +37 -0
- data/cookbooks/rvm/resources/gemset.rb +32 -0
- data/cookbooks/rvm/resources/global_gem.rb +34 -0
- data/cookbooks/rvm/resources/ruby.rb +32 -0
- data/cookbooks/rvm/resources/shell.rb +41 -0
- data/cookbooks/rvm/resources/wrapper.rb +34 -0
- data/cookbooks/rvm/templates/default/rvmrc.erb +14 -0
- data/cookbooks/rvm/templates/default/vagrant-chef-client-wrapper.erb +23 -0
- data/cookbooks/rvm/templates/default/vagrant-chef-solo-wrapper.erb +23 -0
- data/cookbooks/rvm/test/integration/data_bags/users/virgil1.json +4 -0
- data/cookbooks/rvm/test/integration/data_bags/users/virgil2.json +4 -0
- data/cookbooks/rvm/test/integration/data_bags/users/wigglebottom.json +3 -0
- data/cookbooks/rvm/test/integration/installs/bats/version_pinning.bats +13 -0
- data/cookbooks/rvm/test/integration/rubies/bats/_common.bash +16 -0
- data/cookbooks/rvm/test/integration/rubies/bats/verify_1.9.3.bats +9 -0
- data/cookbooks/rvm/test/integration/rubies/bats/verify_jruby.bats +12 -0
- data/cookbooks/rvm/test/integration/rubies/bats/verify_patch_support.bats +19 -0
- data/cookbooks/rvm/test/integration/rubies/bats/verify_ree.bats +9 -0
- data/cookbooks/rvm/test/integration/rubies/bats/verify_rubygems_version_support.bats +15 -0
- data/cookbooks/rvm/test/integration/stock_system_and_user/bats/system.bats +45 -0
- data/cookbooks/rvm/test/unit/libraries/provider_rvm_installation_spec.rb +220 -0
- data/cookbooks/rvm/test/unit/libraries/resource_rvm_installation_spec.rb +139 -0
- data/cookbooks/rvm/test/unit/spec_helper.rb +23 -0
- data/cookbooks/scratchify/.chef/knife.rb +9 -0
- data/cookbooks/scratchify/Berksfile +16 -0
- data/cookbooks/scratchify/Berksfile.lock +19 -0
- data/cookbooks/scratchify/LICENSE.txt +21 -0
- data/cookbooks/scratchify/README.md +41 -0
- data/cookbooks/scratchify/Thorfile +5 -0
- data/cookbooks/scratchify/bin/console +14 -0
- data/cookbooks/scratchify/bin/scratchify +6 -0
- data/cookbooks/scratchify/bin/setup +7 -0
- data/cookbooks/scratchify/chefignore +101 -0
- data/cookbooks/scratchify/data_bags/users/deploy.json +6 -0
- data/cookbooks/scratchify/environments/.gitkeep +0 -0
- data/cookbooks/scratchify/from-scratch.gemspec +36 -0
- data/cookbooks/scratchify/lib/from/scratch.rb +31 -0
- data/cookbooks/scratchify/lib/from/scratch/interviewer.rb +35 -0
- data/cookbooks/scratchify/lib/from/scratch/version.rb +3 -0
- data/cookbooks/scratchify/metadata.json +36 -0
- data/cookbooks/scratchify/nodes/normfood.ru.json +75 -0
- data/cookbooks/scratchify/recipes/default.rb +0 -0
- data/cookbooks/scratchify/roles/.gitkeep +0 -0
- data/cookbooks/scratchify/spec/from/scratch_spec.rb +11 -0
- data/cookbooks/scratchify/spec/spec_helper.rb +2 -0
- data/cookbooks/user/.gitignore +5 -0
- data/cookbooks/user/.kitchen.yml +46 -0
- data/cookbooks/user/.travis.yml +4 -0
- data/cookbooks/user/Berksfile +7 -0
- data/cookbooks/user/CHANGELOG.md +101 -0
- data/cookbooks/user/Gemfile +14 -0
- data/cookbooks/user/README.md +447 -0
- data/cookbooks/user/Rakefile +21 -0
- data/cookbooks/user/attributes/default.rb +50 -0
- data/cookbooks/user/libraries/matchers.rb +26 -0
- data/cookbooks/user/metadata.json +46 -0
- data/cookbooks/user/providers/account.rb +212 -0
- data/cookbooks/user/recipes/data_bag.rb +59 -0
- data/cookbooks/user/recipes/default.rb +18 -0
- data/cookbooks/user/resources/account.rb +41 -0
- data/cookbooks/user/templates/default/authorized_keys.erb +7 -0
- data/from-scratch.gemspec +33 -0
- data/lib/from-scratch.rb +25 -0
- data/lib/from-scratch/version.rb +3 -0
- data/metadata.rb +15 -0
- data/recipes/default.rb +0 -0
- data/templates/node.json.erb +31 -0
- data/templates/user.json.erb +6 -0
- metadata +330 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require "chef/platform"
|
|
2
|
+
require "chef/run_context"
|
|
3
|
+
require "chef/resource"
|
|
4
|
+
require "chef/event_dispatch/base"
|
|
5
|
+
require "chef/event_dispatch/dispatcher"
|
|
6
|
+
|
|
7
|
+
$:.unshift(File.join(File.dirname(__FILE__), "..", "..", "libraries"))
|
|
8
|
+
|
|
9
|
+
module Helpers
|
|
10
|
+
|
|
11
|
+
def events
|
|
12
|
+
@events ||= Chef::EventDispatch::Dispatcher.new
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def run_context
|
|
16
|
+
@run_context ||= Chef::RunContext.new(node, {}, events)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
RSpec.configure do |config|
|
|
21
|
+
config.include Helpers
|
|
22
|
+
config.formatter = :documentation
|
|
23
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
cookbook_path "cookbooks"
|
|
2
|
+
node_path "nodes"
|
|
3
|
+
role_path "roles"
|
|
4
|
+
environment_path "environments"
|
|
5
|
+
data_bag_path "data_bags"
|
|
6
|
+
#encrypted_data_bag_secret "data_bag_key"
|
|
7
|
+
|
|
8
|
+
knife[:berkshelf_path] = "cookbooks"
|
|
9
|
+
Chef::Config[:ssl_verify_mode] = :verify_peer if defined? ::Chef
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
#^syntax detection
|
|
3
|
+
|
|
4
|
+
source "https://supermarket.chef.io"
|
|
5
|
+
|
|
6
|
+
metadata
|
|
7
|
+
|
|
8
|
+
cookbook 'user'
|
|
9
|
+
cookbook 'rvm', github: 'fnichol/chef-rvm'
|
|
10
|
+
# cookbook 'apt'
|
|
11
|
+
# cookbook 'dpkg_packages', git: "https://gitlab.acid.cl/acidlabs/chef-dpkg-packages.git"
|
|
12
|
+
# cookbook 'nginx', git: "https://gitlab.acid.cl/acidlabs/chef-nginx.git"
|
|
13
|
+
# cookbook 'postgresql', git: "https://github.com/phlipper/chef-postgresql.git"
|
|
14
|
+
# cookbook 'rvm'
|
|
15
|
+
# cookbook 'ssh-hardening'
|
|
16
|
+
# cookbook 'sudo'
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
DEPENDENCIES
|
|
2
|
+
rvm
|
|
3
|
+
git: git://github.com/fnichol/chef-rvm.git
|
|
4
|
+
revision: 08ec265f277e112a5a2e4b201bd32ddfe1bb968c
|
|
5
|
+
scratchify
|
|
6
|
+
path: .
|
|
7
|
+
metadata: true
|
|
8
|
+
user
|
|
9
|
+
|
|
10
|
+
GRAPH
|
|
11
|
+
chef_gem (0.1.0)
|
|
12
|
+
java (1.35.0)
|
|
13
|
+
rvm (0.10.1)
|
|
14
|
+
chef_gem (>= 0.0.0)
|
|
15
|
+
java (>= 0.0.0)
|
|
16
|
+
scratchify (0.1.0)
|
|
17
|
+
rvm (>= 0.0.0)
|
|
18
|
+
user (>= 0.0.0)
|
|
19
|
+
user (0.4.2)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015 Andrew Shaydurov
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# FromScratch
|
|
2
|
+
|
|
3
|
+
I'm sick and tired of thousands of articles "How to setup Rails app". Here is your last command to do that.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Gemfile:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem 'from-scratch', group: :development
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Then
|
|
14
|
+
|
|
15
|
+
$ bundle
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
$ bundle exec scratchify
|
|
20
|
+
|
|
21
|
+
## Supports
|
|
22
|
+
|
|
23
|
+

|
|
24
|
+

|
|
25
|
+

|
|
26
|
+
|
|
27
|
+
## Development
|
|
28
|
+
|
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
30
|
+
|
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
32
|
+
|
|
33
|
+
## Contributing
|
|
34
|
+
|
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/from-scratch.
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## License
|
|
39
|
+
|
|
40
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
|
41
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "from/scratch"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Put files/directories that should be ignored in this file when uploading
|
|
2
|
+
# or sharing to the community site.
|
|
3
|
+
# Lines that start with '# ' are comments.
|
|
4
|
+
|
|
5
|
+
# OS generated files #
|
|
6
|
+
######################
|
|
7
|
+
.DS_Store
|
|
8
|
+
Icon?
|
|
9
|
+
nohup.out
|
|
10
|
+
ehthumbs.db
|
|
11
|
+
Thumbs.db
|
|
12
|
+
|
|
13
|
+
# SASS #
|
|
14
|
+
########
|
|
15
|
+
.sass-cache
|
|
16
|
+
|
|
17
|
+
# EDITORS #
|
|
18
|
+
###########
|
|
19
|
+
\#*
|
|
20
|
+
.#*
|
|
21
|
+
*~
|
|
22
|
+
*.sw[a-z]
|
|
23
|
+
*.bak
|
|
24
|
+
REVISION
|
|
25
|
+
TAGS*
|
|
26
|
+
tmtags
|
|
27
|
+
*_flymake.*
|
|
28
|
+
*_flymake
|
|
29
|
+
*.tmproj
|
|
30
|
+
.project
|
|
31
|
+
.settings
|
|
32
|
+
mkmf.log
|
|
33
|
+
|
|
34
|
+
## COMPILED ##
|
|
35
|
+
##############
|
|
36
|
+
a.out
|
|
37
|
+
*.o
|
|
38
|
+
*.pyc
|
|
39
|
+
*.so
|
|
40
|
+
*.com
|
|
41
|
+
*.class
|
|
42
|
+
*.dll
|
|
43
|
+
*.exe
|
|
44
|
+
*/rdoc/
|
|
45
|
+
|
|
46
|
+
# Testing #
|
|
47
|
+
###########
|
|
48
|
+
.watchr
|
|
49
|
+
.rspec
|
|
50
|
+
spec/*
|
|
51
|
+
spec/fixtures/*
|
|
52
|
+
test/*
|
|
53
|
+
features/*
|
|
54
|
+
Guardfile
|
|
55
|
+
Procfile
|
|
56
|
+
|
|
57
|
+
# SCM #
|
|
58
|
+
#######
|
|
59
|
+
.git
|
|
60
|
+
*/.git
|
|
61
|
+
.gitignore
|
|
62
|
+
.gitmodules
|
|
63
|
+
.gitconfig
|
|
64
|
+
.gitattributes
|
|
65
|
+
.svn
|
|
66
|
+
*/.bzr/*
|
|
67
|
+
*/.hg/*
|
|
68
|
+
*/.svn/*
|
|
69
|
+
|
|
70
|
+
# Berkshelf #
|
|
71
|
+
#############
|
|
72
|
+
cookbooks/*
|
|
73
|
+
tmp
|
|
74
|
+
|
|
75
|
+
# Cookbooks #
|
|
76
|
+
#############
|
|
77
|
+
CONTRIBUTING
|
|
78
|
+
CHANGELOG*
|
|
79
|
+
|
|
80
|
+
# Strainer #
|
|
81
|
+
############
|
|
82
|
+
Colanderfile
|
|
83
|
+
Strainerfile
|
|
84
|
+
.colander
|
|
85
|
+
.strainer
|
|
86
|
+
|
|
87
|
+
# Vagrant #
|
|
88
|
+
###########
|
|
89
|
+
.vagrant
|
|
90
|
+
Vagrantfile
|
|
91
|
+
|
|
92
|
+
# Travis #
|
|
93
|
+
##########
|
|
94
|
+
.travis.yml
|
|
95
|
+
|
|
96
|
+
# Gem files #
|
|
97
|
+
Gemfile
|
|
98
|
+
Gemfile.lock
|
|
99
|
+
Rakefile
|
|
100
|
+
lib/*
|
|
101
|
+
bin/*
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "deploy",
|
|
3
|
+
"name": "deploy",
|
|
4
|
+
"groups": ["deploy"],
|
|
5
|
+
"ssh_keys": ["ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDA0w9lFxWQta1H3pNvqvGtKTfdBahIMp9iqmxzDbwbMRZDuJ3ANNeHxebGP6F4pfjOoI9t/+l1ljgRbAXCEgi/klhjj7TMzGalzOBy5kOFfZlZO4km5wiM1QXPtgXhqe4qcnzNQkSTbh3+0h6arGV0fiHOa5Nc3hv3mnBce0M6PCpbK/PGYfc5/TJrvuMwd6K9vLUgFsiQ1vph6mncoAh0QHfbzKmDi86YyzwCyzxwwFz/ZCaYwxf11fAkydm6sNX9VxOqE16LjycFN1khe9xEyQ/wGP7uIH3LGR2VcHAPFxoaTAssyJtiF5WpNQXGCX3SyyBZf9lHjb0RP4IzYJvp gearhead@gearhead-desktop"]
|
|
6
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'from/scratch/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "from-scratch"
|
|
8
|
+
spec.version = FromScratch::VERSION
|
|
9
|
+
spec.authors = ["Andrew Shaydurov"]
|
|
10
|
+
spec.email = ["gearhead@it-primorye.ru"]
|
|
11
|
+
|
|
12
|
+
spec.summary = "Your last command to bootstrap the whole Rails app"
|
|
13
|
+
spec.description = "Makes all the stuff usually you or your DevOps does before first deploy"
|
|
14
|
+
spec.homepage = "https://github.com/sandrew/from-scratch"
|
|
15
|
+
spec.license = "MIT"
|
|
16
|
+
|
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
18
|
+
spec.executables = %w(scratchify)
|
|
19
|
+
spec.require_paths = %w(lib)
|
|
20
|
+
|
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
23
|
+
spec.add_development_dependency "rspec"
|
|
24
|
+
spec.add_development_dependency 'pry'
|
|
25
|
+
|
|
26
|
+
spec.add_dependency 'sshkit', '>= 1.7.1'
|
|
27
|
+
spec.add_dependency 'colorize'
|
|
28
|
+
spec.add_dependency 'activesupport', '>= 3.2.1'
|
|
29
|
+
spec.add_dependency 'knife-solo'
|
|
30
|
+
spec.add_dependency 'knife-solo_data_bag'
|
|
31
|
+
spec.add_dependency 'chef'
|
|
32
|
+
spec.add_dependency 'berkshelf'
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
spec.required_ruby_version = '>= 1.9.3'
|
|
36
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require 'pry'
|
|
2
|
+
|
|
3
|
+
require 'active_support'
|
|
4
|
+
require 'active_support/core_ext/object'
|
|
5
|
+
|
|
6
|
+
require 'sshkit'
|
|
7
|
+
|
|
8
|
+
require 'from/scratch/version'
|
|
9
|
+
require 'from/scratch/interviewer'
|
|
10
|
+
|
|
11
|
+
module FromScratch
|
|
12
|
+
def self.run!
|
|
13
|
+
Interviewer.greetings
|
|
14
|
+
|
|
15
|
+
host = Interviewer.get_host
|
|
16
|
+
|
|
17
|
+
if host != 'localhost'
|
|
18
|
+
`ssh-copy-id root@#{host}`
|
|
19
|
+
root_host = SSHKit::Host.new "root@#{host}"
|
|
20
|
+
else
|
|
21
|
+
root_host = SSHKit::Host.new :local
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
SSHKit::Coordinator.new([root_host]).each do |host|
|
|
25
|
+
execute 'adduser deploy --gecos "" --disabled-password'
|
|
26
|
+
execute 'mkdir -p /home/deploy/.ssh/'
|
|
27
|
+
execute 'cp -R ~/.ssh/authorized_keys /home/deploy/.ssh/'
|
|
28
|
+
execute 'chown -R deploy:deploy /home/deploy/'
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require 'colorize'
|
|
2
|
+
|
|
3
|
+
module FromScratch
|
|
4
|
+
module Interviewer
|
|
5
|
+
class << self
|
|
6
|
+
def greetings
|
|
7
|
+
puts "Greetings, master! Let's make some magic.".blue
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def get_host
|
|
11
|
+
ask 'Please enter address of your server:', default: 'localhost'
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
private
|
|
15
|
+
|
|
16
|
+
def ask(str, default: nil, default_str: nil, variants: [])
|
|
17
|
+
puts
|
|
18
|
+
puts str.yellow
|
|
19
|
+
if variants.any?
|
|
20
|
+
puts "[#{variants.map(&:yellow).join ' | '}]"
|
|
21
|
+
while !variants.include?(answer = gets.strip)
|
|
22
|
+
puts "not recognized".red
|
|
23
|
+
end
|
|
24
|
+
answer
|
|
25
|
+
else
|
|
26
|
+
if default || default_str
|
|
27
|
+
puts "[#{default_str ? default_str : "leave blank for #{default.yellow}"}]"
|
|
28
|
+
end
|
|
29
|
+
answer = gets.strip
|
|
30
|
+
default && answer.blank? ? default : answer
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "scratchify",
|
|
3
|
+
"description": "Cookbook for FromScratch gem",
|
|
4
|
+
"long_description": "",
|
|
5
|
+
"maintainer": "Andrew Shaydurov",
|
|
6
|
+
"maintainer_email": "gearhead@it-primorye.ru",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"platforms": {
|
|
9
|
+
"ubuntu": ">= 0.0.0",
|
|
10
|
+
"debian": ">= 0.0.0"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"user": ">= 0.0.0",
|
|
14
|
+
"rvm": ">= 0.0.0"
|
|
15
|
+
},
|
|
16
|
+
"recommendations": {
|
|
17
|
+
},
|
|
18
|
+
"suggestions": {
|
|
19
|
+
},
|
|
20
|
+
"conflicting": {
|
|
21
|
+
},
|
|
22
|
+
"providing": {
|
|
23
|
+
},
|
|
24
|
+
"replacing": {
|
|
25
|
+
},
|
|
26
|
+
"attributes": {
|
|
27
|
+
},
|
|
28
|
+
"groupings": {
|
|
29
|
+
},
|
|
30
|
+
"recipes": {
|
|
31
|
+
"scratchify": "run all recipes."
|
|
32
|
+
},
|
|
33
|
+
"version": "0.1.0",
|
|
34
|
+
"source_url": "",
|
|
35
|
+
"issues_url": ""
|
|
36
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"run_list": [
|
|
3
|
+
"recipe[user::data_bag]",
|
|
4
|
+
"recipe[rvm::system]",
|
|
5
|
+
"recipe[scratchify]"//,
|
|
6
|
+
//"recipe[apt]",
|
|
7
|
+
// "recipe[ssh-hardening]",
|
|
8
|
+
// "recipe[dpkg_packages]",
|
|
9
|
+
// "recipe[postgresql::server]",
|
|
10
|
+
// "recipe[postgresql::contrib]",
|
|
11
|
+
// "recipe[postgresql::libpq]",
|
|
12
|
+
// "recipe[nginx::server]",
|
|
13
|
+
// "recipe[rvm::user]",
|
|
14
|
+
],
|
|
15
|
+
|
|
16
|
+
"users": ["deploy"],
|
|
17
|
+
|
|
18
|
+
"automatic": {
|
|
19
|
+
"ipaddress": "normfood.ru"
|
|
20
|
+
}//,
|
|
21
|
+
|
|
22
|
+
// //"set_fqdn": "<myhostname>",
|
|
23
|
+
|
|
24
|
+
// "dpkg_packages": {
|
|
25
|
+
// "pkgs": {
|
|
26
|
+
// "tzdata" : { "action": "upgrade" }//,
|
|
27
|
+
// // "nodejs-dev" : { "action": "install" },
|
|
28
|
+
// // "imagemagick": { "action": "install" },
|
|
29
|
+
// // "htop" : { "action": "install" }
|
|
30
|
+
// }
|
|
31
|
+
// },
|
|
32
|
+
|
|
33
|
+
// // Select Timezone you want to configure
|
|
34
|
+
// // "tz": "America/Santiago",
|
|
35
|
+
|
|
36
|
+
// // Postgresql configuration. You can create several users.
|
|
37
|
+
// "postgresql": {
|
|
38
|
+
// "shared_buffers": "256MB", // 1/4 of total memory is recommended
|
|
39
|
+
// "shared_preload_libraries": "pg_stat_statements",
|
|
40
|
+
// "users": [
|
|
41
|
+
// {
|
|
42
|
+
// "username": "deploy",
|
|
43
|
+
// "password": "123456",
|
|
44
|
+
// "superuser": true,
|
|
45
|
+
// "login": true
|
|
46
|
+
// }
|
|
47
|
+
// ]
|
|
48
|
+
// },
|
|
49
|
+
|
|
50
|
+
// // Nginx default values configuration.
|
|
51
|
+
// // Also you can specify your default site configuration.
|
|
52
|
+
// "nginx": {
|
|
53
|
+
// "user" : "deploy",
|
|
54
|
+
// "client_max_body_size": "2m",
|
|
55
|
+
// "worker_processes" : "auto",
|
|
56
|
+
// "worker_connections" : 768,
|
|
57
|
+
// "repository" : "ppa",
|
|
58
|
+
// "site" : {
|
|
59
|
+
// "host" : "<myhostname>",
|
|
60
|
+
// "upstream_ports" : ["3000"],
|
|
61
|
+
// "ip" : "0.0.0.0",
|
|
62
|
+
// "listen" : "80"
|
|
63
|
+
// }
|
|
64
|
+
// },
|
|
65
|
+
|
|
66
|
+
// // The default ruby version and gemset you’re going to use and rvm user.
|
|
67
|
+
// "rvm" : {
|
|
68
|
+
// "user_installs": [
|
|
69
|
+
// {
|
|
70
|
+
// "user" : "deploy",
|
|
71
|
+
// "default_ruby" : "<ruby-version>@<gemset>"
|
|
72
|
+
// }
|
|
73
|
+
// ]
|
|
74
|
+
// }
|
|
75
|
+
}
|