nostr-rs-relay icon indicating copy to clipboard operation
nostr-rs-relay copied to clipboard

"unable to open database file" using docker compose

Open HFulcher opened this issue 1 year ago • 2 comments

Hi, having some issues getting the relay deployed while using docker compose:

version: "3.7"

services:
  public-relay:
    image: scsibug/nostr-rs-relay
    restart: on-failure
    user: "1000:1000" #Tried with and without this
    volumes:
      - /home/huw/docker-files/nostrrelay/config.toml:/usr/src/app/config.toml
      - /home/huw/docker-files/nostrrelay/db:/usr/src/app/db:Z
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.nostr.entrypoints=websecure"
      - "traefik.http.routers.nostr.rule=Host(`nostr.ussenterprise.xyz`)"
      - "traefik.http.routers.nostr.tls=true"
      - "traefik.http.routers.nostr.tls.certresolver=letls"
    networks:
      - cloudflaretunnel

networks:
  cloudflaretunnel:
    external: true

When it spins up I get the error: unable to open database file: /usr/src/app/db/nostr.db

I've tried creating it manually on both sides and not creating it at all but not luck.

Any suggestions? Thanks!

HFulcher avatar Dec 09 '23 19:12 HFulcher

The problem may be associated with the relay database volume. You could try creating a docker volume for the nostr-relay database.

the file would be like this

version:` "3.7"

services:
  public-relay:
    image: scsibug/nostr-rs-relay
    restart: on-failure
    user: "1000:1000" #Tried with and without this
    volumes:
      - /home/huw/docker-files/nostrrelay/config.toml:/usr/src/app/config.toml
      - nostrrelay_db:/usr/src/app/db:Z
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.nostr.entrypoints=websecure"
      - "traefik.http.routers.nostr.rule=Host(`nostr.ussenterprise.xyz`)"
      - "traefik.http.routers.nostr.tls=true"
      - "traefik.http.routers.nostr.tls.certresolver=letls"
    networks:
      - cloudflaretunnel

volumes:
  nostrrelay_db:

networks:
  cloudflaretunnel:
    external: true

jacalfonso avatar Mar 11 '24 20:03 jacalfonso

I had the same issue, just not with docker-compose but plain docker. It was a permissions issue for the folder from where my data was mounted. Changing the perms fixed the problem

kuba-04 avatar Aug 10 '24 09:08 kuba-04