rise-deploy 0.15.7

A simple and powerful CLI for deploying containerized applications
[tools]
minikube = "1.37.0"
pack = "0.39.0"
"ubi:railwayapp/railpack" = "0.15.1"
"cargo:sqlx-cli" = "latest"
"cargo:cargo-all-features" = "latest"
mdbook = "latest"
helm = "latest"
rust = { version = "1.91.1", profile = "default" }

[tasks."sqlx:prepare"]
description = "Prepare the SQLX query cache that needs to be committed for building with SQLX_OFFLINE=true."
run = "cargo sqlx prepare -- --features cli,backend --all-targets"

[tasks."sqlx:check"]
description = "Check that all SQLX queries are valid."
run = "cargo sqlx prepare --check -- --features cli,backend --all-targets"

[tasks.lint]
description = "Run all linting checks (clippy, formatting, sqlx, helm)."
run = """
SQLX_OFFLINE=true cargo all-features check --all-targets
SQLX_OFFLINE=true cargo all-features clippy --all-targets -- -D warnings
cargo fmt --all -- --check
mise sqlx:check
helm lint helm/rise
"""

[tasks."config:schema:generate"]
description = "Generate the backend settings JSON schema."
run = "cargo run --features cli,backend -- backend config-schema > docs/schemas/backend-settings.schema.json"

[tasks."config:schema:check"]
description = "Verify the committed backend settings JSON schema is up to date."
run = "mise config:schema:generate && git --no-pager diff --exit-code -- docs/schemas/backend-settings.schema.json"

[tasks."docs:serve"]
description = "Serve documentation with live reload in port 3001."
run = "mdbook serve -p 3001 --open"

[tasks."db:nuke"]
description = "Drop and recreate the development database. USE WITH CAUTION."
run = """
set -x
docker compose down -v postgres
docker compose up postgres -d
"""

[tasks."db:migrate"]
description = "Run database migrations. Run before building the backend."
run = "docker compose up postgres -d && sleep 2 && sqlx migrate run"

[tasks."backend:deps"]
description = "Start all backend dependencies with docker compose."
run = "docker compose up -d"

[tasks."backend:run"]
description = "Run the backend server."
depends = ["backend:deps", "db:migrate"]
run = "cargo run --features cli,backend -- backend server"
alias = "br"

[tasks."backend:run-container"]
description = "Build and run the backend server in its container (host network). Useful to validate the containerized version works as intended."
depends = ["backend:deps", "db:migrate"]
run = "docker build . -t rise --target rise && docker run --rm --network host -v $PWD/config:/etc/rise:ro -v $HOME/.kube:/root/.kube:ro -v $HOME/.minikube:$HOME/.minikube:ro -e DATABASE_URL=$DATABASE_URL -e RISE_CONFIG_DIR=/etc/rise -e RISE_CONFIG_RUN_MODE=development rise backend server"

[tasks."frontend:dev"]
description = "Run the Vite frontend development server."
run = "cd frontend && npm install && npm run dev"

[tasks."frontend:build"]
description = "Build the frontend bundle for embedding in the backend binary."
run = """
cd frontend
npm install
npm run build
cp dist/index.html ../static/
cp -r dist/assets/* ../static/assets/
"""

[tasks."dist:build"]
description = "Build local release artifacts using cargo-dist."
run = """
cargo install cargo-dist --locked
cargo dist build --target x86_64-unknown-linux-gnu --target x86_64-apple-darwin --target aarch64-apple-darwin
"""

[tasks."minikube:launch"]
description = "Start minikube, preconfigured with access to the local Docker registry (rise-registry)."
run = """
set -x

docker compose up -d registry
NETWORK_NAME=rise_default
REGISTRY_NAME=rise-registry
REGISTRY_DIR="/etc/containerd/certs.d/localhost:5000"

minikube delete
minikube start --driver=docker --insecure-registry="${REGISTRY_NAME}:5000" --memory=4096mb --cpus=2 --cni=calico
minikube addons enable ingress

for node in $(minikube node list | awk '{print $1}'); do
  docker exec "${node}" mkdir -p "${REGISTRY_DIR}"
  cat <<EOF | docker exec -i "${node}" cp /dev/stdin "${REGISTRY_DIR}/hosts.toml"
[host."http://${REGISTRY_NAME}:5000"]
EOF
done

docker network connect "${NETWORK_NAME}" minikube || true

echo
echo "Minikube started. Port-forawrding ingress-nginx-controller to localhost:8080 (HTTP) and localhost:8443 (HTTPS)..."
echo "You might want to update your /etc/hosts to point your local domains to 127.0.0.1"
echo

kubectl port-forward --namespace ingress-nginx svc/ingress-nginx-controller 8080:80 8443:443
"""