dokuen 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +11 -3
- data/lib/dokuen/application.rb +19 -5
- data/lib/dokuen/cli.rb +18 -1
- data/lib/dokuen/version.rb +1 -1
- data/lib/dokuen/wrapper.rb +7 -3
- metadata +2 -2
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Dokuen, a Personal App Platform
|
2
2
|
|
3
|
-
Dokuen is a "personal app platform". It's the same idea as all of these PaaS and IaaS services out there, except you host it on
|
3
|
+
Dokuen is a "personal app platform". It's the same idea as all of these PaaS and IaaS services out there, except you host it on
|
4
|
+
your own machine. Currently, Dokuen supports Mac and Ubuntu. [Here](http://bugsplat.info/2012-05-17-dokuen-a-personal-app-platform.html) is an article that explains my motivations.
|
4
5
|
|
5
6
|
## Requirements
|
6
7
|
|
@@ -29,7 +30,7 @@ gem install dokuen
|
|
29
30
|
|
30
31
|
### Step 2
|
31
32
|
|
32
|
-
Install nginx using homebrew:
|
33
|
+
Install nginx using homebrew or your distro's package manager:
|
33
34
|
|
34
35
|
```
|
35
36
|
$ brew install nginx
|
@@ -46,7 +47,7 @@ Run this:
|
|
46
47
|
```
|
47
48
|
$ sudo mkdir -p /usr/local/var/dokuen
|
48
49
|
$ cd /usr/local/var/dokuen
|
49
|
-
$ sudo dokuen setup
|
50
|
+
$ sudo dokuen setup .
|
50
51
|
```
|
51
52
|
|
52
53
|
This will ask you a few questions, set up a few directories, and install a few useful commands. It'll also show you some things you need to do.
|
@@ -109,4 +110,11 @@ $ ssh git@<your_host> dokuen scale web=1 --application=<name>
|
|
109
110
|
|
110
111
|
Unfortunately the stock Heroku buildpacks install a vendored node.js compiled for the Heroku platform, which happens to be linux. This doesn't work for Mac, which means you have to use a slightly patched version. This one works with a homebrew-installed node.js: https://github.com/peterkeen/heroku-buildpack-ruby
|
111
112
|
|
113
|
+
## License
|
114
|
+
|
115
|
+
MIT
|
116
|
+
|
117
|
+
## Contact and Development
|
118
|
+
|
119
|
+
Fork and send me a pull request. If you'd like to talk about Dokuen there's `#dokuen` on `irc.freenode.net`, as well as a [mailing list](https://groups.google.com/forum/#!forum/dokuen).
|
112
120
|
|
data/lib/dokuen/application.rb
CHANGED
@@ -176,13 +176,27 @@ class Dokuen::Application
|
|
176
176
|
end
|
177
177
|
end
|
178
178
|
|
179
|
-
def shutdown(release)
|
179
|
+
def shutdown(release=nil)
|
180
|
+
if release.nil?
|
181
|
+
with_app_dir do
|
182
|
+
release = File.readlink("current")
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
180
186
|
with_release_dir(release) do
|
181
187
|
running_processes.each do |proc, pidfile|
|
182
|
-
pid = File.read(pidfile)
|
183
|
-
|
184
|
-
|
185
|
-
|
188
|
+
pid = YAML.load(File.read(pidfile))['pid']
|
189
|
+
Process.kill("TERM", pid)
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
def restart
|
195
|
+
with_current_release do
|
196
|
+
running_processes.each do |proc, pidfile|
|
197
|
+
pid = YAML.load(File.read(pidfile))['pid']
|
198
|
+
puts "Sending USR2 to pid #{pid}"
|
199
|
+
Process.kill("USR2", pid)
|
186
200
|
end
|
187
201
|
end
|
188
202
|
end
|
data/lib/dokuen/cli.rb
CHANGED
@@ -78,6 +78,13 @@ class Dokuen::CLI < Thor
|
|
78
78
|
key, val = var.chomp.split('=', 2)
|
79
79
|
app.set_env(key, val)
|
80
80
|
end
|
81
|
+
app.restart
|
82
|
+
end
|
83
|
+
|
84
|
+
desc "restart", "restart all instances of the application"
|
85
|
+
def restart
|
86
|
+
app = Dokuen::Application.new(options[:application], @config)
|
87
|
+
app.restart
|
81
88
|
end
|
82
89
|
|
83
90
|
desc "config_delete VARS", "delete some config variables"
|
@@ -86,9 +93,10 @@ class Dokuen::CLI < Thor
|
|
86
93
|
vars.each do |var|
|
87
94
|
app.delete_env(var)
|
88
95
|
end
|
96
|
+
app.restart
|
89
97
|
end
|
90
98
|
|
91
|
-
desc "boot", "Scale all of the current applications"
|
99
|
+
desc "boot", "Scale all of the current applications", :hide => true
|
92
100
|
def boot
|
93
101
|
Dir.glob("#{@config.dokuen_dir}/apps/*") do |appdir|
|
94
102
|
next if File.basename(appdir)[0] == '.'
|
@@ -98,6 +106,15 @@ class Dokuen::CLI < Thor
|
|
98
106
|
end
|
99
107
|
end
|
100
108
|
|
109
|
+
desc "shutdown", "Shut down all applications", :hide => true
|
110
|
+
def shutdown
|
111
|
+
Dir.glob("#{@config.dokuen_dir}/apps/*") do |appdir|
|
112
|
+
next if File.basename(appdir)[0] == '.'
|
113
|
+
app = Dokuen::Application.new(File.basename(appdir), @config)
|
114
|
+
app.shutdown
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
101
118
|
desc "install_buildpack URL", "Add a buildpack to the mason config"
|
102
119
|
def install_buildpack(url)
|
103
120
|
system("#{@config.bin_path}/mason buildpacks:install #{url}")
|
data/lib/dokuen/version.rb
CHANGED
data/lib/dokuen/wrapper.rb
CHANGED
@@ -16,7 +16,6 @@ class Dokuen::Wrapper
|
|
16
16
|
|
17
17
|
def run!
|
18
18
|
return if daemonize! == nil
|
19
|
-
load_env
|
20
19
|
loop do
|
21
20
|
run_loop
|
22
21
|
end
|
@@ -87,7 +86,12 @@ class Dokuen::Wrapper
|
|
87
86
|
end
|
88
87
|
end
|
89
88
|
|
89
|
+
def term_signal
|
90
|
+
app.config.stop_signal rescue 15
|
91
|
+
end
|
92
|
+
|
90
93
|
def run_loop
|
94
|
+
load_env
|
91
95
|
reader, writer = (IO.method(:pipe).arity == 0 ? IO.pipe : IO.pipe("BINARY"))
|
92
96
|
procfile = Foreman::Procfile.new("Procfile")
|
93
97
|
entry = procfile[proc]
|
@@ -96,11 +100,11 @@ class Dokuen::Wrapper
|
|
96
100
|
log_file = File.open(log_path, 'a')
|
97
101
|
|
98
102
|
Signal.trap("USR2") do
|
99
|
-
process.kill(
|
103
|
+
process.kill(term_signal)
|
100
104
|
end
|
101
105
|
|
102
106
|
Signal.trap("TERM") do
|
103
|
-
if not process.kill(
|
107
|
+
if not process.kill(term_signal)
|
104
108
|
raise "Failed to kill process #{process.pid}"
|
105
109
|
end
|
106
110
|
File.delete(pidfile)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dokuen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-06-02 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|