New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
attempt at deploying on shuttle.rs #2
Conversation
After impl Service myself I get:
[edit: note that |
huzaah! https://dancelist.shuttleapp.rs/ |
This reverts commit 244d32a.
I can't see a way to get at the logs of my project on production, so I'm doing all of my debugging on localhost in their docker-compose setup. My current development workflow is therefore: set up shuttle prod:
setup your local shuttle in a docker:
check locally:
deploy to production
I'm mostly documenting this so that the upstream shuttle team can have an idea of what workflows their users desire, and are willing to hack into place (think "desire path"). I'm assuming that the team already plans to support this kind of workflow in a first-class manner, but there may be quick wins that they're missing. It's also worth going though and looking at the titles of the commits, to work out which steps I needed to take to unblock myself, and which things I tried without success. |
get(|| async { | ||
( | ||
[(header::CONTENT_TYPE, "text/css")], | ||
include_str!("../public/stylesheets/main.css"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I discussed this with Andrew - edit-compile-serve iteration times on axum are pretty slow, so his previous get_service(ServeDir::new(config.public_dir.join("stylesheets")))
approach is super valuable if you want to iterate quickly on your CSS.
let app = setup_app(&config).await?; | ||
|
||
println!("Listening on {}", config.bind_address); | ||
log::warn!("Listening on {}", config.bind_address); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't get any logging out of shuttle. I don't they set anything up to consume logs before loading the .so, so all logging goes nowhere. println statements are visible in the docker logs though.
// We can't use the shuttle_service::main macro because that needs a SimpleService, and orphan rules | ||
// do not allow us to impl anything useful for SimpleService outside of the shuttle_service crate. | ||
struct MyService; | ||
impl MyService { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fact that we can't use the shuttle_service::main macro (due to interactions with the orphan rule) is super-annoying. That said, it feels philosophically aligned with the "batteries included" approach that shuttle has first-party support for all of the things, so they can handle automatic injection of logging and databases etc, and things "just work".
I was about to suggest documenting the "impl Service" workaround with an example, but maybe that's not the answer. Maybe it would be better to allow users to supply their own version of shuttle-service as a git dependency or something? I don't know.
Relatedly, Andrew suggests that maybe breaking with the .crate packaging format would be beneficial - some companies might not be comfortable with pushing their source code elsewhere? (the kind of company that prefers to run their own jenkins instances might not be the target market for shuttle though). If shuttle could ship a docker-compose based setup for building the .so file, then we might be able to sidestep the "no git dependencies" issue? I heard a rumour that synced volumes via virtiofs are pretty fast these days? I've not tried it myself though. Also, it's hard to beat the "just send it to us and we'll build it on our infini-core beast of a server that also has a cache of all of your crate's deps already" approach [edit: unless you're already committed to compiling locally for local dev?].
Codecov Report
@@ Coverage Diff @@
## main #2 +/- ##
=========================================
+ Coverage 0 14.48% +14.48%
=========================================
Files 0 24 +24
Lines 0 5406 +5406
=========================================
+ Hits 0 783 +783
- Misses 0 4623 +4623
Continue to review full report at Codecov.
|
Just closing some old PRs. Nothing to see here. |
This is blocked on shuttle-hq/shuttle#118 .... nevermind. I hacked around it by implementing [Into]Service myself.Caused by:
all dependencies must have a version specified when packaging.
dependency
shuttle-service
does not specify a versionNote: The packaged dependency will use the version from crates.io,
the
git
specification will be removed from the dependency declaration.$ cargo shuttle deploy
Packaging dancelist v0.1.0 (/Users/alsuren/src/dancelist)
Archiving .cargo_vcs_info.json
Archiving .github/workflows/lint.yml
Archiving .github/workflows/rust.yml
Archiving .gitignore
Archiving AUTHORS
Archiving CONTRIBUTING.md
Archiving Cargo.lock
Updating crates.io index
note: package
axum v0.4.8
added to the packaged Cargo.lock filenote: package
axum-core v0.1.2
added to the packaged Cargo.lock filenote: package
matchit v0.4.6
added to the packaged Cargo.lock filenote: package
shuttle-codegen v0.2.5
added to the packaged Cargo.lock file, was originally sourced fromhttps://github.com/getsynth/shuttle?branch=chore/axum-0.5#a5ebf856
note: package
shuttle-service v0.2.5
added to the packaged Cargo.lock file, was originally sourced fromhttps://github.com/getsynth/shuttle?branch=chore/axum-0.5#a5ebf856
Archiving Cargo.toml
Archiving Cargo.toml.orig
Archiving LICENSE
Archiving README.md
Archiving dancelist.example.toml
Archiving debian-scripts/dancelist.service
Archiving events_schema.json
Archiving public/stylesheets/main.css
Archiving src/config.rs
Archiving src/controllers/bands.rs
Archiving src/controllers/callers.rs
Archiving src/controllers/cities.rs
Archiving src/controllers/index.rs
Archiving src/controllers/mod.rs
Archiving src/controllers/organisations.rs
Archiving src/controllers/reload.rs
Archiving src/errors.rs
Archiving src/extractors.rs
Archiving src/icalendar.rs
Archiving src/importers/balfolknl/mod.rs
Archiving src/importers/folkbalbende/mod.rs
Archiving src/importers/folkbalbende/types/bool_as_int.rs
Archiving src/importers/folkbalbende/types/int_as_string.rs
Archiving src/importers/folkbalbende/types/mod.rs
Archiving src/importers/mod.rs
Archiving src/importers/webfeet/mod.rs
Archiving src/importers/webfeet/types.rs
Archiving src/lib.rs
Archiving src/main.rs
Archiving src/model/dancestyle.rs
Archiving src/model/event.rs
Archiving src/model/events.rs
Archiving src/model/filters.rs
Archiving src/model/mod.rs
Archiving templates/bands.html
Archiving templates/callers.html
Archiving templates/cities.html
Archiving templates/index.html
Archiving templates/organisations.html
Error: failed to deploy cargo project
Caused by:
<title>404 Not Found</title>
404: Not Found
The requested resource could not be found.
Rocket