build(rust): declare rust-version 1.88; rustup setup for the server
This commit is contained in:
1 parent
4e619aa2ae
commit
63353f1e80
4 files changed
+19
-5
No files matched your search
@@ -3,7 +3,10 @@ resolver = "3"
|
||||
members = ["collector"]
|
||||
|
||||
[workspace.package]
|
||||
# 1.88: edition 2024 let-chains, and dependencies (home, icu_*) need it. Distro
|
||||
# cargo packages are older: install the toolchain with rustup (rust/README.md).
|
||||
edition = "2024"
|
||||
rust-version = "1.88"
|
||||
license = "MIT"
|
||||
publish = false
|
||||
repository = "https://git.b4l.co.th/B4L/Northern-Thailand-Ping-River-Monitor"
|
||||
|
||||
+13
-4
@@ -72,12 +72,21 @@ Linux needs `pkg-config` and `libssl-dev`.
|
||||
|
||||
### Deploy
|
||||
|
||||
On the server, after `git pull` (the Python side of the switch ships in the
|
||||
same commit):
|
||||
Needs Rust >= 1.88. Distro `cargo` packages are older (`resolver 3 is not
|
||||
valid` / `edition 2024` errors), so install the toolchain once with rustup:
|
||||
|
||||
```bash
|
||||
cargo build --release --locked --manifest-path rust/Cargo.toml # as a normal user,
|
||||
# or BIN=<CI artifact>
|
||||
apt-get install -y build-essential pkg-config libssl-dev curl
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
|
||||
. "$HOME/.cargo/env" # puts ~/.cargo/bin before /usr/bin/cargo
|
||||
cargo --version # >= 1.88
|
||||
```
|
||||
|
||||
Then on the server, after `git pull` (the Python side of the switch ships in
|
||||
the same commit):
|
||||
|
||||
```bash
|
||||
cargo build --release --locked --manifest-path rust/Cargo.toml # or BIN=<CI artifact>
|
||||
sudo bash scripts/install_collector.sh # install + dry run, nothing switched
|
||||
sudo bash scripts/install_collector.sh --cutover # Rust collects from now on
|
||||
sudo bash scripts/install_collector.sh --rollback # back to Python collection
|
||||
|
||||
@@ -3,6 +3,7 @@ name = "ping-collector"
|
||||
version = "0.1.0"
|
||||
description = "Ping River Monitor data collector: RID gauges, HII/ThaiWater, RID dams, Open-Meteo rain -> PostgreSQL"
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
license.workspace = true
|
||||
publish.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
# linux-x86_64" CI artifact) or from rust/target/release/ping-collector, built
|
||||
# beforehand as a normal user:
|
||||
# cargo build --release --locked --manifest-path rust/Cargo.toml
|
||||
# (needs rustup, pkg-config and libssl-dev).
|
||||
# (needs Rust >= 1.88 from rustup -- distro cargo is too old -- plus pkg-config
|
||||
# and libssl-dev; see rust/README.md).
|
||||
set -euo pipefail
|
||||
|
||||
APP_DIR="${APP_DIR:-/opt/thailand-water-monitor}"
|
||||
|
||||
Reference in new issue
Block a user