luban 0.12.2 → 0.12.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -1
- data/lib/luban/deployment/cli/application/docker/dockerizer.rb +19 -7
- data/lib/luban/deployment/cli/application/docker/templates/Dockerfile.erb +16 -13
- data/lib/luban/deployment/cli/application/docker/templates/docker-compose-env.erb +3 -1
- data/lib/luban/deployment/cli/application/docker/templates/docker-compose.yml.erb +7 -1
- data/lib/luban/deployment/parameters.rb +7 -2
- data/lib/luban/deployment/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: 4a2c52afba7ac1fc8e47eed104a2318e486b66a6
|
4
|
+
data.tar.gz: 59f6cc14a8d580e5559e42d53fd4ee66b5efb5ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ef8f2405f5422b2febace4dbc866c35f39789d98613ae526dffdb304c67a021cde884f38ddcb29689cc1af6793825fca04c4e9498e5e89f3dea4a05c81fdee6
|
7
|
+
data.tar.gz: 3f01d09888adc71fb2a628e1ac664bf3084b553ad73bd7e364d7ef56fa88ed925a088f737701b2674637c4ffc33e926e086ede94e7fcb348d95ea68198e7c8c4
|
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,21 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
-
## Version 0.12.
|
3
|
+
## Version 0.12.3 (Feb 15, 2017)
|
4
|
+
|
5
|
+
Minor enhancements:
|
6
|
+
* Added labels in docker image to show info about installed packages
|
7
|
+
* Added new parameter, #luban_uid, to specify user id for luban user
|
8
|
+
* This is mainly to address the permission issues on docker volumes
|
9
|
+
* Refactored luban_user and luban_uid as build arguments
|
10
|
+
* Used environment variable TZ to correctly control the timezone for a docker container
|
4
11
|
|
5
12
|
Bug fixes:
|
6
13
|
* Correctly composed revisions for build sources
|
7
14
|
* Fixed a typo in the template of Dockerfile.erb
|
8
15
|
* Checked the result of bundle install/package in Repository before proceeding to the rest steps
|
9
16
|
* Checked the result of bundle install in Publisher before proceeding to the rest steps
|
17
|
+
* Removed redundant add commands in Dockerfile.erb
|
18
|
+
* Added proper prefix of build sources in dockerization
|
10
19
|
|
11
20
|
## Version 0.12.1 (Feb 09, 2017)
|
12
21
|
|
@@ -141,14 +141,14 @@ module Luban
|
|
141
141
|
|
142
142
|
def init_build_sources
|
143
143
|
sources = { packages: packages_path }
|
144
|
-
releases = get_releases(releases_path)
|
145
|
-
if
|
146
|
-
sources[:vendor] =
|
144
|
+
releases = get_releases(releases_path, type: 'app')
|
145
|
+
if releases.has_key?(:"app.vendor")
|
146
|
+
sources[:"app.vendor"] = releases.delete(:"app.vendor")
|
147
147
|
end
|
148
148
|
sources.merge!(releases)
|
149
149
|
profile_path = releases_path.dirname.join('profile')
|
150
|
-
profile = directory?(profile_path) ? get_releases(profile_path) : {}
|
151
|
-
sources[stage.to_sym] = app_path
|
150
|
+
profile = directory?(profile_path) ? get_releases(profile_path, type: 'profile') : {}
|
151
|
+
sources["env.#{stage}".to_sym] = app_path
|
152
152
|
sources.merge!(profile)
|
153
153
|
sources.inject({}) do |srcs, (name, path)|
|
154
154
|
md5 = md5_for_dir(path)
|
@@ -187,10 +187,22 @@ module Luban
|
|
187
187
|
def compose_file; build[:path].join("docker-compose.yml"); end
|
188
188
|
def compose_env_file; build[:path].join(".env"); end
|
189
189
|
|
190
|
-
def get_releases(path)
|
190
|
+
def get_releases(path, type:)
|
191
191
|
capture(:ls, '-xtd', path.join('*')).split.
|
192
192
|
collect { |p| File.basename(p) }.
|
193
|
-
inject({}) { |r, t| r[t.to_sym] = path.join(t); r }
|
193
|
+
inject({}) { |r, t| r["#{type}.#{t}".to_sym] = path.join(t); r }
|
194
|
+
end
|
195
|
+
|
196
|
+
def get_packages
|
197
|
+
packages.inject({}) do |pkgs, (name, package)|
|
198
|
+
pkgs[name] = package.class.required_packages_for(package.current_version).inject(
|
199
|
+
{ versions: package.installable_versions.join(', '),
|
200
|
+
current_version: package.current_version }) do |pkg, (type, deps)|
|
201
|
+
deps.each { |d| pkg["#{type}.#{d.name}".to_sym] = d.version }
|
202
|
+
pkg
|
203
|
+
end
|
204
|
+
pkgs
|
205
|
+
end
|
194
206
|
end
|
195
207
|
|
196
208
|
def dockerize_application!
|
@@ -1,16 +1,13 @@
|
|
1
1
|
FROM <%= base_image %>
|
2
2
|
MAINTAINER <%= author['name'] %> <%= author['email'].inspect %>
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
chown -R <%= luban_user %>:<%= luban_user %> <%= luban_root_path %>
|
7
|
-
|
8
|
-
<% build[:archives].each_value do |archive| -%>
|
9
|
-
ADD <%= archive[:path].basename %> /
|
10
|
-
<% end -%>
|
4
|
+
ARG luban_uid
|
5
|
+
ARG luban_user
|
11
6
|
|
12
|
-
RUN
|
13
|
-
|
7
|
+
RUN adduser -ms /bin/bash -u $luban_uid $luban_user && \
|
8
|
+
mkdir <%= luban_root_path %> && \
|
9
|
+
chown -R $luban_user:$luban_user <%= luban_root_path %> && \
|
10
|
+
echo "source <%= envrc_file %>" >> /home/$luban_user/.bashrc
|
14
11
|
|
15
12
|
<% build[:archives].each_value do |archive| -%>
|
16
13
|
ADD <%= archive[:path].basename %> /
|
@@ -20,14 +17,20 @@ LABEL luban.project="<%= project %>" \
|
|
20
17
|
luban.application="<%= project %>" \
|
21
18
|
luban.stage="<%= stage %>" \
|
22
19
|
<%- build[:sources].each_pair do |name, source| -%>
|
23
|
-
luban.<%= name
|
20
|
+
luban.<%= name %>.source_tag="<%= source[:tag] %>" \
|
24
21
|
<%- end -%>
|
25
22
|
luban.build_tag="<%= build_tag %>" \
|
26
23
|
luban.bulid_rev="<%= build[:revision] %>" \
|
27
|
-
|
24
|
+
<%- get_packages.each_pair do |name, package| -%>
|
25
|
+
<%- package.each_pair do |k, v| -%>
|
26
|
+
luban.packages.<%= name %>.<%= k %>="<%= v %>" \
|
27
|
+
<%- end -%>
|
28
|
+
<%- end -%>
|
29
|
+
luban.luban_uid="$luban_uid" \
|
30
|
+
luban.luban_user="$luban_user" \
|
28
31
|
luban.luban_root_path="<%= luban_root_path %>"
|
29
32
|
|
30
|
-
USER
|
31
|
-
WORKDIR /home
|
33
|
+
USER $luban_user
|
34
|
+
WORKDIR /home/$luban_user
|
32
35
|
|
33
36
|
CMD ["/bin/bash"]
|
@@ -2,8 +2,14 @@ version: "3"
|
|
2
2
|
|
3
3
|
services:
|
4
4
|
<%= application %>:
|
5
|
-
build:
|
5
|
+
build:
|
6
|
+
context: ./context
|
7
|
+
args:
|
8
|
+
luban_uid: $LUBAN_UID
|
9
|
+
luban_user: $LUBAN_USER
|
6
10
|
image: <%= build[:image_tag] %>
|
11
|
+
environment:
|
12
|
+
TZ: <%= timezone %>
|
7
13
|
entrypoint: /bin/bash
|
8
14
|
stdin_open: true
|
9
15
|
tty: true
|
@@ -27,7 +27,11 @@ module Luban
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def current_user
|
30
|
-
ENV['USER'] || `whoami`.chomp
|
30
|
+
ENV['USER'] || `whoami 2>/dev/null`.chomp
|
31
|
+
end
|
32
|
+
|
33
|
+
def current_uid
|
34
|
+
`id -u #{current_user} 2>/dev/null`.chomp
|
31
35
|
end
|
32
36
|
|
33
37
|
parameter :luban_roles, default: %i(app)
|
@@ -118,7 +122,8 @@ module Luban
|
|
118
122
|
module Docker
|
119
123
|
extend Base
|
120
124
|
|
121
|
-
parameter :
|
125
|
+
parameter :luban_uid, default: ->{ current_uid }
|
126
|
+
parameter :luban_user, default: ->{ current_user }
|
122
127
|
parameter :build_tag, default: '0.0.0'
|
123
128
|
parameter :base_image, default: 'centos:7'
|
124
129
|
parameter :timezone, default: 'UTC'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: luban
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rubyist Lei
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: luban-cli
|