Swap Once install for omaterm prep (docker group + image pre-pull)

This commit is contained in:
Gavin Nugent 2026-06-06 10:39:59 +01:00
parent 7fa912af1b
commit 634b83fe97

View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# ============================================================================= # =============================================================================
# VPS Setup & Hardening Script for Arch Linux # VPS Setup & Hardening Script for Arch Linux
# For use with ONCE (Basecamp) + Docker deployments # Prepares a fresh box for OMATERM (docker-only) + Docker deployments
# Run as root on a fresh Arch Linux VPS # Run as root on a fresh Arch Linux VPS
# ============================================================================= # =============================================================================
@ -55,7 +55,7 @@ fi
echo -e "${CYAN}" echo -e "${CYAN}"
echo "╔══════════════════════════════════════════════════════════════╗" echo "╔══════════════════════════════════════════════════════════════╗"
echo "║ VPS Setup & Hardening Script ║" echo "║ VPS Setup & Hardening Script ║"
echo "║ Arch Linux · Docker · ONCE · Git ║" echo "║ Arch Linux · Docker · OMATERM · Git ║"
echo "╚══════════════════════════════════════════════════════════════╝" echo "╚══════════════════════════════════════════════════════════════╝"
echo -e "${NC}" echo -e "${NC}"
@ -157,8 +157,8 @@ pacman -S --noconfirm --needed \
docker \ docker \
docker-compose docker-compose
# Docker must be running before ONCE installs (the ONCE installer does not # Docker must be running before omaterm installs — the new omaterm is
# install Docker on Arch — only on apt-based distros) # docker-only (everything runs in the ghcr.io/omacom-io/omaterm container)
systemctl enable --now docker.service systemctl enable --now docker.service
log "System updated, packages installed, Docker running" log "System updated, packages installed, Docker running"
@ -352,24 +352,28 @@ log "Weekly auto-update timer enabled (pacman-update.timer)"
warn "Rolling release: check 'journalctl -u pacman-update' if anything misbehaves after an update" warn "Rolling release: check 'journalctl -u pacman-update' if anything misbehaves after an update"
# ============================================================================= # =============================================================================
# 8. ONCE (Docker already installed via pacman in step 1) # 8. OMATERM PREP (Docker already installed via pacman in step 1)
# ============================================================================= # =============================================================================
step "8/8 · ONCE" step "8/8 · Omaterm prep"
log "Installing ONCE..." # Omaterm itself is installed interactively after first login as the deploy
su - $DEPLOY_USER -c 'curl https://get.once.com | ONCE_INTERACTIVE=false sh' || { # user — here we just make sure the box is ready for it:
warn "ONCE auto-install had issues — you can install manually:"
warn " ssh $SSH_ALIAS"
warn " curl https://get.once.com | sh"
}
# Ensure deploy user is in docker group # Deploy user needs docker group membership to run the omaterm container
if getent group docker &>/dev/null; then if getent group docker &>/dev/null; then
usermod -aG docker $DEPLOY_USER usermod -aG docker $DEPLOY_USER
log "$DEPLOY_USER added to docker group" log "$DEPLOY_USER added to docker group"
fi fi
# Pre-pull the omaterm image so the installer doesn't have to
log "Pre-pulling omaterm image (this may take a while)..."
if docker pull ghcr.io/omacom-io/omaterm:latest; then
log "Omaterm image pre-pulled"
else
warn "Image pre-pull failed — the omaterm installer will pull it instead"
fi
# ============================================================================= # =============================================================================
# SWAP (2GB) # SWAP (2GB)
# ============================================================================= # =============================================================================
@ -582,7 +586,7 @@ echo " └─ 443/tcp HTTPS"
echo "" echo ""
echo -e " ${GREEN}Services${NC}" echo -e " ${GREEN}Services${NC}"
echo " ├─ Docker: $(docker --version 2>/dev/null || echo 'installed')" echo " ├─ Docker: $(docker --version 2>/dev/null || echo 'installed')"
echo " ├─ ONCE: run 'once' as $DEPLOY_USER to manage apps" echo " ├─ Omaterm: image pre-pulled — install after first login (see below)"
echo " ├─ Fail2ban: active (systemd backend)" echo " ├─ Fail2ban: active (systemd backend)"
echo " └─ Auto-updates: weekly pacman-update.timer" echo " └─ Auto-updates: weekly pacman-update.timer"
echo "" echo ""
@ -609,8 +613,13 @@ echo ""
echo -e " ${CYAN}────── COPY ABOVE THIS LINE ──────${NC}" echo -e " ${CYAN}────── COPY ABOVE THIS LINE ──────${NC}"
echo "" echo ""
echo " 2. Test SSH: ssh $SSH_ALIAS" echo " 2. Test SSH: ssh $SSH_ALIAS"
echo " 3. Run ONCE: ssh $SSH_ALIAS 'once'" echo " 3. Install omaterm (interactive SSH session, NOT a one-liner —"
echo " 4. Deploy: ssh $SSH_ALIAS '~/deploy.sh /opt/apps/myapp'" echo " the installer needs a real terminal with TERM set):"
echo ""
echo -e " ${CYAN}ssh $SSH_ALIAS${NC}"
echo -e " ${CYAN}curl -fsSL https://omaterm.org/install | bash${NC}"
echo ""
echo " If it complains about the terminal: TERM=xterm-256color first."
echo "" echo ""
echo " Once step 1 is done, Claude Code can control this server." echo " Once step 1 is done, Claude Code can control this server."
echo "" echo ""