### Install Shuttle CLI on Windows Source: https://github.com/shuttle-hq/shuttle/blob/main/README.md This script downloads and installs the `cargo-shuttle` command-line interface tool on Windows systems. It uses PowerShell's `Invoke-WebRequest` to fetch and execute the installation script. ```powershell iwr "https://www.shuttle.dev/install-win" | iex ``` -------------------------------- ### Actix Web 'Hello World' Service with Shuttle Source: https://github.com/shuttle-hq/shuttle/blob/main/services/shuttle-actix-web/README.md This Rust example demonstrates a basic 'Hello World' GET endpoint using Actix Web, integrated with the Shuttle runtime. It defines a service configuration function that registers the endpoint. ```Rust use actix_web::{get, web::ServiceConfig}; use shuttle_actix_web::ShuttleActixWeb; #[get("/")] async fn hello_world() -> &'static str { "Hello World!" } #[shuttle_runtime::main] async fn actix_web() -> ShuttleActixWeb { let config = move |cfg: &mut ServiceConfig| { cfg.service(hello_world); }; Ok(config.into()) } ``` -------------------------------- ### Initialize Git Submodules for Shuttle Examples Source: https://github.com/shuttle-hq/shuttle/blob/main/DEVELOPING.md Initializes and updates the Git submodules, specifically linking the `shuttle-examples` repository. This is necessary to access and test the provided examples. ```bash git submodule init git submodule update ``` -------------------------------- ### Install Shuttle CLI on Linux/macOS Source: https://github.com/shuttle-hq/shuttle/blob/main/README.md This script downloads and installs the `cargo-shuttle` command-line interface tool on Linux and macOS systems. It automatically detects and installs the correct target for your operating system and distribution. ```sh curl -sSfL https://www.shuttle.dev/install | bash ``` -------------------------------- ### Run a Shuttle Example Project Locally Source: https://github.com/shuttle-hq/shuttle/blob/main/DEVELOPING.md Executes a specific Shuttle example project (e.g., `rocket/hello-world`) using `cargo run`. This command allows developers to test user services locally with the Shuttle runtime. ```bash cargo run --bin shuttle -- --wd examples/rocket/hello-world run ``` -------------------------------- ### Initialize a new Shuttle project Source: https://github.com/shuttle-hq/shuttle/blob/main/README.md This command initializes a new Shuttle project from a specified template, creating a boilerplate application structure. For example, it creates a 'hello-world' project using the Axum web framework template. ```bash shuttle init --template axum hello-world ``` -------------------------------- ### Shuttle Tide Service Integration Example Source: https://github.com/shuttle-hq/shuttle/blob/main/services/shuttle-tide/README.md This Rust code snippet demonstrates how to create a Shuttle service that uses the Tide web framework. It initializes a new Tide application, adds logging middleware, and defines a GET route for the root path ('/') that responds with 'Hello, world!'. The application is then wrapped for deployment with Shuttle. ```Rust #[shuttle_runtime::main] async fn tide() -> shuttle_tide::ShuttleTide<()> { let mut app = tide::new(); app.with(tide::log::LogMiddleware::new()); app.at("/").get(|_| async { Ok("Hello, world!") }); Ok(app.into()) } ``` -------------------------------- ### Shuttle Warp 'Hello, World!' Service Example Source: https://github.com/shuttle-hq/shuttle/blob/main/services/shuttle-warp/README.md This Rust code snippet illustrates how to set up a basic 'Hello, World!' web service using the Warp framework and deploy it with Shuttle. It defines a simple route that returns 'Hello, World!' for any request and uses `shuttle_runtime::main` as the entry point for Shuttle deployment. ```Rust use warp::Filter; use warp::Reply; #[shuttle_runtime::main] async fn warp() -> shuttle_warp::ShuttleWarp<(impl Reply,)> { let route = warp::any().map(|| "Hello, World!"); Ok(route.boxed().into()) } ``` -------------------------------- ### Create a basic Axum service with Shuttle Source: https://github.com/shuttle-hq/shuttle/blob/main/services/shuttle-axum/README.md This Rust example demonstrates how to set up a simple Axum web service that returns 'Hello, world!' for the root path. It integrates this Axum router with the Shuttle runtime using the `#[shuttle_runtime::main]` macro, making it deployable as a Shuttle service. ```rust use axum::{routing::get, Router}; async fn hello_world() -> &'static str { "Hello, world!" } #[shuttle_runtime::main] async fn axum() -> shuttle_axum::ShuttleAxum { let router = Router::new().route("/", get(hello_world)); Ok(router.into()) } ``` -------------------------------- ### Shuttle Salvo Hello World Example Source: https://github.com/shuttle-hq/shuttle/blob/main/services/shuttle-salvo/README.md This Rust code snippet demonstrates how to set up a basic 'Hello, world!' web service using the Salvo web framework and deploy it with Shuttle. It defines a handler function that responds with plain text and configures a Salvo router within a Shuttle-compatible main function. ```Rust use salvo::prelude::*; #[handler] async fn hello_world(res: &mut Response) { res.render(Text::Plain("Hello, world!")); } #[shuttle_runtime::main] async fn salvo() -> shuttle_salvo::ShuttleSalvo { let router = Router::new().get(hello_world); Ok(router.into()) } ``` -------------------------------- ### Rocket Web Framework Hello World with Shuttle Source: https://github.com/shuttle-hq/shuttle/blob/main/services/shuttle-rocket/README.md This Rust code snippet demonstrates a minimal 'Hello, world!' web application built with the Rocket framework, configured to be deployed using Shuttle. It defines a simple GET route for the root path and uses `shuttle_runtime::main` to prepare the Rocket application for Shuttle deployment. ```Rust use rocket::{get, routes}; #[get("/")] fn index() -> &'static str { "Hello, world!" } #[shuttle_runtime::main] async fn rocket() -> shuttle_rocket::ShuttleRocket { let rocket = rocket::build().mount("/", routes![index]); Ok(rocket.into()) } ``` -------------------------------- ### Install Shuttle CLI Source: https://github.com/shuttle-hq/shuttle/blob/main/runtime/README.md Instructions to install the Shuttle Command Line Interface on different operating systems. This CLI tool is essential for interacting with the Shuttle platform. ```bash # Linux / macOS curl -sSfL https://www.shuttle.dev/install | bash ``` ```powershell # Windows (Powershell) iwr https://www.shuttle.dev/install-win | iex ``` -------------------------------- ### Example Shuttle deployment output Source: https://github.com/shuttle-hq/shuttle/blob/main/README.md This text snippet illustrates the typical output displayed after a successful deployment of a Shuttle service. It includes key details such as the service name, deployment ID, current status, last update timestamp, and the public URI where the application can be accessed. ```text Service Name: hello-world Deployment ID: 3d08ac34-ad63-41c1-836b-99afdc90af9f Status: running Last Updated: 2022-04-01T08:32:34Z URI: https://hello-world.shuttleapp.rs ``` -------------------------------- ### Log in to Shuttle Source: https://github.com/shuttle-hq/shuttle/blob/main/README.md After installing the Shuttle CLI, use this command to authenticate and log in to your Shuttle account. This step is necessary to deploy and manage your applications on the Shuttle platform. ```sh shuttle login ``` -------------------------------- ### Axum boilerplate code for Shuttle project Source: https://github.com/shuttle-hq/shuttle/blob/main/runtime/README.md Example Rust code for an Axum web application designed to run on Shuttle. It defines a simple 'Hello, world!' endpoint and uses `#[shuttle_runtime::main]` to integrate with the Shuttle runtime. ```rust use axum::{routing::get, Router}; async fn hello_world() -> &'static str { "Hello, world!" } #[shuttle_runtime::main] async fn main() -> shuttle_axum::ShuttleAxum { let router = Router::new().route("/", get(hello_world)); Ok(router.into()) } ``` -------------------------------- ### Install Shuttle CLI on Windows using PowerShell Source: https://github.com/shuttle-hq/shuttle/blob/main/cargo-shuttle/README.md This PowerShell command fetches and executes the Shuttle CLI installer script specifically designed for Windows. It uses `iwr` (Invoke-WebRequest) to download the script and `iex` (Invoke-Expression) to run it, enabling easy installation on Windows systems. ```powershell iwr https://www.shuttle.dev/install-win | iex ``` -------------------------------- ### Test deployed Shuttle service with curl Source: https://github.com/shuttle-hq/shuttle/blob/main/runtime/README.md Example `curl` command to test the deployed Shuttle application. It demonstrates accessing the service via its unique `*.shuttle.app` subdomain. ```bash curl https://my-axum-app-0000.shuttle.app/ # Hello, world! ``` -------------------------------- ### Install Shuttle CLI on Linux and macOS Source: https://github.com/shuttle-hq/shuttle/blob/main/cargo-shuttle/README.md This command downloads and executes the Shuttle CLI installer script for Linux and macOS systems. It uses `curl` to fetch the script and `bash` to run it, providing a quick and automated way to set up the CLI. ```sh curl -sSfL https://www.shuttle.dev/install | bash ``` -------------------------------- ### Shuttle Poem Hello World Service Source: https://github.com/shuttle-hq/shuttle/blob/main/services/shuttle-poem/README.md This Rust code snippet demonstrates how to create a basic 'Hello, world!' web service using the Poem framework and deploy it with Shuttle. It defines a simple GET endpoint at the root path ('/') that returns 'Hello, world!' and sets up the application for Shuttle deployment. ```Rust use poem::{get, handler, Route}; use shuttle_poem::ShuttlePoem; #[handler] fn hello_world() -> &'static str { "Hello, world!" } #[shuttle_runtime::main] async fn poem() -> ShuttlePoem { let app = Route::new().at("/", get(hello_world)); Ok(app.into()) } ``` -------------------------------- ### Test local Shuttle application with curl Source: https://github.com/shuttle-hq/shuttle/blob/main/runtime/README.md Example `curl` command to verify that the locally running Shuttle application is accessible and responding correctly on the default port 8000. ```bash curl http://localhost:8000/ # Hello, world! ``` -------------------------------- ### Build and Install Shuttle CLI from Source Source: https://github.com/shuttle-hq/shuttle/blob/main/cargo-shuttle/README.md This command uses Cargo, Rust's package manager, to build and install the `cargo-shuttle` tool directly from its source code. This method is suitable for developers who want to contribute or use the latest unreleased version of the CLI. ```bash cargo install cargo-shuttle ``` -------------------------------- ### Integrating Shared Postgres Database with Shuttle Axum Source: https://github.com/shuttle-hq/shuttle/blob/main/README.md This example extends the Shuttle-deployed Axum application to include a shared Postgres database. It demonstrates how to inject a `sqlx::PgPool` using the `#[shuttle_shared_db::Postgres]` attribute and includes a basic migration step to run a schema script upon deployment, making the database ready for use. ```Rust use axum::{routing::get, Router}; async fn hello_world() -> &'static str { "Hello, world!" } #[shuttle_runtime::main] async fn main( #[shuttle_shared_db::Postgres] pool: sqlx::PgPool, ) -> shuttle_axum::ShuttleAxum { pool.execute(include_str!("../schema.sql")) .await .expect("failed to run migrations"); let router = Router::new().route("/", get(hello_world)); Ok(router.into()) } ``` -------------------------------- ### Shuttle Rama Application Service with X-Forwarded-For Handling (Rust) Source: https://github.com/shuttle-hq/shuttle/blob/main/services/shuttle-rama/README.md This Rust example demonstrates how to create an HTTP application service using the Rama framework, deployed with Shuttle. It includes handling the `X-Forwarded-For` header to retrieve the client's real IP address, which is crucial when Shuttle is behind a load balancer. The service exposes a `/` endpoint that returns a 'Hello world' message, adapting the greeting based on whether IP information is available. ```Rust use rama::{ Context, Layer, error::ErrorContext, http::{ StatusCode, layer::forwarded::GetForwardedHeaderLayer, service::web::{Router, response::Result}, }, net::forwarded::Forwarded, }; async fn hello_world(ctx: Context<()>) -> Result { Ok(match ctx.get::() { Some(forwarded) => format!( "Hello cloud user @ {}!", forwarded .client_ip() .context("missing IP information from user") .map_err(|err| (StatusCode::INTERNAL_SERVER_ERROR, err.to_string()))? ), None => "Hello local user! Are you developing?".to_owned(), }) } #[shuttle_runtime::main] async fn main() -> Result { let router = Router::new().get("/", hello_world); let app = // Shuttle sits behind a load-balancer, // so in case you want the real IP of the user, // you need to ensure this headers is handled. // // Learn more at GetForwardedHeaderLayer::x_forwarded_for().into_layer(router); Ok(shuttle_rama::RamaService::application(app)) } ``` -------------------------------- ### Basic Serenity Discord Bot with Shuttle Runtime Source: https://github.com/shuttle-hq/shuttle/blob/main/services/shuttle-serenity/README.md This Rust example demonstrates a simple Discord bot built with the Serenity framework, integrated into the Shuttle runtime. It implements an `EventHandler` to respond to `!hello` messages and initializes the bot using a `DISCORD_TOKEN` retrieved from Shuttle's `SecretStore`. ```rust use anyhow::Context as _; use serenity::async_trait; use serenity::model::channel::Message; use serenity::model::gateway::Ready; use serenity::prelude::*; use shuttle_runtime::SecretStore; use tracing::{error, info}; struct Bot; #[async_trait] impl EventHandler for Bot { async fn message(&self, ctx: Context, msg: Message) { if msg.content == "!hello" { if let Err(e) = msg.channel_id.say(&ctx.http, "world!").await { error!("Error sending message: {:?}", e); } } } async fn ready(&self, _: Context, ready: Ready) { info!("{} is connected!", ready.user.name); } } #[shuttle_runtime::main] async fn serenity( #[shuttle_runtime::Secrets] secrets: SecretStore, ) -> shuttle_serenity::ShuttleSerenity { // Get the discord token set in `Secrets.toml` let token = secrets.get("DISCORD_TOKEN").context("'DISCORD_TOKEN' was not found")?; // Set gateway intents, which decides what events the bot will be notified about let intents = GatewayIntents::GUILD_MESSAGES | GatewayIntents::MESSAGE_CONTENT; let client = Client::builder(&token, intents) .event_handler(Bot) .await .expect("Err creating client"); Ok(client.into()) } ``` -------------------------------- ### Connect to Turso Database in Shuttle with Axum Source: https://github.com/shuttle-hq/shuttle/blob/main/resources/turso/README.md This Rust example demonstrates how to integrate the `shuttle-turso` plugin into a Shuttle Axum service. It shows how to declare a `libsql::Connection` using the `#[shuttle_turso::Turso]` attribute, specifying the remote database address and reading the authentication token from Shuttle's secrets management. ```Rust use libsql::Connection; use shuttle_axum::ShuttleAxum; #[shuttle_runtime::main] async fn app( #[shuttle_turso::Turso( addr="libsql://my-turso-db-name.turso.io", token="{secrets.DB_TURSO_TOKEN}" )] client: Connection, ) -> ShuttleAxum {} ``` -------------------------------- ### Configure Axum 0.7 with Shuttle Source: https://github.com/shuttle-hq/shuttle/blob/main/services/shuttle-axum/README.md This TOML configuration snippet shows how to specify Axum version 0.7.3 and enable the `axum-0-7` feature for `shuttle-axum` when not using default features. This setup allows compatibility with older Axum versions when deploying with Shuttle. ```toml axum = "0.7.3" shuttle-axum = { version = "...", default-features = false, features = ["axum-0-7"] } ``` -------------------------------- ### Shuttle Rama Transport Service (Raw TCP/HTTP Response) (Rust) Source: https://github.com/shuttle-hq/shuttle/blob/main/services/shuttle-rama/README.md This Rust example illustrates how to implement a raw TCP transport service using the Rama framework, suitable for deployment with Shuttle. It directly writes a basic HTTP/1.1 200 OK response to the incoming stream, showcasing low-level network interaction rather than a full HTTP framework. This type of service is useful for custom protocols or direct stream manipulation. ```Rust use rama::{net, service::service_fn}; use std::convert::Infallible; use tokio::io::AsyncWriteExt; async fn hello_world(mut stream: S) -> Result<(), Infallible> where S: net::stream::Stream + Unpin, { const TEXT: &str = "Hello, Shuttle!"; let resp = [ "HTTP/1.1 200 OK", "Content-Type: text/plain", format!("Content-Length: {}", TEXT.len()).as_str(), "", TEXT, "", ] .join("\r\n"); stream .write_all(resp.as_bytes()) .await .expect("write to stream"); Ok::<_, std::convert::Infallible>(()) } #[shuttle_runtime::main] async fn main() -> Result { Ok(shuttle_rama::RamaService::transport(service_fn( hello_world, ))) } ``` -------------------------------- ### Deploying Thruster 'Hello, World!' with Shuttle Source: https://github.com/shuttle-hq/shuttle/blob/main/services/shuttle-thruster/README.md This Rust code snippet demonstrates how to create a simple 'Hello, World!' endpoint using the Thruster web framework and then configure it for deployment with Shuttle. It utilizes `shuttle_runtime::main` to define the entry point for Shuttle, wrapping the Thruster `HyperServer`. ```Rust use thruster::{ context::basic_hyper_context::{generate_context, BasicHyperContext as Ctx, HyperRequest}, m, middleware_fn, App, HyperServer, MiddlewareNext, MiddlewareResult, ThrusterServer, }; #[middleware_fn] async fn hello(mut context: Ctx, _next: MiddlewareNext) -> MiddlewareResult { context.body("Hello, World!"); Ok(context) } #[shuttle_runtime::main] async fn thruster() -> shuttle_thruster::ShuttleThruster> { let server = HyperServer::new( App::::create(generate_context, ()).get("/", m![hello]), ); Ok(server.into()) } ``` -------------------------------- ### Basic Axum Hello World Application Source: https://github.com/shuttle-hq/shuttle/blob/main/README.md This snippet demonstrates a standard 'Hello World' web application built with the Axum framework in Rust. It sets up a basic HTTP server that listens on a local address and responds with 'Hello, world!' to requests on the root path. ```Rust use axum::{routing::get, Router}; #[tokio::main] async fn main() { let app = Router::new().route("/", get(hello_world)); let listener = tokio::net::TcpListener::bind("127.0.0.1:3000") .await .unwrap(); println!("listening on {}", listener.local_addr().unwrap()); axum::serve(listener, app).await.unwrap(); } async fn hello_world() -> &'static str { "Hello, world!" } ``` -------------------------------- ### Deploy a Shuttle project Source: https://github.com/shuttle-hq/shuttle/blob/main/README.md Navigate into your project directory and use this command to deploy your Shuttle application to the Shuttle platform. This initiates the build and deployment process, making your application accessible online. ```bash cd hello-world shuttle deploy ``` -------------------------------- ### Initialize a new Shuttle project with Axum template Source: https://github.com/shuttle-hq/shuttle/blob/main/runtime/README.md Command to create a new Shuttle project using the Axum web framework boilerplate. This sets up the basic project structure and dependencies. ```bash shuttle init --template axum my-axum-app ``` -------------------------------- ### Deploying Axum Application with Shuttle Runtime Source: https://github.com/shuttle-hq/shuttle/blob/main/README.md This code shows how to modify a standard Axum application to be deployable with Shuttle. By replacing `#[tokio::main]` with `#[shuttle_runtime::main]` and returning `shuttle_axum::ShuttleAxum`, the application becomes compatible with Shuttle's deployment environment, enabling single-command deployment. ```Rust use axum::{routing::get, Router}; async fn hello_world() -> &'static str { "Hello, world!" } #[shuttle_runtime::main] async fn main() -> shuttle_axum::ShuttleAxum { let router = Router::new().route("/", get(hello_world)); Ok(router.into()) } ``` -------------------------------- ### View Cargo.toml dependencies for Shuttle Axum project Source: https://github.com/shuttle-hq/shuttle/blob/main/runtime/README.md Shows the key dependencies added to the `Cargo.toml` file for a Shuttle project using the Axum framework. These include `shuttle-axum` and `shuttle-runtime`. ```toml axum = "0.8.1" shuttle-axum = "0.55.0" shuttle-runtime = "0.55.0" tokio = "1.28.2" ``` -------------------------------- ### Implement a Basic Tower Service with Shuttle Runtime Source: https://github.com/shuttle-hq/shuttle/blob/main/services/shuttle-tower/README.md This Rust code defines a `HelloWorld` struct that implements the `tower::Service` trait to handle HTTP requests. It returns a simple 'Hello, world!' response. The `#[shuttle_runtime::main]` macro then integrates this Tower service, wrapped in `shuttle_tower::ShuttleTower`, allowing it to be deployed as a Shuttle service. ```rust use std::convert::Infallible; use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; #[derive(Clone)] struct HelloWorld; impl tower::Service> for HelloWorld { type Response = hyper::Response; type Error = Infallible; type Future = Pin> + Send + Sync>>; fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, _req: hyper::Request) -> Self::Future { let body = hyper::Body::from("Hello, world!"); let resp = hyper::Response::builder() .status(200) .body(body) .expect("Unable to create the `hyper::Response` object"); let fut = async { Ok(resp) }; Box::pin(fut) } } #[shuttle_runtime::main] async fn tower() -> shuttle_tower::ShuttleTower { let service = HelloWorld; Ok(service.into()) } ``` -------------------------------- ### Run Shuttle application locally Source: https://github.com/shuttle-hq/shuttle/blob/main/runtime/README.md Command to build and run the Shuttle application on your local machine. This allows for testing and debugging before deployment. ```bash shuttle run ``` -------------------------------- ### Clone Shuttle Repository Source: https://github.com/shuttle-hq/shuttle/blob/main/DEVELOPING.md Clones the Shuttle HQ repository from GitHub and navigates into the project directory. This is the initial step to set up the development environment. ```bash git clone git@github.com:shuttle-hq/shuttle.git cd shuttle ``` -------------------------------- ### Shuttle Turso Attribute Parameters Source: https://github.com/shuttle-hq/shuttle/blob/main/resources/turso/README.md This API documentation details the configurable parameters for the `#[shuttle_turso::Turso]` attribute, which is used to establish a connection to a Turso database within a Shuttle service. It outlines the `addr`, `token`, and `local_addr` parameters, including their types, default values, and descriptions. ```APIDOC shuttle_turso::Turso Attribute: Parameters: addr: Type: str Default: "" Description: URL of the database to connect to. Should begin with either `libsql://` or `https://`. token: Type: str Default: "" Description: The value of the token to authenticate against the Turso database. You can use string interpolation to read a secret from your `Secret.toml` file. local_addr: Type: Option Default: None Description: The URL to use when running your service locally. If not provided, this will default to a local file named `.db`. ``` -------------------------------- ### Deploy Shuttle service to the cloud Source: https://github.com/shuttle-hq/shuttle/blob/main/runtime/README.md Command to deploy the Shuttle application to the Shuttle cloud platform. This makes the service publicly accessible under a unique subdomain. ```bash shuttle deploy ``` -------------------------------- ### Check Rust Code Formatting Before Committing Source: https://github.com/shuttle-hq/shuttle/blob/main/CONTRIBUTING.md Verifies that Rust code is correctly formatted according to the project's `rustfmt` rules. Running this command helps ensure consistent code style across the entire codebase, which is crucial for readability and maintainability. ```Rust cargo fmt --all --check ``` -------------------------------- ### Shuttle AWS RDS Engine Configuration Options Source: https://github.com/shuttle-hq/shuttle/blob/main/resources/aws-rds/README.md This table details the available configuration options that can be applied to each `shuttle-aws-rds` engine. It specifies the option name, its data type, and a description of its functionality, such as `local_uri` for connecting to an existing database instead of spinning up a new local Docker instance. ```APIDOC Option | Type | Description -----------|------|----------------------------------------------------------------------------------------- local_uri | &str | Don't spin up a local docker instance of the DB, but rather connect to this URI instead ``` -------------------------------- ### Run Unit Tests for a Specific Crate Source: https://github.com/shuttle-hq/shuttle/blob/main/DEVELOPING.md Uses `cargo make` to execute unit tests for a specified crate within the Shuttle repository. This command helps in verifying the functionality of individual library components. ```bash cargo make test-member ``` -------------------------------- ### Run Rust Clippy Checks Before Committing Source: https://github.com/shuttle-hq/shuttle/blob/main/CONTRIBUTING.md Ensures that Rust code adheres to Clippy's lints, which helps maintain code quality and consistency. This command should be executed before committing changes to a Rust repository. If a specific lint needs to be ignored for a valid reason, the `#[allow(clippy::)]` macro can be used. ```Rust cargo clippy --tests --all-targets --all-features ``` -------------------------------- ### Shuttle AWS RDS Engine Feature Flags and Attribute Paths Source: https://github.com/shuttle-hq/shuttle/blob/main/resources/aws-rds/README.md This table outlines the supported database engines for the `shuttle-aws-rds` plugin, their corresponding feature flags required for dependency management in a Rust project, and the attribute paths used to reference these database types within the Shuttle service code. Native TLS is the default, with an option for `rustls`. ```APIDOC Engine | Feature flag | Attribute path ----------|--------------|--------------------------- Postgres | postgres | shuttle_aws_rds::Postgres MySql | mysql | shuttle_aws_rds::MySql MariaDB | mariadb | shuttle_aws_rds::MariaDB ``` -------------------------------- ### Generate Cargo Config for Local Patches Source: https://github.com/shuttle-hq/shuttle/blob/main/DEVELOPING.md Runs a script to generate a `.cargo/config.toml` file, which is used to apply local patches for testing changes to library crates. This helps in overriding dependencies for development. ```bash ./scripts/apply-patches ``` -------------------------------- ### Connect to S3 Storage with Shuttle OpenDAL in Axum Source: https://github.com/shuttle-hq/shuttle/blob/main/resources/opendal/README.md This Rust code demonstrates how to integrate the `shuttle-opendal` plugin into an Axum server's main function. It uses the `#[shuttle_opendal::Opendal(scheme = "s3")]` attribute to inject an `opendal::Operator` configured for S3 storage, allowing the service to interact with an S3 bucket. Secrets for the S3 connection (e.g., `bucket`, `access_key_id`, `secret_access_key`) must be pre-configured in `Secrets.toml`. ```Rust use opendal::Operator; use shuttle_axum::ShuttleAxum; #[shuttle_runtime::main] async fn app( #[shuttle_opendal::Opendal(scheme = "s3")] storage: Operator, ) -> ShuttleAxum {} ``` -------------------------------- ### Shuttle OpenDAL Attribute Parameters Source: https://github.com/shuttle-hq/shuttle/blob/main/resources/opendal/README.md Defines the configurable parameters for the `#[shuttle_opendal::Opendal]` attribute used in Shuttle services. The `scheme` parameter specifies the type of storage service to connect to, with 'memory' as the default. All necessary secrets for the chosen scheme are loaded from `Secrets.toml`. ```APIDOC Attribute: #[shuttle_opendal::Opendal] Parameters: - Parameter: scheme Type: str Default: "memory" Description: The scheme of the storage service to connect to. Secrets: All secrets are loaded from your `Secrets.toml` file. Example (s3): bucket, access_key_id, secret_access_key ``` -------------------------------- ### Run Integration Tests for a Specific Crate (Non-Docker) Source: https://github.com/shuttle-hq/shuttle/blob/main/DEVELOPING.md Executes integration tests for a specified crate that do not rely on Docker. This is part of the testing suite for verifying inter-component functionality. ```bash cargo make test-member-integration ``` -------------------------------- ### Run Docker-Dependent Integration Tests for a Crate Source: https://github.com/shuttle-hq/shuttle/blob/main/DEVELOPING.md Executes integration tests for a specified crate that require Docker. This command is used for testing components that interact with containerized services. ```bash cargo make test-member-integration-docker ``` -------------------------------- ### Configure Git to Handle Line Endings for Linux Compatibility (CRLF to LF) Source: https://github.com/shuttle-hq/shuttle/blob/main/DEVELOPING.md Sets Git's `core.autocrlf` configuration globally to `input`. This ensures that Git converts CRLF line endings to LF upon commit, preventing issues with Bash/WSL on Windows when running scripts. ```bash git config --global core.autocrlf input ``` -------------------------------- ### Configure Git to Handle Line Endings for Windows Compatibility (LF to CRLF) Source: https://github.com/shuttle-hq/shuttle/blob/main/DEVELOPING.md Resets Git's `core.autocrlf` configuration globally to `true`. This allows Git to convert LF line endings to CRLF upon checkout, suitable for Windows-native projects. ```bash git config --global core.autocrlf true ``` -------------------------------- ### Shuttle Serenity 0.11 Dependency Configuration Source: https://github.com/shuttle-hq/shuttle/blob/main/services/shuttle-serenity/README.md This TOML snippet illustrates how to configure `Cargo.toml` for a Shuttle project to use Serenity version 0.11.7. It specifies disabling default features for `shuttle-serenity` and enabling the `serenity-0-11-rustls_backend` feature for compatibility. ```toml serenity = { version = "0.11.7", features = ["..."] } shuttle-serenity = { version = "...", default-features = false, features = ["serenity-0-11-rustls_backend"] } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.