atuinsh / atuin

✨ Magical shell history
https://atuin.sh
MIT License
18.54k stars 520 forks source link

Unable to resolve `.local` address using docker on pi #2192

Open deepanchal opened 4 days ago

deepanchal commented 4 days ago

Description

I'm encountering an issue with Atuin running on my Raspberry Pi using Docker. When accessing Atuin through the local IP address (e.g., 192.168.0.90), it works perfectly. However, it fails when trying to connect using the .local address.

❯ curl http://beacon.local:8888/sync/status
{"reason":"missing authorization header"}                                                                       

❯ atuin status
Error: error sending request for url (http://beacon.local:8888/sync/status): error trying to connect: operation timed out

Caused by:
   0: error trying to connect: operation timed out
   1: operation timed out

Location:
    /build/source/atuin-client/src/api_client.rs:225:20

Steps to Reproduce:

Here's my docker-compose.yml:

services:
  atuin:
    restart: always
    image: ghcr.io/atuinsh/atuin:18.2.0
    command: server start
    volumes:
      - "./config:/config"
    links:
      - postgresql:db
    ports:
      - 8888:8888
    user: "0:0"
    environment:
      ATUIN_HOST: "0.0.0.0"
      ATUIN_OPEN_REGISTRATION: "true"
      ATUIN_DB_URI: postgres://$ATUIN_DB_USERNAME:$ATUIN_DB_PASSWORD@db/$ATUIN_DB_NAME
      RUST_LOG: info,atuin_server=debug
  postgresql:
    image: postgres:14
    restart: unless-stopped
    volumes: # Don't remove permanent storage for index database files!
      - "./database:/var/lib/postgresql/data/"
    environment:
      POSTGRES_USER: ${ATUIN_DB_USERNAME}
      POSTGRES_PASSWORD: ${ATUIN_DB_PASSWORD}
      POSTGRES_DB: ${ATUIN_DB_NAME}

Environment Details

Atuin version: 18.2.0 Docker version: Docker version 26.1.4, build 5650f9b Docker compose version: Docker Compose version v2.27.1 Raspberry Pi model and OS: Raspberry Pi 4 Model B Rev 1.4 8GB RAM running Raspberry Pi OS Lite

Atuin doctor output:

Atuin Doctor
Checking for diagnostics

Please include the output below with any bug reports or issues

atuin:
  version: 18.2.0
  sync:
    cloud: false
    records: false
    auto_sync: true
    last_sync: 2024-06-24 18:18:51.051533645 +00:00:00
shell:
  name: zsh
  default: unknown
  plugins:
  - atuin
system:
  os: Manjaro Linux
  arch: x86_64
  version: 24.0.2
  disks:
  - name: /dev/nvme1n1p4
    filesystem: btrfs
  - name: /dev/nvme1n1p4
    filesystem: btrfs
  - name: /dev/nvme1n1p4
    filesystem: btrfs
  - name: /dev/nvme1n1p4
    filesystem: btrfs
  - name: /dev/nvme1n1p4
    filesystem: btrfs
  - name: /dev/nvme1n1p4
    filesystem: btrfs
  - name: /dev/nvme1n1p4
    filesystem: btrfs
  - name: /dev/nvme1n1p1
    filesystem: vfat
  - name: /dev/nvme1n1p4
    filesystem: btrfs
  - name: /dev/nvme1n1p4
    filesystem: btrfs
  - name: /dev/nvme1n1p4
    filesystem: btrfs
  - name: /dev/nvme1n1p4
    filesystem: btrfs
  - name: /dev/nvme1n1p4
    filesystem: btrfs
  - name: /dev/nvme1n1p4
    filesystem: btrfs
  - name: /dev/nvme1n1p4
    filesystem: btrfs
  - name: /dev/nvme1n1p4
    filesystem: btrfs
  - name: /dev/nvme1n1p4
    filesystem: btrfs
ellie commented 4 days ago

Thanks for all the detail! Could you also try running with

ATUIN_LOG=debug atuin sync

and share the output?

deepanchal commented 4 days ago
❯ ATUIN_LOG=debug atuin sync
[2024-06-24T18:53:54Z DEBUG atuin_client::database] opening sqlite database at "/home/deep/.local/share/atuin/history.db"
[2024-06-24T18:53:54Z DEBUG sqlx::query] summary="PRAGMA journal_mode = WAL; …" db.statement="\n\nPRAGMA journal_mode = WAL;\nPRAGMA foreign_keys = ON;\nPRAGMA synchronous = NORMAL;\n" rows_affected=0 rows_returned=1 elapsed=473.691µs
[2024-06-24T18:53:54Z DEBUG atuin_client::database] running sqlite database setup
[2024-06-24T18:53:54Z DEBUG sqlx::query] summary="CREATE TABLE IF NOT …" db.statement="\n\nCREATE TABLE IF NOT EXISTS _sqlx_migrations (\n  version BIGINT PRIMARY KEY,\n  description TEXT NOT NULL,\n  installed_on TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n  success BOOLEAN NOT NULL,\n  checksum BLOB NOT NULL,\n  execution_time BIGINT NOT NULL\n);\n" rows_affected=0 rows_returned=0 elapsed=17.463µs
[2024-06-24T18:53:54Z DEBUG sqlx::query] summary="SELECT version FROM _sqlx_migrations …" db.statement="\n\nSELECT\n  version\nFROM\n  _sqlx_migrations\nWHERE\n  success = false\nORDER BY\n  version\nLIMIT\n  1\n" rows_affected=0 rows_returned=0 elapsed=43.673µs
[2024-06-24T18:53:54Z DEBUG sqlx::query] summary="SELECT version, checksum FROM …" db.statement="\n\nSELECT\n  version,\n  checksum\nFROM\n  _sqlx_migrations\nORDER BY\n  version\n" rows_affected=0 rows_returned=5 elapsed=28.604µs
[2024-06-24T18:53:54Z DEBUG atuin_client::record::sqlite_store] opening sqlite database at "/home/deep/.local/share/atuin/records.db"
[2024-06-24T18:53:54Z DEBUG sqlx::query] summary="PRAGMA journal_mode = WAL; …" db.statement="\n\nPRAGMA journal_mode = WAL;\nPRAGMA foreign_keys = ON;\n" rows_affected=0 rows_returned=1 elapsed=298.492µs
[2024-06-24T18:53:54Z DEBUG atuin_client::record::sqlite_store] running sqlite database setup
[2024-06-24T18:53:54Z DEBUG sqlx::query] summary="CREATE TABLE IF NOT …" db.statement="\n\nCREATE TABLE IF NOT EXISTS _sqlx_migrations (\n  version BIGINT PRIMARY KEY,\n  description TEXT NOT NULL,\n  installed_on TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n  success BOOLEAN NOT NULL,\n  checksum BLOB NOT NULL,\n  execution_time BIGINT NOT NULL\n);\n" rows_affected=0 rows_returned=0 elapsed=12.804µs
[2024-06-24T18:53:54Z DEBUG sqlx::query] summary="SELECT version FROM _sqlx_migrations …" db.statement="\n\nSELECT\n  version\nFROM\n  _sqlx_migrations\nWHERE\n  success = false\nORDER BY\n  version\nLIMIT\n  1\n" rows_affected=0 rows_returned=0 elapsed=39.013µs
[2024-06-24T18:53:54Z DEBUG sqlx::query] summary="SELECT version, checksum FROM …" db.statement="\n\nSELECT\n  version,\n  checksum\nFROM\n  _sqlx_migrations\nORDER BY\n  version\n" rows_affected=0 rows_returned=2 elapsed=26.63µs
[2024-06-24T18:53:54Z DEBUG atuin_client::sync] starting sync upload
[2024-06-24T18:53:54Z DEBUG reqwest::connect] starting new connection: http://beacon.local:8888/
[2024-06-24T18:53:54Z DEBUG hyper::client::connect::dns] resolving host="beacon.local"
Error: error sending request for url (http://beacon.local:8888/sync/status): error trying to connect: operation timed out

Caused by:
   0: error trying to connect: operation timed out
   1: operation timed out

Location:
    /build/source/atuin-client/src/api_client.rs:225:20