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

Simplify the introductory container installation docs #1456

Open
wants to merge 2 commits into
base: 6-dev
Choose a base branch
from

Conversation

davisagli
Copy link
Sponsor Member

It's a best practice to run Volto in seamless mode, where the API is served at the same domain with the /++api++ prefix. This avoids complications with browser cross-origin restrictions when the browser accesses the backend directly at a different domain.

So, we should show this best practice here. The current example sets RAZZLE_API_PATH, because the default is http://localhost:8080/Plone which does not work inside a container. But, setting RAZZLE_API_PATH also stops using the best practice of seamless mode. We can avoid this by setting RAZZLE_DEV_PROXY_API_PATH instead.

(Future improvement: make Volto recognize when it is running in a container, so that it can use http://host.docker.internal:8080/Plone as the default API path instead of localhost. Then it would not be necessary to set RAZZLE_DEV_PROXY_API_PATH here.)

It's a best practice to run Volto in seamless mode, where the API is served at the same domain with the /++api++ prefix. This avoids complications with browser cross-origin restrictions when the browser accesses the backend directly at a different domain.

So, we should show this best practice here. The current example sets RAZZLE_API_PATH, because the default is http://localhost:8080/Plone which does not work inside a container. But, setting RAZZLE_API_PATH also stops using the best practice of seamless mode. We can avoid this by setting RAZZLE_DEV_PROXY_API_PATH instead.

(Future improvement: make Volto recognize when it is running in a container, so that it can use http://host.docker.internal:8080/Plone as the default API path instead of localhost. Then it would not be necessary to set RAZZLE_DEV_PROXY_API_PATH here.)
@netlify
Copy link

netlify bot commented Feb 25, 2023

Deploy Preview for 6-docs-plone-org ready!

Name Link
🔨 Latest commit 4648cef
🔍 Latest deploy log https://app.netlify.com/sites/6-docs-plone-org/deploys/63fa472baab1030008f20f3a
😎 Deploy Preview https://deploy-preview-1456--6-docs-plone-org.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Contributor

@stevepiercy stevepiercy left a comment

Choose a reason for hiding this comment

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

I have not been following environment variables, so I am not qualified to review this PR. Someone else should review and approve.

However, would you please check other instances of RAZZLE_API_PATH in both these and the Volto docs, to ensure that removing it here will not affect its presence in other places? Make sure to check all files, including Makefiles.

@stevepiercy stevepiercy added this to the Plone 6.0 milestone Feb 25, 2023
@davisagli
Copy link
Sponsor Member Author

Hmm. I started checking the rest of the docs, but I'm getting myself confused. I think https://github.com/plone/documentation/blob/6-dev/docs/install/containers/images/frontend.md also needs to be updated to mention RAZZLE_DEV_PROXY_API_PATH. But here's my confusion:

The dev proxy is clearly working when using the plone-frontend image, which I understand is running Volto in production mode. That matches what it says in https://6.docs.plone.org/volto/configuration/internalproxy.html ("You could also use the internal proxy for production setups. For convenience and for testing/demoing using the stock build, it is also enabled in production mode since Volto 14.") But I also see code in Volto that is clearly only using settings.devProxyToApiPath in development mode (__DEVELOPMENT__). So why/how is it working in the image? What am I missing, @sneridagh @tiberiuichim

I can follow up and update the docs about this in more places but first I need to understand better myself.

@davisagli
Copy link
Sponsor Member Author

Answering my own question: the dev proxy is indeed always enabled. There are a couple places where things are done differently when __DEVELOPMENT__ is true, but it's nothing very significant. Probably things left over from before the dev proxy was always enabled.

@davisagli
Copy link
Sponsor Member Author

I need to stop for today, but I'll come back to this and make some more updates. I got sidetracked working on plone/volto#4434

@stevepiercy
Copy link
Contributor

Indeed, I would not take the Volto docs as being 100% accurate. When we imported them initially into the main docs, they were not curated or reviewed for accuracy.

The Volto docs evolved over time, and some things were not updated, but just buried beneath new stuff that was current. Just like Plone 5 docs.

@davisagli
Copy link
Sponsor Member Author

@stevepiercy Sure, that's my general expectation, and I'm trying to help review them now. The bit I pointed out above is in fact accurate -- I thought I saw something in the code that contradicted the docs, but I was mistaken.

```

Now start the Plone Frontend, linking it to the `plone6-backend`:

```shell
docker run --name plone6-frontend --link plone6-backend:backend -e RAZZLE_API_PATH=http://localhost:8080/Plone -e RAZZLE_INTERNAL_API_PATH=http://backend:8080/Plone -d -p 3000:3000 plone/plone-frontend:latest
docker run --name plone6-frontend --link plone6-backend:backend -e RAZZLE_DEV_PROXY_API_PATH=http://backend:8080/Plone -d -p 3000:3000 plone/plone-frontend:latest
Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

Feedback from Wayne Glover in https://community.plone.org/t/trying-to-install-plone-6-on-windows-gets-me-half-way/16084/16:

please consider adding a line above this something to the effect: "The docker run code below is based on the name of the site being "Plone". If you named your site something different, please revise the code below by changing the name"

@fredvd
Copy link
Sponsor Member

fredvd commented Apr 1, 2023

Is this documentation update something that can be moved forward with the recent fixes to seamless mode and the dev proxy path variables in Volto 16.18.0? (https://plone.org/news-and-events/news/2023/plone-6-0-3-released)

@stevepiercy
Copy link
Contributor

@davisagli would you please nudge this PR onward?

@davisagli
Copy link
Sponsor Member Author

@stevepiercy I'll be honest, I've been procrastinating on this because I discovered that the "install from containers" section has some subsections that have useful information but don't belong in their current location. I think a lot of it probably should move into the deployment section. Anyway this is just excuses but that's why I haven't gotten to what might at first glance look like a small fix.

@stevepiercy
Copy link
Contributor

Look at it this way, you can't make the Deployment section any worse than it is now. 🤡 Do you want to chat and figure out where bits should go?

@davisagli
Copy link
Sponsor Member Author

@stevepiercy Yes, but I'm out of time for today. Sometime this next week?

@stevepiercy
Copy link
Contributor

Yup, hit me up on Discord.

@stevepiercy
Copy link
Contributor

@davisagli poke.

@stevepiercy
Copy link
Contributor

@davisagli what's the status of this PR?

What's the relation to #1652?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Status: In Progress
Status: No status
Development

Successfully merging this pull request may close these issues.

None yet

4 participants