-
Notifications
You must be signed in to change notification settings - Fork 671
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
MF-655 Proper usage of docker volumes #657
Conversation
I'm still working on this. I've opened the pull request to get feedback. The current state is:
the |
Codecov Report
@@ Coverage Diff @@
## master #657 +/- ##
=======================================
Coverage 85.58% 85.58%
=======================================
Files 64 64
Lines 4011 4011
=======================================
Hits 3433 3433
Misses 395 395
Partials 183 183 Continue to review full report at Codecov.
|
The fixes which this PR brings are:
The summary of the changes:
|
@chombium Can you pls checkout conflicts and update branch. Thanks! |
@nmarcetic done ;) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just fix these two typos. Great job @chombium!
docs/dev-guide.md
Outdated
__Note:__ Please store your customizations to some folder outside the Mainflux's source folder and maybe add them to some other git repository. You can always apply your customizations by pointing to the right file using `docker-compose -f ...`. | ||
|
||
|
||
### Cleaning up your dockerized Mainlfux setup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mainflux
docs/dev-guide.md
Outdated
|
||
|
||
### Cleaning up your dockerized Mainlfux setup | ||
If you want to clean your whole dockerized Mainlfux installation you can use the `make cleandocker` command. Please note that __by default the `make cleandocker` command will stop and delete all of the containers, images and persistent volumes__. If you want to keep gathered data in the system (the persistent volumes) please use the following command `make spv=true cleandocker` (spv = skip persistent volumes). This form of the command will stop and delete the containers and images, but won't delete the persistent volumes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mainflux
docs/dev-guide.md
Outdated
@@ -65,7 +65,7 @@ make docker_http | |||
|
|||
> N.B. Mainflux creates `FROM scratch` docker containers which are compact and small in size. | |||
|
|||
> N.B. The `things-db` and `users-db` containers are built from a vanilla PostgreSQL docker image downloaded from docker hub which does not persist the data when these containers are rebuilt. Thus, __rebuilding of all docker containers with `make dockers` or rebuilding the `things-db` and `users-db` containers separately with `make docker_things-db` and `make docker_users-db` respectively, will cause data loss. All your users, things, channels and connections between them will be lost!__ As we use this setup only for development, we don't guarantee any permanent data persistence. If you need to retain the data between the container rebuilds you can attach volume to the `things-db` and `users-db` containers. Check the official docs on how to use volumes [here](https://docs.docker.com/storage/volumes/) and [here](https://docs.docker.com/compose/compose-file/#volumes). For examples on how to add persistent volumes check the [Overriding the default docker-compose configuration](#overriding-the-default-docker-compose-configuration) section. | |||
> N.B. The `things-db` and `users-db` containers are built from a vanilla PostgreSQL docker image downloaded from docker hub which does not persist the data when these containers are rebuilt. Thus, __rebuilding of all docker containers with `make dockers` or rebuilding the `things-db` and `users-db` containers separately with `make docker_things-db` and `make docker_users-db` respectively, will cause data loss. All your users, things, channels and connections between them will be lost!__ As we use this setup only for development, we don't guarantee any permanent data persistence. If you want to update your Mainflux dockerized installation and want to keep your data, use `make spv=true cleandocker` to clean the containers and images and keep the data and then `make run` to update the images and the containers. Check the [Cleaning up your dockerized Mainlfux setup](#cleaning-up-your-dockerized-mainlfux-setup) section for details. Please note that this kind of updating might not work if there are database changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mainflux
@anovakovic01 really good catch. LOLed to myself. The same type in two consecutive sentences :) |
docs/dev-guide.md
Outdated
@@ -65,7 +65,7 @@ make docker_http | |||
|
|||
> N.B. Mainflux creates `FROM scratch` docker containers which are compact and small in size. | |||
|
|||
> N.B. The `things-db` and `users-db` containers are built from a vanilla PostgreSQL docker image downloaded from docker hub which does not persist the data when these containers are rebuilt. Thus, __rebuilding of all docker containers with `make dockers` or rebuilding the `things-db` and `users-db` containers separately with `make docker_things-db` and `make docker_users-db` respectively, will cause data loss. All your users, things, channels and connections between them will be lost!__ As we use this setup only for development, we don't guarantee any permanent data persistence. If you need to retain the data between the container rebuilds you can attach volume to the `things-db` and `users-db` containers. Check the official docs on how to use volumes [here](https://docs.docker.com/storage/volumes/) and [here](https://docs.docker.com/compose/compose-file/#volumes). For examples on how to add persistent volumes check the [Overriding the default docker-compose configuration](#overriding-the-default-docker-compose-configuration) section. | |||
> N.B. The `things-db` and `users-db` containers are built from a vanilla PostgreSQL docker image downloaded from docker hub which does not persist the data when these containers are rebuilt. Thus, __rebuilding of all docker containers with `make dockers` or rebuilding the `things-db` and `users-db` containers separately with `make docker_things-db` and `make docker_users-db` respectively, will cause data loss. All your users, things, channels and connections between them will be lost!__ As we use this setup only for development, we don't guarantee any permanent data persistence. If you want to update your Mainflux dockerized installation and want to keep your data, use `make spv=true cleandocker` to clean the containers and images and keep the data and then `make run` to update the images and the containers. Check the [Cleaning up your dockerized Mainflux setup](#cleaning-up-your-dockerized-mainlfux-setup) section for details. Please note that this kind of updating might not work if there are database changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just update the link #cleaning-up-your-dockerized-mainflux-setup
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks once again. I've missed that one :( it is fixed now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chombium Don't worry, it happens. At least you were consistent. 😄 LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chombium please rebase
Signed-off-by: Jovan Kostovski <[email protected]>
Signed-off-by: Jovan Kostovski <[email protected]>
@anovakovic01 done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
|
||
|
||
### Cleaning up your dockerized Mainflux setup | ||
If you want to clean your whole dockerized Mainflux installation you can use the `make cleandocker` command. Please note that __by default the `make cleandocker` command will stop and delete all of the containers, images and persistent volumes__. If you want to keep gathered data in the system (the persistent volumes) please use the following command `make spv=true cleandocker` (spv = skip persistent volumes). This form of the command will stop and delete the containers and images, but won't delete the persistent volumes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is better to skip persistent volume by default, but add explicitly extra parameter if you want to delete it also - like pv=true
.
I think this can help avoinding errors and making idiot-proof solution. I see more a situations where I cleaned dockers, but I fortgot vlumes - so I run the command again with correct param, no big deal. However, the other way around, if I cleaned everything because I forgot a param - it is too late :).
I let you decide on this, but I would personaly do it like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@drasko I completely agree with you from data persistence view point. My idea was to to leave the current make cleandocker
behavior as it is and offer an option to skip the deletetion of the persistent volumes.
On the second thought, taking in account all the complaints about data loss, I would by default skip the volume deletion.
I hope the possible running of the same command twice by the @mainflux/contributors won't be a problem.
I will prepare a new pr
* added filter and a switch for volume deletion Signed-off-by: Jovan Kostovski <[email protected]> * added persistent volume configuration Signed-off-by: Jovan Kostovski <[email protected]>
* added filter and a switch for volume deletion Signed-off-by: Jovan Kostovski <[email protected]> * added persistent volume configuration Signed-off-by: Jovan Kostovski <[email protected]>
* added filter and a switch for volume deletion Signed-off-by: Jovan Kostovski <[email protected]> * added persistent volume configuration Signed-off-by: Jovan Kostovski <[email protected]>
What does this do?
cleanghost
to filter out only the containers which we have createdWhich issue(s) does this PR fix/relate to?
Resolves #655
List any changes that modify/break current functionality
none
Have you included tests for your changes?
no
Did you document any new/modified functionality?
added description about the changes in the dev guide
Notes
See the issue for more details