How workwebui command connect to redis in docker.
bright-coder opened this issue · 1 comments
bright-coder commented
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 commented
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! 😄