metz-sh / simulacrum-self-host

Self host metz.sh!
https://metz.sh
GNU Affero General Public License v3.0
3 stars 0 forks source link

rust error when docker start #1

Closed uraurora closed 3 weeks ago

uraurora commented 1 month ago

I am deploying the application using docker compose without changing any configuration, and a Rust error during the startup process. Since I am not familiar with Rust, I cannot figure out what happened. The full log is as follows.

[2024-Sep-10 10:13:54.335833] Starting deployment of metz-sh to experimental.
[2024-Sep-10 10:13:54.493878] Preparing container with helper image: ghcr.io/coollabsio/coolify-helper:latest.
[2024-Sep-10 10:13:54.582961]

[COMMAND] docker rm -f l4ook44o48wskwsocwoosws8
[OUTPUT]
Error response from daemon: No such container: l4ook44o48wskwsocwoosws8

[2024-Sep-10 10:13:54.694669]

[COMMAND] docker run -d --network a8wo48s --name l4ook44o48wskwsocwoosws8 --rm -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/coollabsio/coolify-helper:latest
[OUTPUT]
401f468893013b62b04b5444eaacd575d022753997176d9e4828ea5c766fb5c1

[2024-Sep-10 10:13:56.242705]

[COMMAND] docker exec l4ook44o48wskwsocwoosws8 bash -c 'GIT_SSH_COMMAND="ssh -o ConnectTimeout=30 -p 22 -o Port=22 -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" git ls-remote https://github.com/metz-sh/simulacrum-self-host main'
[OUTPUT]
67c29008f438209985259600fdc98af251d30905 refs/heads/main

[2024-Sep-10 10:13:56.250516] ----------------------------------------
[2024-Sep-10 10:13:56.251463] Importing metz-sh/simulacrum-self-host:main (commit sha HEAD) to /artifacts/l4ook44o48wskwsocwoosws8.
[2024-Sep-10 10:13:56.377406]

[COMMAND] docker exec l4ook44o48wskwsocwoosws8 bash -c 'git clone -b "main" https://github.com/metz-sh/simulacrum-self-host /artifacts/l4ook44o48wskwsocwoosws8 && cd /artifacts/l4ook44o48wskwsocwoosws8 && sed -i "s#git@\(.*\):#https://\1/#g" /artifacts/l4ook44o48wskwsocwoosws8/.gitmodules || true && cd /artifacts/l4ook44o48wskwsocwoosws8 && GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" git submodule update --init --recursive && cd /artifacts/l4ook44o48wskwsocwoosws8 && GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" git lfs pull'
[OUTPUT]
Cloning into '/artifacts/l4ook44o48wskwsocwoosws8'...

[2024-Sep-10 10:14:02.058454]

[COMMAND] docker exec l4ook44o48wskwsocwoosws8 bash -c 'git clone -b "main" https://github.com/metz-sh/simulacrum-self-host /artifacts/l4ook44o48wskwsocwoosws8 && cd /artifacts/l4ook44o48wskwsocwoosws8 && sed -i "s#git@\(.*\):#https://\1/#g" /artifacts/l4ook44o48wskwsocwoosws8/.gitmodules || true && cd /artifacts/l4ook44o48wskwsocwoosws8 && GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" git submodule update --init --recursive && cd /artifacts/l4ook44o48wskwsocwoosws8 && GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" git lfs pull'
[OUTPUT]
sed: /artifacts/l4ook44o48wskwsocwoosws8/.gitmodules: No such file or directory

[2024-Sep-10 10:14:02.502985]

[COMMAND] docker exec l4ook44o48wskwsocwoosws8 bash -c 'cd /artifacts/l4ook44o48wskwsocwoosws8 && git log -1 67c29008f438209985259600fdc98af251d30905 --pretty=%B'
[OUTPUT]
Update README.md

[2024-Sep-10 10:14:08.137231] Pulling & building required images.
[2024-Sep-10 10:14:08.644789]

