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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refacto docker #2178

Merged
merged 1 commit into from
Apr 11, 2022
Merged

Refacto docker #2178

merged 1 commit into from
Apr 11, 2022

Conversation

irevoire
Copy link
Member

@irevoire irevoire commented Feb 17, 2022

closes #2166 and #2085


I noticed many people had issues with the default configuration of our Dockerfile.
Some examples:

  • Clean persistent volume on Kubernetes cases an error聽#2166: If you use ubuntu and mount your data.ms in a volume (as shown in the doc), you can't run meilisearch
  • Error while persisting update to disk: No such file or directory聽#2085: Here, meilisearch was not able to erase the data.ms when loading a dump because it's the mount point
    Currently, we don't show how to use the snapshot and dumps with docker in the documentation. And it's quite hard to do:
    • You either send a big command to meilisearch to change the dump-path, snapshot-path and db-path a single directory and then mount that one
    • Or you mount three volumes
  • And there were other issues on the slack community

I think this PR solve the problem.
Now the image contains the meilisearch binary in the /bin directory, so it's easy to find and always in the PATH.
It creates a data directory and moves the working-dir in it.
So now you can find the dumps, snapshots and data.ms directory in /data.

Here is the new command to run meilisearch with a volume:

docker run -it --rm -v $PWD/meili_data:/data -p 7700:7700 getmeili/meilisearch:latest

And if you need to import a dump or a snapshot, you don't need to restart your container and mount another volume. You can directly hit the POST /dumps route and then run:

docker run -it --rm -v $PWD/meili_data:/data -p 7700:7700 getmeili/meilisearch:latest meilisearch --import-dump dumps/20220217-152115159.dump

You can already try this PR with the following docker image:

getmeili/meilisearch:test-docker-v0.26.0

If you want to use the v0.25.2 I created another image;

getmeili/meilisearch:test-docker-v0.25.2

If you're using helm I created a branch here that use the v0.26.0 image with the good volume 馃憤
If you use this conf with the v0.25.2, it should also work.

@irevoire irevoire changed the base branch from main to release-v0.26.0 February 17, 2022 16:04
@irevoire irevoire changed the base branch from release-v0.26.0 to main February 17, 2022 16:24
@fr3fou
Copy link

fr3fou commented Feb 19, 2022

Can I use this Dockerfile with 0.25.2 safely? I'm not sure what changes are in the 0.26.0 release of MeiliSearch but I need to use this and so far it seems to have solved meilisearch/meilisearch-kubernetes#95 for (the Pod is running but I'm not sure of any internal changes that might have ocurred)

@irevoire
Copy link
Member Author

Yes but you'll need to rebuild the image yourself.
Something like

git checkout v0.25.2
git checkout refacto-docker -- Dockerfile
docker build . # name your image and everything 

@fr3fou
Copy link

fr3fou commented Feb 19, 2022

Yup, that's what I did exactly!

Dockerfile Outdated
COPY --from=compiler /meilisearch/target/release/meilisearch /bin/meilisearch

# We want user to mount this directory as a volume
RUN mkdir /data

Choose a reason for hiding this comment

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

So I'm not really sure what's going on here, we make a directory first but then also tag it as our working directory.
If we're marking this as our WD then we don't need to make the directory first, it's just an implicit step iirc.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh cool, I didn't know that!
Thanks 馃憤

@irevoire
Copy link
Member Author

Can I use this Dockerfile with 0.25.2 safely? I'm not sure what changes are in the 0.26.0 release of MeiliSearch but I need to use this and so far it seems to have solved meilisearch/meilisearch-kubernetes#95 for (the Pod is running but I'm not sure of any internal changes that might have ocurred)

Hey, I created a new image for you and everyone who wants to test this PR with the v0.25.2.
You can find it here;聽getmeili/meilisearch:test-docker-v0.25.2

- Move the meilisearch binary to `/bin/meilisearch` so it's always in scope.
- Create a `meili_data` directory used as the default working directory
@irevoire
Copy link
Member Author

bors merge

@bors
Copy link
Contributor

bors bot commented Apr 11, 2022

@bors bors bot merged commit f67167f into main Apr 11, 2022
@bors bors bot deleted the refacto-docker branch April 11, 2022 12:21
@curquiza curquiza added the v0.27.0 PRs/issues solved in v0.27.0 label Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v0.27.0 PRs/issues solved in v0.27.0
Projects
None yet
4 participants