Skip to content

Commit

Permalink
Use Debian for cloud image
Browse files Browse the repository at this point in the history
When Debian 10 was stable, the kernel wasn't new enough to include
Wireguard, so I used Ubuntu LTS. That's changed, since Debian 11 now
ships with the 5.10 kernel series, which includes Wireguard by default.
  • Loading branch information
conorsch committed Feb 11, 2022
1 parent ae8330c commit 3ba6d8f
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 9 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Innisfree changelog

## 0.2.16 (in progress)
## 0.2.16

* Use Debian Stable (11 Bullseye), rather than Ubuntu LTS, for cloud image
* Bugfix: add all API pubkeys, not just the first
* Dev only: don't error out on tests if no API key is present
* Dev only: prune unused fields from structs (thanks, clippy!)
Expand Down
2 changes: 1 addition & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@
* [x] Update cli output for ssh to recommend name flag
* [ ] Make IP address pairs deterministic (via ipgen)
* [ ] Create wg interfaces early
* [ ] Switch from Ubuntu LTS to Debian Stable (the freest OS <3)
* [x] Switch from Ubuntu LTS to Debian Stable (the freest OS <3)
1 change: 1 addition & 0 deletions files/cloudinit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ write_files:

packages:
- nginx
- sudo
- unattended-upgrades
- wireguard
- wireguard-tools
9 changes: 7 additions & 2 deletions src/doctor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,19 @@ pub fn distro_support() -> Result<bool, InnisfreeError> {
"Debian Stable Buster 10 doesn't ship wireguard by default, but it's available
in buster-backports. See for details: https://www.wireguard.com/install/"
);
} else if os_release.contains("ID=debian") && os_release.contains("VERSION_CODENAME=bullseye") {
info!(
"Debian Stable Bullseye 11 supports Wireguard out of the box. \
Run 'apt-get install wireguard wireguard-tools'."
);
} else if os_release.contains("ID=ubuntu") && os_release.contains("VERSION_CODENAME=focal") {
info!(
"Ubuntu Focal 20.04 supports Wireguard out of the box. \
Run 'apt-get install wireguard wireguard-tools'."
);
} else if os_release.contains("ID=fedora") && os_release.contains("VERSION_CODENAME=33") {
} else if os_release.contains("ID=fedora") && os_release.contains("VERSION_CODENAME=34") {
info!(
"Fedora 33 supports Wireguard out of the box. \
"Fedora 34 supports Wireguard out of the box. \
Run 'dnf install wireguard wireguard-tools'."
);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use crate::wg::WireguardManager;

const DO_REGION: &str = "sfo2";
const DO_SIZE: &str = "s-1vcpu-1gb";
const DO_IMAGE: &str = "ubuntu-20-04-x64";
const DO_IMAGE: &str = "debian-11-x64";
const DO_API_BASE_URL: &str = "https://api.digitalocean.com/v2/droplets";

// Manager class, wraps a cloudserver VM type, such as Droplet,
Expand Down
23 changes: 19 additions & 4 deletions tools/test-runner
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,27 @@ netstat -lnp | grep -iF "$local_port" | perl -lanE 'say $F[-1]' | grep -oP '^\d+
| xargs -d '\n' -r kill

dst_dir="$(mktemp -d)"
echo "Hello, world!" > "${dst_dir}/index.html"
test_string="Hello, world! $(uuid)"
echo "$test_string" > "${dst_dir}/index.html"
trap 'rm -rf "$dst_dir"' EXIT

cargo build
cargo run -- up -p "$local_port"
cargo run -- up -p "$local_port" &

# wait for server to come up
sleep 90s

python3 -m http.server --directory "$dst_dir" "$local_port" &
sleep 1
curl "http://localhost:${local_port}" || true
curl --connect-timeout 3 --max-time 5 "http://$(cargo run -- ip):${local_port}"
wait
result_string="$(curl -s --connect-timeout 3 --max-time 5 "http://$(cargo run -- ip):${local_port}")"
if [[ "$test_string" != "$result_string" ]] ; then
echo "ERROR: Failed to find test string: '$test_string'" >&2
exit 1
else
echo "SUCCESS: Found test string: '$test_string'" >&2
echo "Cleaning up..." >&2
# use SIGINT to kill because I haven't figured out how to catch other signals
jobs -p | xargs -r kill -s SIGINT
exit 0
fi

0 comments on commit 3ba6d8f

Please sign in to comment.