https://linen.dev logo
nested static folder giving "failed to provision s...
# help
s
My code goes like
Copy code
rust
#[shuttle_service::main]
async fn main(
    #[shuttle_shared_db::Postgres] db: PgPool,
    #[shuttle_static_folder::StaticFolder(folder = "frontend/public")]
    static_folder: std::path::PathBuf,
) -> shuttle_service::ShuttleAxum {
It builds correctly but fails with the aforementioned error. Final part of the log is:
Copy code
2023-03-06T20:07:26.650758147Z  INFO Entering built state

2023-03-06T20:07:27.220298852Z  INFO Entering loading state
2023-03-06T20:07:28.832958420Z TRACE {so_path="/opt/shuttle/shuttle-libs/e510345b-8fea-4f12-883e-ffed5251734e"} shuttle_service::loader: loading .so path
2023-03-06T20:07:29.542240336Z  INFO shuttle_deployer::deployment::provisioner_factory: Fetching secrets for deployment
2023-03-06T20:07:29.542554266Z  INFO shuttle_deployer::deployment::provisioner_factory: Done fetching secrets
2023-03-06T20:07:29.544898656Z  INFO shuttle_deployer::deployment::provisioner_factory: Provisioning a shared::postgres on the shuttle servers. This can take a while...
2023-03-06T20:07:29.547179826Z DEBUG {service.ready=true} tower::buffer::worker: processing request
2023-03-06T20:07:29.591726585Z  INFO shuttle_deployer::deployment::provisioner_factory: Done provisioning database
2023-03-06T20:07:29.591751848Z TRACE shuttle_deployer::deployment::provisioner_factory: giving a DB connection string: postgres://user-rtialrout:S8dUiIFvY0lR@postgres:5432/db-rtialrout

2023-03-06T20:07:29.599287731Z  INFO Entering crashed state
2023-03-06T20:07:29.599331417Z ERROR {error="Run error: Custom error: failed to provision shuttle_static_folder :: StaticFolder"} shuttle_deployer::deployment::run: service startup encountered an error
Is nested static folders not supported?
s
Not tried it myself, but I'd hope it would be enough to just give the top-level folder - so maybe try changing to folder = "frontend" and seeing what happens?
s
Making it a top-level folder works. But as I am keeping my frontend code in
frontend
directory, it is bothersome to copy the public folder up a level just for this.
a
What are you using to write your front end? Surely there's a command you can use to change your output directory?
s
I kinda assumed the static folder would be 'a top level static folder and everything underneath it is recursively included'. I hope so. I am trying to deploy a little test project right now that would prove this one way or another, but a single folder without sub-folders would be.. painful, for sure.
a
Normally it is if you're just building assets for prod
s
Do you mean 'it is a single folder without sub-folders'? I'm gonna want to keep my templates separate from my css, js, icons, images, all the good stuff though.
a
Sorry what I meant was that normally the static folder does have subdirectories but normally, there is a command you can use to change what you want to make the output directory
s
Yes, it is trivial. But that means now some of my frontend material lives outside the frontend folder.
a
Hmmmm, yeah I can see how that would be an issue - it's annoying if you only want specific dirs to have stuff
s
Yep, I definitely want ability to have specific stuff in specific dirs. This may be because I want to do quite an old-school style project with minimal js (using htmx). So I opened this feature request: https://github.com/shuttle-hq/shuttle/issues/701
6 Views