Is it safe to run multiple instances of hydra v1 w...
# talk-hydra
m
Is it safe to run multiple instances of hydra v1 while a new pod performs database migration?
s
depends on what you mean by safe
they probably return errors as long as the migration is not applied
migrations are guaranteed to run in one transaction and only once
m
okay, my question was rather about runing “old” pods (instances — I am running on kubernetes) while the migration script runs for the new version
I have inherited a kubernetes deployment that has a deployment specification defining “replace” as deployment strategy, which means all instances are killed and new instances are deployed instead (with migration running in an init container) This doesn allow HA deployments without downtime. My question was if it is safe to run “mixed” set of hydra versions in a cluster — having first instance of updated version to run migration scripts while old instances server workload requests?
l
I've had success with multiple v1 instances running an older version while the updated pod runs migrations
But I would recommend testing in a cluster as ymmv
m
okay
Btw. It seems v1 migrations are broken in the latest v1 release, as it seems to be re-running already applied migrations.
s
yes please test beforehand, and read the changelog
what is broken? do you have logs or an issue?
m
basically it is complaining that columns it is trying to add already exist.
Okay, so I re-enabled the
ory/hydra:v1
image migrations in the environment we’ve been having trouble with and this is the error we get from
hydra migrate
command:
Copy code
An error occurred while connecting to SQL: Could not migrate sql schema, applied 0 migrations: pq: column "created_at" of relation "hydra_jwk" already exists handling 2
(there’s a long table before that message, but that is the message that the init container errors out with.)
@steep-lamp-91158 - do you have any feedback on this? What is your proposed solution to this issue?
s
safest would be to boot up a new env (can be docker compose) with the currently running version and the same database version, and then compare the schemas if you find differences then you should probably change the schema to be the same