[COMMAND] docker exec l4ook44o48wskwsocwoosws8 bash -c 'SOURCE_COMMIT=67c29008f438209985259600fdc98af251d30905 COOLIFY_BRANCH=main docker compose --env-file /artifacts/l4ook44o48wskwsocwoosws8/.env --project-name g880sc48osg0ws8ggwgw808w --project-directory /artifacts/l4ook44o48wskwsocwoosws8 -f /artifacts/l4ook44o48wskwsocwoosws8/docker-compose.yaml build --pull'
[OUTPUT]
#0 building with "default" instance using docker driver

#1 [server internal] load build definition from Dockerfile
#1 transferring dockerfile: 1.00kB done
#1 DONE 0.0s

#2 [server internal] load metadata for docker.io/lukemathwalker/cargo-chef:0.1.66-rust-slim-bookworm

[2024-Sep-10 10:14:10.465199]

[COMMAND] docker exec l4ook44o48wskwsocwoosws8 bash -c 'SOURCE_COMMIT=67c29008f438209985259600fdc98af251d30905 COOLIFY_BRANCH=main docker compose --env-file /artifacts/l4ook44o48wskwsocwoosws8/.env --project-name g880sc48osg0ws8ggwgw808w --project-directory /artifacts/l4ook44o48wskwsocwoosws8 -f /artifacts/l4ook44o48wskwsocwoosws8/docker-compose.yaml build --pull'
[OUTPUT]
#2 ...

#3 [server internal] load metadata for docker.io/library/debian:trixie-slim
#3 DONE 2.0s

[2024-Sep-10 10:14:10.640669]

[COMMAND] docker exec l4ook44o48wskwsocwoosws8 bash -c 'SOURCE_COMMIT=67c29008f438209985259600fdc98af251d30905 COOLIFY_BRANCH=main docker compose --env-file /artifacts/l4ook44o48wskwsocwoosws8/.env --project-name g880sc48osg0ws8ggwgw808w --project-directory /artifacts/l4ook44o48wskwsocwoosws8 -f /artifacts/l4ook44o48wskwsocwoosws8/docker-compose.yaml build --pull'
[OUTPUT]
#2 [server internal] load metadata for docker.io/lukemathwalker/cargo-chef:0.1.66-rust-slim-bookworm
#2 DONE 2.0s

#4 [server internal] load .dockerignore
#4 transferring context: 112B done
#4 DONE 0.0s

#5 [server runtime 1/5] FROM docker.io/library/debian:trixie-slim@sha256:43788d0fe1fee841d09707fbb9355c938c6eb5b0c6bde2de31a07443f1bc6750
#5 DONE 0.0s

#6 [server runtime 2/5] WORKDIR app
#6 CACHED

#7 [server runtime 3/5] RUN apt-get update
#7 CACHED

#8 [server runtime 4/5] RUN apt-get -y install openssl libssl-dev ca-certificates curl
#8 CACHED

#9 [server chef 1/2] FROM docker.io/lukemathwalker/cargo-chef:0.1.66-rust-slim-bookworm@sha256:2ca0f1f2e81dff0ab84bddca351d55561916e8cc1c23bfa7d99e7eebd8daa3e1
#9 DONE 0.0s

#10 [server internal] load build context
#10 transferring context: 216.77kB done
#10 DONE 0.0s

#11 [server builder 1/6] COPY --from=planner /app/recipe.json recipe.json
#11 CACHED

#12 [server planner 2/2] RUN cargo chef prepare --recipe-path recipe.json
#12 CACHED

#13 [server builder 3/6] RUN apt-get -y install libssl-dev pkg-config libpkgconf3 pkgconf pkgconf-bin
#13 CACHED

#14 [server builder 4/6] RUN cargo chef cook --release --recipe-path recipe.json
#14 CACHED

#15 [server chef 2/2] WORKDIR app
#15 CACHED

#16 [server builder 2/6] RUN apt-get update
#16 CACHED

#17 [server planner 1/2] COPY . .
#17 CACHED

