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

Document how to bind-mount a mkt.yml #321

Merged
merged 3 commits into from
Jun 10, 2020
Merged

Conversation

goodboy
Copy link
Contributor

@goodboy goodboy commented May 18, 2020

Document how to bind-mount in a mkts.yml config for quick testing of
the image included plugins. Fix the python blocks so they highlight
correctly. Mention that you have to build the cmd package before using
the connect command.

@codecov-io
Copy link

Codecov Report

Merging #321 into master will decrease coverage by 0.03%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master     #321      +/-   ##
==========================================
- Coverage   46.02%   45.99%   -0.04%     
==========================================
  Files          87       87              
  Lines       11200    11200              
==========================================
- Hits         5155     5151       -4     
- Misses       5608     5612       +4     
  Partials      437      437              
Impacted Files Coverage Δ
frontend/stream/stream.go 67.82% <0.00%> (-3.48%) ⬇️

README.md Outdated
```sh
mkdir ms_etc/
mv /path/to/mkts.yml ./ms_etc/
docker run --mount type=bind,source="/full/path/to/ms_etc/",target="/etc" \
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe providing the normal volume mount would be shorter:
docker run -v /full/path/to/mkts.yml:/etc/mkts.yml

Also, mounting the whole /etc might have undesirable side-effects: host lookup won't work as /etc/resolv.conf will be non-existent.

Copy link
Contributor Author

@goodboy goodboy May 30, 2020

Choose a reason for hiding this comment

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

would be shorter

Indeed. I originally started with that myself but went to the docker docs since I hadn't actually run a container manually in some time. They now suggest this syntax due to explicitness. I'm not very opinionated one way or the other so whatever peeps prefer.

mounting the whole /etc might have undesirable side-effects: host lookup won't work as /etc/resolv.conf will be non-existent.

I'm not sure this is such a worry given that marketstore shouldn't need to query DNS under normal testing operation, but you're right, there's definitely blank hosts, hostname and resolv.conf being generated by the container in the specified host local dir. Maybe it makes sense to instead show how to copy in a custom mkts.yml into the image with something like docker cp ./mkts.yml <containername>/etc/mkts.yml? The main problem with that is I don't see a command to reload the server config?

I haven't had any problems in my usage with the bind but maybe documenting both or at least warning about the networking implications is better? Either way there seems to be no easy way for testing other then without building a new image with the custom mkts.yml moved in as in the Dockerfile. If planning to use the server in a situation where overriding /etc matters for networking purposes maybe a warning in the readme is sufficient?

For me personally having a set of docs going quickly to see how the project works is more important then worrying about more advanced usage details from the outset. When I first started trying to use the project it was pretty unclear go to get going anything practically useful (see #292 for example).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh, just realized the create then cp instructions are already in the readme so disregard the:

Maybe it makes sense to instead show how to copy in a custom mkts.yml into the image with something like docker cp ./mkts.yml /etc/mkts.yml? The main problem with that is I don't see a command to reload the server config?

Copy link
Contributor

Choose a reason for hiding this comment

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

marketstore uses network for backfiller processes. overwriting /etc for a single file is really not a good idea.

Copy link
Contributor

@dakimura dakimura Jun 1, 2020

Choose a reason for hiding this comment

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

+1 to @tibkiss .
We might want to change the default config file path from /etc/mkts.yml to /etc/mkts/mkts.yml to avoid the above issue?

Copy link
Contributor Author

@goodboy goodboy Jun 2, 2020

Choose a reason for hiding this comment

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

@dakimura really like that idea. The bind mounting sure is handy for testing (at the least) imo 😸

Would you prefer I remove this documentation for now then until that is discussed and possibly PR-ed separately?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh wait, just realizing now that @tibkiss suggestion is to bind the individual file..
I'll just do that with the shorter syntax and drop the etc/ warning.

@goodboy
Copy link
Contributor Author

goodboy commented May 30, 2020

@tibkiss added a further note to address your concerns as well as a further bind-mount tip to address #292.

Let me know if there's anything else needed 👍

@codecov-commenter
Copy link

codecov-commenter commented May 30, 2020

Codecov Report

Merging #321 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #321   +/-   ##
=======================================
  Coverage   46.03%   46.03%           
=======================================
  Files          87       87           
  Lines       11203    11203           
=======================================
  Hits         5157     5157           
  Misses       5609     5609           
  Partials      437      437           

README.md Outdated
a local location:
```sh
docker run -i -p 5993:5993 alpacamarkets/marketstore:latest \
--mount type=bind,source="/<path_to_data>/marketstore",target="/data"
Copy link
Contributor

