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

Do not reset the dev env when booting docker #5088

Conversation

sauloperez
Copy link
Contributor

@sauloperez sauloperez commented Mar 27, 2020

What? Why?

The current web container's command destroys anything you might have in your local DB from a previous session, assuming you always want to start from a clean environment. This is hardly the case and makes docker-compose up take quite long. What if you just stopped containers temporally while developing? All the sample orders you created are gone 🙈

This changes the approach to not assume anything. If you need to install a new gem or reset your DB just run the commands you would without docker. You can run anything you want with docker-compose run web bundle exec <rails/rake command> anyway.

For someone setting things for the first time, the Dockerfile process still installs all dependencies.

What should we test?

Nothing. I know it works because I always comment out these lines.

Release notes

Do not reset the development environment when starting docker
Changelog Category: Changed

The current web container's command destroys anything you might have in
your local DB from a previous session, assuming you always want start
from a clean environment. This is hardly the case and makes
`docker-compose up` take quite long. What if you just stopped containers
temporally while developing?

This changes the approach to not assume anything. If you need to install
a new gem or reset your DB just run the commands you would without
docker. You can run anything you want with `docker-compose run web bundle exec
<rails/rake command>` anyway.

For someone setting things for the first time, the `Dockerfile` process
still installs all dependencies.
@sauloperez sauloperez self-assigned this Mar 27, 2020
Copy link
Contributor

@luisramos0 luisramos0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice.
needs to be tested for a first timer. I can do that when it gets to test ready.

@luisramos0 luisramos0 added dev-test A dev need to test this one and removed pr-no-test labels Mar 30, 2020
bash -c "(bundle check || bundle install) &&
wait-for-it -t 30 db:5432 &&
bundle exec rake db:reset &&
bundle exec rake db:test:prepare ofn:sample_data || true &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the test db and sample data won't be loaded when it's first used?

Copy link
Contributor

@Matt-Yorkley Matt-Yorkley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I don't have Docker set up, but I trust you so I'll slap the Approve button anyway.

Assuming Luis will test it.

@luisramos0
Copy link
Contributor

this is not working for a fresh setup, we need to re-add the initial setup instructions somewhere.
I added them to Dockerfile and Docker.md here: coopdevs#2
I think it's working now for a fresh install with some extra manual commands to be done.

…cker

Re-add setup instructions removed from docker-compose into Dockerfile…
@luisramos0 luisramos0 requested a review from Matt-Yorkley April 6, 2020 19:19
@luisramos0 luisramos0 merged commit 29bbf2f into openfoodfoundation:master Apr 7, 2020
@sauloperez sauloperez deleted the do-not-recreate-when-booting-docker branch April 8, 2020 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev-test A dev need to test this one
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants