cupcakearmy / cryptgeon

cryptgeon is a secure, open source note / file sharing service inspired by PrivNote written in rust & svelte.
https://cryptgeon.org/
MIT License
849 stars 89 forks source link

Could not create note. please try again. (cannot reach redis) #136

Closed MBiesma closed 3 months ago

MBiesma commented 5 months ago

I am working on a new installation of Cryptgeon, but I am encountering an issue when creating a note. I get the following message: "Could not create note. Please try again."

It is a new installation of Ubuntu 22.04.4 LTS, in which I have installed the following packages:

docker.io/jammy-updates,now 24.0.7-0ubuntu2~22.04.1 amd64 [installed]
docker-compose/jammy,now 1.29.2-1 all [installed]

After that, I perform the Docker pull as mentioned on https://hub.docker.com/r/cupcakearmy/cryptgeon

docker pull cupcakearmy/cryptgeon

side note: The docker-compose.yml (version 3.7) on https://hub.docker.com/r/cupcakearmy/cryptgeon is using memcache instead of version 3.8 here on https://github.com/cupcakearmy/cryptgeon?tab=readme-ov-file#docker Perhaps it would be wiser to refer to the docker-compose.yml here on GitHub to avoid misunderstandings?

Then I create a docker-compose.yml file where I paste the configuration below, as mentioned on https://github.com/cupcakearmy/cryptgeon?tab=readme-ov-file#docker

# docker-compose.yml

version: '3.8'

services:
  redis:
    image: redis:7-alpine
    # Set a size limit. See link below on how to customise.
    # https://redis.io/docs/manual/eviction/
    # command: redis-server --maxmemory 1gb --maxmemory-policy allkeys-lru

  app:
    image: cupcakearmy/cryptgeon:latest
    depends_on:
      - redis
    environment:
      # Size limit for a single note.
      SIZE_LIMIT: 4 MiB
    ports:
      - 80:8000

    # Optional health checks
    # healthcheck:
    #   test: ["CMD", "curl", "--fail", "http://127.0.0.1:8000/api/live/"]
    #   interval: 1m
    #   timeout: 3s
    #   retries: 2
    #   start_period: 5s

Then I execute the docker-compose command, the output is as follows:

root@ots:/opt/cryptgeon# docker-compose up -d
Creating network "cryptgeon_default" with the default driver
Pulling redis (redis:7-alpine)...
7-alpine: Pulling from library/redis
ec99f8b99825: Pull complete
5f13f9e3fcad: Pull complete
b6acacb07995: Pull complete
b055da348004: Pull complete
27293d95c7b1: Pull complete
e49aac842805: Pull complete
4f4fb700ef54: Pull complete
f6785829ab74: Pull complete
Digest: sha256:de14eedfbd1fc871d0f5aa1773fd80743930e45354d035b6f3b551e7ffa44df8
Status: Downloaded newer image for redis:7-alpine
Creating cryptgeon_redis_1 ... done
Creating cryptgeon_app_1   ... done

Docker says everything is running:

root@ots:~# docker ps -a
CONTAINER ID   IMAGE                          COMMAND                  CREATED          STATUS         PORTS                                   NAMES
81f2e60c7799   cupcakearmy/cryptgeon:latest   "/app/cryptgeon"         38 minutes ago   Up 4 minutes   0.0.0.0:80->8000/tcp, :::80->8000/tcp   cryptgeon_app_1
26a67aa4828f   redis:7-alpine                 "docker-entrypoint.s…"   38 minutes ago   Up 7 minutes   6379/tcp                                cryptgeon_redis_1

I also tried starting redis first, wait about 10 seconds and then start the cryptgeon container.

The docker logs for the redis:7-alpine container says everything is oke:

root@ots:~# docker logs 26a67aa4828f
1:C 25 Jun 2024 09:21:47.362 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 25 Jun 2024 09:21:47.363 * Redis version=7.2.5, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 25 Jun 2024 09:21:47.363 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
1:M 25 Jun 2024 09:21:47.363 * monotonic clock: POSIX clock_gettime
1:M 25 Jun 2024 09:21:47.365 * Running mode=standalone, port=6379.
1:M 25 Jun 2024 09:21:47.365 * Server initialized
1:M 25 Jun 2024 09:21:47.365 * Loading RDB produced by version 7.2.5
1:M 25 Jun 2024 09:21:47.365 * RDB age 613 seconds
1:M 25 Jun 2024 09:21:47.366 * RDB memory usage when created 0.83 Mb
1:M 25 Jun 2024 09:21:47.366 * Done loading RDB, keys loaded: 0, keys expired: 0.
1:M 25 Jun 2024 09:21:47.366 * DB loaded from disk: 0.001 seconds
1:M 25 Jun 2024 09:21:47.366 * Ready to accept connections tcp

