red-quill-28140
04/22/2023, 7:44 AMshuttle-poise = "0.14.0") that I'm building.
It works fine locally with cargo shuttle run, but I can't get it to start up properly with cargo shuttle deploy. I've tried restarting the project (cargo shuttle project restart --idle-minutes 0) for good measure.
The output I get looks like this:
2023-04-22T08:37:56.573958676Z INFO Finished release [optimized] target(s) in 32.80s
2023-04-22T08:37:56.584035103Z INFO Running unittests src/main.rs (opt/shuttle/shuttle-builds/dls-bot/target/release/deps/dls_bot-65a0a031568fb4aa)
2023-04-22T08:37:56.654605339Z INFO Entering built state
2023-04-22T08:37:56.654806880Z INFO Entering loading state
2023-04-22T08:37:56.659518514Z TRACE shuttle_deployer::runtime_manager: making new client
2023-04-22T08:37:56.663949621Z DEBUG shuttle_deployer::runtime_manager: Starting alpha runtime at: /opt/shuttle/shuttle-executables/ac9b1280-3b1e-48c3-88b5-d65808fa2789
2023-04-22T08:37:58.667368290Z INFO shuttle_proto::runtime: connecting runtime client
2023-04-22T08:37:58.667464780Z DEBUG hyper::client::connect::http: connecting to 127.0.0.1:21644
2023-04-22T08:37:58.670419758Z DEBUG hyper::client::connect::http: connected to 127.0.0.1:21644
2023-04-22T08:37:58.673072001Z DEBUG {service.ready=true} tower::buffer::worker: processing request
2023-04-22T08:37:58.675968159Z INFO shuttle_deployer::deployment::run: loading project from: /opt/shuttle/shuttle-executables/ac9b1280-3b1e-48c3-88b5-d65808fa2789
2023-04-22T08:37:58.677593420Z DEBUG shuttle_deployer::deployment::run: loading service
2023-04-22T08:37:58.679686726Z DEBUG {service.ready=true} tower::buffer::worker: processing request
Deployment has not entered the running state
I don't see any error message, or any output from my application, including the tracing::info! line at the very beginning of my shuttle_service::main. Any tips on how to debug this further? (The bot uses Secrets and Postgres.)agreeable-painting-48846
04/22/2023, 7:46 AMred-quill-28140
04/22/2023, 8:03 AMshuttle_service::main setup). Note the last line in the output ("Deployment has not entered the running state") -- as far as I can tell control never passes to my main function.red-quill-28140
04/22/2023, 8:04 AMdeploy command exits quickly, sometimes it hangs for a while with the deployment status "loading" before giving this message and marking the deployment as "stopped"red-quill-28140
04/22/2023, 8:08 AMred-quill-28140
04/22/2023, 8:08 AMproject stop, right? I think rm was renamed to stopred-quill-28140
04/22/2023, 8:08 AMproject restart)agreeable-painting-48846
04/22/2023, 8:08 AMagreeable-painting-48846
04/22/2023, 8:09 AMcargo shuttle project list after trying to re-deploy again? Just as a sanity check since I saw in a previous couple of threads that users have received this error but then checked the status of the project and it is actually runningred-quill-28140
04/22/2023, 8:10 AMstopped, but I'll post the output once it's done building in the restarted projectred-quill-28140
04/22/2023, 8:10 AMdeployment list -- project list just shows as "ready"red-quill-28140
04/22/2023, 8:11 AMā f66333b1-7787-4151-87f3-e98e82e9a60b ā loading ā 2023-04-22T08:11:27Z āred-quill-28140
04/22/2023, 8:12 AM2023-04-22T09:11:29.116858387Z DEBUG shuttle_deployer::deployment::run: loading servicered-quill-28140
04/22/2023, 8:12 AMred-quill-28140
04/22/2023, 8:12 AMagreeable-painting-48846
04/22/2023, 8:13 AMred-quill-28140
04/22/2023, 8:13 AMred-quill-28140
04/22/2023, 8:13 AMcargo shuttle runagreeable-painting-48846
04/22/2023, 8:17 AM0.14.0 right?red-quill-28140
04/22/2023, 8:17 AMCargo.lockred-quill-28140
04/22/2023, 8:19 AMgrep -A1 'name = "shuttle' Cargo.lock
name = "shuttle-codegen"
version = "0.14.0"
--
name = "shuttle-common"
version = "0.14.0"
--
name = "shuttle-poise"
version = "0.14.0"
--
name = "shuttle-proto"
version = "0.14.0"
--
name = "shuttle-runtime"
version = "0.14.0"
--
name = "shuttle-secrets"
version = "0.14.0"
--
name = "shuttle-service"
version = "0.14.0"
--
name = "shuttle-shared-db"
version = "0.14.0"agreeable-painting-48846
04/22/2023, 8:20 AMred-quill-28140
04/22/2023, 8:20 AMred-quill-28140
04/22/2023, 8:22 AMagreeable-painting-48846
04/22/2023, 8:23 AMred-quill-28140
04/22/2023, 8:25 AMred-quill-28140
04/22/2023, 8:25 AMagreeable-painting-48846
04/22/2023, 8:26 AMenough-oil-62271
04/22/2023, 12:01 PMcargo shuttle logs?enough-oil-62271
04/22/2023, 12:02 PMred-quill-28140
04/22/2023, 12:37 PM2023-04-22T09:11:29.118926415Z DEBUG {service.ready=true} tower::buffer::worker: processing requestred-quill-28140
04/22/2023, 12:38 PM2023-04-22T09:11:29.116858387Z DEBUG shuttle_deployer::deployment::run: loading service (which was the last one logged to the terminal)red-quill-28140
04/22/2023, 12:38 PMDeployment has not entered the running state line, which is not in cargo shuttle logs and is presumably a symptom of a connection timeoutenough-oil-62271
04/22/2023, 12:38 PMenough-oil-62271
04/22/2023, 12:39 PMred-quill-28140
04/22/2023, 12:39 PMenough-oil-62271
04/22/2023, 12:40 PMred-quill-28140
04/22/2023, 12:40 PMred-quill-28140
04/22/2023, 12:40 PMshuttle_service::main functionred-quill-28140
04/22/2023, 12:41 PMenough-oil-62271
04/22/2023, 12:41 PMenough-oil-62271
04/22/2023, 12:41 PMcargo shuttle project restart
2. cargo shuttle stop
3. cargo shuttle deployenough-oil-62271
04/22/2023, 12:43 PMred-quill-28140
04/22/2023, 12:43 PMred-quill-28140
04/22/2023, 12:44 PM$ cargo shuttle stop
Error: 404 Not Found
message: record could not be found
Presumably because it wasn't running?enough-oil-62271
04/22/2023, 12:44 PMenough-oil-62271
04/22/2023, 12:44 PMred-quill-28140
04/22/2023, 12:44 PMenough-oil-62271
04/22/2023, 12:44 PMred-quill-28140
04/22/2023, 12:45 PMagreeable-painting-48846
04/22/2023, 12:45 PMSecrets.dev.toml š I realise this is totally unrelated but it'll stop you needing to use cfgred-quill-28140
04/22/2023, 12:45 PMenough-oil-62271
04/22/2023, 12:45 PMagreeable-painting-48846
04/22/2023, 12:46 PMSecrets.dev.toml exists, it'll use that file first for secretsred-quill-28140
04/22/2023, 12:47 PMSecrets.toml is the mechanism for local runs. When would I have both Secrets.toml and Secrets.dev.toml?agreeable-painting-48846
04/22/2023, 12:47 PMSecrets.dev.toml file is normally for when you want two separate environments for your secretsagreeable-painting-48846
04/22/2023, 12:48 PMred-quill-28140
04/22/2023, 12:48 PMred-quill-28140
04/22/2023, 12:48 PMenough-oil-62271
04/22/2023, 12:49 PMred-quill-28140
04/22/2023, 12:49 PMcargo shuttle logs doesn't show substantially more -- it just has these extra lines:
2023-04-22T13:46:30.452806100Z INFO Entering crashed state
2023-04-22T13:46:30.455388149Z ERROR {error="Load error: <no panic message>"} shuttle_deployer::deployment::run: service startup encountered an errorenough-oil-62271
04/22/2023, 12:49 PM<no panic message>red-quill-28140
04/22/2023, 12:50 PMhttps://cdn.discordapp.com/attachments/1099239188865482854/1099316202272202822/yza8p5b4ig661.pngā¾
enough-oil-62271
04/22/2023, 12:50 PMagreeable-painting-48846
04/22/2023, 12:51 PMred-quill-28140
04/22/2023, 12:51 PMSecrets.dev.toml, thanks for the tip!red-quill-28140
04/22/2023, 12:51 PMred-quill-28140
04/22/2023, 12:52 PM#[shuttle_shared_db::Postgres] pool: Pool<Postgres>red-quill-28140
04/22/2023, 12:52 PM.env file that points to a local postgres containerred-quill-28140
04/22/2023, 12:53 PMagreeable-painting-48846
04/22/2023, 12:53 PMagreeable-painting-48846
04/22/2023, 12:54 PMred-quill-28140
04/22/2023, 1:03 PM#[shuttle_shared_db::Postgres] parameter, the crash does not happenagreeable-painting-48846
04/22/2023, 1:03 PMred-quill-28140
04/22/2023, 1:07 PMagreeable-painting-48846
04/22/2023, 1:07 PMred-quill-28140
04/22/2023, 1:07 PMagreeable-painting-48846
04/22/2023, 1:07 PMred-quill-28140
04/22/2023, 1:08 PM/// An alias for [`Pool`][crate::pool::Pool], specialized for Postgres.
pub type PgPool = crate::pool::Pool<Postgres>;agreeable-painting-48846
04/22/2023, 1:08 PMenough-oil-62271
04/22/2023, 1:14 PMred-quill-28140
04/22/2023, 1:17 PMPgPool resulted in the same hang. (Not sure why sometimes it hangs and sometimes it crashes with those numbers in the message... š¤ )enough-oil-62271
04/22/2023, 3:11 PMagreeable-painting-48846
04/22/2023, 3:15 PMred-quill-28140
04/23/2023, 3:01 PM.expect(...) on the migrations, which would abort the process if they fail, and seemingly not flush log buffers in the process. This made it impossible to diagnose, as additional logging I added was just not being captured.
- Even switching to ? (returning an Err from the shuttle_service::main function) still seemed to not produce all log messages that it should have; there may be some flushes missing.
- Operational misunderstanding: I thought deleting and recreating the Shuttle project would discard the database and start from a fresh one; that's why I never considered migrations could be a problem. Might be worth documenting how long databases live (and perhaps provide commands for managing them? I'd quite like to be able to discard the database without connecting to the postgres:// URI)red-quill-28140
04/23/2023, 3:02 PMred-quill-28140
04/23/2023, 3:02 PMenough-oil-62271
04/23/2023, 3:02 PM