migratio 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 72782d04daa9369d64692d88cbaf87a99c34f142
4
- data.tar.gz: 87bb9fc2f18780825e8305eecb87775bd5fc3f92
3
+ metadata.gz: 5ae15f80e370bb4a7bec6df988bb24d8dc312a0d
4
+ data.tar.gz: 38d817bc87cf9706faaa1f7b62ccd797d699fb48
5
5
  SHA512:
6
- metadata.gz: 79d7a6254b2c287e47bd0483affa51dba629a8e86ada70a20aa89db9b59766acd89ab633baeacc458e4e910a2318b41a802fe16324993f1dce47c6f45c00dcec
7
- data.tar.gz: 991a54d76b02999d04f30a0f6372fe08043189cca98362a40a3bf653627141c3297b865f84f77258e34da2c0836f397a7ae20278b5f5f835596c107df85ab4a4
6
+ metadata.gz: 83d55980b32b9626ddfa8eba8235996fd86842ee69d99bd5375e9a1c3a69321999a26585b5868d6f8345b11edef4274e727127a476e5fcc77c316a19fa92894c
7
+ data.tar.gz: 4d9e480ae84e92c5c86d37519208f3a35d26e1109f619204cd29516c93cac0cd1b06da754bfefac605a90fa0d2ac434a53806f811d8fb2823d9e2415f2ada67a
data/.gitignore CHANGED
@@ -1,24 +1,11 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- log/
18
- tmp
1
+ *.db
2
+ *.log
19
3
  config.yml
4
+
5
+ .idea/
20
6
  *.ipr
21
7
  *.iws
22
8
  *.iml
23
- .idea/
24
- nbproject/
9
+
10
+ /nbproject/private/
11
+ /nbproject/
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in migration-worker.gemspec
3
+ # Specify your gem's dependencies in migratio.gemspec
4
4
  gemspec
@@ -0,0 +1,34 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ migratio (0.0.2)
5
+ sidekiq
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ celluloid (0.16.0)
11
+ timers (~> 4.0.0)
12
+ connection_pool (2.1.1)
13
+ hitimes (1.2.2)
14
+ json (1.8.2)
15
+ rake (10.4.2)
16
+ redis (3.2.0)
17
+ redis-namespace (1.5.1)
18
+ redis (~> 3.0, >= 3.0.4)
19
+ sidekiq (3.3.0)
20
+ celluloid (>= 0.16.0)
21
+ connection_pool (>= 2.0.0)
22
+ json
23
+ redis (>= 3.0.6)
24
+ redis-namespace (>= 1.3.1)
25
+ timers (4.0.1)
26
+ hitimes
27
+
28
+ PLATFORMS
29
+ ruby
30
+
31
+ DEPENDENCIES
32
+ bundler
33
+ migratio!
34
+ rake
data/README.md CHANGED
@@ -9,6 +9,9 @@ This gem is used to perform virtual machine template migration between sites.
9
9
  - Linux (tested on Ubuntu)
10
10
  - Ruby 2.0+
11
11
  - Redis (can be installed on separate server)
12
+ - OpenStack (with `nova` commands available for user who runs `migratio`)
13
+ - Amazon EC2 CLI Tools (with `ec2-*` commands available for user who runs `migratio`, needs: Java Runtime Environment)
14
+ - AWS CLI Tools (with `aws` command, needs: python and pip)
12
15
 
13
16
  ## Packages / Dependencies
14
17
 
@@ -21,7 +24,7 @@ Install additional packages (as root):
21
24
 
22
25
  aptitude install g++ make autoconf bison build-essential libssl-dev libyaml-dev libreadline6 libreadline6-dev zlib1g zlib1g-dev
23
26
 
24
- Install ``ruby`` and ``bundler`` (as root):
27
+ Install `ruby` and `bundler` (as root):
25
28
 
26
29
  mkdir /tmp/ruby
27
30
  pushd /tmp/ruby