But the docker logs for the cupcakearmy/cryptgeon:latest container says it cannot reach redis:

root@ots:~# docker logs 81f2e60c7799
[2024-06-25T09:21:47Z ERROR cryptgeon] cannot reach redis
thread 'main' panicked at src/main.rs:28:9:
canont reach redis
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

When I add "VERBOSITY: debug" under "environment" in the "docker-compose.yml", run "docker-compose up -d", I see the following in the logs:

[2024-06-25T09:49:38Z INFO  actix_server::builder] starting 2 workers
[2024-06-25T09:49:38Z INFO  actix_server::server] Actix runtime found; starting in Actix runtime
[2024-06-25T09:49:57Z INFO  actix_web::middleware::logger] "GET / HTTP/1.1" 200 1106 0.000927
[2024-06-25T09:49:57Z INFO  actix_web::middleware::logger] "GET /_app/immutable/chunks/entry.CRVU5op8.js HTTP/1.1" 200 26534 0.001231
[2024-06-25T09:49:57Z INFO  actix_web::middleware::logger] "GET /_app/immutable/entry/start.CvCQswe2.js HTTP/1.1" 200 68 0.001593
[2024-06-25T09:49:57Z INFO  actix_web::middleware::logger] "GET /_app/immutable/chunks/scheduler.l6DJgB2B.js HTTP/1.1" 200 2986 0.001271
[2024-06-25T09:49:57Z INFO  actix_web::middleware::logger] "GET /_app/immutable/chunks/index._h4b3mIy.js HTTP/1.1" 200 928 0.000580
[2024-06-25T09:49:57Z INFO  actix_web::middleware::logger] "GET /_app/immutable/chunks/preload-helper.BQ24v_F8.js HTTP/1.1" 200 908 0.000387
[2024-06-25T09:49:57Z INFO  actix_web::middleware::logger] "GET /_app/immutable/entry/app.CqqdEiW-.js HTTP/1.1" 200 5880 0.001242
[2024-06-25T09:49:57Z INFO  actix_web::middleware::logger] "GET /_app/immutable/chunks/index.9kvN9rct.js HTTP/1.1" 200 11511 0.000627
[2024-06-25T09:49:57Z DEBUG actix_files::service] error handling /favicon.ico: No such file or directory (os error 2)
[2024-06-25T09:49:57Z INFO  actix_web::middleware::logger] "GET /favicon.ico HTTP/1.1" 200 1106 0.000509
[2024-06-25T09:49:57Z INFO  actix_web::middleware::logger] "GET /api/status/ HTTP/1.1" 200 219 0.000317

When I use "VERBOSITY: trace" under "environment" in the "docker-compose.yml", run "docker-compose up -d", I see the following in the logs:

