Skip to content

Commit

Permalink
fix: install shuttle-next runtime in deployers (#1127)
Browse files Browse the repository at this point in the history
* fix: install shuttle-next runtime in deployers

* fix: revert previous, fix registry bug

* refactor: comment, newline

* fix: add panax mirror after installing shuttle-next

* refactor: clarify comment in containerfile
  • Loading branch information
oddgrd authored Aug 4, 2023
1 parent 4dfd65c commit 1a436ce
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 21 deletions.
3 changes: 2 additions & 1 deletion Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ RUN /prepare.sh "${prepare_args}"

COPY --from=cache /build /usr/src/shuttle/

# Any prepare steps that depend on the COPY from src cache
# Any prepare steps that depend on the COPY from src cache.
# In the deployer shuttle-next is installed and the panamax mirror config is added in this step.
RUN /prepare.sh --after-src "${prepare_args}"

COPY --from=builder /build/target/${CARGO_PROFILE}/shuttle-${folder} /usr/local/bin/service
Expand Down
36 changes: 16 additions & 20 deletions deployer/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,28 @@
# service might need some extra preparation steps for its final image #
###############################################################################


# Stuff that depends on local source files
if [ "$1" = "--after-src" ]; then
# Install the shuttle-next runtime for shuttle-next services.
cargo install shuttle-runtime --path "/usr/src/shuttle/runtime" --bin shuttle-next --features next || exit 1

# Install the shuttle runtime
cargo install shuttle-runtime --path "/usr/src/shuttle/runtime" --bin shuttle-next --features next

while getopts "p," o; do
case $o in
"p") # if panamax is used, the '-p' parameter is passed
# Make future crates requests to our own mirror
echo '
[source.shuttle-crates-io-mirror]
registry = "sparse+http://panamax:8080/index/"
[source.crates-io]
replace-with = "shuttle-crates-io-mirror"' >> $CARGO_HOME/config.toml
;;
*)
;;
esac
done
exit 0
fi


# Patch crates to be on same versions
mkdir -p $CARGO_HOME
touch $CARGO_HOME/config.toml
Expand Down Expand Up @@ -49,21 +60,6 @@ fi
# Add the wasm32-wasi target
rustup target add wasm32-wasi

while getopts "p," o; do
case $o in
"p") # if panamax is used, the '-p' parameter is passed
# Make future crates requests to our own mirror
echo '
[source.shuttle-crates-io-mirror]
registry = "sparse+http://panamax:8080/index/"
[source.crates-io]
replace-with = "shuttle-crates-io-mirror"' >> $CARGO_HOME/config.toml
;;
*)
;;
esac
done

# Install common build tools for external crates
# The image should already have these: https://github.com/docker-library/buildpack-deps/blob/65d69325ad741cea6dee20781c1faaab2e003d87/debian/buster/Dockerfile
apt update
Expand Down

0 comments on commit 1a436ce

Please sign in to comment.