from-scratch 0.1.0 → 0.1.1
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 +4 -4
- data/.gitignore +1 -0
- data/Berksfile.lock +11 -0
- data/chefignore +1 -0
- data/cookbooks/apt/CHANGELOG.md +248 -0
- data/cookbooks/apt/README.md +294 -0
- data/cookbooks/apt/attributes/default.rb +51 -0
- data/cookbooks/apt/files/default/15update-stamp +1 -0
- data/cookbooks/apt/files/default/apt-proxy-v2.conf +50 -0
- data/cookbooks/apt/libraries/helpers.rb +61 -0
- data/cookbooks/apt/libraries/matchers.rb +17 -0
- data/cookbooks/apt/libraries/network.rb +31 -0
- data/cookbooks/apt/metadata.json +1 -0
- data/cookbooks/apt/providers/preference.rb +84 -0
- data/cookbooks/apt/providers/repository.rb +246 -0
- data/cookbooks/apt/recipes/cacher-client.rb +83 -0
- data/cookbooks/apt/recipes/cacher-ng.rb +43 -0
- data/cookbooks/apt/recipes/default.rb +112 -0
- data/cookbooks/apt/recipes/unattended-upgrades.rb +47 -0
- data/cookbooks/apt/resources/preference.rb +37 -0
- data/cookbooks/apt/resources/repository.rb +60 -0
- data/cookbooks/apt/templates/debian-6.0/acng.conf.erb +173 -0
- data/cookbooks/apt/templates/default/01proxy.erb +9 -0
- data/cookbooks/apt/templates/default/10recommends.erb +3 -0
- data/cookbooks/apt/templates/default/20auto-upgrades.erb +2 -0
- data/cookbooks/apt/templates/default/50unattended-upgrades.erb +68 -0
- data/cookbooks/apt/templates/default/acng.conf.erb +275 -0
- data/cookbooks/apt/templates/default/unattended-upgrades.seed.erb +1 -0
- data/cookbooks/apt/templates/ubuntu-10.04/acng.conf.erb +269 -0
- data/cookbooks/build-essential/CHANGELOG.md +136 -0
- data/cookbooks/build-essential/README.md +108 -0
- data/cookbooks/build-essential/attributes/default.rb +20 -0
- data/cookbooks/build-essential/libraries/matchers.rb +5 -0
- data/cookbooks/build-essential/libraries/timing.rb +124 -0
- data/cookbooks/build-essential/libraries/xcode_command_line_tools.rb +210 -0
- data/cookbooks/build-essential/metadata.json +1 -0
- data/cookbooks/build-essential/recipes/_debian.rb +28 -0
- data/cookbooks/build-essential/recipes/_fedora.rb +32 -0
- data/cookbooks/build-essential/recipes/_freebsd.rb +24 -0
- data/cookbooks/build-essential/recipes/_mac_os_x.rb +22 -0
- data/cookbooks/build-essential/recipes/_omnios.rb +33 -0
- data/cookbooks/build-essential/recipes/_rhel.rb +36 -0
- data/cookbooks/build-essential/recipes/_smartos.rb +27 -0
- data/cookbooks/build-essential/recipes/_solaris2.rb +48 -0
- data/cookbooks/build-essential/recipes/_suse.rb +29 -0
- data/cookbooks/build-essential/recipes/default.rb +29 -0
- data/cookbooks/chef-sugar/CHANGELOG.md +159 -0
- data/cookbooks/chef-sugar/README.md +464 -0
- data/cookbooks/chef-sugar/metadata.json +1 -0
- data/cookbooks/chef-sugar/recipes/default.rb +34 -0
- data/cookbooks/openssl/CHANGELOG.md +30 -0
- data/cookbooks/openssl/README.md +115 -0
- data/cookbooks/openssl/attributes/default.rb +21 -0
- data/cookbooks/openssl/libraries/secure_password.rb +37 -0
- data/cookbooks/openssl/metadata.json +31 -0
- data/cookbooks/openssl/providers/x509.rb +94 -0
- data/cookbooks/openssl/recipes/default.rb +18 -0
- data/cookbooks/openssl/recipes/upgrade.rb +39 -0
- data/cookbooks/openssl/resources/x509.rb +16 -0
- data/cookbooks/postgresql/CHANGELOG.md +220 -0
- data/cookbooks/postgresql/README.md +464 -0
- data/cookbooks/postgresql/attributes/default.rb +549 -0
- data/cookbooks/postgresql/files/default/tests/minitest/apt_pgdg_postgresql_test.rb +39 -0
- data/cookbooks/postgresql/files/default/tests/minitest/default_test.rb +27 -0
- data/cookbooks/postgresql/files/default/tests/minitest/ruby_test.rb +28 -0
- data/cookbooks/postgresql/files/default/tests/minitest/server_test.rb +43 -0
- data/cookbooks/postgresql/files/default/tests/minitest/support/helpers.rb +29 -0
- data/cookbooks/postgresql/libraries/default.rb +377 -0
- data/cookbooks/postgresql/metadata.json +56 -0
- data/cookbooks/postgresql/recipes/apt_pgdg_postgresql.rb +18 -0
- data/cookbooks/postgresql/recipes/client.rb +32 -0
- data/cookbooks/postgresql/recipes/config_initdb.rb +148 -0
- data/cookbooks/postgresql/recipes/config_pgtune.rb +284 -0
- data/cookbooks/postgresql/recipes/contrib.rb +44 -0
- data/cookbooks/postgresql/recipes/default.rb +18 -0
- data/cookbooks/postgresql/recipes/ruby.rb +117 -0
- data/cookbooks/postgresql/recipes/server.rb +89 -0
- data/cookbooks/postgresql/recipes/server_conf.rb +34 -0
- data/cookbooks/postgresql/recipes/server_debian.rb +38 -0
- data/cookbooks/postgresql/recipes/server_redhat.rb +100 -0
- data/cookbooks/postgresql/recipes/yum_pgdg_postgresql.rb +45 -0
- data/cookbooks/postgresql/templates/default/pg_hba.conf.erb +35 -0
- data/cookbooks/postgresql/templates/default/pgsql.sysconfig.erb +4 -0
- data/cookbooks/postgresql/templates/default/postgresql.conf.erb +21 -0
- data/cookbooks/scratchify/.chef/knife.rb +2 -5
- data/cookbooks/scratchify/Berksfile +2 -1
- data/cookbooks/scratchify/Berksfile.lock +11 -0
- data/cookbooks/scratchify/README.md +34 -17
- data/cookbooks/scratchify/bin/scratchify +1 -1
- data/cookbooks/scratchify/chefignore +1 -0
- data/cookbooks/scratchify/from-scratch.gemspec +2 -5
- data/cookbooks/scratchify/lib/from-scratch.rb +25 -0
- data/cookbooks/scratchify/lib/{from/scratch → from-scratch}/version.rb +1 -1
- data/cookbooks/scratchify/metadata.json +2 -1
- data/cookbooks/scratchify/templates/node.json.erb +34 -0
- data/cookbooks/scratchify/templates/user.json.erb +6 -0
- data/lib/from-scratch.rb +2 -2
- data/lib/from-scratch/version.rb +1 -1
- data/templates/node.json.erb +6 -3
- metadata +85 -10
- data/cookbooks/scratchify/bin/console +0 -14
- data/cookbooks/scratchify/bin/setup +0 -7
- data/cookbooks/scratchify/data_bags/users/deploy.json +0 -6
- data/cookbooks/scratchify/environments/.gitkeep +0 -0
- data/cookbooks/scratchify/lib/from/scratch.rb +0 -31
- data/cookbooks/scratchify/lib/from/scratch/interviewer.rb +0 -35
- data/cookbooks/scratchify/nodes/normfood.ru.json +0 -75
- data/cookbooks/scratchify/roles/.gitkeep +0 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Cookbook Name:: postgresql
|
|
3
|
+
# Recipe::yum_pgdg_postgresql
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
#
|
|
17
|
+
|
|
18
|
+
#######
|
|
19
|
+
# Load the pgdgrepo_rpm_info method from libraries/default.rb
|
|
20
|
+
::Chef::Recipe.send(:include, Opscode::PostgresqlHelpers)
|
|
21
|
+
|
|
22
|
+
######################################
|
|
23
|
+
# Install the "PostgreSQL RPM Building Project - Yum Repository" through
|
|
24
|
+
# the repo_rpm_url determined with pgdgrepo_rpm_info method from
|
|
25
|
+
# libraries/default.rb. The /etc/yum.repos.d/pgdg-*.repo
|
|
26
|
+
# will provide postgresql9X packages, but you may need to exclude
|
|
27
|
+
# postgresql packages from the repository of the distro in order to use
|
|
28
|
+
# PGDG repository properly. Conflicts will arise if postgresql9X does
|
|
29
|
+
# appear in your distro's repo and you want a more recent patch level.
|
|
30
|
+
|
|
31
|
+
repo_rpm_url, repo_rpm_filename, repo_rpm_package = pgdgrepo_rpm_info
|
|
32
|
+
|
|
33
|
+
# Download the PGDG repository RPM as a local file
|
|
34
|
+
remote_file "#{Chef::Config[:file_cache_path]}/#{repo_rpm_filename}" do
|
|
35
|
+
source repo_rpm_url
|
|
36
|
+
mode "0644"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Install the PGDG repository RPM from the local file
|
|
40
|
+
# E.g., /etc/yum.repos.d/pgdg-91-centos.repo
|
|
41
|
+
package repo_rpm_package do
|
|
42
|
+
provider Chef::Provider::Package::Rpm
|
|
43
|
+
source "#{Chef::Config[:file_cache_path]}/#{repo_rpm_filename}"
|
|
44
|
+
action :install
|
|
45
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# This file was automatically generated and dropped off by Chef!
|
|
2
|
+
|
|
3
|
+
# PostgreSQL Client Authentication Configuration File
|
|
4
|
+
# ===================================================
|
|
5
|
+
#
|
|
6
|
+
# Refer to the "Client Authentication" section in the PostgreSQL
|
|
7
|
+
# documentation for a complete description of this file.
|
|
8
|
+
|
|
9
|
+
<% if node['postgresql']['version'].to_f < 9.1 -%>
|
|
10
|
+
# TYPE DATABASE USER CIDR-ADDRESS METHOD
|
|
11
|
+
<% elsif node['postgresql']['version'].to_f >= 9.1 -%>
|
|
12
|
+
# TYPE DATABASE USER ADDRESS METHOD
|
|
13
|
+
<% end -%>
|
|
14
|
+
|
|
15
|
+
###########
|
|
16
|
+
# Other authentication configurations taken from chef node defaults:
|
|
17
|
+
###########
|
|
18
|
+
<% node['postgresql']['pg_hba'].each do |auth| -%>
|
|
19
|
+
|
|
20
|
+
<% if auth[:comment] %>
|
|
21
|
+
<%= auth[:comment] %>
|
|
22
|
+
<% end %>
|
|
23
|
+
<% if auth[:addr] %>
|
|
24
|
+
<%= auth[:type].ljust(7) %> <%= auth[:db].ljust(15) %> <%= auth[:user].ljust(15) %> <%= auth[:addr].ljust(23) %> <%= auth[:method] %>
|
|
25
|
+
<% else %>
|
|
26
|
+
<%= auth[:type].ljust(7) %> <%= auth[:db].ljust(15) %> <%= auth[:user].ljust(15) %> <%= auth[:method] %>
|
|
27
|
+
<% end %>
|
|
28
|
+
<% end %>
|
|
29
|
+
|
|
30
|
+
# "local" is for Unix domain socket connections only
|
|
31
|
+
<% if node['postgresql']['version'].to_f < 9.1 -%>
|
|
32
|
+
local all all ident
|
|
33
|
+
<% elsif node['postgresql']['version'].to_f >= 9.1 -%>
|
|
34
|
+
local all all peer
|
|
35
|
+
<% end -%>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# PostgreSQL configuration file
|
|
2
|
+
# This file was automatically generated and dropped off by chef!
|
|
3
|
+
# Please refer to the PostgreSQL documentation for details on
|
|
4
|
+
# configuration settings.
|
|
5
|
+
|
|
6
|
+
<% node['postgresql']['config'].sort.each do |key, value| %>
|
|
7
|
+
<% next if value.nil? -%>
|
|
8
|
+
<% next if node['postgresql']['version'].to_f < 9.2 && /ssl_.*._file/.match(key) -%>
|
|
9
|
+
<%= key %> = <%=
|
|
10
|
+
case value
|
|
11
|
+
when String
|
|
12
|
+
"'#{value}'"
|
|
13
|
+
when TrueClass
|
|
14
|
+
'on'
|
|
15
|
+
when FalseClass
|
|
16
|
+
'off'
|
|
17
|
+
else
|
|
18
|
+
value
|
|
19
|
+
end
|
|
20
|
+
%>
|
|
21
|
+
<% end %>
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
cookbook_path "cookbooks"
|
|
2
|
-
node_path "nodes"
|
|
3
|
-
|
|
4
|
-
environment_path "environments"
|
|
5
|
-
data_bag_path "data_bags"
|
|
6
|
-
#encrypted_data_bag_secret "data_bag_key"
|
|
2
|
+
node_path "tmp/nodes"
|
|
3
|
+
data_bag_path "tmp/data_bags"
|
|
7
4
|
|
|
8
5
|
knife[:berkshelf_path] = "cookbooks"
|
|
9
6
|
Chef::Config[:ssl_verify_mode] = :verify_peer if defined? ::Chef
|
|
@@ -7,7 +7,8 @@ metadata
|
|
|
7
7
|
|
|
8
8
|
cookbook 'user'
|
|
9
9
|
cookbook 'rvm', github: 'fnichol/chef-rvm'
|
|
10
|
-
|
|
10
|
+
cookbook 'postgresql'
|
|
11
|
+
|
|
11
12
|
# cookbook 'dpkg_packages', git: "https://gitlab.acid.cl/acidlabs/chef-dpkg-packages.git"
|
|
12
13
|
# cookbook 'nginx', git: "https://gitlab.acid.cl/acidlabs/chef-nginx.git"
|
|
13
14
|
# cookbook 'postgresql', git: "https://github.com/phlipper/chef-postgresql.git"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
DEPENDENCIES
|
|
2
|
+
postgresql
|
|
2
3
|
rvm
|
|
3
4
|
git: git://github.com/fnichol/chef-rvm.git
|
|
4
5
|
revision: 08ec265f277e112a5a2e4b201bd32ddfe1bb968c
|
|
@@ -8,12 +9,22 @@ DEPENDENCIES
|
|
|
8
9
|
user
|
|
9
10
|
|
|
10
11
|
GRAPH
|
|
12
|
+
apt (2.9.2)
|
|
13
|
+
build-essential (2.2.4)
|
|
14
|
+
chef-sugar (3.1.1)
|
|
11
15
|
chef_gem (0.1.0)
|
|
12
16
|
java (1.35.0)
|
|
17
|
+
openssl (4.0.0)
|
|
18
|
+
chef-sugar (>= 0.0.0)
|
|
19
|
+
postgresql (3.4.20)
|
|
20
|
+
apt (>= 1.9.0)
|
|
21
|
+
build-essential (>= 0.0.0)
|
|
22
|
+
openssl (~> 4.0.0)
|
|
13
23
|
rvm (0.10.1)
|
|
14
24
|
chef_gem (>= 0.0.0)
|
|
15
25
|
java (>= 0.0.0)
|
|
16
26
|
scratchify (0.1.0)
|
|
27
|
+
postgresql (>= 0.0.0)
|
|
17
28
|
rvm (>= 0.0.0)
|
|
18
29
|
user (>= 0.0.0)
|
|
19
30
|
user (0.4.2)
|
|
@@ -1,39 +1,56 @@
|
|
|
1
1
|
# FromScratch
|
|
2
2
|
|
|
3
|
-
I'm sick and tired of thousands of articles "How to setup Rails app". Here is your last command to do that.
|
|
3
|
+
I'm sick and tired of thousands of articles "How to setup Rails app server". Here is your last command to do that.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
No configs, no questions. Just ~~one ring to rule them all~~ one command to get fully functional server with best security practices ready for first `cap production deploy`.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
$ gem install from-scratch
|
|
10
|
+
$ scratchify your_app_name your.host.com
|
|
11
|
+
|
|
12
|
+
And everything is done. Then add following to your `config/deploy.rb` or `config/deploy/production.rb` for Capistrano:
|
|
8
13
|
|
|
9
14
|
```ruby
|
|
10
|
-
|
|
15
|
+
server 'your.host.com', user: 'deploy', roles: %w(app db web)
|
|
16
|
+
set :deploy_to, "/home/deploy/your_app_name"
|
|
11
17
|
```
|
|
12
18
|
|
|
13
|
-
|
|
19
|
+
## Supports
|
|
14
20
|
|
|
15
|
-
|
|
21
|
+
OS:
|
|
16
22
|
|
|
17
|
-
|
|
23
|
+
- APT-based Linux (Ubuntu, Debian)
|
|
24
|
+
- YUM-based Linux (RedHat, CentOS)
|
|
18
25
|
|
|
19
|
-
|
|
26
|
+
## It's a kind of magic!
|
|
20
27
|
|
|
21
|
-
|
|
28
|
+
Not actully. Just preconfigured [Chef](https://www.chef.io/). Here are the things done with the command:
|
|
22
29
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
30
|
+
- Install system-wide RVM with latest MRI (2.2.3)
|
|
31
|
+
- Install PostgreSQL, create database with user, pg_tune a little
|
|
32
|
+
- Add _deploy_ non-admin user to system specially for your app, upload your SSH pub key to it
|
|
33
|
+
- Install nginx and replace it's default site config with one prepared for rails app
|
|
34
|
+
- Generate app folder inside _deploy_'s home and generate `database.yml` and `secrets.yml`
|
|
26
35
|
|
|
27
|
-
##
|
|
36
|
+
## Things you need to know
|
|
28
37
|
|
|
29
|
-
|
|
38
|
+
Nginx config is set up to connect to unix socket placed at `/home/deploy/your_app_name/shared/tmp/sockets/application.sock`. Change it manually or config your favorite app server (Puma, Unicorn, Thin etc) to place it's socket there.
|
|
30
39
|
|
|
31
|
-
|
|
40
|
+
You can just `ssh deploy@your.host.com` because your SSH pub key is already there.
|
|
32
41
|
|
|
33
|
-
|
|
42
|
+
Both `postgres` and `your_app_name` DB users get (different) randomly generated passwords. You can see app-user password inside `config/database.yml`, but `postgres` password is not saved anywhere. If you need admin access to your PostgreSQL, then you should SSH as root and:
|
|
43
|
+
|
|
44
|
+
# su - postgres
|
|
45
|
+
$ psql
|
|
46
|
+
|
|
47
|
+
## Development
|
|
48
|
+
|
|
49
|
+
TODO
|
|
34
50
|
|
|
35
|
-
|
|
51
|
+
## Contributing
|
|
36
52
|
|
|
53
|
+
TODO
|
|
37
54
|
|
|
38
55
|
## License
|
|
39
56
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# coding: utf-8
|
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
-
require 'from
|
|
4
|
+
require 'from-scratch/version'
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = "from-scratch"
|
|
@@ -20,12 +20,9 @@ Gem::Specification.new do |spec|
|
|
|
20
20
|
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.10"
|
|
22
22
|
spec.add_development_dependency "rake", "~> 10.0"
|
|
23
|
-
spec.add_development_dependency
|
|
23
|
+
spec.add_development_dependency 'rspec', "~> 3.3.0"
|
|
24
24
|
spec.add_development_dependency 'pry'
|
|
25
25
|
|
|
26
|
-
spec.add_dependency 'sshkit', '>= 1.7.1'
|
|
27
|
-
spec.add_dependency 'colorize'
|
|
28
|
-
spec.add_dependency 'activesupport', '>= 3.2.1'
|
|
29
26
|
spec.add_dependency 'knife-solo'
|
|
30
27
|
spec.add_dependency 'knife-solo_data_bag'
|
|
31
28
|
spec.add_dependency 'chef'
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require 'securerandom'
|
|
2
|
+
require 'erb'
|
|
3
|
+
require 'fileutils'
|
|
4
|
+
|
|
5
|
+
module FromScratch
|
|
6
|
+
def self.run!
|
|
7
|
+
app_name, host = ARGV
|
|
8
|
+
ssh_pub_key = `cat ~/.ssh/id_rsa.pub`.strip
|
|
9
|
+
postgresql_admin_password = `echo -n '#{SecureRandom.hex(64)}''postgres' | openssl md5 | sed -e 's/.* /md5/'`.strip
|
|
10
|
+
|
|
11
|
+
{ node: ['nodes', host], user: ['data_bags/users', 'deploy'] }.each do |from, to|
|
|
12
|
+
FileUtils.mkdir_p File.expand_path("../../tmp/#{to[0]}", __FILE__)
|
|
13
|
+
File.open(File.expand_path("../../tmp/#{to.join('/')}.json", __FILE__), 'w') do |f|
|
|
14
|
+
f.write ERB.new(File.open(File.expand_path("../../templates/#{from}.json.erb", __FILE__)).read).result(binding)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
Dir.chdir(File.expand_path('../..', __FILE__)) do
|
|
19
|
+
system "knife solo bootstrap root@#{host}"
|
|
20
|
+
system "knife solo clean root@#{host}"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
FileUtils.rm_rf [File.expand_path('../../tmp', __FILE__)]
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"run_list": [
|
|
3
|
+
"recipe[rvm::system]",
|
|
4
|
+
"recipe[postgresql::server]",
|
|
5
|
+
"recipe[postgresql::config_pgtune]",
|
|
6
|
+
"recipe[user::data_bag]",
|
|
7
|
+
"recipe[scratchify]"
|
|
8
|
+
],
|
|
9
|
+
|
|
10
|
+
"users": ["deploy"],
|
|
11
|
+
|
|
12
|
+
"rvm": {
|
|
13
|
+
"default_ruby": "2.2.3",
|
|
14
|
+
"rubies": ["2.2.3"],
|
|
15
|
+
"install_rubies": true,
|
|
16
|
+
"gpg": {}
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
"postgresql": {
|
|
20
|
+
"version": "9.4",
|
|
21
|
+
"enable_pgdg_yum": true,
|
|
22
|
+
"enable_pgdg_apt": true,
|
|
23
|
+
"password": {
|
|
24
|
+
"postgres": "<%= postgresql_admin_password %>"
|
|
25
|
+
},
|
|
26
|
+
"config_pgtune": {
|
|
27
|
+
"db_type": "web"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
"automatic": {
|
|
32
|
+
"ipaddress": "<%= host %>"
|
|
33
|
+
}
|
|
34
|
+
}
|
data/lib/from-scratch.rb
CHANGED
|
@@ -6,7 +6,7 @@ module FromScratch
|
|
|
6
6
|
def self.run!
|
|
7
7
|
app_name, host = ARGV
|
|
8
8
|
ssh_pub_key = `cat ~/.ssh/id_rsa.pub`.strip
|
|
9
|
-
postgresql_admin_password = `echo -n '#{SecureRandom.hex(64)}''postgres' | openssl md5 | sed -e 's/.* /md5/'
|
|
9
|
+
postgresql_admin_password = `echo -n '#{SecureRandom.hex(64)}''postgres' | openssl md5 | sed -e 's/.* /md5/'`.strip
|
|
10
10
|
|
|
11
11
|
{ node: ['nodes', host], user: ['data_bags/users', 'deploy'] }.each do |from, to|
|
|
12
12
|
FileUtils.mkdir_p File.expand_path("../../tmp/#{to[0]}", __FILE__)
|
|
@@ -15,7 +15,7 @@ module FromScratch
|
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
Dir.chdir(File.expand_path('
|
|
18
|
+
Dir.chdir(File.expand_path('../..', __FILE__)) do
|
|
19
19
|
system "knife solo bootstrap root@#{host}"
|
|
20
20
|
system "knife solo clean root@#{host}"
|
|
21
21
|
end
|
data/lib/from-scratch/version.rb
CHANGED
data/templates/node.json.erb
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"run_list": [
|
|
3
3
|
"recipe[rvm::system]",
|
|
4
|
-
"recipe[
|
|
5
|
-
"recipe[
|
|
4
|
+
"recipe[postgresql::server]",
|
|
5
|
+
"recipe[postgresql::config_pgtune]",
|
|
6
6
|
"recipe[user::data_bag]",
|
|
7
7
|
"recipe[scratchify]"
|
|
8
8
|
],
|
|
@@ -10,7 +10,10 @@
|
|
|
10
10
|
"users": ["deploy"],
|
|
11
11
|
|
|
12
12
|
"rvm": {
|
|
13
|
-
"default_ruby": "2.2.3"
|
|
13
|
+
"default_ruby": "2.2.3",
|
|
14
|
+
"rubies": ["2.2.3"],
|
|
15
|
+
"install_rubies": true,
|
|
16
|
+
"gpg": {}
|
|
14
17
|
},
|
|
15
18
|
|
|
16
19
|
"postgresql": {
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: from-scratch
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrew Shaydurov
|
|
@@ -143,6 +143,52 @@ files:
|
|
|
143
143
|
- Thorfile
|
|
144
144
|
- bin/scratchify
|
|
145
145
|
- chefignore
|
|
146
|
+
- cookbooks/apt/CHANGELOG.md
|
|
147
|
+
- cookbooks/apt/README.md
|
|
148
|
+
- cookbooks/apt/attributes/default.rb
|
|
149
|
+
- cookbooks/apt/files/default/15update-stamp
|
|
150
|
+
- cookbooks/apt/files/default/apt-proxy-v2.conf
|
|
151
|
+
- cookbooks/apt/libraries/helpers.rb
|
|
152
|
+
- cookbooks/apt/libraries/matchers.rb
|
|
153
|
+
- cookbooks/apt/libraries/network.rb
|
|
154
|
+
- cookbooks/apt/metadata.json
|
|
155
|
+
- cookbooks/apt/providers/preference.rb
|
|
156
|
+
- cookbooks/apt/providers/repository.rb
|
|
157
|
+
- cookbooks/apt/recipes/cacher-client.rb
|
|
158
|
+
- cookbooks/apt/recipes/cacher-ng.rb
|
|
159
|
+
- cookbooks/apt/recipes/default.rb
|
|
160
|
+
- cookbooks/apt/recipes/unattended-upgrades.rb
|
|
161
|
+
- cookbooks/apt/resources/preference.rb
|
|
162
|
+
- cookbooks/apt/resources/repository.rb
|
|
163
|
+
- cookbooks/apt/templates/debian-6.0/acng.conf.erb
|
|
164
|
+
- cookbooks/apt/templates/default/01proxy.erb
|
|
165
|
+
- cookbooks/apt/templates/default/10recommends.erb
|
|
166
|
+
- cookbooks/apt/templates/default/20auto-upgrades.erb
|
|
167
|
+
- cookbooks/apt/templates/default/50unattended-upgrades.erb
|
|
168
|
+
- cookbooks/apt/templates/default/acng.conf.erb
|
|
169
|
+
- cookbooks/apt/templates/default/unattended-upgrades.seed.erb
|
|
170
|
+
- cookbooks/apt/templates/ubuntu-10.04/acng.conf.erb
|
|
171
|
+
- cookbooks/build-essential/CHANGELOG.md
|
|
172
|
+
- cookbooks/build-essential/README.md
|
|
173
|
+
- cookbooks/build-essential/attributes/default.rb
|
|
174
|
+
- cookbooks/build-essential/libraries/matchers.rb
|
|
175
|
+
- cookbooks/build-essential/libraries/timing.rb
|
|
176
|
+
- cookbooks/build-essential/libraries/xcode_command_line_tools.rb
|
|
177
|
+
- cookbooks/build-essential/metadata.json
|
|
178
|
+
- cookbooks/build-essential/recipes/_debian.rb
|
|
179
|
+
- cookbooks/build-essential/recipes/_fedora.rb
|
|
180
|
+
- cookbooks/build-essential/recipes/_freebsd.rb
|
|
181
|
+
- cookbooks/build-essential/recipes/_mac_os_x.rb
|
|
182
|
+
- cookbooks/build-essential/recipes/_omnios.rb
|
|
183
|
+
- cookbooks/build-essential/recipes/_rhel.rb
|
|
184
|
+
- cookbooks/build-essential/recipes/_smartos.rb
|
|
185
|
+
- cookbooks/build-essential/recipes/_solaris2.rb
|
|
186
|
+
- cookbooks/build-essential/recipes/_suse.rb
|
|
187
|
+
- cookbooks/build-essential/recipes/default.rb
|
|
188
|
+
- cookbooks/chef-sugar/CHANGELOG.md
|
|
189
|
+
- cookbooks/chef-sugar/README.md
|
|
190
|
+
- cookbooks/chef-sugar/metadata.json
|
|
191
|
+
- cookbooks/chef-sugar/recipes/default.rb
|
|
146
192
|
- cookbooks/chef_gem/CHANGELOG.md
|
|
147
193
|
- cookbooks/chef_gem/README.md
|
|
148
194
|
- cookbooks/chef_gem/libraries/chef_gem.rb
|
|
@@ -185,6 +231,40 @@ files:
|
|
|
185
231
|
- cookbooks/java/resources/ark.rb
|
|
186
232
|
- cookbooks/java/templates/default/ibm_jdk.installer.properties.erb
|
|
187
233
|
- cookbooks/java/templates/default/oracle.jinfo.erb
|
|
234
|
+
- cookbooks/openssl/CHANGELOG.md
|
|
235
|
+
- cookbooks/openssl/README.md
|
|
236
|
+
- cookbooks/openssl/attributes/default.rb
|
|
237
|
+
- cookbooks/openssl/libraries/secure_password.rb
|
|
238
|
+
- cookbooks/openssl/metadata.json
|
|
239
|
+
- cookbooks/openssl/providers/x509.rb
|
|
240
|
+
- cookbooks/openssl/recipes/default.rb
|
|
241
|
+
- cookbooks/openssl/recipes/upgrade.rb
|
|
242
|
+
- cookbooks/openssl/resources/x509.rb
|
|
243
|
+
- cookbooks/postgresql/CHANGELOG.md
|
|
244
|
+
- cookbooks/postgresql/README.md
|
|
245
|
+
- cookbooks/postgresql/attributes/default.rb
|
|
246
|
+
- cookbooks/postgresql/files/default/tests/minitest/apt_pgdg_postgresql_test.rb
|
|
247
|
+
- cookbooks/postgresql/files/default/tests/minitest/default_test.rb
|
|
248
|
+
- cookbooks/postgresql/files/default/tests/minitest/ruby_test.rb
|
|
249
|
+
- cookbooks/postgresql/files/default/tests/minitest/server_test.rb
|
|
250
|
+
- cookbooks/postgresql/files/default/tests/minitest/support/helpers.rb
|
|
251
|
+
- cookbooks/postgresql/libraries/default.rb
|
|
252
|
+
- cookbooks/postgresql/metadata.json
|
|
253
|
+
- cookbooks/postgresql/recipes/apt_pgdg_postgresql.rb
|
|
254
|
+
- cookbooks/postgresql/recipes/client.rb
|
|
255
|
+
- cookbooks/postgresql/recipes/config_initdb.rb
|
|
256
|
+
- cookbooks/postgresql/recipes/config_pgtune.rb
|
|
257
|
+
- cookbooks/postgresql/recipes/contrib.rb
|
|
258
|
+
- cookbooks/postgresql/recipes/default.rb
|
|
259
|
+
- cookbooks/postgresql/recipes/ruby.rb
|
|
260
|
+
- cookbooks/postgresql/recipes/server.rb
|
|
261
|
+
- cookbooks/postgresql/recipes/server_conf.rb
|
|
262
|
+
- cookbooks/postgresql/recipes/server_debian.rb
|
|
263
|
+
- cookbooks/postgresql/recipes/server_redhat.rb
|
|
264
|
+
- cookbooks/postgresql/recipes/yum_pgdg_postgresql.rb
|
|
265
|
+
- cookbooks/postgresql/templates/default/pg_hba.conf.erb
|
|
266
|
+
- cookbooks/postgresql/templates/default/pgsql.sysconfig.erb
|
|
267
|
+
- cookbooks/postgresql/templates/default/postgresql.conf.erb
|
|
188
268
|
- cookbooks/rvm/.foodcritic
|
|
189
269
|
- cookbooks/rvm/.gitignore
|
|
190
270
|
- cookbooks/rvm/.kitchen.yml
|
|
@@ -263,22 +343,17 @@ files:
|
|
|
263
343
|
- cookbooks/scratchify/LICENSE.txt
|
|
264
344
|
- cookbooks/scratchify/README.md
|
|
265
345
|
- cookbooks/scratchify/Thorfile
|
|
266
|
-
- cookbooks/scratchify/bin/console
|
|
267
346
|
- cookbooks/scratchify/bin/scratchify
|
|
268
|
-
- cookbooks/scratchify/bin/setup
|
|
269
347
|
- cookbooks/scratchify/chefignore
|
|
270
|
-
- cookbooks/scratchify/data_bags/users/deploy.json
|
|
271
|
-
- cookbooks/scratchify/environments/.gitkeep
|
|
272
348
|
- cookbooks/scratchify/from-scratch.gemspec
|
|
273
|
-
- cookbooks/scratchify/lib/from
|
|
274
|
-
- cookbooks/scratchify/lib/from
|
|
275
|
-
- cookbooks/scratchify/lib/from/scratch/version.rb
|
|
349
|
+
- cookbooks/scratchify/lib/from-scratch.rb
|
|
350
|
+
- cookbooks/scratchify/lib/from-scratch/version.rb
|
|
276
351
|
- cookbooks/scratchify/metadata.json
|
|
277
|
-
- cookbooks/scratchify/nodes/normfood.ru.json
|
|
278
352
|
- cookbooks/scratchify/recipes/default.rb
|
|
279
|
-
- cookbooks/scratchify/roles/.gitkeep
|
|
280
353
|
- cookbooks/scratchify/spec/from/scratch_spec.rb
|
|
281
354
|
- cookbooks/scratchify/spec/spec_helper.rb
|
|
355
|
+
- cookbooks/scratchify/templates/node.json.erb
|
|
356
|
+
- cookbooks/scratchify/templates/user.json.erb
|
|
282
357
|
- cookbooks/user/.gitignore
|
|
283
358
|
- cookbooks/user/.kitchen.yml
|
|
284
359
|
- cookbooks/user/.travis.yml
|