@@ -36,14 +39,10 @@ Install ``ruby`` and ``bundler`` (as root):
36
39
 
37
40
  Install this software (as non-root):
38
41
 
39
- git clone https://github.com/paoolo/migratio.git /home/atmosphere/migratio
42
+ git clone https://github.com/dice-cyfronet/migratio.git /home/atmosphere/migratio
40
43
  cd /home/atmosphere/migratio
41
44
  cp /home/atmosphere/migratio/config.yml.example /home/atmosphere/migratio/config.yml
42
45
 
43
- Edit config file, set proper ``redis_url`` and name first row in queues with proper, unique name:
44
-
45
- nano /home/atmosphere/migratio/config.yml
46
-
47
46
  Install gems:
48
47
 
49
48
  pushd /home/atmosphere/migratio
@@ -89,12 +88,12 @@ Install upstart scripts (as non-root, inside migratio directory):
89
88
  mkdir -p /home/atmosphere/.init
90
89
  cp -i /home/atmosphere/migratio/support/upstart/*.conf /home/atmosphere/.init/
91
90
 
92
- Set proper directory for ``migratio/`` and ``migratio/log/``:
91
+ Set proper directory for `migratio/` and `migratio/log/`:
93
92
 
94
- nano /home/atmosphere/.init/migration.conf
95
- nano /home/atmosphere/.init/migratio-1.conf
93
+ nano /home/atmosphere/.init/migratio.conf
94
+ nano /home/atmosphere/.init/migratio-worker-1.conf
96
95
 
97
- Update profile files (eg. ``.bash_profile``):
96
+ Update profile files (eg. `.bash_profile`):
98
97
 
99
98
  cat >> /home/atmosphere/.bash_profile <<EOL
100
99
  if [ ! -f /var/run/user/\$(id -u)/upstart/sessions/*.session ]
@@ -109,21 +108,81 @@ Update profile files (eg. ``.bash_profile``):
109
108
  EOL
110
109
  # you need to re-login to apply changes in /home/atmosphere/.bash_profile
111
110
 
111
+ ### Amazon EC2 CLI Tools
112
+
113
+ Download Amazon EC2 CLI Tools:
114
+
115
+ wget http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip
116
+
117
+ Copy all executable files (unix scripts) from `bin/` to `/usr/bin`. Copy all libraries (jars) from `lib/` to `/usr/lib`.
118
+
119
+ Add to `/etc/environment` following lines:
120
+
121
+ EC2_HOME=/usr
122
+ JAVA_HOME=/usr/lib/jvm/default-java
123
+
124
+ ### AWS CLI Tools
125
+
126
+ Install `awscli` as `root`
127
+
128
+ pip install awscli
129
+
130
+ Configure `awscli` for user who run `migratio`
131
+
132
+ aws configure
133
+
134
+ ## Configuration
135
+
136
+ Edit config file. Set proper `redis_url` and `name`:
137
+
138
+ nano /home/atmosphere/migratio/config.yml
139
+
140
+ `name` must be identical with ComputeSite `site_id` property. Eg. for ComputeSite with `name` `Local` and `site_id` `local`, `name` used in configuration is `local`, not `Local`.
141
+
142
+ Create file `~/.creds` with credentials used in OpenStack and Amazon. Eg.
143
+
144
+ export OS_TENANT_NAME=openstack_tenant
145
+ export OS_USERNAME=openstack_username_for_tenant
146
+ export OS_PASSWORD=openstack_password_for_tenant
147
+ export OS_AUTH_URL="http://127.0.0.1:5000/v2.0/" # default value for OpenStack installation
148
+ export IMAGES_DIR=/var/lib/glance/images # default value for OpenStack installation
149
+ export SOURCE_CS=atmosphere_local_compute_site_site_id_property
150
+ export AWS_ACCESS_KEY=aws_access_key
151
+ export AWS_SECRET_KEY=aws_secret_key
152
+
153
+ User who runs `migratio` need to be assigned to `glance` group. User running `migratio` need to be allow in `visudo` to run `qemu-img`.
154
+
155
+ atmosphere ALL=(root) NOPASSWD: /usr/bin/qemu-img
156
+
157
+ Create configuration files per Compute Site in directory `config/`. Configuration file name must be identical with ComputeSite `site_id` property. Use suffix `.conf`. See [config/](config/).
158
+
159
+ For OpenStack:
160
+
161
+ export EXTERNAL_USER=external_username
162
+ export EXTERNAL_HOST=external_ip_or_hostname
163
+
164
+ Create account `external_username` and allow login without password (using ssh authorized keys) for user which is running `migratio`. Allow `external_username` to use OpenStack on external compute site.
165
+
166
+ For Amazon:
167
+
168
+ export AWS_REGION=eu-west-1 # or eu-central-1, us-east-1, us-west-1, etc.
169
+ export EC2_URL=https://ec2.eu-west-1.amazonaws.com
170
+
112
171
  ## Usage
113
172
 
114
- First time run (as non-root, inside ``migratio/`` directory):
173
+ First time run (as non-root, inside `migratio/` directory):
115
174
 
116
175
  pushd /home/atmosphere/migratio
117
- bundle exec ./bin/run
176
+ bundle exec ./bin/migratio-run
118
177
  popd
119
178
 
120
179
  Normal run (as non-root):
121
180
 
122
- start migration
181
+ start migratio
123
182
 
124
183
  Stop (as non-root):
125
184
 
126
- stop migration
185
+ stop migratio
127
186
 
128
187
  ## Contributing
129
188
 
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'rubygems'
3
3
  require 'sidekiq'
4
- require_relative '../lib/migration/worker'
4
+ require_relative '../lib/migratio/worker'
5
5
 
6
- RUNNER_PATH = File.join(ROOT_PATH, 'lib', 'migration', 'runner.rb')
6
+ RUNNER_PATH = File.join(ROOT_PATH, 'lib', 'migratio', 'runner.rb')
7
7
 
8
8
  def queue
9
- "migration_#{Migration::Worker.config.name}"
9
+ "migration_#{Migratio::Worker.config.name}"
10
10
  end
11
11
 
12
12
  system "sidekiq -q #{queue} -c 1 -r #{RUNNER_PATH}"
@@ -1,3 +1,3 @@
1
1
  name: own_name
2
2
  redis_url: redis://localhost:6379
3
- namespace: air
3
+ namespace: atmosphere
@@ -1 +1,2 @@
1
- export AWS_REGION=eu-west-1
1
+ export AWS_REGION=eu-west-1
2
+ export EC2_URL=https://ec2.eu-west-1.amazonaws.com
@@ -0,0 +1,2 @@
1
+ export EXTERNAL_USER=external_username
2
+ export EXTERNAL_HOST=external_ip_or_hostname
@@ -8,8 +8,8 @@ module Migratio
8
8
  dir = File.dirname(__FILE__)
9
9
  output = `#{dir}/../../../scripts/openstack2amazon-convert.sh "#{image_uuid}" "#{dir}/../../../config/#{compute_site}.conf"`
10
10
  Sidekiq::Client.push(
11
- 'queue' => 'migration_jobs',
12
- 'class' => 'UpdateMigrationJobStatusWorker',
11
+ 'queue' => 'feedback',
12
+ 'class' => 'Atmosphere::UpdateMigrationJobStatusWorker',
13
13
  'args' => [image_uuid, config.name, compute_site, output])
14
14
  if $?.exitstatus == 1
15
15
  return
@@ -17,8 +17,8 @@ module Migratio
17
17
 
18
18
  output = `#{dir}/../../../scripts/openstack2amazon-transfer.sh "#{image_uuid}" "#{dir}/../../../config/#{compute_site}.conf"`
19
19
  Sidekiq::Client.push(
20
- 'queue' => 'migration_jobs',
21
- 'class' => 'UpdateMigrationJobStatusWorker',
20
+ 'queue' => 'feedback',
21
+ 'class' => 'Atmosphere::UpdateMigrationJobStatusWorker',
22
22
  'args' => [image_uuid, config.name, compute_site, output])
23
23
  if $?.exitstatus == 1
24
24
  return
@@ -26,8 +26,8 @@ module Migratio
26
26
 
27
27
  output = `#{dir}/../../../scripts/openstack2amazon-import.sh "#{image_uuid}" "#{dir}/../../../config/#{compute_site}.conf"`
28
28
  Sidekiq::Client.push(
29
- 'queue' => 'migration_jobs',
30
- 'class' => 'UpdateMigrationJobStatusWorker',
29
+ 'queue' => 'feedback',
30
+ 'class' => 'Atmosphere::UpdateMigrationJobStatusWorker',
31
31
  'args' => [image_uuid, config.name, compute_site, output])
32
32
  if $?.exitstatus == 1
33
33
  return
@@ -35,8 +35,8 @@ module Migratio
35
35
 
36
36
  output = `#{dir}/../../../scripts/openstack2amazon-register.sh "#{image_uuid}" "#{dir}/../../../config/#{compute_site}.conf"`
37
37
  Sidekiq::Client.push(
38
- 'queue' => 'migration_jobs',
39
- 'class' => 'UpdateMigrationJobStatusWorker',
38
+ 'queue' => 'feedback',
39
+ 'class' => 'Atmosphere::UpdateMigrationJobStatusWorker',
40
40
  'args' => [image_uuid, config.name, compute_site, output])
41
41
  end
42
42
  end
@@ -8,8 +8,8 @@ module Migratio
8
8
  dir = File.dirname(__FILE__)
9
9
  output = `#{dir}/../../../scripts/openstack2openstack-transfer.sh "#{image_uuid}" "#{dir}/../../../config/#{compute_site}.conf"`
10
10
  Sidekiq::Client.push(
11
- 'queue' => 'migration_jobs',
12
- 'class' => 'UpdateMigrationJobStatusWorker',
11
+ 'queue' => 'feedback',
12
+ 'class' => 'Atmosphere::UpdateMigrationJobStatusWorker',
13
13
  'args' => [image_uuid, config.name, compute_site, output])
14
14
  if $?.exitstatus == 1
15
15
  return
@@ -17,8 +17,8 @@ module Migratio
17
17
 
18
18
  output = `#{dir}/../../../scripts/openstack2openstack-register.sh "#{image_uuid}" "#{dir}/../../../config/#{compute_site}.conf"`
19
19
  Sidekiq::Client.push(
20
- 'queue' => 'migration_jobs',
21
- 'class' => 'UpdateMigrationJobStatusWorker',
20
+ 'queue' => 'feedback',
21
+ 'class' => 'Atmosphere::UpdateMigrationJobStatusWorker',
22
22
  'args' => [image_uuid, config.name, compute_site, output])
23
23
  end
24
24
  end
@@ -1,5 +1,5 @@
1
1
  module Migratio
2
2
  module Worker
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
@@ -1,9 +1,9 @@
1
- start on starting migration-worker
2
- stop on stopping migration-worker
1
+ start on starting migratio-worker
2
+ stop on stopping migratio-worker
3
3
  respawn
4
4
 
5
5
  setuid atmosphere
6
- chdir /home/atmosphere/migration-worker
6
+ chdir /home/atmosphere/migratio
7
7
 
8
8
  script
9
9
  # this script runs in /bin/sh by default
@@ -26,6 +26,6 @@ exec /bin/bash <<EOT
26
26
  # rvm
27
27
  # source /home/apps/.rvm/scripts/rvm
28
28
 
29
- exec bundle exec ./bin/run >> /home/atmosphere/migration-worker/log/migration-worker.log 2>&1
29
+ exec bundle exec ./bin/migratio-run >> /home/atmosphere/migratio/log/migratio.log 2>&1
30
30
  EOT
31
- end script
31
+ end script
@@ -0,0 +1,2 @@
1
+ start on starting migratio
2
+ stop on stopping migratio
@@ -1,6 +1,6 @@
1
1
  pre-start script
2
- mkdir -p /home/atmosphere/migration-worker/log
3
- chown -R atmosphere /home/atmosphere/migration-worker/log
2
+ mkdir -p /home/atmosphere/migratio/log
3
+ chown -R atmosphere /home/atmosphere/migratio/log
4
4
  end script
5
5
 
6
6
  start on (started network-interface
@@ -9,4 +9,4 @@ start on (started network-interface
9
9
 
10
10
  stop on (stopping network-interface
11
11
  or stopping network-manager
12
- or stopping networking)
12
+ or stopping networking)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: migratio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paweł Suder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-13 00:00:00.000000000 Z
11
+ date: 2015-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq
@@ -56,23 +56,20 @@ description: Migration worker
56
56
  email:
57
57
  - pawel@suder.info
58
58
  executables:
59
- - migratio-client
60
59
  - migratio-run
61
60
  extensions: []
62
61
  extra_rdoc_files: []
63
62
  files:
64
63
  - ".gitignore"
65
64
  - Gemfile
65
+ - Gemfile.lock
66
66
  - LICENSE.txt
67
67
  - README.md
68
68
  - Rakefile
69
- - bin/migratio-client
70
69
  - bin/migratio-run
71
70
  - config.yml.example
72
71
  - config/amazon.conf
73
- - config/cyfronet-folsom.conf
74
- - config/cyfronet-icehouse.conf
75
- - config/vienna.conf
72
+ - config/external_openstack.conf
76
73
  - lib/migratio/config.rb
77
74
  - lib/migratio/runner.rb
78
75
  - lib/migratio/worker.rb
@@ -89,9 +86,9 @@ files:
89
86
  - scripts/openstack2openstack-register.sh
90
87
  - scripts/openstack2openstack-transfer.sh
91
88
  - scripts/openstack2openstack.sh
92
- - support/upstart/migration-worker-1.conf
93
- - support/upstart/migration-worker.conf
94
- - support/upstart/migration.conf
89
+ - support/upstart/migratio-worker-1.conf
90
+ - support/upstart/migratio-worker.conf
91
+ - support/upstart/migratio.conf
95
92
  homepage: https://github.com/dice-cyfronet/migratio
96
93
  licenses:
97
94
  - MIT
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'rubygems'
3
- require 'sidekiq'
4
-
5
- require_relative '../lib/migration/worker/openstack_amazon_migrator'
6
- require_relative '../lib/migration/worker/openstack_openstack_migrator'
7
- require_relative '../lib/migration/config'
8
- require_relative '../lib/migration/worker'
9
-
10
- Sidekiq.configure_client do |c|
11
- c.redis = { :namespace => Migration::Worker.config.namespace, :url => Migration::Worker.config.redis_url, queue: Migration::Worker.config.queue }
12
- end
13
-
14
- Sidekiq::Client.push('queue' => 'cyfronet', 'class' => Migration::Worker::AmazonExporter, 'args' => [])
15
- Sidekiq::Client.push('queue' => 'cyfronet', 'class' => Migration::Worker::OpenstackExporter, 'args' => [])
@@ -1,2 +0,0 @@
1
- export EXTERNAL_USER=atmosphere
2
- export EXTERNAL_HOST=10.100.0.24
@@ -1,2 +0,0 @@
1
- export EXTERNAL_USER=atmosphere
2
- export EXTERNAL_HOST=10.100.0.4
@@ -1,2 +0,0 @@
1
- export EXTERNAL_USER=atmosphere
2
- export EXTERNAL_HOST=10.0.0.1
@@ -1,2 +0,0 @@
1
- start on starting migration
2
- stop on stopping migration