synchronised_migration 2.1.2 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +6 -0
- data/.github/workflows/release.yml +59 -0
- data/.github/workflows/ruby.yml +16 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +4 -0
- data/README.md +13 -4
- data/Rakefile +10 -0
- data/lib/synchronised_migration/version.rb +1 -1
- data/spec/synchronised_migration/main_spec.rb +9 -8
- data/synchronised_migration.gemspec +1 -0
- metadata +10 -8
- data/.travis.yml +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 178cde6a23ffc12e5074df16e0c8b2f5503ce460727607fc3af824c98a92bce1
|
4
|
+
data.tar.gz: 0e3ebd525d0e55ffeabe3565f811ed3ff57ea272d042a3b72386ae6a627ba03c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc7a499baac225c7f3e11467f84c44eae41a2af3ef6c016b3a8b674fdd177c53930efb86ec5951da2ce5b220fb697ff87faa62ba557a3de14767293a10a71371
|
7
|
+
data.tar.gz: 6d07aad5e40d68ac72c240f39875e2686416c1d2c38e1fb7555fe18626a47dbdc510116d51e6c19776ed5c22a3ef4e3bcc77b20b5c3672ed94098768dffdd35c
|
@@ -0,0 +1,59 @@
|
|
1
|
+
name: Release
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- "v*"
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
build:
|
10
|
+
name: Build
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
steps:
|
13
|
+
- name: Checkout
|
14
|
+
uses: actions/checkout@v2
|
15
|
+
- uses: ruby/setup-ruby@v1
|
16
|
+
with:
|
17
|
+
bundler-cache: true
|
18
|
+
- run: bundle exec rake
|
19
|
+
|
20
|
+
release:
|
21
|
+
needs: build
|
22
|
+
name: Release
|
23
|
+
runs-on: ubuntu-latest
|
24
|
+
steps:
|
25
|
+
- name: Checkout
|
26
|
+
uses: actions/checkout@v2
|
27
|
+
|
28
|
+
- name: Generate Changelog
|
29
|
+
run: |
|
30
|
+
# Get version from github ref (remove 'refs/tags/' and prefix 'v')
|
31
|
+
version="${GITHUB_REF#refs/tags/v}"
|
32
|
+
npx changelog-parser CHANGELOG.md | jq -cr ".versions | .[] | select(.version == \"$version\") | .body" > ${{ github.workflow }}-CHANGELOG.txt
|
33
|
+
|
34
|
+
- name: Release
|
35
|
+
uses: softprops/action-gh-release@v1
|
36
|
+
with:
|
37
|
+
body_path: ${{ github.workflow }}-CHANGELOG.txt
|
38
|
+
env:
|
39
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
40
|
+
|
41
|
+
publish:
|
42
|
+
needs: [build, release]
|
43
|
+
name: Publish
|
44
|
+
runs-on: ubuntu-latest
|
45
|
+
|
46
|
+
steps:
|
47
|
+
- uses: actions/checkout@v2
|
48
|
+
- uses: ruby/setup-ruby@v1
|
49
|
+
|
50
|
+
- name: Publish to RubyGems
|
51
|
+
run: |
|
52
|
+
mkdir -p $HOME/.gem
|
53
|
+
touch $HOME/.gem/credentials
|
54
|
+
chmod 0600 $HOME/.gem/credentials
|
55
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
56
|
+
gem build *.gemspec
|
57
|
+
gem push *.gem
|
58
|
+
env:
|
59
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
name: Build and Test
|
2
|
+
on: [push, pull_request]
|
3
|
+
jobs:
|
4
|
+
test:
|
5
|
+
strategy:
|
6
|
+
fail-fast: false
|
7
|
+
matrix:
|
8
|
+
ruby: ["2.6", "2.7", "3.0"]
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
steps:
|
11
|
+
- uses: actions/checkout@v2
|
12
|
+
- uses: ruby/setup-ruby@v1
|
13
|
+
with:
|
14
|
+
ruby-version: ${{ matrix.ruby }}
|
15
|
+
bundler-cache: true
|
16
|
+
- run: bundle exec rake
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.0.0
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Synchronised Migration
|
2
2
|
|
3
|
-
[![
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/synchronised_migration.svg)](http://badge.fury.io/rb/synchronised_migration)
|
4
|
+
[![Build Status](https://github.com/sealink/synchronised-migration-rb/workflows/Build%20and%20Test/badge.svg?branch=master)](https://github.com/sealink/synchronised-migration-rb/actions)
|
4
5
|
|
5
6
|
This gem makes it possible to deploy multiple instances with data migration
|
6
7
|
simultaneously. It uses Redis to ensure that there will be only one migration
|
@@ -17,7 +18,7 @@ Docker](https://github.com/sealink/craft-docker) project.
|
|
17
18
|
|
18
19
|
Module `SynchronisedMigration` needs to be configured as below.
|
19
20
|
|
20
|
-
```
|
21
|
+
```ruby
|
21
22
|
SynchronisedMigration.configure do |config|
|
22
23
|
config.host = 'example.com'
|
23
24
|
config.port = 6379
|
@@ -45,6 +46,14 @@ Run this before you launch the application during deployment.
|
|
45
46
|
$ rake synchronised_migrate:execute
|
46
47
|
```
|
47
48
|
|
48
|
-
##
|
49
|
+
## Release
|
50
|
+
|
51
|
+
To publish a new version of this gem the following steps must be taken.
|
49
52
|
|
50
|
-
|
53
|
+
* Update the version in the following files
|
54
|
+
```
|
55
|
+
CHANGELOG.md
|
56
|
+
lib/synchronised_migration/version.rb
|
57
|
+
````
|
58
|
+
* Create a tag using the format v0.1.0
|
59
|
+
* Follow build progress in GitHub actions
|
data/Rakefile
CHANGED
@@ -1,2 +1,12 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
+
|
3
|
+
desc 'Default: run specs.'
|
4
|
+
task :default => :spec
|
5
|
+
|
2
6
|
require 'rspec/core/rake_task'
|
7
|
+
|
8
|
+
desc "Run specs"
|
9
|
+
RSpec::Core::RakeTask.new do |t|
|
10
|
+
t.pattern = "./spec/**/*_spec.rb" # don't need this, it's default.
|
11
|
+
# Put spec opts in a file named .rspec in root
|
12
|
+
end
|
@@ -122,11 +122,10 @@ describe SynchronisedMigration::Main do
|
|
122
122
|
end
|
123
123
|
|
124
124
|
context 'when the task crashed' do
|
125
|
-
before do
|
126
|
-
allow_any_instance_of(Process::Status).to receive(:success?).and_return(false)
|
127
|
-
end
|
128
|
-
|
129
125
|
it 'marks the failure in Redis' do
|
126
|
+
fork { exit 1 }
|
127
|
+
Process.wait
|
128
|
+
|
130
129
|
expect(result).not_to be_success
|
131
130
|
expect(redis).to have_received(:set).with('migration-failed-bork', 123456789, ex: 3600)
|
132
131
|
expect(redis).not_to have_received(:del)
|
@@ -138,6 +137,9 @@ describe SynchronisedMigration::Main do
|
|
138
137
|
|
139
138
|
context 'in the happy path' do
|
140
139
|
it 'executes the migration successfully' do
|
140
|
+
fork { exit 0 }
|
141
|
+
Process.wait
|
142
|
+
|
141
143
|
expect(result).to be_success
|
142
144
|
expect(redlock).to have_received(:lock!)
|
143
145
|
expect(redis).to have_received(:get).with('migration-failed')
|
@@ -149,11 +151,10 @@ describe SynchronisedMigration::Main do
|
|
149
151
|
end
|
150
152
|
|
151
153
|
context 'when the task crashed' do
|
152
|
-
before do
|
153
|
-
allow_any_instance_of(Process::Status).to receive(:success?).and_return(false)
|
154
|
-
end
|
155
|
-
|
156
154
|
it 'marks the failure in Redis' do
|
155
|
+
fork { exit 1 }
|
156
|
+
Process.wait
|
157
|
+
|
157
158
|
expect(result).not_to be_success
|
158
159
|
expect(redis).to have_received(:set).with('migration-failed', 123456789, ex: 3600)
|
159
160
|
expect(redis).not_to have_received(:del)
|
@@ -15,6 +15,7 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
16
16
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
17
17
|
spec.require_paths = ['lib']
|
18
|
+
spec.required_ruby_version = '>= 2.6.0'
|
18
19
|
|
19
20
|
spec.add_dependency 'redlock', '>= 0.2'
|
20
21
|
spec.add_dependency 'redis'
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: synchronised_migration
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alvin Yim
|
8
8
|
- Stefan Cooper
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-01-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: redlock
|
@@ -101,9 +101,11 @@ executables: []
|
|
101
101
|
extensions: []
|
102
102
|
extra_rdoc_files: []
|
103
103
|
files:
|
104
|
+
- ".github/dependabot.yml"
|
105
|
+
- ".github/workflows/release.yml"
|
106
|
+
- ".github/workflows/ruby.yml"
|
104
107
|
- ".gitignore"
|
105
108
|
- ".ruby-version"
|
106
|
-
- ".travis.yml"
|
107
109
|
- CHANGELOG.md
|
108
110
|
- Gemfile
|
109
111
|
- LICENSE
|
@@ -121,7 +123,7 @@ files:
|
|
121
123
|
homepage: https://github.com/sealink/synchronised-migration-rb
|
122
124
|
licenses: []
|
123
125
|
metadata: {}
|
124
|
-
post_install_message:
|
126
|
+
post_install_message:
|
125
127
|
rdoc_options: []
|
126
128
|
require_paths:
|
127
129
|
- lib
|
@@ -129,15 +131,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
129
131
|
requirements:
|
130
132
|
- - ">="
|
131
133
|
- !ruby/object:Gem::Version
|
132
|
-
version:
|
134
|
+
version: 2.6.0
|
133
135
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
136
|
requirements:
|
135
137
|
- - ">="
|
136
138
|
- !ruby/object:Gem::Version
|
137
139
|
version: '0'
|
138
140
|
requirements: []
|
139
|
-
rubygems_version: 3.
|
140
|
-
signing_key:
|
141
|
+
rubygems_version: 3.2.3
|
142
|
+
signing_key:
|
141
143
|
specification_version: 4
|
142
144
|
summary: For deploying to multiple instances simultaneously
|
143
145
|
test_files:
|