#18 [server builder 5/6] COPY . .
#18 CACHED

#19 [server builder 6/6] RUN cargo build --release --bin rusty-backend

[2024-Sep-10 10:14:10.907132]

[COMMAND] docker exec l4ook44o48wskwsocwoosws8 bash -c 'SOURCE_COMMIT=67c29008f438209985259600fdc98af251d30905 COOLIFY_BRANCH=main docker compose --env-file /artifacts/l4ook44o48wskwsocwoosws8/.env --project-name g880sc48osg0ws8ggwgw808w --project-directory /artifacts/l4ook44o48wskwsocwoosws8 -f /artifacts/l4ook44o48wskwsocwoosws8/docker-compose.yaml build --pull'
[OUTPUT]
#19 0.418 Compiling rusty-backend v0.1.0 (/app)

[2024-Sep-10 10:14:11.223487]

[COMMAND] docker exec l4ook44o48wskwsocwoosws8 bash -c 'SOURCE_COMMIT=67c29008f438209985259600fdc98af251d30905 COOLIFY_BRANCH=main docker compose --env-file /artifacts/l4ook44o48wskwsocwoosws8/.env --project-name g880sc48osg0ws8ggwgw808w --project-directory /artifacts/l4ook44o48wskwsocwoosws8 -f /artifacts/l4ook44o48wskwsocwoosws8/docker-compose.yaml build --pull'
[OUTPUT]
#19 0.734 error[E0599]: no method named `build_sqlx` found for mutable reference `&mut sea_query::UpdateStatement` in the current scope
#19 0.734 --> src/repositories/project_repository.rs:155:10
#19 0.734 |
#19 0.734 144 | let (sql, values) = Query::update()
#19 0.734 | _____________________________-
#19 0.734 145 | | .table(TableRef::Table(SIden(TABLE).into_iden()))
#19 0.734 146 | | .values(update_values)
#19 0.734 147 | | .and_where(Expr::col(ProjectIden::Id).eq(project_id))
#19 0.734 ... |
#19 0.734 154 | | ]))
#19 0.734 155 | | .build_sqlx(PostgresQueryBuilder);
#19 0.734 | |_________-^^^^^^^^^^
#19 0.734 |
#19 0.734 help: there is a method `build` with a similar name
#19 0.734 |
#19 0.734 155 | .build(PostgresQueryBuilder);
#19 0.734 | ~~~~~
#19 0.734

[2024-Sep-10 10:14:11.375927]

[COMMAND] docker exec l4ook44o48wskwsocwoosws8 bash -c 'SOURCE_COMMIT=67c29008f438209985259600fdc98af251d30905 COOLIFY_BRANCH=main docker compose --env-file /artifacts/l4ook44o48wskwsocwoosws8/.env --project-name g880sc48osg0ws8ggwgw808w --project-directory /artifacts/l4ook44o48wskwsocwoosws8 -f /artifacts/l4ook44o48wskwsocwoosws8/docker-compose.yaml build --pull'
[OUTPUT]
#19 0.736 error[E0277]: the size for values of type `str` cannot be known at compilation time
#19 0.736 --> src/repositories/project_repository.rs:144:14
#19 0.736 |
#19 0.736 144 | let (sql, values) = Query::update()
#19 0.736 | ^^^ doesn't have a size known at compile-time
#19 0.736 |
#19 0.736 = help: the trait `Sized` is not implemented for `str`
#19 0.736 = note: all local variables must have a statically known size
#19 0.736 = help: unsized locals are gated as an unstable feature
#19 0.736

[2024-Sep-10 10:14:11.418787]

