Skip to content
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

fix: cleanup for 0.28.0 #1278

Merged
merged 10 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,7 @@ jobs:
command: |
# From https://github.com/briansmith/ring/issues/1414#issuecomment-1055177218
export CC_aarch64_unknown_linux_musl=clang
# "vendored-openssl" is from https://github.com/cross-rs/cross/issues/229#issuecomment-597898074
cargo build --release --package cargo-shuttle --features vendored-openssl --target << parameters.target >>
cargo build --release --package cargo-shuttle --target << parameters.target >>
- make-artifact:
target: << parameters.target >>
build-binaries-windows:
Expand All @@ -489,8 +488,7 @@ jobs:
# From https://github.com/alexcrichton/openssl-src-rs/issues/45
# Because of https://github.com/openssl/openssl/issues/9048
$env:OPENSSL_SRC_PERL="C:\Strawberry\perl\bin\perl.exe"
# "vendored-openssl" is from https://github.com/cross-rs/cross/issues/229#issuecomment-597898074
..\.cargo\bin\cargo.exe build --release --package cargo-shuttle --features vendored-openssl --target x86_64-pc-windows-msvc
..\.cargo\bin\cargo.exe build --release --package cargo-shuttle --target x86_64-pc-windows-msvc
shell: powershell.exe
- make-artifact:
target: x86_64-pc-windows-msvc
Expand All @@ -509,8 +507,7 @@ jobs:
- run:
name: Build
command: |
# "vendored-openssl" is from https://github.com/cross-rs/cross/issues/229#issuecomment-597898074
cargo build --release --package cargo-shuttle --features vendored-openssl --target x86_64-apple-darwin
cargo build --release --package cargo-shuttle --target x86_64-apple-darwin
- make-artifact:
target: x86_64-apple-darwin
publish-github-release:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ rand = "0.8.5"
reqwest = { version = "0.11.13", default-features = false, features = ["rustls-tls"] }
ring = "0.16.20"
rmp-serde = "1.1.1"
semver = { version = "1.0.19", features = ["serde"] }
semver = { version = "1.0.17", features = ["serde"] }
serde = { version = "1.0.148", default-features = false }
serde_json = "1.0.89"
sqlx = "0.7.1"
Expand Down
1 change: 1 addition & 0 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ RUN for target_platform in "linux/arm64" "linux/arm64/v8"; do \
ARG PROD
# Easy way to check if you are running in Shuttle's container
ARG SHUTTLE=true
ENV SHUTTLE=${SHUTTLE}
COPY deployer/prepare.sh /prepare.sh
COPY scripts/apply-patches.sh /scripts/apply-patches.sh
COPY scripts/patches.toml /scripts/patches.toml
Expand Down
14 changes: 6 additions & 8 deletions deployer/src/deployment/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,13 @@ pub async fn task(
async move {
// Timeout after 3 minutes if the build queue hangs or it takes
// too long for a slot to become available
match timeout(
if let Err(err) = timeout(
Duration::from_secs(60 * 3),
wait_for_queue(queue_client.clone(), id),
)
.await
{
Ok(_) => {}
Err(err) => return build_failed(&id, err),
return build_failed(&id, err);
}

if let Some(mut inner) = builder_client {
Expand Down Expand Up @@ -342,11 +341,6 @@ async fn set_secrets(
/// Akin to the command: `tar -xzf --strip-components 1`
#[instrument(skip(data, dest))]
async fn extract_tar_gz_data(data: impl Read, dest: impl AsRef<Path>) -> Result<()> {
debug!("Unpacking archive into {:?}", dest.as_ref());
let tar = GzDecoder::new(data);
let mut archive = Archive::new(tar);
archive.set_overwrite(true);

// Clear directory first
trace!("Clearing old files");
let mut entries = fs::read_dir(&dest).await?;
Expand All @@ -366,6 +360,10 @@ async fn extract_tar_gz_data(data: impl Read, dest: impl AsRef<Path>) -> Result<
}
}

debug!("Unpacking archive into {:?}", dest.as_ref());
let tar = GzDecoder::new(data);
let mut archive = Archive::new(tar);
archive.set_overwrite(true);
for entry in archive.entries()? {
let mut entry = entry?;
let name = entry.path()?;
Expand Down
2 changes: 1 addition & 1 deletion resources/metadata/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use async_trait::async_trait;
pub use shuttle_service::DeploymentMetadata as Metadata;
use shuttle_service::{error::Error, Factory, ResourceBuilder, Type};
pub use shuttle_service::{DeploymentMetadata as Metadata, Environment, ProjectName};

pub struct ShuttleMetadata;

Expand Down
3 changes: 2 additions & 1 deletion resources/static-folder/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[package]
# TODO: remove me from shuttle repo after 0.28.0
name = "shuttle-static-folder"
version = "0.27.0"
edition = "2021"
Expand All @@ -9,4 +10,4 @@ keywords = ["shuttle-service", "static-folder"]
[dependencies]
async-trait = "0.1.56"
serde = { version = "1.0.148", features = ["derive"] }
shuttle-service = { path = "../../service", version = "0.27.0" }
shuttle-service = { path = "../../service", version = ">=0.27.0, <0.31.0" }
4 changes: 4 additions & 0 deletions resources/static-folder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ use serde::Serialize;
use shuttle_service::{Error, Factory, ResourceBuilder, Type};

#[derive(Serialize)]
#[deprecated(
since = "0.27.0",
note = "Folder names can now be hard coded. More about deployment files: https://docs.shuttle.rs/configuration/files"
)]
pub struct StaticFolder<'a> {
/// The folder to reach at runtime. Defaults to `static`
folder: &'a str,
Expand Down
2 changes: 1 addition & 1 deletion scripts/local-admin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
key="dh9z58jttoes3qvt" # arbitrary test key
export SHUTTLE_API_KEY=$key
export SHUTTLE_API="http://localhost:8001"
export PS1="(shuttle: local admin key) $PS1"
export PS1="(shuttle: local admin key) $(echo $PS1 | sed -e "s/(shuttle: .*) //")"

docker compose --file docker-compose.rendered.yml --project-name shuttle-dev exec auth /usr/local/bin/shuttle-auth --state=/var/lib/shuttle-auth init-admin --name admin --key $key
2 changes: 1 addition & 1 deletion scripts/production.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

export SHUTTLE_API="https://api.shuttle.rs"
unset SHUTTLE_API_KEY
export PS1="(shuttle: production) $PS1"
export PS1="(shuttle: production) $(echo $PS1 | sed -e "s/(shuttle: .*) //")"
2 changes: 1 addition & 1 deletion scripts/unstable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

export SHUTTLE_API="https://api.unstable.shuttle.rs"
unset SHUTTLE_API_KEY
export PS1="(shuttle: unstable) $PS1"
export PS1="(shuttle: unstable) $(echo $PS1 | sed -e "s/(shuttle: .*) //")"