0
votes

How can i setup anycable(action cable) port on docker?

this is my Dockerfile for anycable

FROM ruby:2.6.3-alpine3.10

WORKDIR /home/app

COPY . /home/app/

EXPOSE 50051

CMD ["anycable"]

and this is my docker-compose

version: "3" services: app: build: context: . dockerfile: ./dockers/app/Dockerfile container_name: out_app restart: unless-stopped volumes: - .:/app - /app/node_modules - /app/public/assets - /app/public/packs ports: - 3000:3000 db: build: context: . dockerfile: ./dockers/postgis/Dockerfile container_name: out_db environment: POSTGRES_USER: ${DOCKER_DB_USER} POSTGRES_PASSWORD: ${DOCKER_DB_PASSWORD} POSTGRES_DB: ${DOCKER_DB_NAME} volumes: - /docker_data/giggle/postgres:/var/lib/postgresql/data ports: - 5435:5432 nginx: build: context: . dockerfile: ./dockers/web/Dockerfile container_name: out_web restart: unless-stopped ports: - 80:80 - 443:443 depends_on: - app volumes: - ./dockers/web/nginx.conf:/etc/nginx/conf.d/default.conf - ./data/certbot/conf:/etc/letsencrypt - ./data/certbot/www:/var/www/certbot certbot: image: certbot/certbot restart: unless-stopped volumes: - ./data/certbot/conf:/etc/letsencrypt - ./data/certbot/www:/var/www/certbot entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'" redis: image: redis volumes: - ../../tmp/db:/var/lib/redis/data delayed_job: build: context: . dockerfile: ./dockers/delayed_job/Dockerfile container_name: out_delayed_job command: bundle exec rails jobs:work depends_on: - db volumes: - .:/app

anycable:

image: 'anycable/anycable-go:edge-mrb'

ports:

- "3334"

environment:

ANYCABLE_HOST: 0.0.0.0

REDIS_URL: redis://redis:6379/1

ANYCABLE_RPC_HOST: 0.0.0.0:3334

ANYCABLE_DEBUG: 1

command: bundle exec anycable

anycable: build: context: . dockerfile: ./dockers/anycable/Dockerfile container_name: anycable command: bundle exec anycable depends_on: - redis

1

1 Answers

0
votes

You provided anycable-go configuration. To set custom port for anycable-go server add ANYCABLE_PORT: <your port> to anycable-go image environment or expose image port like ports: ['<your_port>:8080'].

Check anycable configuration page (contains env variables info): https://docs.anycable.io/#/anycable-go/configuration