Choose a reason for hiding this comment

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

I personally still prefer the shorter -v form, as we don't gain anything being explicit here.
I could also argue, that then you could also write --publish and --interactive as opposed to their short form.

I'll let others (@umitanuki / @dakimura / @leki75 ) to chime in here.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 for the short form

Copy link
Contributor

Choose a reason for hiding this comment

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

prefer the shorter -v form,

yes, I agree.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good.

@goodboy
Copy link
Contributor Author

goodboy commented Jun 2, 2020

@tibkiss @dakimura made all suggested changes. Let me know if there's anything else 👍

@goodboy
Copy link
Contributor Author

goodboy commented Jun 3, 2020

@dakimura I've noticed the integration tests aren't so healthy from also trying to use that code manually.

Maybe it's worth opening a new PR to fix those?

@dakimura
Copy link
Contributor

dakimura commented Jun 3, 2020

@dakimura I've noticed the integration tests aren't so healthy from also trying to use that code manually.

Maybe it's worth opening a new PR to fix those?

ah sorry it's not related to your change... I fixed the issue just now, please pull the latest master to run the test again!

@goodboy
Copy link
Contributor Author

goodboy commented Jun 4, 2020

ah sorry it's not related to your change.

Gosh, well I would hope not! 🤣

I fixed the issue just now, please pull the latest master to run the test again!

👍

goodboy added 2 commits June 3, 2020 20:58
Document how to bind-mount in a `mkts.yml` config for quick testing of
the image included plugins. Fix the python blocks so they highlight
correctly. Mention that you have to build the `cmd` package before using
the `connect` command.
Mention in the readme how to bind-mount the data dir using `docker` so
that persistent storage is possible using the container host.

Fixes alpacahq#292
@goodboy goodboy mentioned this pull request Jun 7, 2020
@goodboy
Copy link
Contributor Author

goodboy commented Jun 7, 2020

@leki75 & @tibkiss I made the changes requested so I think this is ready to land?

README.md Outdated
container's host storage. To accomplish this, bind the `data` directory to
a local location:
```sh
docker run -i -p 5993:5993 alpacamarkets/marketstore:latest -v "/path/to/store/data:/data"
Copy link
Contributor

Choose a reason for hiding this comment

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

this is not valid, we are passing down -v "/path..." to marketstore entrypoint.

-v "/path/to/store/data:/data" should come before the image specification:

docker run -i -p 5993:5993 -v /path/to/store/data:/data alpacamarkets/marketstore:latest 

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch 😅

@tibkiss
Copy link
Contributor

tibkiss commented Jun 7, 2020

@leki75 & @tibkiss I made the changes requested so I think this is ready to land?

yes! i found one more problem however, would be nice to fix that first.

thank you for your help here!

Also just suggest binding the `mkts.yml` file directly to avoid issues
with clobbering `/etc/` on the container.
@goodboy
Copy link
Contributor Author

goodboy commented Jun 8, 2020

@tibkiss fixed it! Let me know if there's anything else 🏄

@tibkiss
Copy link
Contributor

tibkiss commented Jun 10, 2020

thank you!

@tibkiss tibkiss merged commit fed6997 into alpacahq:master Jun 10, 2020
@goodboy
Copy link
Contributor Author

goodboy commented Jun 10, 2020

Hmm you know what @tibkiss I'm thinking the bind-mount for /data isn't so clear in terms of the path.

>>> tree /<path_to_data>/marketstore
/<path_to_data>/marketstore
├── category_name
├── WALFile.1590868038674814776.walfile
├── SYMBOL_1
├── SYMBOL_2
├── SYMBOL_3

I'm thinking that should have:

>>> tree /path/to/store/data
/path/to/store/data

To match the -v line from the command above?

What you think?
I can quickly PR this in.
Might not be worth 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

Successfully merging this pull request may close these issues.

6 participants