Skip to content

[bug]: Minio uses localhost #2345

Closed
Closed

Description

@loranger

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

Hi,

I tried running plane work behind traefik reverse proxy, and it almost works, except for the file upload which seems to use localhost for minio calls.
I can't find where I can change these settings.

Here is the setup I use:

docker-compose.yml
version: "3.8"

services:
  web:
    container_name: web
    build:
      context: .
      dockerfile: ./web/Dockerfile.web
      args:
        DOCKER_BUILDKIT: 1
    restart: always
    command: /usr/local/bin/start.sh web/server.js web
    depends_on:
      - api
      - worker
    labels:
      - "traefik.http.routers.${APP_PROJECT}.rule=Host(`${APP_DOMAIN}`)"
      - "traefik.http.services.${APP_PROJECT}-service.loadbalancer.server.port=3000"

  space:
    container_name: space
    build:
      context: .
      dockerfile: ./space/Dockerfile.space
      args:
        DOCKER_BUILDKIT: 1
    restart: always
    command: /usr/local/bin/start.sh space/server.js space
    depends_on:
      - api
      - worker
      - web

  api:
    container_name: api
    build:
      context: ./apiserver
      dockerfile: Dockerfile.api
      args:
        DOCKER_BUILDKIT: 1
    restart: always
    command: ./bin/takeoff
    env_file:
      - ./apiserver/.env
    depends_on:
      - plane-db
      - plane-redis
    labels:
      - "traefik.http.routers.${APP_PROJECT}-api.rule=Host(`${APP_DOMAIN}`) && PathPrefix(`/api`)"
      - "traefik.http.services.${APP_PROJECT}-api-service.loadbalancer.server.port=8000"

  worker:
    container_name: bgworker
    build:
      context: ./apiserver
      dockerfile: Dockerfile.api
      args:
        DOCKER_BUILDKIT: 1
    restart: always
    command: ./bin/worker
    env_file:
      - ./apiserver/.env
    depends_on:
      - api
      - plane-db
      - plane-redis

  beat-worker:
    container_name: beatworker
    build:
      context: ./apiserver
      dockerfile: Dockerfile.api
      args:
        DOCKER_BUILDKIT: 1
    restart: always
    command: ./bin/beat
    env_file:
      - ./apiserver/.env
    depends_on:
      - api
      - plane-db
      - plane-redis

  plane-db:
    container_name: plane-db
    image: postgres:15.2-alpine
    restart: always
    command: postgres -c 'max_connections=1000'
    volumes:
      - pgdata:/var/lib/postgresql/data
    env_file:
      - .env
    environment:
      POSTGRES_USER: ${PGUSER}
      POSTGRES_DB: ${PGDATABASE}
      POSTGRES_PASSWORD: ${PGPASSWORD}
      PGDATA: /var/lib/postgresql/data

  plane-redis:
    container_name: plane-redis
    image: redis:6.2.7-alpine
    restart: always
    volumes:
      - redisdata:/data

  plane-minio:
    container_name: plane-minio
    image: minio/minio
    restart: always
    command: server /export --console-address ":9090"
    volumes:
      - uploads:/export
    environment:
      MINIO_ROOT_USER: ${AWS_ACCESS_KEY_ID}
      MINIO_ROOT_PASSWORD: ${AWS_SECRET_ACCESS_KEY}
    labels:
      - "traefik.http.routers.${APP_PROJECT}-minio.rule=Host(`${APP_DOMAIN}`) && PathPrefix(`/${AWS_S3_BUCKET_NAME}`)"
      - "traefik.http.services.${APP_PROJECT}-minio-service.loadbalancer.server.port=9000"

  createbuckets:
    image: minio/mc
    entrypoint: >
      /bin/sh -c " /usr/bin/mc config host add plane-minio http://plane-minio:9000 \$AWS_ACCESS_KEY_ID \$AWS_SECRET_ACCESS_KEY; /usr/bin/mc mb plane-minio/\$AWS_S3_BUCKET_NAME; /usr/bin/mc anonymous set download plane-minio/\$AWS_S3_BUCKET_NAME; exit 0; "
    env_file:
      - .env
    depends_on:
      - plane-minio

