From 90d0caff2288e4da9d392b7a35bf4ba5853752ab Mon Sep 17 00:00:00 2001 From: Pierre Slamich Date: Sat, 23 Mar 2024 18:41:15 +0100 Subject: [PATCH] fix: GitPod clarification (#9981) Co-authored-by: Alex Garel --- docs/dev/how-to-use-gitpod.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/dev/how-to-use-gitpod.md b/docs/dev/how-to-use-gitpod.md index fc2c2155b50d2..d4dbd4718210f 100644 --- a/docs/dev/how-to-use-gitpod.md +++ b/docs/dev/how-to-use-gitpod.md @@ -9,7 +9,6 @@ of setting up local environments and IDEs with Perl, Docker and plugins, making OpenFoodFacts Server to get started in minutes instead of hours! - Note that while this how-to is tailored for Gitpod, using alternatives like [GitHub Codespaces][github-codespaces] should be similar. @@ -32,10 +31,12 @@ On the Gitpod side, you can also update what Gitpod is allowed to do with your G > the project for you on opening and comes with Docker and other tools pre-installed making it one of the fastest ways > to spin up an environment for `openfoodfacts-server`. + + Once the repository is open in Gitpod, other instructions in the [quick-start guide](how-to-quick-start-guide.md) can be generally followed. -## Accessing your development instance of OpenFoodFacts Web +## Accessing your development instance of openfoodfacts-server Since Gitpod runs your code in a remote machine, your dev-deployment spun up with `make dev` or `make up` will not accessible when you open the default http://openfoodfacts.localhost in your browser. This occurs because the server @@ -44,11 +45,11 @@ running on the remote machine is not accessible on your local network interface. To overcome this, we can make use of SSH tunnel that listens to your local port 80 and forwards traffic to the port 80 of the remote machine. Gitpod makes it really simple to SSH into your dev environment by letting you copy the `ssh` command required to reach your remote environment. To start, follow the ssh instructions on Gitpod's official -guide: [SSH for workspaces as easy as copy/paste][gitpod-ssh-guide]. Once you have copied the ssh command and ensure it -works as-is, add a `-L 80:localhost:80` to the command to make it look like: +guide: [SSH for workspaces as easy as copy/paste][gitpod-ssh-guide]. +Once you have copied the ssh command and ensure it works as-is, add a `-L 80:localhost:80` to the command to make it look like: `ssh -L 80:localhost:80 'openfoodfac-openfoodfac-tok-openfoodfac-r9f61214h9vt.ssh.ws-c.gitpod.io'`. -Once you execute the altered command in your terminal, you should be able to access OpenFoodFacts +Once you execute the altered command in your terminal, you should be able to access Open Food Facts on http://openfoodfacts.localhost just as documented in the quickstart guide! [gitpod-ssh-guide]: https://www.gitpod.io/blog/copy-paste-ssh-workspace-access @@ -56,6 +57,10 @@ on http://openfoodfacts.localhost just as documented in the quickstart guide! **Remark:** for some Linux distributions, the port 80 is reserved. A workaround is to switch to port 8080: in gitpod, open the .env file and replace the line PRODUCT_OPENER_PORT=80 by PRODUCT_OPENER_PORT=8080, then replace -L 80:localhost:80 by -L 8080:localhost:8080. **Rollback the changes on .env before to make a pull request!*** +**Remark:** you will need to trust the fingerprint at first connection. + +**Remark:** on MacOS or Linux, when trying to bind, you might see a bind fail. Remember that any port below 1024 is reserved for the root user. You might want to add `sudo` just before the ssh command. + **Remark:** the address to connect with ssh can change after few days. If you get a ```Connection closed by ... port 22``` simply go back to https://gitpod.io/workspaces and copy the new address. **Remark:** if you load the page after some changes but get a ```502 Bad Gateway``` check again your code. Something may be wrong with it. Eventually, try to comment the part you just coded to see if it works. @@ -81,4 +86,4 @@ $ make tail After development, before opening a pull request, run the following command: ``` $ make checks -``` \ No newline at end of file +```