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

signal-cli binary in docker image #732

Closed
SecT0uch opened this issue Nov 13, 2022 · 5 comments
Closed

signal-cli binary in docker image #732

SecT0uch opened this issue Nov 13, 2022 · 5 comments

Comments

@SecT0uch
Copy link

SecT0uch commented Nov 13, 2022

It seems the signal-cli binary in not included in the docker image.
It is needed for the Signal integration
Would it be possible to make it available ?

Edit: Submitted #733

@cuu508
Copy link
Member

cuu508 commented Nov 13, 2022

Wouldn't it be better to signal-cli in a separate container?

@SecT0uch
Copy link
Author

SecT0uch commented Nov 13, 2022

That's what I initially did, sharing the signal socket between the containers.
However signal-cli needs to be available in healthchecks container to connect to the socket.
Am I missing something ?

@cuu508
Copy link
Member

cuu508 commented Nov 13, 2022

Did sharing the socket between the containers not work? What problem did you hit?
(note – I've not personally tested running healthchecks and signal-cli in separate containers, but I assumed there must be a way to make a socket from one container available to another container)

@SecT0uch
Copy link
Author

I did manage to share the socket between the containers.

The issue is when testing my Signal integration: Could not send a test notification. signal-cli call failed

@cuu508
Copy link
Member

cuu508 commented Dec 15, 2022

I got it semi-working with the following docker-compose file:

version: "3"
volumes:
    db-data:

services:
  db:
    image: postgres:12
    volumes:
      - db-data:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=$DB_NAME
      - POSTGRES_PASSWORD=$DB_PASSWORD
  web:
    build:
        context: ..
        dockerfile: docker/Dockerfile
    env_file:
        - .env
    ports:
        - "8000:8000"
    volumes:
      - "/tmp/sockets:/tmp/sockets"
    depends_on:
        - db
    command: bash -c 'while !</dev/tcp/db/5432; do sleep 1; done; uwsgi /opt/healthchecks/docker/uwsgi.ini'
  signal-cli:
    image: registry.gitlab.com/packaging/signal-cli/signal-cli-native:latest
    command: -a +[redacted] --config /var/lib/signal-cli daemon --socket /tmp/sockets/signal-cli.socket
    ports:
      - "7583:7583"
    volumes:
      - "/tmp/signal-cli-config:/var/lib/signal-cli"
      - "/tmp/sockets:/tmp/sockets"
    tmpfs:
      - "/tmp:exec"

And I had this in .env file:

SIGNAL_CLI_SOCKET=/tmp/sockets/signal-cli.socket

But using volumes to share sockets is quite clumsy. I had permission problems with socket files – I had to chmod the socket file so the healthchecks process would be able to access it. And, after stopping and restarting containers, the signal-cli container complained about the socket file already being there – I had to manually remove it between restarts.

I'm inexperienced with docker, there may be proper ways to solve the above issues.

As an experimental alternative I added support for connecting to a TCP socket in 73a5cb0. TCP communication between containers is simpler–no volumes, no sokcet files:

version: "3"
volumes:
    db-data:

services:
  db:
    image: postgres:12
    volumes:
      - db-data:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=$DB_NAME
      - POSTGRES_PASSWORD=$DB_PASSWORD
  web:
    build:
        context: ..
        dockerfile: docker/Dockerfile
    env_file:
        - .env
    ports:
        - "8000:8000"
    depends_on:
        - db
        - signal-cli
    command: bash -c 'while !</dev/tcp/db/5432; do sleep 1; done; uwsgi /opt/healthchecks/docker/uwsgi.ini'
  signal-cli:
    image: registry.gitlab.com/packaging/signal-cli/signal-cli-native:latest
    command: -a +[redacted] --config /var/lib/signal-cli daemon --tcp 0.0.0.0:7583
    volumes:
      - "/tmp/signal-cli-config:/var/lib/signal-cli"
    tmpfs:
      - "/tmp:exec"

And I had this in .env file:

SIGNAL_CLI_SOCKET=signal-cli:7583

@cuu508 cuu508 closed this as completed Dec 19, 2022
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