scsibug / nostr-rs-relay

Mirror of https://sr.ht/~gheartsfield/nostr-rs-relay/
MIT License
593 stars 161 forks source link

"unable to open database file" using docker compose #180

Closed HFulcher closed 2 months ago

HFulcher commented 11 months ago

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!

jacalfonso commented 8 months ago

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
kuba-04 commented 3 months ago

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