-
Notifications
You must be signed in to change notification settings - Fork 173
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
Research a way around non empty new volumes and containers expecting empty volumes #3857
Comments
We had a similar problem with postgres containers in compose. Here are the comments I put in the compose file we have in our repo's demo folder:
|
Proposed text for the release notes. @chengwang86 or @sflxn, could you please provide the correct MYSQL env variable to replace the one that I made up in the example? Thanks!
|
@chengwang86 told me in a Slack chat that he couldn't get a workaround to work for MySQL. @sflxn, do you know of one? |
Added the following in https://github.com/vmware/vic/releases/tag/v0.8.0:
@chengwang86 and @sflxn is this OK? |
@stuclem I think this is OK. We can also suggest the customer to use MariaDB, which works fine for docker compose on vic. But this may not seem like a workaround though. |
Thanks @chengwang86. I updated the workaround as follows: Workaround: Currently none, but it is possible to use the Removing the kind/notes flag as this is now in the release notes. |
I don't know of a work around for mysql. I'd have to look at the mysql init script in the container to determine if we can workaround it. I'm not sure simply suggesting people use mariadb is the solution. For new application, that may be fine. Those who have production apps that uses mysql and want to convert over to VIC may not have the choice to simply switch over to mariadb. It's my opinion that this is a big enough issue for us to try and find a solution instead of asking users to do a workaround. We should investigate one. I converted this issue to a research spike. We now have two very popular DB, mysql and postgres, that have a problem with the way we mount volumes. |
Thanks @sflxn. Reworded the workaround as follows: Workaround: Currently none. VMware is working to find a solution. In the meantime, it is possible to use the |
@sflxn @stuclem @anchal-agrawal First, we find that the problem does not exist if the customer uses mysql:5.6 instead of 5.7. See an example here https://blogs.vmware.com/vsphere/2017/02/deploying-wordpress-vsphere-integrated-containers.html. Second, Anchal found this https://dev.mysql.com/doc/refman/5.7/en/server-options.html#option_mysqld_ignore-db-dir
I have tested mysql:5.7 and mysql:lastest on vic for docker-compose using the following compose file and it worked
If you already have a default volume when creating the VCH, this will mount /var/lib/mysql to your default volume which has a folder for lost+found. With --ignore-db-dir=lost+found, mysql:5.7 ignores this folder. Alternatively, we can also create an external volume on vic outside of docker-compose, e.g.,
Then mount /var/lib/mysql to "aaa", and it still works if using "--ignore-db-dir"
|
See #3909 (comment). |
@chengwang86 , so, as a workaround, I should document that you can use v5.6 or use the |
@stuclem Quick note, the option is |
Updated the workarounds as follows: Workarounds: Use the version: '2' services: db: image: mysql:5.7 environment: MYSQL_ROOT_PASSWORD: root command: ["mysqld", "----ignore-db-dir=lost+found"] volumes: - /var/lib/mysql |
This looks good. You just need to change ---- to -- in the yml file.
…On Tuesday, February 21, 2017, Stuart Clements ***@***.***> wrote:
Updated the workarounds as follows:
*Workarounds*: Use the mysql:5.6 image, which is not subject to this
issue. Alternatively, if you are using mysql:5.7, specify
--ignore-db-dir=lost+found in the YML file:
version: '2'
services:
db:
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: root
command: ["mysqld", "----ignore-db-dir=lost+found"]
volumes:
- /var/lib/mysql
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3857 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AVRU4zeyYjg18y2MFPJjQMiBgHR3EgLmks5rewlLgaJpZM4L4vzr>
.
|
After discussing with @anchal-agrawal and @matthewavery , it seems like we would have empty volumes if the customer is willing to deploy NFS. See this PR #3926. This could also be a more general workaround. |
Trying to gauge what the output of this issue should be. @sflxn, we now have fairly good solutions for Are there other solutions? I'm not sure if there's a way to obtain empty volumes with the current volume support. @fdawg4l? |
@anchal-agrawal, for my own clarity, I'm going to try to summarize the issue. You want to attach a volume at The answer is (as was mentioned in the original issue) this is non-trivial. There is a lifecycle problem for volumes used in this way. Here are a few examples. Example 1 - new ImageI have an image with a directory Example 2 - upgrade imageSay we do the same as above; we have a db directory and we copy it into a volume. Now we do the same as above and destroy the container. If we create a new container with the same image name but different version whose contents of Example 3 - restartSame again, same image, container, contents in The naive solution is the first time you attach a volume, you copy the contents of the target directory into it, update some metadata (ON THE VOLUME ITSELF, NOT IN VIC) so you know you copied the data (maybe a |
OH! My mistake @anchal-agrawal! I think there's a simple fix for that. Let me get back to you. |
The most obvious solution is deleting the file after we create the volume on the vch. But that seems like an unnecessary step. It would involve I'm still looking for knobs to deal with it transparently, but what I described above will definitely work. |
@chengwang86 @anchal-agrawal good job finding the workaround. Glad to see mysql anticipated this. Put this issue in verify and I'll put it in closed. |
As a VIC user, I should be able to add a volume and still run popular container images, such as mysql and postgres.
VIC version:
0.8
Deployment details:
What was the vic-machine create command used to deploy the VCH?
bin/vic-machine-linux create --target=10.160.130.42 --user=usr --volume-store=datastore1/test:default --image-store=datastore1 --appliance-iso=bin/appliance.iso --bootstrap-iso=bin/bootstrap.iso --password=pwd --force=true --bridge-network=bridge --compute-resource=/ha-datacenter/host/10.160.106.191/Resources --public-network=vm-network --name=vch-3 --no-tlsverify --no-tls --debug 1
Steps to reproduce:
Run "docker-compose up" with the following yml:
Actual behavior:
In the mysql log, I find
Expected behavior:
The mysql db should be started successfully.
Additional comment:
Even if I remove "volumes: - /var/lib/mysql", I still observe the same behavior.
The text was updated successfully, but these errors were encountered: