Skip to content

Support --socket-dir command line argument #126

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

Open
tjhorner opened this issue Sep 4, 2024 · 3 comments
Open

Support --socket-dir command line argument #126

tjhorner opened this issue Sep 4, 2024 · 3 comments

Comments

@tjhorner
Copy link

tjhorner commented Sep 4, 2024

The dispatcher server accepts a --socket-dir command line argument to let the user customize the location of the unix domain sockets that are created. The dispatcher client already listens to OVERPASS_SOCKET_DIR, so it would be great if dispatcher_start.sh added the appropriate --socket-dir parameter if OVERPASS_SOCKET_DIR is set. I think some additional work would need to be done for the dispatcher_areas supervisord job and here in the entrypoint.

By default, Overpass stores the domain sockets in the database directory, but this can cause problems if the directory is a network share or otherwise does not support unix domain sockets, so specifying a separate directory for those is required.

Thank you for this Docker image!

@BrendenKingTLG
Copy link

I attempted to use a volume mount for the database and store the socket file on the container. Everything seems to be functioning.

https://github.com/BrendenKingTLG/overpass-api-k8

@tjhorner
Copy link
Author

tjhorner commented Mar 26, 2025

@BrendenKingTLG If you are using a normal volume mount on your local filesystem then it will work fine. I ran into issues when I mounted a directory over NFS and used that as my volume mount, but sockets don't work with NFS (understandably)

@BrendenKingTLG
Copy link

I use a similar setup with AWS EFS. To avoid issues with socket files being shared across instances, I moved the socket file from the DB volume to a path inside the container.

Step 1: Set OVERPASS_SOCKET_DIR

Define an environment variable to set the socket directory. This can be any path within the container. I use /app/socket:

# Dockerfile (line 45)
ENV OVERPASS_RULES_LOAD=1 \
    OVERPASS_USE_AREAS=true \
    OVERPASS_ALLOW_DUPLICATE_QUERIES=no \
    OVERPASS_SOCKET_DIR=/app/socket

Step 2: Start Dispatcher with --socket-dir

Update your startup script to pass the --socket-dir flag when starting the dispatcher. This argument is supported even though it isn’t shown in the help output:

/app/bin/dispatcher --osm-base --socket-dir=/app/socket --meta --db-dir=/app/db &

Reference: dispatcher_server.cc#L264

Step 3: Mount Only the DB Files

Make sure you mount just the DB directory and not the socket path:

volumeMounts:
  - name: db-volume
    mountPath: /app/db
  - name: data-volume
    mountPath: /data

volumes:
  - name: db-volume
    hostPath:
      path: {{ .Values.volumes.dbHostPath }}
      type: Directory

This way, /app/db includes only the database files, while the sockets remain local to the container. I run multiple API instances sharing the same database without socket conflicts. Hope this helps!

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