fmeringdal / nettu-scheduler

A self-hosted calendar and scheduler server.
MIT License
535 stars 27 forks source link

thread 'main' panicked at 'To create default account' #15

Closed jjdonov closed 2 years ago

jjdonov commented 3 years ago

Hi there, found this repo through an old HN thread and am very excited by it as it seems to have a lot of great features. Great work!

The instructions for cargo run works perfectly 👌 but unfortunately, I am hitting some issues when using the nettu-scheduler:latest image.

I've enabled RUST_BACKTRACE=full incase it is helpful in debugging.

docker run -p 5000:5000 -e RUST_BACKTRACE=full -e ACCOUNT_API_KEY="JOHN" -e DATABASE_URL="postgresql://postgres:postgres@localhost:5432/nettuscheduler" fmeringdal/nettu-scheduler:latest

thread 'main' panicked at 'To create default account: pool timed out while waiting for an open connection', /home/rust/crates/api/src/lib.rs:172:18
stack backtrace:
   0:     0x5615e1f970f0 - std::backtrace_rs::backtrace::libunwind::trace::ha5edb8ba5c6b7a6c
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x5615e1f970f0 - std::backtrace_rs::backtrace::trace_unsynchronized::h0de86d320a827db2
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x5615e1f970f0 - std::sys_common::backtrace::_print_fmt::h97b9ad6f0a1380ff
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x5615e1f970f0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h14be7eb08f97fe80
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x5615e1fbab8f - core::fmt::write::h2ca8877d3e0e52de
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/fmt/mod.rs:1094:17
   5:     0x5615e1f90ff5 - std::io::Write::write_fmt::h64f5987220b618f4
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/io/mod.rs:1584:15
   6:     0x5615e1f9922b - std::sys_common::backtrace::_print::h7f1a4097308f2e0a
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x5615e1f9922b - std::sys_common::backtrace::print::h1f799fc2ca7f5035
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x5615e1f9922b - std::panicking::default_hook::{{closure}}::hf38436e8a3ce1071
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:208:50
   9:     0x5615e1f98cfd - std::panicking::default_hook::he2f8f3fae11ed1dd
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:225:9
  10:     0x5615e1f9983d - std::panicking::rust_panic_with_hook::h79a18548bd90c7d4
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:591:17
  11:     0x5615e1f993d7 - std::panicking::begin_panic_handler::{{closure}}::h212a72cc08e25126
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:497:13
{"v":0,"name":"nettu_scheduler_server","msg":"[USECASE EXECUTED BY ACCOUNT - END]","level":30,"hostname":"c7062d1a04f1","pid":1,"time":"2021-08-17T00:20:29.116945900+00:00","target":"nettu_scheduler_api::shared::usecase","line":68,"file":"crates/api/src/shared/usecase.rs","usecase":"SyncEventReminders","elapsed_milliseconds":60024}
{"v":0,"name":"nettu_scheduler_server","msg":"[USECASE EXECUTED BY ACCOUNT - END]","level":30,"hostname":"c7062d1a04f1","pid":1,"time":"2021-08-17T00:20:29.117019500+00:00","target":"nettu_scheduler_api::shared::usecase","line":68,"file":"crates/api/src/shared/usecase.rs","usecase":"GetUpcomingReminders","elapsed_milliseconds":29023}
  12:     0x5615e1f9758c - std::sys_common::backtrace::__rust_end_short_backtrace::hbd6897dd42bc0fcd
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/sys_common/backtrace.rs:141:18
  13:     0x5615e1f99339 - rust_begin_unwind
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:493:5
  14:     0x5615e160b4a1 - core::panicking::panic_fmt::h77ecd04e9b1dd84d
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/panicking.rs:92:14
  15:     0x5615e160b593 - core::result::unwrap_failed::hcbdf25d28ce8f0ca
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/result.rs:1355:5
  16:     0x5615e16af6bb - nettu_scheduler::main::{{closure}}::h8b52303dba30fd4d
  17:     0x5615e1662e90 - <tokio::task::local::RunUntil<T> as core::future::future::Future>::poll::hb7651b6179296dd1
  18:     0x5615e16aa94c - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hd9c78b3724817a0e
  19:     0x5615e1660f69 - tokio::runtime::basic_scheduler::BasicScheduler<P>::block_on::h060d79147c4f7119
  20:     0x5615e162ef11 - tokio::runtime::context::enter::h1854e0d2ef3876fd
  21:     0x5615e167ea85 - tokio::runtime::handle::Handle::enter::h0fb8c9743be40152
  22:     0x5615e1695747 - nettu_scheduler::main::h5db2b16262521d9c
  23:     0x5615e16bb6c3 - std::sys_common::backtrace::__rust_begin_short_backtrace::heffc8041cb84f74e
  24:     0x5615e16bb6d9 - std::rt::lang_start::{{closure}}::h634ffa86d9b93813
  25:     0x5615e1f99d3a - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hc4354216bf39217c
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/ops/function.rs:259:13
  26:     0x5615e1f99d3a - std::panicking::try::do_call::hb68eb312780385cf
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:379:40
  27:     0x5615e1f99d3a - std::panicking::try::h22b8e08595060b8b
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:343:19
  28:     0x5615e1f99d3a - std::panic::catch_unwind::hc64f1a6a0e71b1fc
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panic.rs:431:14
  29:     0x5615e1f99d3a - std::rt::lang_start_internal::h4461fc58637f04f8
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/rt.rs:34:21
  30:     0x5615e16957f2 - main
  31:     0x7f1bcf35b0b3 - __libc_start_main
  32:     0x5615e160bc1e - _start
  33:                0x0 - <unknown>
Panic in Arbiter thread.

Is this a known issue? (And apologies in advance in case this is user error 😉 )

fmeringdal commented 3 years ago

Hi @jjdonov ,

The readme seems to be a little bit outdated, sorry about that. The issue is the localhost part in your connection string. Docker is not running in your host network so localhost for your docker container is not the same as localhost for your host machine where postgres is available.

If you are not on Mac you can add this flag and it should work: --network host. This is the reason why it wont work on Mac.

If you are a Mac you can use the docker bridge ip instead of localhost, which is 172.17.0.1

jjdonov commented 3 years ago

🤦 thanks @fmeringdal that makes sense. Would you be open to a PR to get the README fixed up?

fmeringdal commented 3 years ago

@jjdonov Absolutely! :)

jjdonov commented 2 years ago

Sorry for the slow response here, your reply got buried in my inbox. I see 2a4c88d4c054fd6d0e9e790ee3d04d86473e178f removed the docker instructions from the readme. I'm taking that to mean cargo is the preferred way of running this, and will close this issue 👍