[COMMAND] docker exec l4ook44o48wskwsocwoosws8 bash -c 'SOURCE_COMMIT=67c29008f438209985259600fdc98af251d30905 COOLIFY_BRANCH=main docker compose --env-file /artifacts/l4ook44o48wskwsocwoosws8/.env --project-name g880sc48osg0ws8ggwgw808w --project-directory /artifacts/l4ook44o48wskwsocwoosws8 -f /artifacts/l4ook44o48wskwsocwoosws8/docker-compose.yaml build --pull'
[OUTPUT]
#19 0.930 warning: unused import: `sea_query_binder::SqlxBinder`
#19 0.930 --> src/repositories/project_repository.rs:4:5
#19 0.930 |
#19 0.930 4 | use sea_query_binder::SqlxBinder;
#19 0.930 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#19 0.930 |
#19 0.930 = note: `#[warn(unused_imports)]` on by default
#19 0.930

[2024-Sep-10 10:14:11.572356]

[COMMAND] docker exec l4ook44o48wskwsocwoosws8 bash -c 'SOURCE_COMMIT=67c29008f438209985259600fdc98af251d30905 COOLIFY_BRANCH=main docker compose --env-file /artifacts/l4ook44o48wskwsocwoosws8/.env --project-name g880sc48osg0ws8ggwgw808w --project-directory /artifacts/l4ook44o48wskwsocwoosws8 -f /artifacts/l4ook44o48wskwsocwoosws8/docker-compose.yaml build --pull'
[OUTPUT]
#19 1.083 Some errors have detailed explanations: E0277, E0599.
#19 1.083 For more information about an error, try `rustc --explain E0277`.

[2024-Sep-10 10:14:11.734911]

[COMMAND] docker exec l4ook44o48wskwsocwoosws8 bash -c 'SOURCE_COMMIT=67c29008f438209985259600fdc98af251d30905 COOLIFY_BRANCH=main docker compose --env-file /artifacts/l4ook44o48wskwsocwoosws8/.env --project-name g880sc48osg0ws8ggwgw808w --project-directory /artifacts/l4ook44o48wskwsocwoosws8 -f /artifacts/l4ook44o48wskwsocwoosws8/docker-compose.yaml build --pull'
[OUTPUT]
#19 1.095 warning: `rusty-backend` (lib) generated 1 warning
#19 1.095 error: could not compile `rusty-backend` (lib) due to 2 previous errors; 1 warning emitted

[2024-Sep-10 10:14:11.797384]

[COMMAND] docker exec l4ook44o48wskwsocwoosws8 bash -c 'SOURCE_COMMIT=67c29008f438209985259600fdc98af251d30905 COOLIFY_BRANCH=main docker compose --env-file /artifacts/l4ook44o48wskwsocwoosws8/.env --project-name g880sc48osg0ws8ggwgw808w --project-directory /artifacts/l4ook44o48wskwsocwoosws8 -f /artifacts/l4ook44o48wskwsocwoosws8/docker-compose.yaml build --pull'
[OUTPUT]
#19 ERROR: process "/bin/sh -c cargo build --release --bin rusty-backend" did not complete successfully: exit code: 101

[2024-Sep-10 10:14:11.811804]

[COMMAND] docker exec l4ook44o48wskwsocwoosws8 bash -c 'SOURCE_COMMIT=67c29008f438209985259600fdc98af251d30905 COOLIFY_BRANCH=main docker compose --env-file /artifacts/l4ook44o48wskwsocwoosws8/.env --project-name g880sc48osg0ws8ggwgw808w --project-directory /artifacts/l4ook44o48wskwsocwoosws8 -f /artifacts/l4ook44o48wskwsocwoosws8/docker-compose.yaml build --pull'
[OUTPUT]
------
> [server builder 6/6] RUN cargo build --release --bin rusty-backend:
0.930 |
0.930 4 | use sea_query_binder::SqlxBinder;
0.930 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0.930 |
0.930 = note: `#[warn(unused_imports)]` on by default
0.930
1.083 Some errors have detailed explanations: E0277, E0599.
1.083 For more information about an error, try `rustc --explain E0277`.
1.095 warning: `rusty-backend` (lib) generated 1 warning
1.095 error: could not compile `rusty-backend` (lib) due to 2 previous errors; 1 warning emitted
------

[2024-Sep-10 10:14:11.813442]

