cloudkeeper 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +36 -0
- data/Dockerfile +51 -0
- data/cloudkeeper.gemspec +1 -1
- data/config/cloudkeeper.yml +5 -2
- data/lib/cloudkeeper/cli.rb +22 -11
- data/lib/cloudkeeper/nginx/http_server.rb +11 -6
- data/lib/cloudkeeper/version.rb +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b68f4e4bb882318c02878608479323a196857f2e
|
4
|
+
data.tar.gz: 13b08b1aae43eb6858fa726ebfe782644b72e681
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c16beb7fe52106c8987ab873fd3c4be88883d3e830f08aadf3e30a8b7fe12ee15c0c0fb9f91e071e7841e01591493ce385fb325ed5a24a24b63ce6f0fb7bf9d1
|
7
|
+
data.tar.gz: fae35d54048e43b15d0cdc472aa98cf973bfab70322d7610f55018fd077ec4a16560129b947e4804bf9153016b23216b378f78abed6722de6684ef072ad17b89
|
@@ -0,0 +1,36 @@
|
|
1
|
+
version: 2
|
2
|
+
jobs:
|
3
|
+
build:
|
4
|
+
branches:
|
5
|
+
only:
|
6
|
+
- master
|
7
|
+
docker:
|
8
|
+
- image: docker:stable
|
9
|
+
working_directory: /root/cloudkeeper
|
10
|
+
steps:
|
11
|
+
- run: apk add --no-cache git openssh
|
12
|
+
- checkout
|
13
|
+
- setup_remote_docker
|
14
|
+
- run: |
|
15
|
+
TAG=${CIRCLE_BRANCH}
|
16
|
+
BRANCH=${CIRCLE_BRANCH}
|
17
|
+
VERSION=">= 0"
|
18
|
+
|
19
|
+
if [ "${TAG}" == "master" ]; then
|
20
|
+
TAG=latest
|
21
|
+
fi
|
22
|
+
|
23
|
+
if [ -n "${CIRCLE_TAG}" ]; then
|
24
|
+
TAG=${CIRCLE_TAG#v}
|
25
|
+
BRANCH=${TAG/%.*/.x}
|
26
|
+
VERSION=${TAG}
|
27
|
+
fi
|
28
|
+
|
29
|
+
docker build --build-arg branch=$BRANCH --build-arg version="$VERSION" -t cloudkeeper/cloudkeeper:$TAG .
|
30
|
+
docker login -u $DOCKER_USER -p $DOCKER_PASS
|
31
|
+
docker push cloudkeeper/cloudkeeper:$TAG
|
32
|
+
deployment:
|
33
|
+
fake_deploy_for_cci2:
|
34
|
+
tag: /v.*/
|
35
|
+
commands:
|
36
|
+
- echo "make tags run in 2.0"
|
data/Dockerfile
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
FROM ubuntu:16.04
|
2
|
+
|
3
|
+
ARG branch=master
|
4
|
+
ARG version
|
5
|
+
|
6
|
+
ENV name="cloudkeeper"
|
7
|
+
ENV spoolDir="/var/spool/${name}"
|
8
|
+
ENV imgDir="${spoolDir}/images" \
|
9
|
+
runDir="/var/run/${name}" \
|
10
|
+
logDir="/var/log/${name}" \
|
11
|
+
lockDir="/var/lock/${name}" \
|
12
|
+
nginxLogDir="/var/log/nginx" \
|
13
|
+
nginxLibDir="/var/lib/nginx"
|
14
|
+
|
15
|
+
LABEL application=${name} \
|
16
|
+
description="A tool for synchronizing appliances between AppDB and CMFs" \
|
17
|
+
maintainer="kimle@cesnet.cz" \
|
18
|
+
version=${version} \
|
19
|
+
branch=${branch}
|
20
|
+
|
21
|
+
SHELL ["/bin/bash", "-c"]
|
22
|
+
|
23
|
+
# update + dependencies
|
24
|
+
RUN apt-get update && \
|
25
|
+
apt-get --assume-yes upgrade && \
|
26
|
+
apt-get --assume-yes install ruby qemu-utils curl nginx file
|
27
|
+
|
28
|
+
# EGI trust anchors
|
29
|
+
RUN set -o pipefail && \
|
30
|
+
curl -s https://dist.eugridpma.info/distribution/igtf/current/GPG-KEY-EUGridPMA-RPM-3 | apt-key add - && \
|
31
|
+
echo $'#### EGI Trust Anchor Distribution ####\n\
|
32
|
+
deb http://repository.egi.eu/sw/production/cas/1/current egi-igtf core' > /etc/apt/sources.list.d/egi.list && \
|
33
|
+
apt-get update && \
|
34
|
+
apt-get --assume-yes install ca-policy-egi-core
|
35
|
+
|
36
|
+
# cloudkeeper
|
37
|
+
RUN gem install ${name} -v "${version}" --no-document
|
38
|
+
|
39
|
+
# env
|
40
|
+
RUN useradd --system --shell /bin/false --home ${spoolDir} --create-home ${name} && \
|
41
|
+
usermod -L ${name} && \
|
42
|
+
mkdir -p ${imgDir} ${runDir} ${logDir} ${lockDir} && \
|
43
|
+
chown -R ${name}:${name} ${spoolDir} ${runDir} ${logDir} ${lockDir} ${nginxLogDir} ${nginxLibDir}
|
44
|
+
|
45
|
+
VOLUME ${imgDir}
|
46
|
+
|
47
|
+
EXPOSE 7300-7400
|
48
|
+
|
49
|
+
USER ${name}
|
50
|
+
|
51
|
+
ENTRYPOINT ["cloudkeeper"]
|
data/cloudkeeper.gemspec
CHANGED
@@ -40,7 +40,7 @@ Gem::Specification.new do |spec|
|
|
40
40
|
spec.add_development_dependency 'simplecov', '~> 0.12'
|
41
41
|
spec.add_development_dependency 'pry', '~> 0.10'
|
42
42
|
spec.add_development_dependency 'vcr', '~> 3.0'
|
43
|
-
spec.add_development_dependency 'webmock', '~>
|
43
|
+
spec.add_development_dependency 'webmock', '~> 3.0'
|
44
44
|
spec.add_development_dependency 'diffy', '~> 3.1'
|
45
45
|
spec.add_development_dependency 'grpc-tools', '~> 1.0'
|
46
46
|
|
data/config/cloudkeeper.yml
CHANGED
@@ -15,8 +15,11 @@ cloudkeeper:
|
|
15
15
|
access-log-file: /var/log/cloudkeeper/nginx-access.log # File for NGINX access log
|
16
16
|
pid-file: /var/run/cloudkeeper/nginx.pid # NGINX pid file
|
17
17
|
ip-address: 127.0.0.1 # IP address NGINX can listen on
|
18
|
-
|
19
|
-
|
18
|
+
port: 50505 # Port NGINX can listen on
|
19
|
+
proxy:
|
20
|
+
ip-address: # Proxy IP address
|
21
|
+
port: # Proxy port
|
22
|
+
ssl: false # Whether proxy will use SSL connection
|
20
23
|
backend:
|
21
24
|
endpoint: 127.0.0.1:50051 # Backend's gRPC endpoint
|
22
25
|
certificate: /etc/grid-security/backendcert.pem # Backend's certificate
|
data/lib/cloudkeeper/cli.rb
CHANGED
@@ -84,14 +84,22 @@ module Cloudkeeper
|
|
84
84
|
default: Cloudkeeper::Settings['nginx']['ip-address'],
|
85
85
|
type: :string,
|
86
86
|
desc: 'IP address NGINX can listen on'
|
87
|
-
method_option :'nginx-
|
88
|
-
default: Cloudkeeper::Settings['nginx']['
|
87
|
+
method_option :'nginx-port',
|
88
|
+
default: Cloudkeeper::Settings['nginx']['port'],
|
89
89
|
type: :numeric,
|
90
|
-
desc: '
|
91
|
-
method_option :'nginx-
|
92
|
-
default: Cloudkeeper::Settings['nginx']['
|
90
|
+
desc: 'Port NGINX can listen on'
|
91
|
+
method_option :'nginx-proxy-ip-address',
|
92
|
+
default: Cloudkeeper::Settings['nginx']['proxy']['ip-address'],
|
93
|
+
type: :string,
|
94
|
+
desc: 'Proxy IP address'
|
95
|
+
method_option :'nginx-proxy-port',
|
96
|
+
default: Cloudkeeper::Settings['nginx']['proxy']['port'],
|
93
97
|
type: :numeric,
|
94
|
-
desc: '
|
98
|
+
desc: 'Proxy port'
|
99
|
+
method_option :'nginx-proxy-ssl',
|
100
|
+
default: Cloudkeeper::Settings['nginx']['proxy']['ssl'],
|
101
|
+
type: :boolean,
|
102
|
+
desc: 'Whether proxy will use SSL connection'
|
95
103
|
method_option :'backend-endpoint',
|
96
104
|
required: true,
|
97
105
|
default: Cloudkeeper::Settings['backend']['endpoint'],
|
@@ -142,17 +150,20 @@ module Cloudkeeper
|
|
142
150
|
end
|
143
151
|
|
144
152
|
def validate_configuration!
|
145
|
-
validate_configuration_group!
|
153
|
+
validate_configuration_group! %i[authentication],
|
146
154
|
%i[certificate key backend-certificate],
|
147
155
|
'Authentication configuration missing'
|
148
|
-
validate_configuration_group!
|
156
|
+
validate_configuration_group! %i[remote-mode],
|
149
157
|
%i[nginx-binary nginx-runtime-dir nginx-error-log-file nginx-access-log-file nginx-pid-file
|
150
|
-
nginx-ip-address nginx-
|
158
|
+
nginx-ip-address nginx-port],
|
151
159
|
'NGINX configuration missing'
|
160
|
+
validate_configuration_group! %i[remote-mode nginx-proxy-ip-address],
|
161
|
+
%i[nginx-proxy-port],
|
162
|
+
'NGINX proxy configuration missing'
|
152
163
|
end
|
153
164
|
|
154
|
-
def validate_configuration_group!(
|
155
|
-
return unless Cloudkeeper::Settings[
|
165
|
+
def validate_configuration_group!(flags, required_options, error_message)
|
166
|
+
return unless flags.reduce(true) { |acc, elem| Cloudkeeper::Settings[elem] && acc }
|
156
167
|
|
157
168
|
raise Cloudkeeper::Errors::InvalidConfigurationError, error_message unless all_options_available(required_options)
|
158
169
|
end
|
@@ -3,6 +3,7 @@ require 'tempfile'
|
|
3
3
|
require 'securerandom'
|
4
4
|
require 'erb'
|
5
5
|
require 'tilt/erb'
|
6
|
+
require 'uri'
|
6
7
|
|
7
8
|
module Cloudkeeper
|
8
9
|
module Nginx
|
@@ -48,8 +49,13 @@ module Cloudkeeper
|
|
48
49
|
private
|
49
50
|
|
50
51
|
def fill_access_data(credentials, configuration)
|
52
|
+
host = configuration[:proxy_ip_address] || configuration[:ip_address]
|
53
|
+
port = configuration[:proxy_port] || configuration[:port]
|
54
|
+
scheme = configuration[:proxy_ip_address] && configuration[:proxy_ssl] ? 'https' : 'http'
|
55
|
+
path = configuration[:image_file]
|
56
|
+
|
51
57
|
access_data.merge! credentials
|
52
|
-
access_data[:url] = "
|
58
|
+
access_data[:url] = "#{scheme}://#{host}:#{port}/#{path}"
|
53
59
|
end
|
54
60
|
|
55
61
|
def prepare_credentials
|
@@ -100,16 +106,15 @@ module Cloudkeeper
|
|
100
106
|
nginx_configuration[:root_dir] = root_dir
|
101
107
|
nginx_configuration[:image_file] = image_file
|
102
108
|
nginx_configuration[:ip_address] = Cloudkeeper::Settings[:'nginx-ip-address']
|
103
|
-
nginx_configuration[:port] =
|
109
|
+
nginx_configuration[:port] = Cloudkeeper::Settings[:'nginx-port']
|
110
|
+
nginx_configuration[:proxy_ip_address] = Cloudkeeper::Settings[:'nginx-proxy-ip-address']
|
111
|
+
nginx_configuration[:proxy_port] = Cloudkeeper::Settings[:'nginx-proxy-port']
|
112
|
+
nginx_configuration[:proxy_ssl] = Cloudkeeper::Settings[:'nginx-proxy-ssl']
|
104
113
|
|
105
114
|
logger.debug("NGINX configuration: #{nginx_configuration.inspect}")
|
106
115
|
nginx_configuration
|
107
116
|
end
|
108
117
|
|
109
|
-
def choose_port
|
110
|
-
rand(Cloudkeeper::Settings[:'nginx-min-port']..Cloudkeeper::Settings[:'nginx-max-port'])
|
111
|
-
end
|
112
|
-
|
113
118
|
def random_string
|
114
119
|
SecureRandom.uuid
|
115
120
|
end
|
data/lib/cloudkeeper/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudkeeper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michal Kimle
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -142,14 +142,14 @@ dependencies:
|
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: '
|
145
|
+
version: '3.0'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: '
|
152
|
+
version: '3.0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: diffy
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -318,12 +318,14 @@ executables:
|
|
318
318
|
extensions: []
|
319
319
|
extra_rdoc_files: []
|
320
320
|
files:
|
321
|
+
- ".circleci/config.yml"
|
321
322
|
- ".gitignore"
|
322
323
|
- ".gitmodules"
|
323
324
|
- ".rspec"
|
324
325
|
- ".rubocop.yml"
|
325
326
|
- ".travis.yml"
|
326
327
|
- CODE_OF_CONDUCT.md
|
328
|
+
- Dockerfile
|
327
329
|
- Gemfile
|
328
330
|
- LICENSE.txt
|
329
331
|
- README.md
|
@@ -432,7 +434,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
432
434
|
version: '0'
|
433
435
|
requirements: []
|
434
436
|
rubyforge_project:
|
435
|
-
rubygems_version: 2.6.
|
437
|
+
rubygems_version: 2.6.10
|
436
438
|
signing_key:
|
437
439
|
specification_version: 4
|
438
440
|
summary: Synchronize cloud appliances between AppDB and cloud platforms
|