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

How workwebui command connect to redis in docker. #157

Open
bright-coder opened this issue May 23, 2020 · 1 comment
Open

How workwebui command connect to redis in docker. #157

bright-coder opened this issue May 23, 2020 · 1 comment

Comments

@bright-coder
Copy link

bright-coder commented May 23, 2020

docker-compose.yml

version: "2"
services:
  api:
    build:
      context: .
      dockerfile: Dockerfile
    volumes:
      - .:/go/src/goble
    restart: always
    depends_on:
      - db
      - redis
    env_file:
      - .env
    ports:
      - "8080:8080"
  db:
    image: mysql:5.7
    command:
      [
        "mysqld",
        "--character-set-server=utf8",
        "--collation-server=utf8_general_ci",
        "--max_allowed_packet=1073741824",
      ]
    restart: always
    volumes:
      - ./data/mysql:/var/lib/mysql
    ports:
      - 60001:3306
    environment:
      MYSQL_ROOT_PASSWORD: root
  redis:
    image: redis:alpine
    restart: always
    volumes:
      - ./data/redis:/data
    ports:
      - 63790:6379
  workerui:
    build:
      context: ./workwebui
      dockerfile: Dockerfile
    depends_on:
      - api
      - redis
    ports:
      - "8181:8181"

In workerui Dockerfile

FROM golang:1.12-alpine

RUN apk add --update git;
RUN go get github.com/gocraft/work/cmd/workwebui && \
  go install github.com/gocraft/work/cmd/workwebui

CMD workwebui -redis="redis:6379" -ns="goble_namespace" -listen="0.0.0.0:8181"

I got a message.
ERROR: worker_observations.worker_pool_heartbeats - invalid redis URL, url is opaque: redis:6379

@davidroman0O
Copy link

davidroman0O commented Jul 9, 2020

I made it worker like this:

Dockerfile.worker

FROM golang:1.12-alpine

RUN apk add --update git;
RUN go get github.com/gocraft/work/cmd/workwebui && \
  go install github.com/gocraft/work/cmd/workwebui

CMD workwebui -redis="$REDIS_HOSTS" -ns="work" -listen="0.0.0.0:8181"

docker-compose.yml

version: '3.5'
services:
  redis:
    container_name: redis
    image: redis
    expose:
      - 6379

  redis-commander:
    container_name: redis-commander
    image: rediscommander/redis-commander:latest
    restart: always
    environment:
    - REDIS_HOSTS=local:redis:6379
    ports:
    - "8081:8081"
      
  workerui:
    restart: always
    environment:
      - REDIS_HOSTS=redis://redis:6379
    build:
        context: .
        dockerfile: Dockerfile.worker
    ports:
      - "8181:8181"
docker-compose up --build redis workerui redis-commander

Hope it will works also on your machine, I've been struggling the same way as you! 😄

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