#!/bin/bash
set -e

if [ "$EUID" -ne 0 ]; then 
  echo "Please run as root (sudo)"
  exit 1
fi

echo "--- Installing Certbot ---"
apt-get update
apt-get install -y certbot python3-certbot-nginx

echo "--- Obtaining SSL Certificate ---"
# This command is interactive and will ask for email and agreement
certbot --nginx -d wa.app.oncloud.my.id
