saleor / saleor-platform

All Saleor services started from a single repository with docker-compose.
BSD 3-Clause "New" or "Revised" License
643 stars 876 forks source link

Login went wrong. Please try again. #298

Open thephilluk opened 11 months ago

thephilluk commented 11 months ago

Hi there,

I checked both issues with the same name (#274 & #280) for solutions and tried those, but the issue still persists.

after following the guide for Docker installation here and everything started up without errors.

when trying to log in with my superuser I get the "Login went wrong. Please try again." error message. After checking the Dev Console I can see that the Dashboard is trying to reach the GraphQL instance on my local machine but the Containers run on my local server.

I tried the methods listed in the Issues I mentioned:

unfortunately after that the issue still persists. most recent try after all tried fixes: Imgur Link

Ports 8000 & 9000 are allowed through the Firewall

any help is appreciated and if you need any info

current docker-compose:

version: "3.4"

services:
  api:
    image: ghcr.io/saleor/saleor:3.16.1
    ports:
      - 8000:8000
    restart: unless-stopped
    networks:
      - saleor-backend-tier
    stdin_open: true
    tty: true
    depends_on:
      - db
      - redis
      - jaeger
    volumes:
      # shared volume between worker and api for media
      - saleor-media:/app/media
    env_file:
      - common.env
      - backend.env
    environment:
      - JAEGER_AGENT_HOST=jaeger
      - DASHBOARD_URL=http://x.x.x.x:9000/
      - ALLOWED_HOSTS=localhost,api,x.x.x.x

  dashboard:
    image: ghcr.io/saleor/saleor-dashboard:3.16.1
    ports:
      - 9000:80
    restart: unless-stopped

  db:
    image: library/postgres:13-alpine
    ports:
      - 5432:5432
    restart: unless-stopped
    networks:
      - saleor-backend-tier
    volumes:
      - saleor-db:/var/lib/postgresql/data
      - ./replica_user.sql:/docker-entrypoint-initdb.d/replica_user.sql
    environment:
      - POSTGRES_USER=saleor
      - POSTGRES_PASSWORD=saleor
      - API_URL=http://x.x.x.x:8000/graphql/

  redis:
    image: library/redis:7.0-alpine
    ports:
      - 6379:6379
    restart: unless-stopped
    networks:
      - saleor-backend-tier
    volumes:
      - saleor-redis:/data

  worker:
    image: ghcr.io/saleor/saleor:3.16.1
    command: celery -A saleor --app=saleor.celeryconf:app worker --loglevel=info -B
    restart: unless-stopped
    networks:
      - saleor-backend-tier
    env_file:
      - common.env
      - backend.env
    depends_on:
      - redis
      - mailpit
    volumes:
      # shared volume between worker and api for media
      - saleor-media:/app/media

  jaeger:
    image: jaegertracing/all-in-one
    ports:
      - "5775:5775/udp"
      - "6831:6831/udp"
      - "6832:6832/udp"
      - "5778:5778"
      - "16686:16686"
      - "14268:14268"
      - "9411:9411"
    restart: unless-stopped
    networks:
      - saleor-backend-tier

  mailpit:
    image: axllent/mailpit
    ports:
      - 1025:1025 # smtp server
      - 8025:8025 # web ui. Visit http://localhost:8025/ to check emails
    restart: unless-stopped
    networks:
      - saleor-backend-tier

volumes:
  saleor-db:
    driver: local
  saleor-redis:
    driver: local
  saleor-media:

networks:
  saleor-backend-tier:
    driver: bridge
shakeelasim86 commented 9 months ago

Hi every one, i am trying to follow https://github.com/saleor/saleor-platform for development purpose but when try to access my saleor dashboard it gives me error as under:- Failed to load resource: net::ERR_CONNECTION_REFUSED localhost:8000/graphql/:1 please guide me how to setup .env exactly as i have configured my public-ip:8000 in .yml file but while accessing it points to localhost:8000. Here is my yml file attached for better understanding. Due to unsuccessfull attempts i have duplicated env variables for every container/ service. thanks for your cooperation

version: "3.4"

services: api: image: ghcr.io/saleor/saleor:unstable-main #ghcr.io/saleor/saleor:3.17 ports:

volumes: saleor-db: driver: local saleor-redis:

driver: local

saleor-media:

networks: saleor-backend-tier: driver: bridge

brandoncazander commented 9 months ago

I had this same issue and had to run this command to update the API_URL after bringing everything up with docker compose up:

docker exec -it -e API_URL=http://public-ip:8000/graphql/ <dashboard container ID> /docker-entrypoint.d/50-replace-api-url.sh

I got this from the saleor-dashboard docker docs. ~It would be really nice if you could just override this as an environment variable at runtime but it appears impossible for now, at least from what I tried.~


Edit: setting the API_URL in the environment for the dashboard container does appear to work after all, not sure what I was seeing before. You can verify this by checking the logs after bringing everything up:

$ docker compose logs | grep API_URL
magnolia-dashboard-1  | Setting API_URL to: http://magnolia-api.home.arpa/graphql/
shakeelasim86 commented 9 months ago

Thank you so much for your solution. i have successfully configured my env variable through same command but my static content is set to localhost:8000 for dashboard product images and images are unable to load but when i manually replace my localhost with public ip of cloud instance it works perfectly fine. Now i want to set docker exec -it -e STATIC_URL=http://public ip :8000/ please share a command for it if you experience it as well. Once again thank you for cooperation.

yajuve commented 4 months ago

You can also set your API_URL value in your docker-compose.yml as follow:

  dashboard:
    image: ghcr.io/saleor/saleor-dashboard:latest
    ports:
      - 9000:80
    restart: unless-stopped
    environment:
      - API_URL=<your-IP-here>:8000/graphql/ # <-- replace your-IP-here

important!: Don't forget to allow your IP in api service in docker-compose.yml:

  api:
    image: ghcr.io/saleor/saleor:3.19
    ...
    environment:
      ...
      - ALLOWED_HOSTS=localhost,api,your-IP <-- add your-IP-here