freighter 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +98 -2
- data/bin/freighter +4 -0
- data/config/freighter.example.yml +4 -3
- data/lib/freighter/ssh.rb +2 -2
- data/lib/freighter/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70c6f6f59c11d33c9a2b6c2deea4e0cc53baccef
|
4
|
+
data.tar.gz: a8e612fa7748bbbc9e68f9071a5e58a5a9974a52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee8b45ac9114b3f277263c5ebfb9f315c535e4e5edcf2192a6bda2c2644ba832071e9591c4a96ac5f945fb490442d7e458c21d9ea1648b89dd22a0ac527ea195
|
7
|
+
data.tar.gz: 8613d3b488128480c8a89b376cbd4722abb5eaa9ada2530202d5c0419d871542698a4d685b7245e2c044ea1df4c2a7e81b7bbc55c66bda6410c61302d39bae92
|
data/README.md
CHANGED
@@ -32,7 +32,7 @@ echo 'DOCKER_OPTS="-H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock"' | su
|
|
32
32
|
|
33
33
|
The docker service, on the host(s), will need to be restarted.
|
34
34
|
|
35
|
-
Running the docker REST API this way should be secure since all communication to the API is over an SSH tunnel, and the REST API
|
35
|
+
Running the docker REST API this way should be secure since all communication to the API is over an SSH tunnel, and the docker REST API should only be available locally on the host.
|
36
36
|
|
37
37
|
### Authentication
|
38
38
|
|
@@ -75,9 +75,105 @@ The apps are defined in freighter.yml.
|
|
75
75
|
|
76
76
|
When you run `freighter configure` it will copy an example freighter.yml file that you can use as a template. The structure of the YAML file is important. More documentation on configuration to come.
|
77
77
|
|
78
|
+
Here is what part of the example freighter YAML configuration looks like:
|
79
|
+
```YAML
|
80
|
+
connection:
|
81
|
+
type: ssh
|
82
|
+
ssh_options:
|
83
|
+
config: true
|
84
|
+
# user_name: user name on host
|
85
|
+
# keys:
|
86
|
+
# - "~/.config/id_rsa"
|
87
|
+
|
88
|
+
docker:
|
89
|
+
port: 2375
|
90
|
+
|
91
|
+
environments:
|
92
|
+
staging:
|
93
|
+
hosts:
|
94
|
+
- host: staging.example.com
|
95
|
+
images:
|
96
|
+
- name: organization/imageName:latest
|
97
|
+
containers:
|
98
|
+
- name: app
|
99
|
+
port_mapping: 0.0.0.0:80->80
|
100
|
+
env:
|
101
|
+
DB_USERNAME: fooBar
|
102
|
+
DB_PASSWORD: My53cr37
|
103
|
+
```
|
104
|
+
Breaking this example down:
|
105
|
+
|
106
|
+
```YAML
|
107
|
+
connection:
|
108
|
+
type: ssh
|
109
|
+
ssh_options:
|
110
|
+
config: true
|
111
|
+
# user_name: user name on host
|
112
|
+
# keys:
|
113
|
+
# - "~/.config/id_rsa"
|
114
|
+
```
|
115
|
+
This specifies the connection used to connect to the host servers. Currently, SSH via key based authentication is the only method supported. In order to deploy, you'll need to be able to SSH into all host server you are attempting to deploy to. More connection options may be provided in the future.
|
116
|
+
|
117
|
+
There are many ssh_options available. See the following documented here: http://net-ssh.github.io/net-ssh/ (for the "start" method's options). One additional options is "user_name" that was added. You can also use the "--user" option when running freighter to override the user_name in the freighter.yml. For the most simple and flexible configuraiton, use the `config: true` option and that will load your ~/.ssh/config, /etc/ssh_config files to determine how to connect to the hosts.
|
118
|
+
|
119
|
+
If more than one user uses freighter to deploy, specifying the user_name in the freighter.yml is not recommended. Use the `config: true` option or the `--user` flag option.
|
120
|
+
|
121
|
+
```YAML
|
122
|
+
docker:
|
123
|
+
port: 2375
|
124
|
+
```
|
125
|
+
This specifies the port the docker REST API is running on the host servers. This port should be consistent across all host servers running docker. This port is specified in /etc/default/docker on the hosts, and more information is supplied in the installation instructions. A SSH tunnel is established tunneling TCP traffic from your local machine starting on port 7000 to the host server's localhost:<configured-port>.
|
126
|
+
|
127
|
+
```YAML
|
128
|
+
environments:
|
129
|
+
staging:
|
130
|
+
hosts:
|
131
|
+
- host: staging.example.com
|
132
|
+
images:
|
133
|
+
- name: organization/imageName:latest
|
134
|
+
containers:
|
135
|
+
- name: app
|
136
|
+
port_mapping: 0.0.0.0:80->80
|
137
|
+
env:
|
138
|
+
DB_USERNAME: fooBar
|
139
|
+
DB_PASSWORD: My53cr37
|
140
|
+
```
|
141
|
+
|
142
|
+
This is where you specify your environments > hosts > images > containers. The formatting was designed to help make it easy to see how the containers are deployed.
|
143
|
+
|
144
|
+
The parser uses Ruby's Psych ruby parser. More details on YAML formatting can be found here: http://www.yaml.org/spec/1.2/spec.html. It is possible to use advanced YAML formatting options to reduce redundancy in your freighter.yml file. The "production" environment in the example freighter.yml shows a basic way that YAML can be formatted to reduce redundancy. I didn't want to get too fancy in this file, but that shouldn't stop you. So long as the following is defined, you should be fine:
|
145
|
+
* environments
|
146
|
+
* environments/hosts (must be an array)
|
147
|
+
* environments/hosts/images (must be an array)
|
148
|
+
* environments/hosts/images/containers (must be an array)
|
149
|
+
|
150
|
+
The above YAML example will evaluate to the equivalent JSON representation.
|
151
|
+
```javascript
|
152
|
+
{
|
153
|
+
"environments": {
|
154
|
+
"staging": {
|
155
|
+
"hosts": [{
|
156
|
+
"host": "staging.example.com",
|
157
|
+
"images": [{
|
158
|
+
"name": "organization/imageName:latest",
|
159
|
+
"containers": [{
|
160
|
+
"name": "app",
|
161
|
+
"port_mapping": "0.0.0.0:80->80",
|
162
|
+
"env": {
|
163
|
+
"DB_USERNAME": "fooBar",
|
164
|
+
"DB_PASSWORD": "My53cr37"
|
165
|
+
}
|
166
|
+
}]
|
167
|
+
}]
|
168
|
+
}]
|
169
|
+
}
|
170
|
+
}
|
171
|
+
}
|
172
|
+
```
|
173
|
+
|
78
174
|
## Fun facts
|
79
175
|
|
80
|
-
If you find yourself in a pickle of not being able to Ctrl+c (
|
176
|
+
If you find yourself in a pickle of not being able to Ctrl+c (interrupt) the command. Ctrl+z (suspend) the process and the kill the pid with `kill -6 <pid>`. I'll try to fix it so that this scenario is more avoidable.
|
81
177
|
|
82
178
|
# Status
|
83
179
|
|
data/bin/freighter
CHANGED
@@ -41,6 +41,10 @@ OptionParser.new do |opts|
|
|
41
41
|
options.deploy_all = true
|
42
42
|
end
|
43
43
|
|
44
|
+
opts.on('--user SSH_USER', 'User name used for the SSH connection. (optional depending on your configuration)') do |user|
|
45
|
+
options.ssh_user = user
|
46
|
+
end
|
47
|
+
|
44
48
|
# This option is not yet implemented because the docker REST api is not the best at searching available images
|
45
49
|
# opts.on('--no-pull', 'specify if you do not wish to pull the image') do
|
46
50
|
# options.pull_image = false
|
data/lib/freighter/ssh.rb
CHANGED
data/lib/freighter/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: freighter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean McCleary
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ssh
|