rails_pwnerer 0.5.6 → 0.5.7
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2 -0
- data/README +56 -4
- data/lib/pwnage/app/cluster_config.rb +7 -1
- data/lib/pwnage/app/config.rb +2 -0
- data/lib/pwnage/app/nginx_config.rb +1 -0
- data/lib/pwnage/executor.rb +1 -1
- data/rails_pwnerer.gemspec +2 -2
- metadata +1 -1
data/CHANGELOG
CHANGED
data/README
CHANGED
@@ -19,11 +19,13 @@ Read a couple more 20-page guides, and learn to push newer versions
|
|
19
19
|
of your application. You'll become lazy, and take shortcuts, like having
|
20
20
|
production passwords in the repository, or insecure file permissions, or
|
21
21
|
you'll forget to delete cached javascripts and stylesheets from public/.
|
22
|
-
I won't even mention backups.
|
22
|
+
I won't even mention backups. Or scripts to recover your mongrels
|
23
|
+
properly from power outages. Or a staging server of your application.
|
23
24
|
|
24
25
|
Life with +rails_pwnerer+:
|
25
26
|
|
26
|
-
1) Install
|
27
|
+
1) Install a bootstrap version of ruby and rubygems
|
28
|
+
(one command should be enough, but rubygems doesn't work in Ubuntu 8.04):
|
27
29
|
|
28
30
|
sudo apt-get -y install rubygems
|
29
31
|
|
@@ -42,7 +44,7 @@ sudo rpwn install svn+ssh://your.repository.host/path/to/your_application
|
|
42
44
|
|
43
45
|
5) Reboot, or start the services right away:
|
44
46
|
sudo rpwn go live
|
45
|
-
|
47
|
+
|
46
48
|
6) Maintain your application
|
47
49
|
|
48
50
|
* Push the updates in the SVN repository:
|
@@ -66,5 +68,55 @@ sudo rpwn scaffold ddns full_host_name ddns_user ddns_password
|
|
66
68
|
* Bring down all the applications (panic mode):
|
67
69
|
sudo rpwn go down
|
68
70
|
|
69
|
-
|
71
|
+
* Uninstall your application
|
70
72
|
sudo rpwn uninstall your_application
|
73
|
+
|
74
|
+
|
75
|
+
In love with +rails_pwnerer+:
|
76
|
+
|
77
|
+
Got your first Rails app up with +rails_pwnerer+? Want more than
|
78
|
+
one site on the production box? Want multiple instances of the same
|
79
|
+
app (e.g. running a staging server on the same box)?
|
80
|
+
|
81
|
+
Instances let you do that. Creating an instance:
|
82
|
+
sudo rpwn install svn+ssh://whatever instance_name
|
83
|
+
|
84
|
+
All the commands that take an application name take an optional
|
85
|
+
instance name. If no name is given, the default is used (usually
|
86
|
+
your host name, see below for finding it out). Use * to mean
|
87
|
+
"every instance of that application". For instance:
|
88
|
+
sudo rpwn update your_application *
|
89
|
+
|
90
|
+
+rails_pwnerer+ has a configuration repository (a bunch of YAML
|
91
|
+
files) that you can see with:
|
92
|
+
sudo rpwn showconfig
|
93
|
+
|
94
|
+
Installing an application creates a default configuration
|
95
|
+
database for the application. You can override defaults by
|
96
|
+
creating some files in your application directory (so the
|
97
|
+
overrides will be version-controlled). In your Rails directory
|
98
|
+
(on your devbox), use rpwndev as follows:
|
99
|
+
|
100
|
+
* Set the DNS name that your app responds to:
|
101
|
+
rpwndev set dns-name your.dns.name
|
102
|
+
|
103
|
+
* Tweak the number of mongrels for an instance:
|
104
|
+
rpwndev setnum mongrels 8 your_instance
|
105
|
+
|
106
|
+
* Delete the previous tweak and apply it to all instances:
|
107
|
+
rpwndev del mongrels your_instance;
|
108
|
+
rpwndev setnum mongrels
|
109
|
+
|
110
|
+
The overrides are YAML files in +config/rails_pwnage+, so you
|
111
|
+
can view and edit them by hand. rpwndev is just a handy tool,
|
112
|
+
because YAML files are easy to tweak, but hard to code from
|
113
|
+
scratch without learning the format :)
|
114
|
+
|
115
|
+
Once the overrides are pushed to your SVN repository, updating
|
116
|
+
your app will apply the changes to the configuration repository.
|
117
|
+
Use +rpwn showconfig+ on the server to see all the variables
|
118
|
+
that you can tweak.
|
119
|
+
|
120
|
+
Before I forget: don't dots (.) in instance names. Think
|
121
|
+
underscores (_) instead. You can use dots in application names,
|
122
|
+
though.
|
@@ -11,8 +11,13 @@ class RailsPwnage::App::ClusterConfig
|
|
11
11
|
pwnerer_uid = uid_for_username(pwnerer_user)
|
12
12
|
pwnerer_group = group_for_username(pwnerer_user)
|
13
13
|
|
14
|
+
writable_dirs = %w(log tmp public)
|
15
|
+
if app_config[:writable_dirs]
|
16
|
+
writable_dirs += app_config[:writable_dirs].split ','
|
17
|
+
end
|
18
|
+
|
14
19
|
Dir.chdir app_config[:app_path] do
|
15
|
-
|
20
|
+
writable_dirs.each do |writable_dir|
|
16
21
|
FileUtils.chown_R(pwnerer_uid, pwnerer_group, writable_dir)
|
17
22
|
end
|
18
23
|
end
|
@@ -144,6 +149,7 @@ class RailsPwnage::App::ClusterConfig
|
|
144
149
|
end
|
145
150
|
|
146
151
|
def remove(app_name, instance_name)
|
152
|
+
stop_mongrels app_name, instance_name
|
147
153
|
remove_mongrels app_name, instance_name
|
148
154
|
manage_ports app_name, instance_name, :free
|
149
155
|
end
|
data/lib/pwnage/app/config.rb
CHANGED
@@ -33,6 +33,8 @@ class RailsPwnage::App::Config
|
|
33
33
|
app_db[:dns_name] = ''
|
34
34
|
# the maximum request size (megabytes) to be accepted by an application
|
35
35
|
app_db[:max_request_mb] = 48
|
36
|
+
# comma-separated directories that should be writable by the application user
|
37
|
+
app_db[:writable_dirs] = ''
|
36
38
|
|
37
39
|
RailsPwnage::Config.flush_db app_db
|
38
40
|
return app_path
|
data/lib/pwnage/executor.rb
CHANGED
@@ -80,7 +80,7 @@ class RailsPwnage::Executor
|
|
80
80
|
instance_name = args[2] || '.'
|
81
81
|
RailsPwnage::App.manage app_name, instance_name, :db_console
|
82
82
|
|
83
|
-
when 'showconfig', 'configshow', 'show_config', 'config_show'
|
83
|
+
when 'showconfig', 'configshow', 'show_config', 'config_show', 'showconf'
|
84
84
|
if args.length < 2
|
85
85
|
# dump all databases
|
86
86
|
RailsPwnage::Config.databases.each do |db|
|
data/rails_pwnerer.gemspec
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
|
2
|
-
# Gem::Specification for Rails_pwnerer-0.5.
|
2
|
+
# Gem::Specification for Rails_pwnerer-0.5.7
|
3
3
|
# Originally generated by Echoe
|
4
4
|
|
5
5
|
--- !ruby/object:Gem::Specification
|
6
6
|
name: rails_pwnerer
|
7
7
|
version: !ruby/object:Gem::Version
|
8
|
-
version: 0.5.
|
8
|
+
version: 0.5.7
|
9
9
|
platform: ruby
|
10
10
|
authors:
|
11
11
|
- Victor Costan
|