forked from trillium-rs/trillium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mathias Iversen
committed
Apr 18, 2022
1 parent
a00bcee
commit b0e771f
Showing
2 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/*! | ||
## How to deploy to aws | ||
Prerequisites: | ||
- [aws account](https://aws.amazon.com) | ||
- [aws cli](https://aws.amazon.com/cli/) | ||
- [musl gcc](https://www.musl-libc.org/how.html) | ||
Installing musl-gcc: | ||
- Darwin: `brew install filosottile/musl-cross/musl-cross` | ||
- Linux: `sudo apt get install musl-tools` | ||
**1. Add build target to rustup** | ||
```no_run | ||
rustup target add x86_64-unknown-linux-musl | ||
``` | ||
**2. Update cargo config with target & linker** | ||
```no_run | ||
mkdir .cargo | ||
echo -e '[target.x86_64-unknown-linux-musl]\nlinker = "x86_64-linux-musl-gcc"' > .cargo/config | ||
``` | ||
You can either create the .cargo folder inside you project or install it in you home directory if you prefer to use the same settings across all your projects. | ||
You might also have to create a symbolic link to the installd linker. | ||
```no_run | ||
ln -s /usr/local/bin/x86_64-linux-musl-gcc /usr/local/bin/musl-gcc | ||
``` | ||
**3. Build your program** | ||
```no_run | ||
cargo build --release --target x86_64-unknown-linux-musl | ||
``` | ||
The aws lambda expects the uploaded binary to be named `bootstrap`. So either make sure to rename your binary add boostrap to your Config.toml and build with: `--bin bootstrap`. | ||
```no_run | ||
[[ bin ]] | ||
name = "boostrap" | ||
path = "src/main.rs" | ||
``` | ||
**4. Zip the binary** | ||
-j *stores just the name of the saved file, 'junk the path'* | ||
```no_run | ||
zip -j lambda.zip ./target/x86_64-unknown-linux-musl/release/bootstrap | ||
``` | ||
**5. Create the lambda.** | ||
*/ |