rappa 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +143 -3
- metadata +19 -3
data/README.md
CHANGED
@@ -1,7 +1,147 @@
|
|
1
|
-
|
1
|
+
# Package and deploy ruby rack based applications
|
2
2
|
|
3
|
-
|
3
|
+
Rappa is a tool which lets you package your rack based application e.g. Sinatra, Rails etc for easy deployment to a ThunderCat container.
|
4
|
+
Visit the ThunderCat project to understand how this works.
|
4
5
|
|
6
|
+
## Background
|
5
7
|
|
6
|
-
|
8
|
+
Rappa is written in ruby and was created to simplify the package and deploy process of Sinatra and Rails apps. The idea is to have a single artifact
|
9
|
+
that is propagated through various environments and into a production environment via a deployment pipeline.
|
10
|
+
|
11
|
+
## Install
|
12
|
+
|
13
|
+
gem install rappa
|
14
|
+
|
15
|
+
## Config
|
16
|
+
|
17
|
+
The first thing you need is a rap.yml file which needs to live in the root of your project:
|
18
|
+
|
19
|
+
:name: My Awesome App
|
20
|
+
:version: 0.0.1
|
21
|
+
:description: This App rocks
|
22
|
+
:server_type: thin
|
23
|
+
:start_script: start.sh
|
24
|
+
:stop_script: stop.sh
|
25
|
+
:pids: tmp/pids
|
26
|
+
:bootstrap: bootstrap.sh
|
27
|
+
|
28
|
+
All fields are mandatory apart from the bootstrap field. All the fields are pretty self explanatory but here is a detailed breakdown:
|
29
|
+
|
30
|
+
* :name: - the name of the application
|
31
|
+
* :version: - the version of the application
|
32
|
+
* :description: - the description of the application
|
33
|
+
* :server_type: - the type of server - supported servers currently are: thin, unicorn, webrick
|
34
|
+
* :start_script: - the path relative to the root of your project which contains a script that starts your application
|
35
|
+
* :stop_script: - the path relative to the root of your project which contains a script that stops your application
|
36
|
+
* :pids: - the path relative to the root of your project that contains the pids generated when your application starts
|
37
|
+
* :bootstrap: - the path relative to the root of your project to a script that contains extra commands to run before starting
|
38
|
+
|
39
|
+
Rappa works by trying to start and stop your application via the start and stop scripts you provide. It also uses the pids to figure out if
|
40
|
+
your application is running or not. You can supply a script to run before start is called via the bootstrap field.
|
41
|
+
|
42
|
+
An example would be to have a thin project which uses Rake and has the following content:
|
43
|
+
|
44
|
+
### Rakefile
|
45
|
+
|
46
|
+
require 'rake'
|
47
|
+
|
48
|
+
namespace :thin do
|
49
|
+
|
50
|
+
desc "Start The Application"
|
51
|
+
task :start do
|
52
|
+
puts "Starting The Application..."
|
53
|
+
system("thin start -e production -p 9991 -s 1 -d")
|
54
|
+
end
|
55
|
+
|
56
|
+
desc "Stop The Application"
|
57
|
+
task :stop do
|
58
|
+
puts "Stopping The Application..."
|
59
|
+
Dir.new(File.dirname(__FILE__) + '/tmp/pids').each do |file|
|
60
|
+
prefix = file.to_s
|
61
|
+
if prefix[0, 4] == 'thin'
|
62
|
+
str = "thin stop -P#{File.dirname(__FILE__)}/tmp/pids/#{file}"
|
63
|
+
puts "Stopping server on port #{file[/\d+/]}..."
|
64
|
+
system(str)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
### Start and Stop Scripts
|
71
|
+
|
72
|
+
./start.sh
|
73
|
+
|
74
|
+
rake thin:start
|
75
|
+
|
76
|
+
./stop.sh
|
77
|
+
|
78
|
+
rake thin:stop
|
79
|
+
|
80
|
+
./config.ru
|
81
|
+
|
82
|
+
require File.dirname(__FILE__) + '/sinatra_app'
|
83
|
+
run Sinatra::Application
|
84
|
+
|
85
|
+
./bootstrap.sh
|
86
|
+
|
87
|
+
echo "Inside the bootstrap"
|
88
|
+
bundle install
|
89
|
+
mkdir -p /some/dir/some/where
|
90
|
+
echo "Done with bootstrap"
|
91
|
+
|
92
|
+
(Recommended that you bundle package instead of putting a bundle install in the bootstrap.sh though)
|
93
|
+
|
94
|
+
### Rap file
|
95
|
+
|
96
|
+
./rap.yml
|
97
|
+
|
98
|
+
:name: My Awesome App
|
99
|
+
:version: 0.0.1
|
100
|
+
:description: This App rocks
|
101
|
+
:server_type: thin
|
102
|
+
:start_script: start.sh
|
103
|
+
:stop_script: stop.sh
|
104
|
+
:pids: tmp/pids
|
105
|
+
:bootstrap: bootstrap.sh
|
106
|
+
|
107
|
+
## Usage
|
108
|
+
|
109
|
+
Once you have your rap.yml in the root of your project you must navigate one level up and you can perform the following things:
|
110
|
+
|
111
|
+
* package
|
112
|
+
* expand
|
113
|
+
* deploy
|
114
|
+
|
115
|
+
### package
|
116
|
+
|
117
|
+
This packages your application. You need a rap.yml in the root of your project and must be executed from one level up from your application e.g.
|
118
|
+
|
119
|
+
rappa package -i path/to/your/app -o path/to/destination
|
120
|
+
|
121
|
+
The -i is for input directory and the -o is for output directory e.g.
|
122
|
+
|
123
|
+
rappa package -i ./myapp -o .
|
124
|
+
|
125
|
+
Will produce a myapp.rap in the current directory. The name of the folder of your application is what will be used in the rap archive.
|
126
|
+
|
127
|
+
### expand
|
128
|
+
|
129
|
+
This expands an existing rap archive e.g.
|
130
|
+
|
131
|
+
rappa -a myapp.rap -d .
|
132
|
+
|
133
|
+
This will expand the myapp.rap into the current directory. (it will be inside a directory called myapp)
|
134
|
+
|
135
|
+
### deploy
|
136
|
+
|
137
|
+
This deploys a rap archive to a thundercat server e.g.
|
138
|
+
|
139
|
+
rappa deploy -r myapp.rap -u http://thundercat/api/deploy -k your_api_key
|
140
|
+
|
141
|
+
-r is to specify your rap archive and -u is the url of the deploy api where your thundercat instance is running. -k is your api_key which is configured in your
|
142
|
+
thundercat server.
|
143
|
+
|
144
|
+
## Develop
|
145
|
+
|
146
|
+
Interested in contributing? Great just let me know how you want to help.
|
7
147
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rappa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
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: 2013-
|
12
|
+
date: 2013-07-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -75,6 +75,22 @@ dependencies:
|
|
75
75
|
- - ! '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rest-client
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :runtime
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
78
94
|
description: ! 'Easy and simple way to package up your rack based application into
|
79
95
|
a .rap (Ruby Application Package) for deployment to a web container that supports
|
80
96
|
.rap such as ThunderCat.
|
@@ -96,7 +112,7 @@ licenses:
|
|
96
112
|
post_install_message:
|
97
113
|
rdoc_options: []
|
98
114
|
require_paths:
|
99
|
-
-
|
115
|
+
- lib
|
100
116
|
required_ruby_version: !ruby/object:Gem::Requirement
|
101
117
|
none: false
|
102
118
|
requirements:
|