mirror of
https://github.com/mcloh/decision-models-benchmark.git
synced 2026-11-06 06:14:11 +00:00
setup models
This commit is contained in:
14
infra/vm/bootstrap.sh
Executable file
14
infra/vm/bootstrap.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
# Preparação idempotente da VM de trabalho (Oracle Linux 9). Rodar na VM:
|
||||
# bash infra/vm/bootstrap.sh
|
||||
set -euo pipefail
|
||||
sudo dnf install -y -q git rsync tmux jq python3.12 python3.12-pip python3.12-devel gcc gcc-c++ >/dev/null
|
||||
[ -d "$HOME/.venv-oci" ] || python3.12 -m venv "$HOME/.venv-oci"
|
||||
"$HOME/.venv-oci/bin/pip" install -q --upgrade pip
|
||||
"$HOME/.venv-oci/bin/pip" install -q "oci==2.187.2" oci-cli "huggingface_hub==0.36.2" jsonschema fastapi uvicorn pyyaml pytest httpx
|
||||
grep -q OCI_CLI_AUTH "$HOME/.bashrc" || cat >> "$HOME/.bashrc" <<'RC'
|
||||
export OCI_CLI_AUTH=instance_principal
|
||||
export DMB_OCI_AUTH=instance_principal
|
||||
export PATH=$HOME/.venv-oci/bin:$PATH
|
||||
RC
|
||||
echo "bootstrap ok: $(python3.12 --version), oci $("$HOME/.venv-oci/bin/python" -c 'import oci;print(oci.__version__)')"
|
||||
26
infra/vm/remote.sh
Executable file
26
infra/vm/remote.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
# Máquina local = IDE + repositório; execução na VM dmb-vm.
|
||||
# infra/vm/remote.sh sync # envia o repositório (sem .secrets, models, venvs)
|
||||
# infra/vm/remote.sh run <comando...> # sincroniza e roda o comando na VM, dentro do repositório
|
||||
# infra/vm/remote.sh ssh # abre um shell na VM
|
||||
set -euo pipefail
|
||||
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
KEY="$ROOT/.secrets/ssh/ssh-key-oci.key"
|
||||
IP="$(grep -oE 'IP público [0-9.]+' "$ROOT/.secrets/artefatos-OCI.md" | head -1 | awk '{print $3}')"
|
||||
[ -n "$IP" ] || { echo "IP da VM não encontrado em .secrets/artefatos-OCI.md" >&2; exit 1; }
|
||||
SSH=(ssh -i "$KEY" -o StrictHostKeyChecking=accept-new -o ServerAliveInterval=30 "opc@$IP")
|
||||
REMOTE_DIR=/data/repo
|
||||
|
||||
sync() {
|
||||
rsync -az --delete -e "ssh -i $KEY -o StrictHostKeyChecking=accept-new" \
|
||||
--exclude '.git/' --exclude '.secrets/' --exclude 'models/' --exclude '.venv*/' \
|
||||
--exclude '__pycache__/' --exclude 'reports/sanity/' --exclude 'runs/' \
|
||||
"$ROOT/" "opc@$IP:$REMOTE_DIR/"
|
||||
}
|
||||
|
||||
case "${1:-}" in
|
||||
sync) sync ;;
|
||||
run) shift; sync; "${SSH[@]}" "cd $REMOTE_DIR && bash -lc $(printf '%q' "$*")" ;;
|
||||
ssh) "${SSH[@]}" ;;
|
||||
*) sed -n '2,6p' "$0"; exit 1 ;;
|
||||
esac
|
||||
Reference in New Issue
Block a user