[COMMAND] docker exec l4ook44o48wskwsocwoosws8 bash -c 'SOURCE_COMMIT=67c29008f438209985259600fdc98af251d30905 COOLIFY_BRANCH=main docker compose --env-file /artifacts/l4ook44o48wskwsocwoosws8/.env --project-name g880sc48osg0ws8ggwgw808w --project-directory /artifacts/l4ook44o48wskwsocwoosws8 -f /artifacts/l4ook44o48wskwsocwoosws8/docker-compose.yaml build --pull'
[OUTPUT]
failed to solve: process "/bin/sh -c cargo build --release --bin rusty-backend" did not complete successfully: exit code: 101

[2024-Sep-10 10:14:11.847484] Oops something is not okay, are you okay? 😢

[2024-Sep-10 10:14:11.849250] failed to solve: process "/bin/sh -c cargo build --release --bin rusty-backend" did not complete successfully: exit code: 101
iostreamer-X commented 1 month ago

Hello @uraurora, thank you for reporting!

A particular dependency didn't get its version pinned, leading to this. It's fixed in this PR: #2 and already merged.

Can you please try again?

uraurora commented 4 weeks ago

@iostreamer-X alright i tried again, and a runtime error occured this time, it seems related to 'config.json'. Am i supposed to config anything? And full log here:

thread 'main' panicked at src/common/settings/mod.rs:82:35:
Could not load config! configuration file "./config.json" not found
stack backtrace:
   0:     0x555ac347eef2 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hffecb437d922f988
   1:     0x555ac34a84dc - core::fmt::write::hd9a8d7d029f9ea1a
   2:     0x555ac347bc7f - std::io::Write::write_fmt::h0e1226b2b8d973fe
   3:     0x555ac347ecc4 - std::sys_common::backtrace::print::he907f6ad7eee41cb
   4:     0x555ac348047b - std::panicking::default_hook::{{closure}}::h3926193b61c9ca9b
   5:     0x555ac34801d3 - std::panicking::default_hook::h25ba2457dea68e65
   6:     0x555ac348091d - std::panicking::rust_panic_with_hook::h0ad14d90dcf5224f
   7:     0x555ac34807f2 - std::panicking::begin_panic_handler::{{closure}}::h4a1838a06f542647
   8:     0x555ac347f3c6 - std::sys_common::backtrace::__rust_end_short_backtrace::h77cc4dc3567ca904
   9:     0x555ac3480524 - rust_begin_unwind
  10:     0x555ac2fd2dc5 - core::panicking::panic_fmt::h940d4fd01a4b4fd1
  11:     0x555ac2fb2c69 - std::sys::sync::once::futex::Once::call::hea42e03bc76d2587
  12:     0x555ac2faca00 - std::sync::once_lock::OnceLock<T>::initialize::h8d4e62d0d1f98454
  13:     0x555ac304c2b0 - rusty_backend::common::settings::settings::h2ecb92b439b266a6
  14:     0x555ac3005396 - tokio::runtime::park::CachedParkThread::block_on::h03676419d0641067
  15:     0x555ac2ff6782 - tokio::runtime::context::runtime::enter_runtime::h7f45ac8a7eeb08bc
  16:     0x555ac30132ae - tokio::runtime::runtime::Runtime::block_on::h22032340f42f925d
  17:     0x555ac3021d4a - rusty_backend::main::hd2f82f9b97b19bbd
  18:     0x555ac300e873 - std::sys_common::backtrace::__rust_begin_short_backtrace::h9fce6f36bc453ba7
  19:     0x555ac3014399 - std::rt::lang_start::{{closure}}::h61b6d56c2d4cfa1c
  20:     0x555ac3475593 - std::rt::lang_start_internal::h103c42a9c4e95084
  21:     0x555ac3021e05 - main
  22:     0x7f72b326bdba - <unknown>
  23:     0x7f72b326be75 - __libc_start_main
  24:     0x555ac2fd3471 - _start
  25:                0x0 - <unknown>
