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

Usage from within docker for official plumber api example with entrypoint.R #2

Open
mskyttner opened this issue Jan 29, 2021 · 4 comments

Comments

@mskyttner
Copy link

I tried using drip in a container (see https://github.com/mskyttner/drip/blob/master/README-container.md) and have some questions/issues (which are hopefully possible to replicate using https://github.com/mskyttner/drip/blob/master/README-container.md#issues--questions).

The use case was to set up an container environment allowing live reload, by default using the plumber api example with an entrypoint that is bundled in the plumber R package.

I think I got it to run, but strangely the counter does not increment.

Any idea why?

@siegerts
Copy link
Owner

siegerts commented Jan 29, 2021

I'm happy that you're making use of the lib!

I'd probably need to dig in a bit but the first thing that comes to mind is that counter is trying persist across session. But in order for this to be reused- that session cookie needs to be reused by the client to make each subsequent request. If that's not happening then all requests at the server level appear distinct.

So, server creates session cookie -> passes to client -> client stores cookie -> client attaches cookie to next request.

Another way to test the counter is just to increment global state across all server requests or store that increment value into a persistent store/database.

@mskyttner
Copy link
Author

mskyttner commented Jan 29, 2021

Ah, of course! My curl command did not store or reuse cookies. Works great when I use a web browser. Thanks! That resolves my cookie confusion.

Onto the "runnable router" and entrypoint.R confusion. The docs here https://www.rplumber.io/reference/plumb.html implies there is now a convention that plumber uses an entrypoint.R file to return a "runnable router". And the drip also wants an "entrypoint.R" to start from, but in this case it needs a runnable router that has been started with $run()?

@siegerts
Copy link
Owner

Opened a new issue to track updates for plumber 1.x+. The current version was written when these conventions weren't yet in place.

@mskyttner
Copy link
Author

👍

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

No branches or pull requests

2 participants