arrival 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.codeclimate.yml +8 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +31 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/.gitignore +13 -0
- data/.rspec +2 -0
- data/.rubocop.yml +59 -0
- data/.travis.yml +20 -0
- data/CHANGELOG.md +184 -0
- data/CODE_OF_CONDUCT.md +50 -0
- data/Dockerfile +39 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +22 -0
- data/README.md +209 -0
- data/RELEASING.md +17 -0
- data/Rakefile +17 -0
- data/arrival.gemspec +29 -0
- data/bin/console +14 -0
- data/bin/rspec +16 -0
- data/bin/setup +7 -0
- data/config.yml.erb +4 -0
- data/configuration.rb +16 -0
- data/docker-compose-inspiration.yml +44 -0
- data/docker-compose.yml +40 -0
- data/lib/active_record/connection_adapters/for_alter.rb +91 -0
- data/lib/active_record/connection_adapters/percona_adapter.rb +158 -0
- data/lib/arrival.rb +68 -0
- data/lib/arrival/alter_argument.rb +43 -0
- data/lib/arrival/cli_generator.rb +85 -0
- data/lib/arrival/command.rb +96 -0
- data/lib/arrival/configuration.rb +19 -0
- data/lib/arrival/connection_details.rb +96 -0
- data/lib/arrival/dsn.rb +24 -0
- data/lib/arrival/errors.rb +39 -0
- data/lib/arrival/log_sanitizers/password_sanitizer.rb +22 -0
- data/lib/arrival/logger.rb +42 -0
- data/lib/arrival/logger_factory.rb +16 -0
- data/lib/arrival/null_logger.rb +15 -0
- data/lib/arrival/option.rb +75 -0
- data/lib/arrival/railtie.rb +28 -0
- data/lib/arrival/runner.rb +62 -0
- data/lib/arrival/user_options.rb +44 -0
- data/lib/arrival/version.rb +3 -0
- data/lib/lhm.rb +23 -0
- data/lib/lhm/adapter.rb +107 -0
- data/lib/lhm/column_with_sql.rb +96 -0
- data/lib/lhm/column_with_type.rb +29 -0
- data/main/conf/mysql.conf.cnf +9 -0
- data/main/mysql_main.env +7 -0
- data/replica/conf/mysql.conf.cnf +10 -0
- data/replica/mysql_replica.env +7 -0
- data/test_database.rb +80 -0
- metadata +220 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c332dc7b7c51a5b6618708a6eb86048150299eb763768f14f0e16c1c3ddd4edb
|
4
|
+
data.tar.gz: cd107ee392065839636c80f6c03884d5e137d1d974f7af98a3354f1d939c946f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 810977503202add1a717f2ef5a63eebaeac5fadda9cbe46a7f1bc0817e42f28957b425dd4bf4ca5e182ec6e92c009ace7b188780efc85bf28c7cc6e1fd1c3e23
|
7
|
+
data.tar.gz: 64cc923ed13acfad1f6259be3b268e15f69501a4beed5d59c737c978b1f29da6a6a0d8f32fd213a6611db10451670cf4ff6aeab68f36d8b7aededc4918a0a50b
|
data/.codeclimate.yml
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
---
|
2
|
+
name: Bug report
|
3
|
+
about: Create a report to help us improve
|
4
|
+
title: "[BUG] "
|
5
|
+
labels: ''
|
6
|
+
assignees: ''
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
**Describe the bug**
|
11
|
+
<!-- A clear and concise description of what the bug is. -->
|
12
|
+
|
13
|
+
**To Reproduce**
|
14
|
+
Steps to reproduce the behavior:
|
15
|
+
1. Configure like '...'
|
16
|
+
2. Run '...'
|
17
|
+
3. See error
|
18
|
+
|
19
|
+
**Expected behavior**
|
20
|
+
A clear and concise description of what you expected to happen.
|
21
|
+
|
22
|
+
**Back traces, screenshots, errors **
|
23
|
+
If applicable, add anything that helps explaining your problem.
|
24
|
+
|
25
|
+
**Setup**
|
26
|
+
- OS: name, version
|
27
|
+
- gh-ost version:
|
28
|
+
- arrival version:
|
29
|
+
|
30
|
+
**Additional context**
|
31
|
+
Add any other context about the problem here.
|
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
name: Feature request
|
3
|
+
about: Suggest an idea for this project
|
4
|
+
title: "[IMPROVEMENT]"
|
5
|
+
labels: ''
|
6
|
+
assignees: ''
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
**Is your feature request related to a problem? Please describe.**
|
11
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
12
|
+
|
13
|
+
**Describe the solution you'd like**
|
14
|
+
A clear and concise description of what you want to happen.
|
15
|
+
|
16
|
+
**Describe alternatives you've considered**
|
17
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
18
|
+
|
19
|
+
**Additional context**
|
20
|
+
Add any other context or screenshots about the feature request here.
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
---
|
2
|
+
Metrics/AbcSize:
|
3
|
+
Enabled: false
|
4
|
+
|
5
|
+
Metrics/BlockLength:
|
6
|
+
Max: 20
|
7
|
+
Exclude:
|
8
|
+
- 'spec/*'
|
9
|
+
- 'spec/**/*'
|
10
|
+
|
11
|
+
Metrics/BlockNesting:
|
12
|
+
Max: 4
|
13
|
+
|
14
|
+
Metrics/ClassLength:
|
15
|
+
Max: 250
|
16
|
+
|
17
|
+
Metrics/LineLength:
|
18
|
+
Max: 120
|
19
|
+
Exclude:
|
20
|
+
- 'arrival.gemspec'
|
21
|
+
- 'test_database.rb'
|
22
|
+
|
23
|
+
Metrics/MethodLength:
|
24
|
+
Max: 30
|
25
|
+
|
26
|
+
Metrics/ModuleLength:
|
27
|
+
Max: 250
|
28
|
+
|
29
|
+
Metrics/ParameterLists:
|
30
|
+
Max: 5
|
31
|
+
|
32
|
+
Performance/Casecmp:
|
33
|
+
Enabled: false
|
34
|
+
|
35
|
+
Style/BracesAroundHashParameters:
|
36
|
+
Exclude:
|
37
|
+
- 'spec/fixtures/migrate/**.rb'
|
38
|
+
- 'spec/integration/**.rb'
|
39
|
+
|
40
|
+
Style/CommandLiteral:
|
41
|
+
Exclude:
|
42
|
+
- 'test_database.rb'
|
43
|
+
|
44
|
+
Style/Documentation:
|
45
|
+
Enabled: false
|
46
|
+
|
47
|
+
Style/MultilineBlockChain:
|
48
|
+
Exclude:
|
49
|
+
- 'spec/integration_spec.rb'
|
50
|
+
|
51
|
+
Layout/MultilineMethodCallIndentation:
|
52
|
+
Enabled: false
|
53
|
+
|
54
|
+
Style/SymbolArray:
|
55
|
+
Enabled: false
|
56
|
+
|
57
|
+
Style/UnneededPercentQ:
|
58
|
+
Exclude:
|
59
|
+
- 'arrival.gemspec'
|
data/.travis.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
language: ruby
|
2
|
+
services:
|
3
|
+
- mysql
|
4
|
+
rvm:
|
5
|
+
- 2.2
|
6
|
+
- 2.3
|
7
|
+
- 2.4
|
8
|
+
- 2.5
|
9
|
+
- 2.6
|
10
|
+
before_install:
|
11
|
+
- sudo apt-key adv --keyserver keys.gnupg.net --recv-keys 8507EFA5
|
12
|
+
- echo "deb http://repo.percona.com/apt `lsb_release -cs` main" | sudo tee -a /etc/apt/sources.list
|
13
|
+
- sudo apt-get update -qq
|
14
|
+
- sudo apt-get install percona-toolkit
|
15
|
+
- gem update bundler
|
16
|
+
|
17
|
+
install: bin/setup
|
18
|
+
|
19
|
+
after_success:
|
20
|
+
- codeclimate-test-reporter
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,184 @@
|
|
1
|
+
# Change Log
|
2
|
+
All notable changes to this project will be documented in this file.
|
3
|
+
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
|
+
|
5
|
+
Please follow the format in [Keep a Changelog](http://keepachangelog.com/)
|
6
|
+
|
7
|
+
## [Unreleased]
|
8
|
+
|
9
|
+
### Added
|
10
|
+
|
11
|
+
- Support for ActiveRecord 5.2
|
12
|
+
- Support to batch multiple changes at once with #change_table
|
13
|
+
- Support for connection to MySQL server over SSL
|
14
|
+
|
15
|
+
### Changed
|
16
|
+
|
17
|
+
- Depend only in railties and activerecord instead of rails gem
|
18
|
+
|
19
|
+
### Deprecated
|
20
|
+
### Removed
|
21
|
+
### Fixed
|
22
|
+
|
23
|
+
- Fix support for removing foreign keys
|
24
|
+
|
25
|
+
## [6.1.0] - 2018-02-27
|
26
|
+
|
27
|
+
### Added
|
28
|
+
### Changed
|
29
|
+
|
30
|
+
- Permit PERCONA_ARGS to be applied to db:migrate tasks
|
31
|
+
|
32
|
+
### Deprecated
|
33
|
+
### Removed
|
34
|
+
### Fixed
|
35
|
+
|
36
|
+
- Output lines are no longer wrapped at 8 chars
|
37
|
+
|
38
|
+
## [6.0.0] - 2017-09-25
|
39
|
+
|
40
|
+
### Added
|
41
|
+
|
42
|
+
- Support for ActiveRecord 5.1
|
43
|
+
|
44
|
+
### Changed
|
45
|
+
### Deprecated
|
46
|
+
### Removed
|
47
|
+
### Fixed
|
48
|
+
|
49
|
+
## [5.0.0] - 2017-09-19
|
50
|
+
|
51
|
+
### Added
|
52
|
+
|
53
|
+
- Support for ActiveRecord 5.0
|
54
|
+
- Docker setup to run the spec suite
|
55
|
+
|
56
|
+
### Changed
|
57
|
+
### Deprecated
|
58
|
+
### Removed
|
59
|
+
### Fixed
|
60
|
+
|
61
|
+
- Allow using bash special characters in passwords
|
62
|
+
|
63
|
+
## [4.0.1] - 2017-08-01
|
64
|
+
|
65
|
+
### Added
|
66
|
+
|
67
|
+
- Support for all pt-osc command-line options, including short forms and array
|
68
|
+
arguments
|
69
|
+
|
70
|
+
### Changed
|
71
|
+
### Deprecated
|
72
|
+
### Removed
|
73
|
+
### Fixed
|
74
|
+
|
75
|
+
## [4.0.0] - 2017-06-12
|
76
|
+
|
77
|
+
### Added
|
78
|
+
### Changed
|
79
|
+
|
80
|
+
- Rename the gem from percona_migrator to arrival.
|
81
|
+
|
82
|
+
### Deprecated
|
83
|
+
### Removed
|
84
|
+
|
85
|
+
- Percona_migrator's deprecation warnings when installing and running the gem.
|
86
|
+
|
87
|
+
### Fixed
|
88
|
+
|
89
|
+
## [3.0.0] - 2016-04-07
|
90
|
+
|
91
|
+
### Added
|
92
|
+
|
93
|
+
- Support for ActiveRecord 4.2.x
|
94
|
+
- Support for Mysql2 4.x
|
95
|
+
- Allow passing any `pt-online-schema-change`'s arguments through the
|
96
|
+
`PERCONA_ARGS` env var when executing a migration with `rake db:migrate:up`
|
97
|
+
or `db:migrate:down`.
|
98
|
+
- Allow setting global percona arguments via gem configuration
|
99
|
+
- Filter MySQL's password from logs
|
100
|
+
|
101
|
+
### Changed
|
102
|
+
|
103
|
+
- Enable default pt-online-schema-change replicas discovering mechanism.
|
104
|
+
So far, this was purposely set to `none`. To keep this same behaviour
|
105
|
+
provide the `PERCONA_ARGS=--recursion-method=none` env var when running the
|
106
|
+
migration.
|
107
|
+
|
108
|
+
## [1.0.0] - 2016-11-30
|
109
|
+
|
110
|
+
### Added
|
111
|
+
|
112
|
+
- Show pt-online-schema-change's stdout while the migration is running instead
|
113
|
+
of at then and all at once.
|
114
|
+
- Store pt-online-schema-change's stderr to percona_migrator_error.log in the
|
115
|
+
default Rails tmp folder.
|
116
|
+
- Allow configuring the tmp directory where the error log gets written into,
|
117
|
+
with the `tmp_path` configuration setting.
|
118
|
+
- Support for ActiveRecord 4.0. Adds the following migration methods:
|
119
|
+
- #rename_index, #change_column_null, #add_reference, #remove_reference,
|
120
|
+
#set_field_encoding, #add_timestamps, #remove_timestamps, #rename_table,
|
121
|
+
#rename_column
|
122
|
+
|
123
|
+
## [0.1.0.rc.7] - 2016-09-15
|
124
|
+
|
125
|
+
### Added
|
126
|
+
|
127
|
+
- Toggle pt-online-schema-change's output as well when toggling the migration's
|
128
|
+
verbose option.
|
129
|
+
|
130
|
+
### Changed
|
131
|
+
|
132
|
+
- Enabled pt-online-schema-change's output while running the migration, that got
|
133
|
+
broken in v0.1.0.rc.2
|
134
|
+
|
135
|
+
## [0.1.0.rc.6] - 2016-04-07
|
136
|
+
|
137
|
+
### Added
|
138
|
+
|
139
|
+
- Support non-ddl migrations by implementing the methods for the ActiveRecord
|
140
|
+
quering to work.
|
141
|
+
|
142
|
+
### Changed
|
143
|
+
|
144
|
+
- Refactor the PerconaAdapter to use the Runner as connection client, as all the
|
145
|
+
other adapters.
|
146
|
+
|
147
|
+
## [0.1.0.rc.5] - 2016-03-29
|
148
|
+
|
149
|
+
### Changed
|
150
|
+
|
151
|
+
- Raise a ActiveRecord::StatementInvalid on failed migration. It also provides
|
152
|
+
more detailed error message when possible such as pt-onlin-schema-change
|
153
|
+
being missing.
|
154
|
+
|
155
|
+
## [0.1.0.rc.4] - 2016-03-15
|
156
|
+
|
157
|
+
### Added
|
158
|
+
|
159
|
+
- Support #drop_table
|
160
|
+
- Support for foreing keys in db/schema.rb when using [Foreigner
|
161
|
+
gem](https://github.com/matthuhiggins/foreigner) in Rails 3 apps. This allows to
|
162
|
+
define foreign keys with #execute, but does not provide support for
|
163
|
+
add_foreign_key yet.
|
164
|
+
|
165
|
+
## [0.1.0.rc.3] - 2016-03-10
|
166
|
+
|
167
|
+
### Added
|
168
|
+
|
169
|
+
- Support #execute. Allows to execute raw SQL from the migration
|
170
|
+
|
171
|
+
## [0.1.0.rc.2] - 2016-03-09
|
172
|
+
|
173
|
+
### Added
|
174
|
+
|
175
|
+
- VERBOSE env var in tests. Specially useful for integration tests.
|
176
|
+
- Fix #create_table migration method. Now it does create the table.
|
177
|
+
|
178
|
+
### Changed
|
179
|
+
|
180
|
+
- Use ActiveRecord's logger instead of specifying one in the connection data.
|
181
|
+
|
182
|
+
## [0.1.0.rc.1] - 2016-03-01
|
183
|
+
|
184
|
+
- Initial gem version
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at accounts@redbooth.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
|
45
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
46
|
+
version 1.3.0, available at
|
47
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
48
|
+
|
49
|
+
[homepage]: http://contributor-covenant.org
|
50
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Dockerfile
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
FROM ruby:2.6
|
2
|
+
ENV GHOST_VERSION=1.0.48
|
3
|
+
|
4
|
+
# Install apt based dependencies required to run Rails as
|
5
|
+
# well as RubyGems. As the Ruby image itself is based on a
|
6
|
+
# Debian image, we use apt-get to install those.
|
7
|
+
RUN apt-get update && \
|
8
|
+
apt-get install -y \
|
9
|
+
build-essential \
|
10
|
+
percona-toolkit && \
|
11
|
+
apt-get clean && \
|
12
|
+
apt-get remove
|
13
|
+
|
14
|
+
# Download gh-ost and install the binary
|
15
|
+
WORKDIR /usr/bin
|
16
|
+
RUN wget https://github.com/github/gh-ost/releases/download/v$GHOST_VERSION/gh-ost-binary-linux-20190214020851.tar.gz && \
|
17
|
+
tar -xvf gh-ost-binary-linux-20190214020851.tar.gz
|
18
|
+
|
19
|
+
RUN mkdir -p /app /app/lib/arrival
|
20
|
+
WORKDIR /app
|
21
|
+
|
22
|
+
# Copy the Gemfile as well as the Gemfile.lock and install
|
23
|
+
# the RubyGems. This is a separate step so the dependencies
|
24
|
+
# will be cached unless changes to one of those two files
|
25
|
+
# are made.
|
26
|
+
COPY arrival.gemspec Gemfile ./
|
27
|
+
COPY lib/arrival/version.rb ./lib/arrival/
|
28
|
+
|
29
|
+
RUN gem update --system && \
|
30
|
+
gem install bundler -v 1.17.3 && \
|
31
|
+
bundle install --jobs $(nproc) --retry 5
|
32
|
+
|
33
|
+
# Copy the main application.
|
34
|
+
COPY . ./
|
35
|
+
|
36
|
+
# The main command to run when the container starts. Also
|
37
|
+
# tell the Rails dev server to bind to all interfaces by
|
38
|
+
# default.
|
39
|
+
#CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]
|