negroku 1.1.4 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +107 -25
- data/lib/negroku/helpers.rb +7 -3
- data/lib/negroku/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9adb73105871cbf165656dfe33507cda128c5c8a
|
4
|
+
data.tar.gz: b07e0bcd847d070997f21f08139bc33dc63b0d94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bacb1d75946396c708f3c2ac661dd3747ff338e87eebb481722855008261f74181816d9726ebee62ce1e619515346b3cc9946aaf425291966bbec920d5b16489
|
7
|
+
data.tar.gz: b532f52f6edd707cfe13a0be44cca44df22270bdc13cbbd8a1f7cf380e719fcd3fff9d956d96592f87c254fff2bf6221f6fad0262539144ccbb26f3c5b1cdc25
|
data/README.md
CHANGED
@@ -3,22 +3,76 @@ Negroku
|
|
3
3
|
|
4
4
|
Negroku is an opinionated collection of recipes for capistrano.
|
5
5
|
|
6
|
-
The goal is to be able to deploy **ruby on rails applications** and **static websites** without the hassle of
|
6
|
+
The goal is to be able to deploy **ruby on rails applications** and **static websites** without the hassle of configuring and defining all the stuff involved in an application deployment.
|
7
7
|
|
8
|
-
All the server
|
8
|
+
All the server settings pre-defined in the configuration files generated by negroku are targeted to this server generic [configuration guide](https://github.com/platanus/guides/tree/master/deployment). Although in most cases you can customize those settings.
|
9
9
|
|
10
10
|
Installation
|
11
11
|
------------
|
12
12
|
|
13
|
-
|
13
|
+
Install negroku as a global gem.
|
14
14
|
|
15
|
-
|
15
|
+
```shell
|
16
|
+
$ gem install negroku
|
17
|
+
```
|
18
|
+
|
19
|
+
Add the negroku gem to your `Gemfile` development group to lock the version your are going to use.
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
group :development do
|
23
|
+
gem 'negroku', '1.1.4'
|
24
|
+
end
|
25
|
+
```
|
26
|
+
|
27
|
+
You will need to add to your Gemfile these two gems:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
group :assets do
|
31
|
+
gem 'therubyracer', :platforms => :ruby
|
32
|
+
end
|
33
|
+
|
34
|
+
group :production do
|
35
|
+
gem 'unicorn'
|
36
|
+
end
|
37
|
+
```
|
38
|
+
|
39
|
+
Then execute
|
40
|
+
|
41
|
+
```shell
|
42
|
+
$ bundle install
|
43
|
+
```
|
44
|
+
|
45
|
+
**Note:** Add the `therubyracer` gem only if your are going to use the assets precompile of a rails project.
|
16
46
|
|
17
47
|
## Getting started
|
18
48
|
|
19
|
-
1.
|
49
|
+
1. Create your app executing the following command, and just follow the on-screen questions.
|
50
|
+
|
51
|
+
```
|
52
|
+
$ negroku app create
|
53
|
+
```
|
54
|
+
|
55
|
+
####Give your application a name
|
56
|
+
|
57
|
+
This will be used to create the app folder structure in the server and to name some files, for example, the log files.
|
58
|
+
|
59
|
+
|
60
|
+
####Please choose your repository
|
61
|
+
|
62
|
+
You'll need to choose the git respository where your are going to store your project. Typically a GitHub repository, it can be any repository that the server has access to.
|
63
|
+
|
64
|
+
If you have already initializated your git repository for the project, you'll be offered to choose the remotes of the current repo.
|
65
|
+
|
66
|
+
####Target servers
|
20
67
|
|
21
|
-
|
68
|
+
You'll need to choose the server address where the project will be deployed and the hostname that will be used by *nginx* to host the application. Negroku will ask this for two stage servers (staging, production)
|
69
|
+
|
70
|
+
*Note:* Refer to the [negroku config taks](#config-task) to add some default servers to the negroku configuration.
|
71
|
+
|
72
|
+
|
73
|
+
1. The `app create` command will bootpstrapp your app (behind the scenes it will run the capistrano command `capify .` and add some customizations)
|
74
|
+
|
75
|
+
Some files and folders will be added to your project, this is the same structure that capistrano expects when using multistage extensions
|
22
76
|
|
23
77
|
```
|
24
78
|
project_root
|
@@ -30,36 +84,52 @@ Just install negroku as a global gem.
|
|
30
84
|
+--- staging.rb # Specific settings for staging server
|
31
85
|
```
|
32
86
|
|
33
|
-
|
87
|
+
1. Configure your specific settings in the files created above
|
34
88
|
|
35
|
-
|
36
|
-
group :assets do
|
37
|
-
gem 'therubyracer', :platforms => :ruby
|
38
|
-
end
|
89
|
+
####Common settings for all stages `deploy.rb`
|
39
90
|
|
40
|
-
|
41
|
-
|
42
|
-
|
91
|
+
Here you can add all the settings that are common to all the stage severs.
|
92
|
+
|
93
|
+
```ruby
|
94
|
+
#You may want to change the stages and the default stage
|
95
|
+
set :stages, %w(production staging)
|
96
|
+
set :default_stage, "staging"
|
43
97
|
```
|
44
98
|
|
45
|
-
1. Configure your specific settings in the files created above
|
46
99
|
|
47
|
-
|
100
|
+
####Per-stage settings `staging.rb` `production.rb`
|
101
|
+
|
102
|
+
Here you can add all the settings that are specific to the stage.
|
103
|
+
|
104
|
+
```ruby
|
105
|
+
#You may want to change the repository branch for each stage.
|
106
|
+
set :branch, "production" # Optional, defaults to master
|
107
|
+
```
|
108
|
+
|
48
109
|
|
49
|
-
1.
|
110
|
+
1. Prepare the server for your application executing
|
50
111
|
|
51
|
-
|
112
|
+
```shell
|
113
|
+
$ cap deploy:setup
|
114
|
+
```
|
52
115
|
|
53
|
-
|
116
|
+
1. Commit and push the changes to the repository
|
54
117
|
|
118
|
+
1. Configure all your environmental variables for your project using the [negroku env taks](#env-task)
|
55
119
|
|
56
|
-
|
120
|
+
1. Deploy you application for the first time executing
|
57
121
|
|
58
|
-
|
122
|
+
```shell
|
123
|
+
$ cap deploy:cold # for the default stage
|
124
|
+
$ cap production deploy:cold # for the production stage
|
125
|
+
```
|
59
126
|
|
60
|
-
|
127
|
+
For all the next following deploys, you should execute
|
61
128
|
|
62
|
-
|
129
|
+
```shell
|
130
|
+
$ cap deploy # for the default stage
|
131
|
+
$ cap production deploy # for the production stage
|
132
|
+
```
|
63
133
|
|
64
134
|
The CLI
|
65
135
|
-------
|
@@ -68,10 +138,16 @@ Negroku also provides a simple CLI that helps to initialize the deployment of yo
|
|
68
138
|
|
69
139
|
### App task
|
70
140
|
|
141
|
+
*comming soon...*
|
142
|
+
|
71
143
|
### Env task
|
72
144
|
|
145
|
+
*comming soon...*
|
146
|
+
|
73
147
|
### Config task
|
74
148
|
|
149
|
+
*comming soon...*
|
150
|
+
|
75
151
|
Included recipes
|
76
152
|
----------------
|
77
153
|
|
@@ -123,9 +199,15 @@ cap rbenv:vars:symlink # Symlink rbenv-vars file into the current ...
|
|
123
199
|
Customizing the recipes
|
124
200
|
-----------------------
|
125
201
|
|
126
|
-
Aside of
|
127
|
-
|
202
|
+
Aside of predefining some ways of doing the deployments, negroku is very flexible. This flexibility is inherited from capistrano, so you can extend negroku with your recipes, overide existing ones, and modify every configuration you want.
|
128
203
|
|
204
|
+
Contributing
|
205
|
+
------------
|
129
206
|
|
207
|
+
1. Fork it
|
208
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
209
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
210
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
211
|
+
5. Create new Pull Request
|
130
212
|
|
131
213
|
|
data/lib/negroku/helpers.rb
CHANGED
@@ -43,19 +43,19 @@ def init(target=".", data)
|
|
43
43
|
|
44
44
|
# Create the new deploy
|
45
45
|
puts "[Negroku] => Writing new deploy.rb."
|
46
|
-
erb =
|
46
|
+
erb = getTemplate 'deploy.rb.erb'
|
47
47
|
File.open(deployfile, 'w') do |f|
|
48
48
|
f.write ERB.new(erb).result(binding)
|
49
49
|
end
|
50
50
|
|
51
51
|
# Create the new configuration stages
|
52
52
|
puts "[Negroku] => Writing new deploy/staging.rb"
|
53
|
-
erb =
|
53
|
+
erb = getTemplate 'staging.rb.erb'
|
54
54
|
File.open(stagingfile, 'w') do |f|
|
55
55
|
f.write ERB.new(erb).result(binding)
|
56
56
|
end
|
57
57
|
puts "[Negroku] => Writing new deploy/production.rb"
|
58
|
-
erb =
|
58
|
+
erb = getTemplate 'production.rb.erb'
|
59
59
|
File.open(productionfile, 'w') do |f|
|
60
60
|
f.write ERB.new(erb).result(binding)
|
61
61
|
end
|
@@ -75,6 +75,10 @@ def showConfig()
|
|
75
75
|
puts config
|
76
76
|
end
|
77
77
|
|
78
|
+
def getTemplate(template)
|
79
|
+
File.read(File.join(File.dirname(__FILE__), 'templates', template))
|
80
|
+
end
|
81
|
+
|
78
82
|
##
|
79
83
|
# Helper Method that assists in loading in tasks from the tasks folder
|
80
84
|
def load_tasks(tasks)
|
data/lib/negroku/version.rb
CHANGED
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: negroku
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Ignacio Donoso
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 2.15.4
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 2.15.4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: capistrano-unicorn
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 0.1.9
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.1.9
|
41
41
|
- !ruby/object:Gem::Dependency
|