iostreamer-X commented 4 weeks ago

Hey @uraurora

Context

Both rusty-backend and app.metz need to be configured, but they come along with a configuration that works out of the box.

The error you encountered seems to be coming from rusty-backend. It indeed relies on a config.json ONLY IF the config is not being provided through environment variables.

If you set the env LOAD_CONFIG_FROM_ENV=true, it will not attempt to load on file, rather will look for config on environment.

Problem

The docker-compose.yaml file has this configured on line 20.

Based on your logs that you shared in your first comment, this is how it's kicking off the process:

[COMMAND] docker exec l4ook44o48wskwsocwoosws8 bash -c 'SOURCE_COMMIT=67c29008f438209985259600fdc98af251d30905 COOLIFY_BRANCH=main docker compose --env-file /artifacts/l4ook44o48wskwsocwoosws8/.env --project-name g880sc48osg0ws8ggwgw808w --project-directory /artifacts/l4ook44o48wskwsocwoosws8 -f /artifacts/l4ook44o48wskwsocwoosws8/docker-compose.yaml build --pull'
[OUTPUT]
#0 building with "default" instance using docker driver

Notice --env-file /artifacts/l4ook44o48wskwsocwoosws8/.env, which is probably overriding the env-file configuration in docker-compose.yaml.

Possible Solution

Can you please try removing the part which loads another .env and let the compose file do it?

Alternatively, look at:

These are environment variables that need to be present.

uraurora commented 4 weeks ago

Hey @uraurora

Context

Both rusty-backend and app.metz need to be configured, but they come along with a configuration that works out of the box.

The error you encountered seems to be coming from rusty-backend. It indeed relies on a config.json ONLY IF the config is not being provided through environment variables.

If you set the env LOAD_CONFIG_FROM_ENV=true, it will not attempt to load on file, rather will look for config on environment.

Problem

The docker-compose.yaml file has this configured on line 20.

Based on your logs that you shared in your first comment, this is how it's kicking off the process:

[COMMAND] docker exec l4ook44o48wskwsocwoosws8 bash -c 'SOURCE_COMMIT=67c29008f438209985259600fdc98af251d30905 COOLIFY_BRANCH=main docker compose --env-file /artifacts/l4ook44o48wskwsocwoosws8/.env --project-name g880sc48osg0ws8ggwgw808w --project-directory /artifacts/l4ook44o48wskwsocwoosws8 -f /artifacts/l4ook44o48wskwsocwoosws8/docker-compose.yaml build --pull'
[OUTPUT]
#0 building with "default" instance using docker driver

Notice --env-file /artifacts/l4ook44o48wskwsocwoosws8/.env, which is probably overriding the env-file configuration in docker-compose.yaml.

Possible Solution

Can you please try removing the part which loads another .env and let the compose file do it?

Alternatively, look at:

These are environment variables that need to be present.

Oh, I didn't notice that the configuration file had changed, it starts successfully now, thanks😁.

uraurora commented 4 weeks ago

It seems that success is just one step away, when accessing the page, it remains in a loading state as shown below, but i cannot find anything wrong from the log image

iostreamer-X commented 4 weeks ago

Whoa, that's weird. Can you please check network logs from browser?

My guess is the frontend app is not able to reach the server. Given server port is unchanged, can you please try reaching the server from your terminal?

curl -v http://localhost:3117/health
uraurora commented 4 weeks ago

yeah, pretty weird, the result seems fine

*   Trying 192.168.254.193:3117...
* Connected to 192.168.254.193 (192.168.254.193) port 3117 (#0)
> GET /health HTTP/1.1
> Host: 192.168.254.193:3117
> User-Agent: curl/7.79.1
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< content-length: 0
< date: Thu, 12 Sep 2024 01:31:53 GMT
<
* Connection #0 to host 192.168.254.193 left intact

I tried my local env instead of remote and it works well, so sure its my net issue, i'll handle it myself, thanks😁

iostreamer-X commented 3 weeks ago

Anytime! Thank you for reporting.