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

Some assistance with setup needed. #16

Closed
athphane opened this issue Oct 1, 2020 · 3 comments
Closed

Some assistance with setup needed. #16

athphane opened this issue Oct 1, 2020 · 3 comments

Comments

@athphane
Copy link

athphane commented Oct 1, 2020

Hi! I've been trying to set the project up for myself and I'm stuck. I've set up the docker-compose file and nginx as follows:

docker-compose.yml

version: "3"

services:
  app:
    image: yooooomi/your_spotify_server
    container_name: express-mongo
    restart: always
    ports:
      - "8080:8080"
    links:
      - mongo
    depends_on:
      - mongo
    environment:
      - API_ENDPOINT=http://spotify.domain.com/api
      - CLIENT_ENDPOINT=http://spotify.domain.com
      - SPOTIFY_PUBLIC=redacted
      - SPOTIFY_SECRET=redacted
      - CORS=all

  mongo:
    container_name: mongo
    image: mongo
    volumes:
      - /home/titan/your_spotify/db:/data/db

  web:
    image: yooooomi/your_spotify_client
    container_name: web
    restart: always
    ports:
      - "3000:3000"
    environment:
      - API_ENDPOINT=http://spotify.domain.com/api

spotify.domain.com nginx conf file

server {
  listen 80;
  server_name spotify.domain.com;

  location / {
    proxy_pass http://localhost:3000/;
  }

  location /api {
    proxy_pass http://localhost:8080/;
  }
}

With this much, I am able to get to the login page of the app when i go to http://spotify.domain.com like below.

image

On this same page, I get a 404 error. It's trying to go to /api/me
image

When I try to register, I get this:
image

I read through some of the issues and they helped me get here. Any extra help is appreciated.

@Yooooomi
Copy link
Owner

Yooooomi commented Oct 1, 2020

Hello, I'm glad you put interest in setting up my project!

I think I know what is happening.

You set the api behind /api. So when calling /me it calls /api/me which doesn't exist in the server.

Using nginx, you should rewrite the actual url before proxy'ing to the server to /me instead of /api/me. Or you could simply set the server to api-spotify.domain.com.

I hope this will help you, do not hesitate to ask further informations.

@athphane
Copy link
Author

athphane commented Oct 2, 2020

Hi! Thanks for the quick reply. I immediately went to bed after posting the issue.

You were right, rewriting the url did the trick. I added the following line to my /api location.

rewrite /api/(.*) /$1 break;

All works just fine.

Would like to disable the registration ability now tho. It was previously discussed on #9. Any progress on that?

You think nginx auth_basic would be enough for a workaround?

@Yooooomi
Copy link
Owner

Yooooomi commented Oct 3, 2020

Hello,

Happy to ear that it works now! I don't know much about nginx auth_basic, maybe you should investigate that.

I didn't work much on blocking registers but I'll consider implementing it next time.
Marking this as solved.

Have a great day :)

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