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

[Bug]: can’t access the website #88

Open
4 tasks done
acracker opened this issue Dec 4, 2023 · 4 comments
Open
4 tasks done

[Bug]: can’t access the website #88

acracker opened this issue Dec 4, 2023 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@acracker
Copy link

acracker commented Dec 4, 2023

Initial Checks

  • I have searched GitHub for a duplicate issue and I'm sure this is something new
  • I have searched Google & StackOverflow for a solution and couldn't find anything
  • I have read and followed the docs and the FAQ's and still think this is a bug
  • I am confident that the issue is with swiple and not my configuration in docker/.env or docker/.env-non-dev

Description

I installed Swiple via Docker on a remote computer, but I can’t access the website. The remote computer’s IP address is 192.168.123.88. When I try to access http://192.168.123.88:3000/ through the browser, I noticed that the browser is making a request to this endpoint http://127.0.0.1:8000/api/v1/user/me. I think this might be the reason for the issue. So, I searched for “8000” in the project folder and replaced it with “3001,” then executed “docker compose -f docker-compose-non-dev.yaml up.” However, it didn’t work, and it’s still trying to access http://127.0.0.1:8000/api/v1/user/me.

If UI related, what browsers are you seeing the problem on?

No response

Relevant log output

[root@172-16-0-175 swiple]# grep -rn 3001 . |grep -v backend/app/sample_data/data |grep -v  poetry.lock |grep 3001
./backend/app/settings.py:27:    SWIPLE_API_URL: AnyHttpUrl = Field(default="http://swiple_api:3001")
./backend/app/settings.py:30:    BACKEND_CORS_ORIGINS: List[AnyHttpUrl] = Field(default=["http://swiple_api:3001", "http://127.0.0.1:3000"])
./backend/Dockerfile:54:CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "3001"]
./backend/main.py:5:    uvicorn.run("app.main:app", host="0.0.0.0", port=3001, reload=True, env_file="../docker/.env-local")
./docker/.env-local:2:SWIPLE_API_URL=http://192.168.123.88:3001
./docker/.env-local:4:BACKEND_CORS_ORIGINS=["http://127.0.0.1:3000", "http://192.168.123.88:3001", "http://192.168.123.88:3000"]
./docs/package.json:7:    "start": "docusaurus start --port 3001",
./docs/package.json:12:    "serve": "docusaurus serve --port 3001",
./frontend/.env.development:1:REACT_APP_API_DOMAIN=http://192.168.123.88:3001/api/v1
./frontend/.env.production:1:REACT_APP_API_DOMAIN=http://192.168.123.88:3001/api/v1
./docker-compose.yaml:19:    command: ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "3001", "--reload"]
./docker-compose.yaml:22:      - "3001:3001"
./docker-compose-non-dev.yaml:23:      - "3001:3001"
@acracker acracker added the bug Something isn't working label Dec 4, 2023
@acracker
Copy link
Author

acracker commented Dec 5, 2023

I found that the static files for the UI are inside the image and not packaged with local files when creating the container.

I replaced “http://127.0.0.1:8000” with “http://192.168.123.88:8000” in the JavaScript files under the “/usr/share/nginx/html/static/js/” directory inside the container. However, the page is still not displaying correctly.

Furthermore, my English is poor, and I’m using translation software, so there might be some difficulty in understanding. Please forgive any confusion.

@acracker
Copy link
Author

acracker commented Dec 5, 2023

There are quite a few configurations to be done now, and there are multiple docker-compose.yml files, which make it a bit overwhelming for me.

We can simplify things and address cross-origin issues by using Nginx to proxy both the frontend(3000) and backend(8000) to port 80, even during local development.

@KentonParton
Copy link
Contributor

Hi @acracker, if you are running the UI at a different url, you should override the environment variables. This is how you can override ENV variables:
https://swiple.io/docs/how-to-guides/overriding-env-variables

This is a full list of variables you can override:
https://github.com/Swiple/swiple/blob/main/backend/app/settings.py

For the frontend, take a look here to make API requests to a different backend URL:
https://github.com/Swiple/swiple/blob/main/frontend/.env.development

@acracker
Copy link
Author

hi, @KentonParton, I've changed this configuration, but it doesn't seem to be working
./frontend/.env.development:1:REACT_APP_API_DOMAIN=http://192.168.123.88:3001/api/v1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants