-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat/migrations] split plugins migrations #443
Conversation
9074f84
to
0a6d09b
Compare
Because this is a breaking change to the underlying datastore, now is a good time to:
Of course users will need to migrate to this new setup, should we provide a script to do that? |
5498eee
to
2559988
Compare
Ping @thefosk @ahmadnassri previous comment is of major importance. |
If this is a breaking change we should also include all the other major changes that are in the pipeline. But I would merge this into master after |
|
another option is an export / import script, that can export data into JSON, then use the same JSON to re-import with HTTP admin API (rather than cql) |
Don't get that part |
current setup is labeled "migration" but it's more of an "upgrade" of schema changes on the same system / db where "migrate" usually indicates moving from one system to another, or one db cluster to another ... synonymous with "moving" data |
so a "migration script" treats old version vs. new version as separate systems and "moves" data between them using a full reconfiguration & setup (new IDs) so it would be agnostic to schema changes |
which would also be useful to have anyways regardless |
To make it easier we should definitely write a script to migrate old data into the new format. It can also be a bash/python/lua script that moves data from an old cassandra to the new cassandra with the new schema. |
2559988
to
5b7c5a6
Compare
Should I start writing a script for the migration? For now, the script can modify the content of the If we decide to change the plugins names, the script can also handle it. If so, what should I write it in? I could write it in Lua or Python (not sure if all instances have Lua installed @thefosk?). In Python users could just |
Python maybe it's more portable? Would the script also be able to change the plugin configuration values? For example the ratelimiting went from |
Here is a Python script to migrate to 0.5.0 with a cluster already migrated to 0.4.2: https://gist.github.com/thibaultCha/87bbfe2831e035274232
One of its limitations is that it does not support different ports for each node (like Kong does). All hosts must listen on the same port. Currently it only supports port 9042 since the We can add more steps if we decide to rename the plugins and to change some other values (like the ratelimiting values). +1 to do both of these things ^ ? Feedback on the script? Should this script live in this repo or should it just be a gist? @thefosk @ahmadnassri |
could we not compile the script into a binary? (so its not language dependent) |
safe bet that we might have need in the future for similar, if not exact scenario (v2.0, v15.0, etc ..) so might as well be a repo ( |
but why would that matter? the script only needs to run on one specific node, and the changes apply across the board ... no? |
I'm really not following here?
I feel like this might be overkill for now though. Let it just be a script that can be easily changed (I wrote the functions with that in mind).
I wanted it to just be a drop-in. You could run it by just giving your Kong configuration. But the configuration might be specifying different ports for each node and the script would just not work. Basically one would have to edit the config file, or the script should take contact_points and a port as arguments |
This too ^ Should it do those things too? |
wrap the script in an executable binary, so users wont have to |
as for naming convention: makes it easy to search and list in github... matches our any conflict with luarocks in doing that? |
See #480 for plugins renaming. |
I believe the script should live in this repository. |
Proper architecture and CLI update for plugin-specific migrations. This is the first step in separating the plugins out of the core repo as planed for 0.5.0. It is related to #93. This is implemented by using the same table as before (`schema_migrations`) to keep track of the executed migrations, except that each plugin and the core itself all have their own row. For simplifications, migrations (plugins or core) now live in a single file. The `database` folder disappeared for core and the migration lives in the DAO. Plugins have migrations in a `migration` folder, named after the type of the database (`cassandra.lua` currently). For now, only the keyauth plugin has its own migrations. The `kong migrations up|down` commands slightly changed. It takes a `-t` parameter to specify which migrations to run (core or a plugin name) and is running all migrations by default. `kong migrations list` lists all executed migration for the core and all plugins. - Needs tests (integration) - Old unit tests were removed - `database` was removed - `kong migrations` slightly changed
5b7c5a6
to
f90d55e
Compare
f90d55e
to
d3ebaf7
Compare
Here are the instructions to run the script but I don't know where to store the actual script. In this repo under a new We could put it in a gist, under Mashape? In another repo like @ahmadnassri suggested is still kind of a pain for users. |
17c010f
to
85c5731
Compare
85c5731
to
ca81266
Compare
[feat/migrations] split plugins migrations
[feat/migrations] split plugins migrations Former-commit-id: c60894e8f384d6181e5aac99c62ec0fbfd632592
Proper architecture and CLI update for plugin-specific migrations. This
is the first step in separating the plugins out of the core repo as
planed for 0.5.0. It is related to #93.
0.4
and0.5
.Changes
This is implemented by using the same table as before
(
schema_migrations
) to keep track of the executed migrations, exceptthat each plugin and the core itself all have their own row.
For simplifications, migrations (plugins or core) now live in a single
file. The
database
folder disappeared for core and the migration livesin the DAO. Plugins have migrations in a
migration
folder, named afterthe type of the database (
cassandra.lua
currently).For now, only the keyauth plugin has its own migrations.
CLI
The
kong migrations up|down
commands slightly changed. It takes a-t
parameter to specify which migrations to run (core or a plugin name) and
is running all migrations by default.
kong migrations list
lists allexecuted migration for the core and all plugins.
Summary
database
was removedkong migrations
slightly changed