cloudkeeper-one 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 782d5e9a1c747b951cc7a253f90a029a90d42256
4
- data.tar.gz: b6debe2f03c6f5c199b72cab2628feaf04b15748
3
+ metadata.gz: 9d4f43bd15b32c1d02aae284b97d12baafb1491e
4
+ data.tar.gz: 06c4f1b3c6ad21c30bf71477b0b44b571ce69240
5
5
  SHA512:
6
- metadata.gz: 6bae19c429f299deab00c21d0551b033211935a8aca701d4e51d1ffe5054ffd1cddc6348b0f91e0c300137c07ea38eab0492f736d48d0f342ef75c35a7fce562
7
- data.tar.gz: 01676f4e211792611c3c8f774f110b2dee4eeef4a480c5a84499cab4de171f88fcdf3ebcbc3efb25fdb123462ad1d540ae01bda5899070c4c01c6ec9ceaec4b0
6
+ metadata.gz: af3ffac5e682f97bfb76ac273d0a27c58900560c62291cf739f0506d27b691dcb28ae31fa357278c21cb87d48b69bea8be1aa668c5548d31b7ee78311b564fa3
7
+ data.tar.gz: d9bcce658d11f698a58873c1645fae55a00a0ad829d0b88a5efb5069fcfd92b7a5a336230cc33cc163850db6c5f52c6c5145726ec92f39c09989d3bb6e36f8ad
data/README.md CHANGED
@@ -9,20 +9,20 @@ OpenNebula backend for [cloudkeeper](https://github.com/the-cloudkeeper-project/
9
9
  ## What does cloudkeeper-one do?
10
10
  cloudkeeper-one is able to manage [OpenNebula](https://opennebula.org/) cloud - upload, update and remove images and templates representing EGI AppDB appliances. cloudkeeper-one runs as a server listening for [gRPC](http://www.grpc.io/) communication usually from core [cloudkeeper](https://github.com/the-cloudkeeper-project/cloudkeeper) component.
11
11
 
12
- ##Requirements
13
- * Ruby >= 2.0.0
12
+ ## Requirements
13
+ * Ruby >= 2.2.0
14
14
  * Rubygems
15
15
  * OpenNebula >= 5.2 (doesn't have to be present on the same machine)
16
16
 
17
17
  ## Installation
18
18
 
19
- ###From RubyGems.org
19
+ ### From RubyGems.org
20
20
  To install the most recent stable version
21
21
  ```bash
22
22
  gem install cloudkeeper-one
23
23
  ```
24
24
 
25
- ###From source (dev)
25
+ ### From source (dev)
26
26
  **Installation from source should never be your first choice! Especially, if you are not
27
27
  familiar with RVM, Bundler, Rake and other dev tools for Ruby!**
28
28
 
@@ -38,8 +38,8 @@ bundle install
38
38
  bundle exec rake spec
39
39
  ```
40
40
 
41
- ##Configuration
42
- ###Create a configuration file for cloudkeeper-one
41
+ ## Configuration
42
+ ### Create a configuration file for cloudkeeper-one
43
43
  Configuration file can be read by cloudkeeper-one from these
44
44
  three locations:
45
45
 
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
 
13
13
  spec.summary = 'OpenNebula backend for cloudkeeper'
14
14
  spec.description = 'OpenNebula backend for cloudkeeper'
15
- spec.homepage = 'https://github.com/Misenko/cloudkeeper-one'
15
+ spec.homepage = 'https://github.com/the-cloudkeeper-project/cloudkeeper-one'
16
16
  spec.license = 'Apache License, Version 2.0'
17
17
 
18
18
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
@@ -0,0 +1,125 @@
1
+ #!/bin/sh
2
+
3
+ ### BEGIN INIT INFO
4
+ # Provides: cloudkeeper-one
5
+ # Required-Start: $local_fs $remote_fs $network $syslog $named
6
+ # Required-Stop: $local_fs $remote_fs $network $syslog $named
7
+ # Default-Start: 2 3 4 5
8
+ # Default-Stop: 0 1 6
9
+ # Short-Description: Start/stop cloudkeeper-one GRPC server
10
+ # Description: Start the GRPC server for cloudkeeper-one.
11
+ ### END INIT INFO
12
+
13
+ run_dir="/var/run/cloudkeeper-one"
14
+ log_dir="/var/log/cloudkeeper-one"
15
+ conf_dir="/etc/cloudkeeper-one"
16
+
17
+ omnibus_base_dir="/opt/cloudkeeper-one"
18
+ embedded_base_dir="$omnibus_base_dir/embedded"
19
+ embedded_ruby_version=`$embedded_base_dir/bin/ruby -e "puts RUBY_VERSION.split('.').fill('0',2..2).join('.')"`
20
+ embedded_cloudkeeper_one_version=`$omnibus_base_dir/bin/cloudkeeper-one version`
21
+ embedded_cloudkeeper_one_dir="$embedded_base_dir/lib/ruby/gems/$embedded_ruby_version/gems/cloudkeeper-one-$embedded_cloudkeeper_one_version"
22
+
23
+ user="cloudkeeper-one"
24
+ cmd="$omnibus_base_dir/bin/cloudkeeper-one"
25
+
26
+ name=`basename $0`
27
+ pid_file="$run_dir/cloudkeeper-one.init.pid"
28
+ stdout_log="$log_dir/cloudkeeper-one.init.stdout.log"
29
+ stderr_log="$log_dir/cloudkeeper-one.init.stderr.log"
30
+
31
+ retval=0
32
+
33
+ get_pid() {
34
+ cat "$pid_file"
35
+ }
36
+
37
+ is_running() {
38
+ [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1
39
+ }
40
+
41
+ start() {
42
+ if is_running; then
43
+ echo "Already started"
44
+ else
45
+ echo "Starting $name ..."
46
+
47
+ cd "$run_dir"
48
+ sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" &
49
+
50
+ echo $! > "$pid_file"
51
+ if ! is_running; then
52
+ echo "Unable to start, see $stdout_log and $stderr_log"
53
+ retval=1
54
+ else
55
+ echo "Started"
56
+ fi
57
+ fi
58
+ }
59
+
60
+ stop() {
61
+ if is_running; then
62
+ echo "Stopping $name ..."
63
+
64
+ kill -SIGINT `get_pid`
65
+ for i in $(seq 1 15); do
66
+ if ! is_running; then
67
+ break
68
+ fi
69
+ echo -n "."
70
+ sleep 1
71
+ done
72
+
73
+ echo
74
+ if is_running; then
75
+ echo "Not stopped; may still be shutting down or shutdown may have failed"
76
+ kill -SIGKILL `get_pid`
77
+ retval=1
78
+ else
79
+ echo "Stopped"
80
+ if [ -f "$pid_file" ]; then
81
+ rm "$pid_file"
82
+ fi
83
+ fi
84
+ else
85
+ echo "Not running"
86
+ retval=1
87
+ fi
88
+ }
89
+
90
+ restart(){
91
+ stop
92
+
93
+ if is_running; then
94
+ echo "Unable to stop, will not attempt to start"
95
+ retval=1
96
+ else
97
+ start
98
+ fi
99
+ }
100
+
101
+ case "$1" in
102
+ start)
103
+ start
104
+ ;;
105
+ stop)
106
+ stop
107
+ ;;
108
+ restart)
109
+ restart
110
+ ;;
111
+ status)
112
+ if is_running; then
113
+ echo "Running"
114
+ else
115
+ echo "Stopped"
116
+ retval=3
117
+ fi
118
+ ;;
119
+ *)
120
+ echo "Usage: $name {start|stop|restart|status}"
121
+ retval=1
122
+ ;;
123
+ esac
124
+
125
+ exit $retval
@@ -5,6 +5,10 @@ require 'chronic_duration'
5
5
  module Cloudkeeper
6
6
  module One
7
7
  class CLI < Thor
8
+ SIGINT = 2
9
+ SIGTERM = 15
10
+ SIGNALS = [SIGTERM, SIGINT].freeze
11
+
8
12
  class_option :'logging-level',
9
13
  required: true,
10
14
  default: Cloudkeeper::One::Settings['logging']['level'],
@@ -96,7 +100,8 @@ module Cloudkeeper
96
100
  grpc_server.add_http2_port Cloudkeeper::One::Settings[:'listen-address'], credentials
97
101
  grpc_server.handle Cloudkeeper::One::CoreConnector
98
102
  grpc_server.run_till_terminated
99
- rescue Interrupt
103
+ rescue SignalException => ex
104
+ raise ex unless SIGNALS.include? ex.signo
100
105
  grpc_server.stop
101
106
  rescue Cloudkeeper::One::Errors::InvalidConfigurationError => ex
102
107
  abort ex.message
@@ -1,5 +1,5 @@
1
1
  module Cloudkeeper
2
2
  module One
3
- VERSION = '1.0.1'.freeze
3
+ VERSION = '1.1.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudkeeper-one
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.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-03-28 00:00:00.000000000 Z
11
+ date: 2017-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -313,6 +313,7 @@ files:
313
313
  - config/cloudkeeper-one.yml
314
314
  - config/templates/image.erb
315
315
  - config/templates/template.erb
316
+ - examples/etc/init.d/cloudkeeper-one
316
317
  - lib/cloudkeeper/one.rb
317
318
  - lib/cloudkeeper/one/appliance_actions.rb
318
319
  - lib/cloudkeeper/one/appliance_actions/list.rb
@@ -358,7 +359,7 @@ files:
358
359
  - lib/cloudkeeper/one/settings.rb
359
360
  - lib/cloudkeeper/one/version.rb
360
361
  - lib/cloudkeeper_grpc.rb
361
- homepage: https://github.com/Misenko/cloudkeeper-one
362
+ homepage: https://github.com/the-cloudkeeper-project/cloudkeeper-one
362
363
  licenses:
363
364
  - Apache License, Version 2.0
364
365
  metadata: {}