From c4bcad9bbf691c1e73d5ac261dda7047398b2fd7 Mon Sep 17 00:00:00 2001 From: jonaro00 <54029719+jonaro00@users.noreply.github.com> Date: Fri, 27 Sep 2024 13:15:36 +0200 Subject: [PATCH 1/9] feat: colored platform outputs --- cargo-shuttle/src/lib.rs | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/cargo-shuttle/src/lib.rs b/cargo-shuttle/src/lib.rs index 60a7a1b6d..3232b62a5 100644 --- a/cargo-shuttle/src/lib.rs +++ b/cargo-shuttle/src/lib.rs @@ -158,22 +158,19 @@ impl Shuttle { self.beta = args.beta; if self.beta { if matches!(args.cmd, Command::Project(ProjectCommand::Restart { .. })) { - bail!("This command is discontinued on the beta platform. Deploy to start a new deployment."); + bail!("This command is discontinued on the NEW platform (shuttle.dev). Deploy to start a new deployment."); } if matches!(args.cmd, Command::Status) { - bail!("This command is discontinued on the beta platform. Use `deployment status` instead."); + bail!("This command is discontinued on the NEW platform (shuttle.dev). Use `deployment status` instead."); } if matches!( args.cmd, Command::Stop | Command::Project(ProjectCommand::Stop { .. }) ) { - bail!("This command is discontinued on the beta platform. Use `deployment stop` instead."); + bail!("This command is discontinued on the NEW platform (shuttle.dev). Use `deployment stop` instead."); } if matches!(args.cmd, Command::Clean) { - bail!("This command is not yet implemented on the beta platform."); - } - if self.bin == Binary::CargoShuttle { - eprintln!("INFO: Using beta platform API"); + bail!("This command is not yet implemented on the NEW platform (shuttle.dev)."); } } else if matches!( args.cmd, @@ -181,11 +178,20 @@ impl Shuttle { | Command::Account | Command::Project(ProjectCommand::Link) ) { - bail!("This command is not supported on the legacy platform. Set --beta or SHUTTLE_BETA=true."); + bail!("This command is not supported on the old platform (shuttle.rs)."); + } + + if self.beta { + eprintln!("{}", "INFO: Using NEW platform API (shuttle.dev)".green()); + } else { + eprintln!("{}", "INFO: Using OLD platform API (shuttle.rs)".blue()); } if let Some(ref url) = args.api_url { if (!self.beta && url != API_URL_DEFAULT) || (self.beta && url != API_URL_BETA) { - eprintln!("INFO: Targeting non-standard API: {url}"); + eprintln!( + "{}", + format!("INFO: Targeting non-standard API: {url}").yellow(), + ); } if url.ends_with('/') { eprintln!("WARNING: API URL is probably incorrect. Ends with '/': {url}"); From 93e479073012d3d17fdbba065f7d62d8ba0969b5 Mon Sep 17 00:00:00 2001 From: jonaro00 <54029719+jonaro00@users.noreply.github.com> Date: Thu, 3 Oct 2024 01:27:20 +0200 Subject: [PATCH 2/9] chore: unhide beta commands --- cargo-shuttle/src/args.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/cargo-shuttle/src/args.rs b/cargo-shuttle/src/args.rs index d5004aa06..aea462d3f 100644 --- a/cargo-shuttle/src/args.rs +++ b/cargo-shuttle/src/args.rs @@ -121,13 +121,13 @@ pub enum Command { /// Manage resources #[command(subcommand, visible_alias = "res")] Resource(ResourceCommand), - /// BETA: Manage SSL certificates for custom domains - #[command(subcommand, visible_alias = "cert", hide = true)] + /// Manage SSL certificates for custom domains + #[command(subcommand, visible_alias = "cert")] Certificate(CertificateCommand), /// Remove cargo build artifacts in the Shuttle environment Clean, - /// BETA: Show info about your Shuttle account - #[command(visible_alias = "acc", hide = true)] + /// Show info about your Shuttle account + #[command(visible_alias = "acc")] Account, /// Login to the Shuttle platform Login(LoginArgs), @@ -188,8 +188,7 @@ pub enum DeploymentCommand { /// ID of deployment to get status for id: Option, }, - /// BETA: Stop running deployment(s) - #[command(hide = true)] + /// Stop running deployment(s) Stop, } @@ -306,11 +305,11 @@ pub struct LogoutArgs { #[derive(Parser, Default)] pub struct DeployArgs { - /// BETA: Deploy this Docker image instead of building one + /// WIP: Deploy this Docker image instead of building one #[arg(long, short = 'i', hide = true)] pub image: Option, // TODO?: Make this a subcommand instead? `cargo shuttle deploy image ...` - /// BETA: Don't follow the deployment status, exit after the deployment begins - #[arg(long, visible_alias = "nf", hide = true)] + /// Don't follow the deployment status, exit after the deployment begins + #[arg(long, visible_alias = "nf")] pub no_follow: bool, /// Allow deployment with uncommitted files From b4d12c8f7d8b155e15bc35fd949b54f3fe2e71f1 Mon Sep 17 00:00:00 2001 From: jonaro00 <54029719+jonaro00@users.noreply.github.com> Date: Mon, 30 Sep 2024 12:39:21 +0200 Subject: [PATCH 3/9] nits --- cargo-shuttle/src/args.rs | 29 ++++++++++++++--------------- cargo-shuttle/src/lib.rs | 6 +++--- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/cargo-shuttle/src/args.rs b/cargo-shuttle/src/args.rs index aea462d3f..4459a0fef 100644 --- a/cargo-shuttle/src/args.rs +++ b/cargo-shuttle/src/args.rs @@ -28,8 +28,7 @@ use shuttle_common::resource; pub struct ShuttleArgs { #[command(flatten)] pub project_args: ProjectArgs, - /// Run this command against the API at the supplied URL - /// (allows targeting a custom deployed instance for this command only, mainly for development) + /// URL for the Shuttle API to target (mainly for development) #[arg(global = true, long, env = "SHUTTLE_API")] pub api_url: Option, /// Disable network requests that are not strictly necessary. Limits some features. @@ -46,7 +45,7 @@ pub struct ShuttleArgs { pub cmd: Command, } -// Common args for subcommands that deal with projects. +/// Global args for subcommands that deal with projects #[derive(Parser, Clone, Debug)] pub struct ProjectArgs { /// Specify the working directory @@ -102,20 +101,20 @@ impl ProjectArgs { pub enum Command { /// Generate a Shuttle project from a template Init(InitArgs), - /// Run a Shuttle service locally + /// Run a project locally Run(RunArgs), - /// Deploy a Shuttle service + /// Deploy a project Deploy(DeployArgs), - /// Manage deployments of a Shuttle service + /// Manage deployments #[command(subcommand, visible_alias = "depl")] Deployment(DeploymentCommand), /// View the status of a Shuttle service Status, /// Stop a Shuttle service Stop, - /// View logs of a Shuttle service + /// View build and deployment logs Logs(LogsArgs), - /// Manage projects on Shuttle + /// Manage Shuttle projects #[command(subcommand, visible_alias = "proj")] Project(ProjectCommand), /// Manage resources @@ -129,7 +128,7 @@ pub enum Command { /// Show info about your Shuttle account #[command(visible_alias = "acc")] Account, - /// Login to the Shuttle platform + /// Log in to the Shuttle platform Login(LoginArgs), /// Log out of the Shuttle platform Logout(LogoutArgs), @@ -162,8 +161,8 @@ pub enum GenerateCommand { #[derive(Parser)] pub struct TableArgs { - #[arg(long, default_value_t = false)] /// Output tables without borders + #[arg(long, default_value_t = false)] pub raw: bool, } @@ -172,12 +171,12 @@ pub enum DeploymentCommand { /// List the deployments for a service #[command(visible_alias = "ls")] List { - #[arg(long, default_value = "1")] /// Which page to display + #[arg(long, default_value = "1")] page: u32, - #[arg(long, default_value = "10", visible_alias = "per-page")] /// How many deployments per page to display + #[arg(long, default_value = "10", visible_alias = "per-page")] limit: u32, #[command(flatten)] @@ -200,8 +199,8 @@ pub enum ResourceCommand { #[command(flatten)] table: TableArgs, - #[arg(long, default_value_t = false)] /// Show secrets from resources (e.g. a password in a connection string) + #[arg(long, default_value_t = false)] show_secrets: bool, }, /// Delete a resource @@ -246,9 +245,9 @@ pub enum ProjectCommand { Start(ProjectStartArgs), /// Check the status of this project's environment on Shuttle Status { - #[arg(short, long)] /// Follow status of project // unused in beta (project has no state to follow) + #[arg(short, long)] follow: bool, }, /// Destroy this project's environment (container) on Shuttle @@ -276,8 +275,8 @@ pub enum ProjectCommand { #[derive(Parser, Debug)] pub struct ConfirmationArgs { - #[arg(long, short, default_value_t = false)] /// Skip confirmations and proceed + #[arg(long, short, default_value_t = false)] pub yes: bool, } diff --git a/cargo-shuttle/src/lib.rs b/cargo-shuttle/src/lib.rs index 3232b62a5..518a3d38d 100644 --- a/cargo-shuttle/src/lib.rs +++ b/cargo-shuttle/src/lib.rs @@ -178,7 +178,7 @@ impl Shuttle { | Command::Account | Command::Project(ProjectCommand::Link) ) { - bail!("This command is not supported on the old platform (shuttle.rs)."); + bail!("This command is not supported on the OLD platform (shuttle.rs)."); } if self.beta { @@ -190,7 +190,7 @@ impl Shuttle { if (!self.beta && url != API_URL_DEFAULT) || (self.beta && url != API_URL_BETA) { eprintln!( "{}", - format!("INFO: Targeting non-standard API: {url}").yellow(), + format!("INFO: Targeting non-default API: {url}").yellow(), ); } if url.ends_with('/') { @@ -1124,7 +1124,7 @@ impl Shuttle { async fn logs_beta(&self, args: LogsArgs) -> Result<()> { if args.follow { - eprintln!("Streamed logs are not yet supported on beta."); + eprintln!("Streamed logs are not yet supported on the new platform."); return Ok(()); } // TODO: implement logs range From 70f09121bfa93e9e406bb905bb27b5b5f53e562e Mon Sep 17 00:00:00 2001 From: jonaro00 <54029719+jonaro00@users.noreply.github.com> Date: Mon, 7 Oct 2024 17:56:17 +0200 Subject: [PATCH 4/9] fix: beta deprecate clean command --- cargo-shuttle/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cargo-shuttle/src/lib.rs b/cargo-shuttle/src/lib.rs index 518a3d38d..6b88e674e 100644 --- a/cargo-shuttle/src/lib.rs +++ b/cargo-shuttle/src/lib.rs @@ -170,7 +170,7 @@ impl Shuttle { bail!("This command is discontinued on the NEW platform (shuttle.dev). Use `deployment stop` instead."); } if matches!(args.cmd, Command::Clean) { - bail!("This command is not yet implemented on the NEW platform (shuttle.dev)."); + bail!("This command is discontinued on the NEW platform (shuttle.dev)."); } } else if matches!( args.cmd, From c1dd73759305f6ff01e0ef2eeaf8f555097b9ee2 Mon Sep 17 00:00:00 2001 From: jonaro00 <54029719+jonaro00@users.noreply.github.com> Date: Tue, 8 Oct 2024 13:33:07 +0200 Subject: [PATCH 5/9] fix(cargo-shuttle): don't validate api key, beta login url --- cargo-shuttle/src/config.rs | 27 ++++++++++++--------------- cargo-shuttle/src/lib.rs | 22 +++++++++++----------- common/src/constants.rs | 1 + 3 files changed, 24 insertions(+), 26 deletions(-) diff --git a/cargo-shuttle/src/config.rs b/cargo-shuttle/src/config.rs index 0da4772f2..ca35e5159 100644 --- a/cargo-shuttle/src/config.rs +++ b/cargo-shuttle/src/config.rs @@ -5,7 +5,7 @@ use std::path::{Path, PathBuf}; use anyhow::{anyhow, Context, Result}; use serde::{Deserialize, Serialize}; use shuttle_common::constants::API_URL_BETA; -use shuttle_common::{constants::API_URL_DEFAULT, ApiKey}; +use shuttle_common::constants::API_URL_DEFAULT; use tracing::trace; use crate::args::ProjectArgs; @@ -128,12 +128,12 @@ pub struct GlobalConfig { } impl GlobalConfig { - pub fn api_key(&self) -> Option> { - self.api_key.as_ref().map(|key| ApiKey::parse(key)) + pub fn api_key(&self) -> Option { + self.api_key.clone() } - pub fn set_api_key(&mut self, api_key: ApiKey) -> Option { - self.api_key.replace(api_key.as_ref().to_string()) + pub fn set_api_key(&mut self, api_key: String) -> Option { + self.api_key.replace(api_key) } pub fn clear_api_key(&mut self) { @@ -432,14 +432,11 @@ impl RequestContext { /// Get the API key from the `SHUTTLE_API_KEY` env variable, or /// otherwise from the global configuration. Returns an error if /// an API key is not set. - pub fn api_key(&self) -> Result { - let api_key = std::env::var("SHUTTLE_API_KEY"); - - if let Ok(key) = api_key { - ApiKey::parse(&key).context("environment variable SHUTTLE_API_KEY is invalid") - } else { - match self.global.as_ref().unwrap().api_key() { - Some(key) => key, + pub fn api_key(&self) -> Result { + match std::env::var("SHUTTLE_API_KEY") { + Ok(key) => Ok(key), + Err(_) => match self.global.as_ref().unwrap().api_key() { + Some(key) => Ok(key), None => Err(anyhow!( "Configuration file: `{}`", self.global.manager.path().display() @@ -447,7 +444,7 @@ impl RequestContext { .context(anyhow!( "No valid API key found, try logging in first with:\n\tcargo shuttle login" ))), - } + }, } } @@ -465,7 +462,7 @@ impl RequestContext { } /// Set the API key to the global configuration. Will persist the file. - pub fn set_api_key(&mut self, api_key: ApiKey) -> Result<()> { + pub fn set_api_key(&mut self, api_key: String) -> Result<()> { self.global.as_mut().unwrap().set_api_key(api_key); self.global.save() } diff --git a/cargo-shuttle/src/lib.rs b/cargo-shuttle/src/lib.rs index 6b88e674e..fa825c1e7 100644 --- a/cargo-shuttle/src/lib.rs +++ b/cargo-shuttle/src/lib.rs @@ -38,7 +38,7 @@ use shuttle_common::{ headers::X_CARGO_SHUTTLE_VERSION, API_URL_BETA, API_URL_DEFAULT, DEFAULT_IDLE_MINUTES, EXAMPLES_REPO, EXECUTABLE_DIRNAME, RESOURCE_SCHEMA_VERSION, RUNTIME_NAME, SHUTTLE_GH_ISSUE_URL, SHUTTLE_GH_REPO_URL, SHUTTLE_IDLE_DOCS_URL, SHUTTLE_INSTALL_DOCS_URL, - SHUTTLE_LOGIN_URL, STORAGE_DIRNAME, TEMPLATES_SCHEMA_VERSION, + SHUTTLE_LOGIN_URL, SHUTTLE_LOGIN_URL_BETA, STORAGE_DIRNAME, TEMPLATES_SCHEMA_VERSION, }, deployment::{DeploymentStateBeta, DEPLOYER_END_MESSAGES_BAD, DEPLOYER_END_MESSAGES_GOOD}, log::LogsRange, @@ -222,7 +222,7 @@ impl Shuttle { ) { let client = ShuttleApiClient::new( self.ctx.api_url(self.beta), - self.ctx.api_key().ok().map(|s| s.as_ref().to_owned()), + self.ctx.api_key().ok(), Some( HeaderMap::try_from(&HashMap::from([( X_CARGO_SHUTTLE_VERSION.clone(), @@ -917,14 +917,17 @@ impl Shuttle { /// Log in with the given API key or after prompting the user for one. async fn login(&mut self, login_args: LoginArgs, offline: bool) -> Result<()> { - let api_key_str = match login_args.api_key { + let api_key = match login_args.api_key { Some(api_key) => api_key, None => { if !offline { - let _ = webbrowser::open(SHUTTLE_LOGIN_URL); - println!( - "If your browser did not automatically open, go to {SHUTTLE_LOGIN_URL}" - ); + let url = if self.beta { + SHUTTLE_LOGIN_URL_BETA + } else { + SHUTTLE_LOGIN_URL + }; + let _ = webbrowser::open(url); + println!("If your browser did not automatically open, go to {url}"); } Password::with_theme(&ColorfulTheme::default()) @@ -934,13 +937,10 @@ impl Shuttle { } }; - // TODO(beta): don't validate the key in c-s - let api_key = ApiKey::parse(&api_key_str)?; - self.ctx.set_api_key(api_key.clone())?; if let Some(client) = self.client.as_mut() { - client.api_key = Some(api_key.as_ref().to_string()); + client.api_key = Some(api_key); if self.beta { if offline { diff --git a/common/src/constants.rs b/common/src/constants.rs index fb1d92006..bb61ad382 100644 --- a/common/src/constants.rs +++ b/common/src/constants.rs @@ -16,6 +16,7 @@ pub const API_URL_DEFAULT: &str = API_URL_PRODUCTION; pub const SHUTTLE_STATUS_URL: &str = "https://status.shuttle.rs"; pub const SHUTTLE_LOGIN_URL: &str = "https://console.shuttle.rs/new-project"; +pub const SHUTTLE_LOGIN_URL_BETA: &str = "https://console.shuttle.dev/new-project"; pub const SHUTTLE_GH_REPO_URL: &str = "https://github.com/shuttle-hq/shuttle"; pub const SHUTTLE_GH_ISSUE_URL: &str = "https://github.com/shuttle-hq/shuttle/issues/new/choose"; pub const SHUTTLE_INSTALL_DOCS_URL: &str = "https://docs.shuttle.rs/getting-started/installation"; From 71241435b449124fa3611d5f8afac7969a8ca758 Mon Sep 17 00:00:00 2001 From: jonaro00 <54029719+jonaro00@users.noreply.github.com> Date: Tue, 8 Oct 2024 17:36:44 +0200 Subject: [PATCH 6/9] fix: mentions of cargo shuttle --- .github/ISSUE_TEMPLATE/BUG-REPORT.yml | 2 +- README.md | 11 +++++------ cargo-shuttle/README.md | 2 +- cargo-shuttle/src/args.rs | 2 +- cargo-shuttle/src/config.rs | 2 +- cargo-shuttle/src/lib.rs | 24 ++++++++++++------------ common/src/models/error.rs | 2 +- common/src/models/resource.rs | 2 +- common/src/templates.rs | 2 +- install.ps1 | 6 +++--- resources/aws-rds/README.md | 6 +++--- runtime/README.md | 20 ++++++-------------- runtime/src/start.rs | 2 +- 13 files changed, 37 insertions(+), 46 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/BUG-REPORT.yml b/.github/ISSUE_TEMPLATE/BUG-REPORT.yml index 76009f6d1..4cc8b5f0c 100644 --- a/.github/ISSUE_TEMPLATE/BUG-REPORT.yml +++ b/.github/ISSUE_TEMPLATE/BUG-REPORT.yml @@ -19,7 +19,7 @@ body: id: version attributes: label: Version - description: What version of `cargo-shuttle` are you running (`cargo shuttle --version`)? + description: What version of `cargo-shuttle` are you running (`shuttle --version`)? placeholder: "v0.48.0" validations: required: true diff --git a/README.md b/README.md index 7506b5bae..dd896ee11 100644 --- a/README.md +++ b/README.md @@ -91,21 +91,20 @@ iwr "https://www.shuttle.rs/install-win" | iex After installing, log in with: ```sh -cargo shuttle login +shuttle login ``` To initialize your project, simply write: ```bash -cargo shuttle init --template axum hello-world +shuttle init --template axum hello-world ``` And to deploy it, write: ```bash cd hello-world -cargo shuttle project start # Only needed if project has not already been created during init -cargo shuttle deploy --allow-dirty +shuttle deploy ``` And... that's it! @@ -163,7 +162,7 @@ async fn main() -> shuttle_axum::ShuttleAxum { } ``` -Now, with just `cargo shuttle deploy`, you can see your application live. But let's enhance it further by adding a shared Postgres database: +Now, with just `shuttle deploy`, you can see your application live. But let's enhance it further by adding a shared Postgres database: ```rust use axum::{routing::get, Router}; @@ -187,7 +186,7 @@ async fn main( } ``` -Now, if we run `cargo shuttle deploy`, we'll have an up and running project with a database inside & ready to use. +Now, if we run `shuttle deploy`, we'll have an up and running project with a database inside & ready to use.

diff --git a/cargo-shuttle/README.md b/cargo-shuttle/README.md index 2edf4fa67..99aa4e4f9 100644 --- a/cargo-shuttle/README.md +++ b/cargo-shuttle/README.md @@ -44,7 +44,7 @@ cargo install cargo-shuttle ## Documentation -Run `cargo shuttle help` to see the basic usage. +Run `shuttle help` to see the basic usage. Full list of commands and more documentation can be viewed on the [CLI docs](https://docs.shuttle.rs/getting-started/shuttle-commands). diff --git a/cargo-shuttle/src/args.rs b/cargo-shuttle/src/args.rs index 4459a0fef..29ae3cedc 100644 --- a/cargo-shuttle/src/args.rs +++ b/cargo-shuttle/src/args.rs @@ -306,7 +306,7 @@ pub struct LogoutArgs { pub struct DeployArgs { /// WIP: Deploy this Docker image instead of building one #[arg(long, short = 'i', hide = true)] - pub image: Option, // TODO?: Make this a subcommand instead? `cargo shuttle deploy image ...` + pub image: Option, // TODO?: Make this a subcommand instead? `shuttle deploy image ...` /// Don't follow the deployment status, exit after the deployment begins #[arg(long, visible_alias = "nf")] pub no_follow: bool, diff --git a/cargo-shuttle/src/config.rs b/cargo-shuttle/src/config.rs index ca35e5159..d7d7ca960 100644 --- a/cargo-shuttle/src/config.rs +++ b/cargo-shuttle/src/config.rs @@ -442,7 +442,7 @@ impl RequestContext { self.global.manager.path().display() ) .context(anyhow!( - "No valid API key found, try logging in first with:\n\tcargo shuttle login" + "No valid API key found, try logging in first with `shuttle login`" ))), }, } diff --git a/cargo-shuttle/src/lib.rs b/cargo-shuttle/src/lib.rs index fa825c1e7..d9bd3f7d0 100644 --- a/cargo-shuttle/src/lib.rs +++ b/cargo-shuttle/src/lib.rs @@ -723,10 +723,14 @@ impl Shuttle { if std::env::current_dir().is_ok_and(|d| d != path) { println!("You can `cd` to the directory, then:"); } - println!("Run `cargo shuttle run` to run the app locally."); + if self.beta { + println!("Run `shuttle run` to run the app locally."); + } else { + println!("Run `cargo shuttle run` to run the app locally."); + } if !should_create_environment { if self.beta { - println!("Run `cargo shuttle deploy --allow-dirty` to deploy it to Shuttle."); + println!("Run `shuttle deploy` to deploy it to Shuttle."); } else { println!( "Run `cargo shuttle project start` to create a project environment on Shuttle." @@ -1267,7 +1271,7 @@ impl Shuttle { let proj_name = self.ctx.project_name(); - let deployments_len = if self.beta { + if self.beta { let mut deployments = client .get_deployments_beta(self.ctx.project_id(), page as i32, limit as i32) .await? @@ -1288,8 +1292,6 @@ impl Shuttle { if page_hint { println!("View the next page using `--page {}`", page + 1); } - - deployments.len() } else { let mut deployments = client .get_deployments(proj_name, page, limit) @@ -1305,15 +1307,13 @@ impl Shuttle { get_deployments_table(&deployments, proj_name, page, table_args.raw, page_hint); println!("{table}"); - deployments.len() + if deployments.is_empty() { + println!("Run `cargo shuttle deploy` to deploy your project."); + } else { + println!("Run `cargo shuttle logs ` to get logs for a given deployment."); + } }; - if deployments_len == 0 { - println!("Run `cargo shuttle deploy` to deploy your project."); - } else { - println!("Run `cargo shuttle logs ` to get logs for a given deployment."); - } - Ok(()) } diff --git a/common/src/models/error.rs b/common/src/models/error.rs index d20e7e88e..d56e146b0 100644 --- a/common/src/models/error.rs +++ b/common/src/models/error.rs @@ -260,7 +260,7 @@ pub struct ProjectNotReady; pub struct ProjectUnavailable; #[derive(Debug, Error)] -#[error("Project '{0}' not found. Make sure you are the owner of this project name. Run `cargo shuttle project start` to create a new project.")] +#[error("Project '{0}' not found. Make sure you are the owner of this project name. Run the `project start` to create a new project.")] pub struct ProjectNotFound(pub String); impl From for ApiError { diff --git a/common/src/models/resource.rs b/common/src/models/resource.rs index bdb5f5368..b7926045c 100644 --- a/common/src/models/resource.rs +++ b/common/src/models/resource.rs @@ -207,7 +207,7 @@ fn get_databases_table_beta( let show_secret_hint = if databases.is_empty() || show_secrets { "" } else { - "Hint: you can show the secrets of these resources using `cargo shuttle resource list --show-secrets`\n" + "Hint: you can show the secrets of these resources using `shuttle resource list --show-secrets`\n" }; format!("These databases are linked to {service_name}\n{table}\n{show_secret_hint}") diff --git a/common/src/templates.rs b/common/src/templates.rs index a4205597c..a8df1eedc 100644 --- a/common/src/templates.rs +++ b/common/src/templates.rs @@ -36,7 +36,7 @@ pub struct TemplateDefinition { /// URL to a live instance of the template (if relevant) pub live_demo: Option, - /// If this template is available in the `cargo shuttle init --template` short-hand options, add that name here + /// If this template is available in the `shuttle init --template` short-hand options, add that name here pub template: Option, ////// Fields for community templates diff --git a/install.ps1 b/install.ps1 index 1bc38256a..41cc83996 100644 --- a/install.ps1 +++ b/install.ps1 @@ -50,7 +50,7 @@ Please file an issue if you encounter any problems! Write-Host "Installing cargo-shuttle using cargo binstall" cargo-binstall.exe cargo-shuttle --no-confirm if ($?) { - Write-Host "Installed cargo-shuttle, try running ``cargo shuttle --help``" -ForegroundColor Green + Write-Host "Installed cargo-shuttle" -ForegroundColor Green return } else { @@ -74,7 +74,7 @@ Please file an issue if you encounter any problems! Move-Item -Force "$TempDir\cargo-shuttle\cargo-shuttle-x86_64-pc-windows-msvc-$LatestRelease\cargo-shuttle.exe" "$CargoHome\bin\cargo-shuttle.exe" Move-Item -Force "$TempDir\cargo-shuttle\cargo-shuttle-x86_64-pc-windows-msvc-$LatestRelease\shuttle.exe" "$CargoHome\bin\shuttle.exe" Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "$TempDir\cargo-shuttle.tar.gz", "$TempDir\cargo-shuttle" - Write-Host "Installed cargo-shuttle, try running ``cargo shuttle --help``" -ForegroundColor Green + Write-Host "Installed cargo-shuttle" -ForegroundColor Green return } elseif ($Arch -ne "AMD64") { @@ -89,7 +89,7 @@ Please file an issue if you encounter any problems! Write-Host "Installing cargo-shuttle using cargo install (from source)" cargo.exe install cargo-shuttle --locked if ($?) { - Write-Host "Installed cargo-shuttle, try running ``cargo shuttle --help``" -ForegroundColor Green + Write-Host "Installed cargo-shuttle" -ForegroundColor Green return } else { diff --git a/resources/aws-rds/README.md b/resources/aws-rds/README.md index d62c5e194..d53198762 100644 --- a/resources/aws-rds/README.md +++ b/resources/aws-rds/README.md @@ -25,6 +25,6 @@ An example using the Tide framework can be found on [GitHub](https://github.com/ Each engine can take in the following options: -| Option | Type | Description | -|-----------|------|--------------------------------------------------------------------------------------------------------------| -| local_uri | &str | Don't spin up a local docker instance of the DB, but rather connect to this URI instead for `cargo shuttle run` | +| Option | Type | Description | +|-----------|------|-----------------------------------------------------------------------------------------| +| local_uri | &str | Don't spin up a local docker instance of the DB, but rather connect to this URI instead | diff --git a/runtime/README.md b/runtime/README.md index 5fe2b0e59..693488739 100644 --- a/runtime/README.md +++ b/runtime/README.md @@ -21,7 +21,7 @@ cargo install cargo-shuttle Now that Shuttle is installed, you can initialize a project with Axum boilerplate: ```bash -cargo shuttle init --template axum my-axum-app +shuttle init --template axum my-axum-app ``` By looking at the `Cargo.toml` file of the generated `my-axum-app` project you will see it has been made to @@ -59,7 +59,7 @@ our [examples](https://github.com/shuttle-hq/shuttle-examples) if you prefer tha To test your app locally before deploying, use: ```bash -cargo shuttle run +shuttle run ``` You should see your app build and start on the default port 8000. You can test this using; @@ -71,23 +71,15 @@ curl http://localhost:8000/ ## Deploying -Before you can deploy, you have to create a project. This will start a deployer container for your -project under the hood, ensuring isolation from other users' projects. PS. you don't have to do this -now if you did in in the `cargo shuttle init` flow. +Deploy the service with: ```bash -cargo shuttle project start +shuttle deploy ``` -Then, deploy the service with: +Your service will then be made available under a subdomain of `*.shuttle.app`. For example: ```bash -cargo shuttle deploy -``` - -Your service will immediately be available at `https://{project_name}.shuttleapp.rs/`. For example: - -```bash -curl https://my-axum-app.shuttleapp.rs/ +curl https://my-axum-app-0000.shuttle.app/ # Hello, world! ``` diff --git a/runtime/src/start.rs b/runtime/src/start.rs index e128fe977..43a9fb8b9 100644 --- a/runtime/src/start.rs +++ b/runtime/src/start.rs @@ -60,7 +60,7 @@ pub async fn start(loader: impl Loader + Send + 'static, runner: impl Runner + S Ok(args) => args, Err(e) => { eprintln!("ERROR: Runtime failed to parse args: {e}"); - let help_str = "[HINT]: Run your Shuttle app with `cargo shuttle run`"; + let help_str = "[HINT]: Run your Shuttle app with `shuttle run` or `cargo shuttle run`"; let wrapper_str = "-".repeat(help_str.len()); eprintln!("{wrapper_str}\n{help_str}\n{wrapper_str}"); return; From f7dd3ef10de43957eb44326971b1ef866578c5c9 Mon Sep 17 00:00:00 2001 From: jonaro00 <54029719+jonaro00@users.noreply.github.com> Date: Wed, 9 Oct 2024 14:28:08 +0200 Subject: [PATCH 7/9] chore: bump cargo-shuttle --- Cargo.lock | 2 +- cargo-shuttle/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 76c0d4ef7..c389535d9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -998,7 +998,7 @@ dependencies = [ [[package]] name = "cargo-shuttle" -version = "0.48.1" +version = "0.48.2" dependencies = [ "anyhow", "assert_cmd", diff --git a/cargo-shuttle/Cargo.toml b/cargo-shuttle/Cargo.toml index c2611add4..c6a91bb40 100644 --- a/cargo-shuttle/Cargo.toml +++ b/cargo-shuttle/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cargo-shuttle" -version = "0.48.1" +version = "0.48.2" edition.workspace = true license.workspace = true repository.workspace = true From 81f54f6fdd3ae63d8a74625ed1b08622b48497f9 Mon Sep 17 00:00:00 2001 From: jonaro00 <54029719+jonaro00@users.noreply.github.com> Date: Wed, 9 Oct 2024 15:09:19 +0200 Subject: [PATCH 8/9] fix: show project id when deleting --- cargo-shuttle/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cargo-shuttle/src/lib.rs b/cargo-shuttle/src/lib.rs index d9bd3f7d0..ab8e2d802 100644 --- a/cargo-shuttle/src/lib.rs +++ b/cargo-shuttle/src/lib.rs @@ -2972,6 +2972,7 @@ impl Shuttle { async fn project_delete_beta(&self, no_confirm: bool) -> Result<()> { let client = self.client.as_ref().unwrap(); + let pid = self.ctx.project_id(); if !no_confirm { println!( @@ -2979,13 +2980,12 @@ impl Shuttle { formatdoc!( r#" WARNING: - Are you sure you want to delete "{}"? + Are you sure you want to delete "{pid}"? This will... - Shut down you service. - Delete any databases and secrets in this project. - Delete any custom domains linked to this project. - This action is permanent."#, - self.ctx.project_name() + This action is permanent."# ) .bold() .red() @@ -3000,7 +3000,7 @@ impl Shuttle { } } - let res = client.delete_project_beta(self.ctx.project_id()).await?; + let res = client.delete_project_beta(pid).await?; println!("{res}"); From d910c2b6d0c3624601934a918147a1027eb3e995 Mon Sep 17 00:00:00 2001 From: jonaro00 <54029719+jonaro00@users.noreply.github.com> Date: Thu, 10 Oct 2024 02:03:18 +0200 Subject: [PATCH 9/9] tracing log --- runtime/src/start.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/runtime/src/start.rs b/runtime/src/start.rs index 43a9fb8b9..55c2ae9e1 100644 --- a/runtime/src/start.rs +++ b/runtime/src/start.rs @@ -82,9 +82,11 @@ pub async fn start(loader: impl Loader + Send + 'static, runner: impl Runner + S ) .init(); - warn!( - "Default tracing subscriber initialized (https://docs.shuttle.rs/configuration/logs)" - ); + if args.beta { + warn!("Default tracing subscriber initialized (https://docs.shuttle.dev/docs/logs)"); + } else { + warn!("Default tracing subscriber initialized (https://docs.shuttle.rs/configuration/logs)"); + } } if args.beta {