[2024-06-25T09:56:53Z INFO  actix_server::builder] starting 2 workers
[2024-06-25T09:56:53Z INFO  actix_server::server] Actix runtime found; starting in Actix runtime
[2024-06-25T09:56:53Z TRACE actix_server::worker] starting server worker 0
[2024-06-25T09:56:53Z TRACE mio::poll] registering event source with poller: token=Token(1), interests=READABLE
[2024-06-25T09:56:53Z TRACE actix_web::middleware::logger] Access log format: "%r" %s %b %T
[2024-06-25T09:56:53Z TRACE actix_server::worker] starting server worker 1
[2024-06-25T09:56:53Z TRACE actix_server::worker] service "actix-web-service-0.0.0.0:8000" is available
[2024-06-25T09:56:53Z TRACE mio::poll] registering event source with poller: token=Token(1), interests=READABLE
[2024-06-25T09:56:53Z TRACE actix_web::middleware::logger] Access log format: "%r" %s %b %T
[2024-06-25T09:56:53Z TRACE mio::poll] registering event source with poller: token=Token(0), interests=READABLE
[2024-06-25T09:56:53Z TRACE actix_server::worker] service "actix-web-service-0.0.0.0:8000" is available
[2024-06-25T09:56:53Z TRACE actix_server::signals] setting up OS signal listener
[2024-06-25T09:57:30Z TRACE mio::poll] registering event source with poller: token=Token(140223962486528), interests=READABLE | WRITABLE
[2024-06-25T09:57:30Z TRACE actix_http::h1::dispatcher] start flags: Flags(0x0)
[2024-06-25T09:57:30Z TRACE actix_http::h1::dispatcher] start timers:
[2024-06-25T09:57:30Z TRACE actix_http::h1::dispatcher]   head timer is inactive
[2024-06-25T09:57:30Z TRACE actix_http::h1::dispatcher]   keep-alive timer is inactive
[2024-06-25T09:57:30Z TRACE actix_http::h1::dispatcher]   shutdown timer is inactive
[2024-06-25T09:57:30Z TRACE actix_http::h1::dispatcher] end timers:
[2024-06-25T09:57:30Z TRACE actix_http::h1::dispatcher]   head timer is active and due to expire in 4776.4263 milliseconds
[2024-06-25T09:57:30Z TRACE actix_http::h1::dispatcher]   keep-alive timer is inactive
[2024-06-25T09:57:30Z TRACE actix_http::h1::dispatcher]   shutdown timer is inactive
[2024-06-25T09:57:30Z TRACE actix_http::h1::dispatcher] end flags: Flags(STARTED)
[2024-06-25T09:57:30Z TRACE actix_http::h1::dispatcher] start flags: Flags(STARTED)
[2024-06-25T09:57:30Z TRACE actix_http::h1::dispatcher] start timers:
[2024-06-25T09:57:30Z TRACE actix_http::h1::dispatcher]   head timer is active and due to expire in 4776.395 milliseconds
[2024-06-25T09:57:30Z TRACE actix_http::h1::dispatcher]   keep-alive timer is inactive
[2024-06-25T09:57:30Z TRACE actix_http::h1::dispatcher]   shutdown timer is inactive
[2024-06-25T09:57:30Z INFO  actix_web::middleware::logger] "GET /api/status/ HTTP/1.1" 200 219 0.000359
[2024-06-25T09:57:30Z TRACE actix_http::h1::dispatcher] end timers:
[2024-06-25T09:57:30Z TRACE actix_http::h1::dispatcher]   head timer is inactive
[2024-06-25T09:57:30Z TRACE actix_http::h1::dispatcher]   keep-alive timer is active and due to expire in 4775.8887 milliseconds
[2024-06-25T09:57:30Z TRACE actix_http::h1::dispatcher]   shutdown timer is inactive
[2024-06-25T09:57:30Z TRACE actix_http::h1::dispatcher] end flags: Flags(STARTED | FINISHED | KEEP_ALIVE)
[2024-06-25T09:57:30Z TRACE actix_http::h1::dispatcher] start flags: Flags(STARTED | FINISHED | KEEP_ALIVE)
[2024-06-25T09:57:30Z TRACE actix_http::h1::dispatcher] start timers:
[2024-06-25T09:57:30Z TRACE actix_http::h1::dispatcher]   head timer is inactive
[2024-06-25T09:57:30Z TRACE actix_http::h1::dispatcher]   keep-alive timer is active and due to expire in 4775.403 milliseconds
[2024-06-25T09:57:30Z TRACE actix_http::h1::dispatcher]   shutdown timer is inactive
[2024-06-25T09:57:30Z TRACE actix_http::h1::dispatcher] read half closed; start shutdown
[2024-06-25T09:57:30Z TRACE actix_http::h1::dispatcher] start flags: Flags(STARTED | KEEP_ALIVE | SHUTDOWN | READ_DISCONNECT)
[2024-06-25T09:57:30Z TRACE actix_http::h1::dispatcher] start timers:
[2024-06-25T09:57:30Z TRACE actix_http::h1::dispatcher]   head timer is inactive
[2024-06-25T09:57:30Z TRACE actix_http::h1::dispatcher]   keep-alive timer is active and due to expire in 4775.384 milliseconds
[2024-06-25T09:57:30Z TRACE actix_http::h1::dispatcher]   shutdown timer is inactive
[2024-06-25T09:57:30Z TRACE actix_http::h1::dispatcher] end flags: Flags(STARTED | KEEP_ALIVE | SHUTDOWN | READ_DISCONNECT)
[2024-06-25T09:57:30Z TRACE mio::poll] deregistering event source from poller

I hope you can help me out!

With kind regards,

Mark

cupcakearmy commented 3 months ago

Thanks for reporting, did not realise the docker hub readme was out of date, thanks!

cupcakearmy commented 3 months ago

Updated the readme