volumes:
  pgdata:
  redisdata:
  uploads:

networks:
  default:
      name: web
      external: true
.env
APP_PROJECT="plane"
APP_DOMAIN="my.plane.host.name"

# Database Settings
PGUSER="plane"
PGPASSWORD="very-secret-plane-password"
PGHOST="plane-db"
PGDATABASE="plane"
DATABASE_URL=postgresql://${PGUSER}:${PGPASSWORD}@${PGHOST}/${PGDATABASE}

# Redis Settings
REDIS_HOST="plane-redis"
REDIS_PORT="6379"
REDIS_URL="redis://${REDIS_HOST}:6379/"

# AWS Settings
AWS_REGION=""
AWS_ACCESS_KEY_ID="plane-access-key"
AWS_SECRET_ACCESS_KEY="my-very-secret-plane-key"
# AWS_S3_ENDPOINT_URL="http://plane-minio:9000"
AWS_S3_ENDPOINT_URL="http://${APP_DOMAIN}/"
# Changing this requires change in the nginx.conf for uploads if using minio setup
AWS_S3_BUCKET_NAME="uploads"
# Maximum file upload limit
FILE_SIZE_LIMIT=5242880

# GPT settings
OPENAI_API_BASE="https://api.openai.com/v1" # change if using a custom endpoint
OPENAI_API_KEY="sk-" # add your openai key here
GPT_ENGINE="gpt-3.5-turbo" # use "gpt-4" if you have access

# Settings related to Docker
DOCKERIZED=1
# set to 1 If using the pre-configured minio setup
USE_MINIO=1

Steps to reproduce

Using the files above, I start the container and try to upload a logo for the current workspace and every aws/minio call are requested to localhost

SCR-20231003-ihpa

http://localhost/uploads/01547f90-620e-44b6-9ee2-2cb1dae46380/7bfb56129cbd41fe82e7fc6a5b123735-gradient_spinner_w_BTZnewH.png

Browser

Mozilla Firefox

Version

Self-hosted

Activity

  1. avinashk2946 commented on Oct 19, 2023

    @avinashk2946

    I am facing same issue

  2. blackkaiserxjc commented on Oct 21, 2023

    @blackkaiserxjc

    I am facing same issue

    +1

  3. digitalbirth commented on Oct 26, 2023

    @digitalbirth

    +1
    On boot, it mentioned that minio is set for download

  4. TheAwiteb commented on Nov 6, 2023

    @TheAwiteb

    Any workaround for this?

  5. pablohashescobar commented on Nov 10, 2023

    @pablohashescobar
    Member

    Hi, you have to configure another variable in the .env WEB_URL to the current domain http://{app_domain}

  6. blackkaiserxjc commented on Nov 11, 2023

    @blackkaiserxjc

    Hi, you have to configure another variable in the .env WEB_URL to the current domain http://{app_domain}

    I do it, but it's not working.

  7. codevski commented on Dec 2, 2023

    @codevski

    just verify that api server is actually getting passed in WEB_URL var. I had to double check that and noticed it wasn't. Redeployed and images starting to work, not sure if you need to reupload the image or not

  8. 0xbytejay commented on Dec 3, 2023

    @0xbytejay

    According to plane/apiserver/plane/settings/selfhosted.py file

    parsed_url = urlparse(os.environ.get("WEB_URL", "http://localhost"))
    AWS_S3_CUSTOM_DOMAIN = f"{parsed_url.netloc}/{AWS_STORAGE_BUCKET_NAME}"
    AWS_S3_URL_PROTOCOL = f"{parsed_url.scheme}:"
    

    I tried adding WEB_URL in .env file,
    At the same time, modify the docker-compose-hub.yml file and add the following environment variables in the api service:

    - WEB_URL=${WEB_URL:-http://localhost/}
    

    , now it can work.
    image

  9. mguptahub commented on Dec 19, 2023

    @mguptahub
    Contributor

    This issue has been fixed in the latest release. Follow the latest self hosting docs.

  10. pablohashescobar commented on Dec 19, 2023

    @pablohashescobar
    Member

    Closing this issue as this has been fixed. If you are still facing this please reopen the issue.

  11. added a commit that references this issue on Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions