Skip to content
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

Migration commands need to be run before starting image, api and auth containers #29

Open
ToshKoevoets opened this issue Jun 21, 2020 · 5 comments
Assignees

Comments

@ToshKoevoets
Copy link
Collaborator

ToshKoevoets commented Jun 21, 2020

I've tried adding migrate command in deployment files, but I'm not sure I did it the right way, don't seem to get it working.

I've tried, on k8s/deployment/api.yaml

command: ['node migrate.js', 'npm start']

For dev environment I've solved it for now by adding command to npm start. Not sure what is better.

For api it is done by

node migrate.js

For image and auth it is managed with

knex migrate:latest
@diederikgithub diederikgithub self-assigned this Jun 22, 2020
@diederikgithub
Copy link
Collaborator

@ToshKoevoets : The migrations are already done during container initialization with the initContainers command. So I think there should be no need for this?

@ToshKoevoets
Copy link
Collaborator Author

ToshKoevoets commented Jun 22, 2020 via email

@diederikgithub
Copy link
Collaborator

Updating the image must trigger the initContainers, so I'm not sure what is wrong. Tried it myself with:
kubectl set image deployment/openstad-api openstad-api=openstad/api:latest --record
and the logs say:
+ openstad-api-7447dd6c77-rzk5m › init-db-ready
openstad-api-7447dd6c77-rzk5m init-db-ready No new migrations

The change course is recorded (kubectl get deployment openstad-api -o yaml):
kubernetes.io/change-cause: kubectl set image deployment/openstad-api openstad-api=openstad/api:latest --record=true
Could you check that with your deployment?

@ToshKoevoets
Copy link
Collaborator Author

Okay will have to debug then, deploy with travis only started working when I add node migrate.js to the npm start command.

@diederikgithub
Copy link
Collaborator

@ToshKoevoets Did you manage to debug it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants