diff --git a/elemes.sh b/elemes.sh index 66953a0..23a5bd9 100755 --- a/elemes.sh +++ b/elemes.sh @@ -182,25 +182,25 @@ run) ;; exportall) echo "đŸ“Ļ === Mengekspor Semua Image (Pre-Compiled Bundle) ===" - TAR_FILE="lms-c-precompiled.tar" + TAR_FILE="lms-precompiled.tar" cd "$SCRIPT_DIR" || exit echo "đŸ—ī¸ 1. Mem-build Backend Elemes..." - podman build -t lms-c-backend:latest -f Dockerfile . + podman build -t lms-backend:latest -f Dockerfile . echo "đŸ—ī¸ 2. Mem-build Frontend Elemes (SvelteKit)..." - podman build -t lms-c-frontend:latest -f frontend/Dockerfile frontend/ + podman build -t lms-frontend:latest -f frontend/Dockerfile frontend/ echo "đŸ—ī¸ 3. Mem-build Velxio Simulator..." - podman build -t lms-c-velxio:latest -f velxio/Dockerfile.standalone --build-arg ENABLE_ESP32=${ENABLE_ESP32:-0} velxio/ + podman build -t lms-velxio:latest -f velxio/Dockerfile.standalone --build-arg ENABLE_ESP32=${ENABLE_ESP32:-0} velxio/ echo "" echo "🔍 Memverifikasi image yang berhasil di-build..." - podman images | grep -E "lms-c-(backend|frontend|velxio)" + podman images | grep -E "lms-(backend|frontend|velxio)" echo "" echo "💾 Menyatukan semua image menjadi 1 file tar: $TAR_FILE..." - podman save lms-c-backend:latest lms-c-frontend:latest lms-c-velxio:latest >"$TAR_FILE" + podman save lms-backend:latest lms-frontend:latest lms-velxio:latest >"$TAR_FILE" if [ $? -eq 0 ]; then FILESIZE=$(du -h "$TAR_FILE" | cut -f1) @@ -212,21 +212,23 @@ exportall) echo " 2. Load image: podman load -i $TAR_FILE" echo " 3. Jalankan: podman-compose up -d" echo "" - echo " âš ī¸ Pastikan podman-compose.yml menggunakan image:" + echo " âš ī¸ Tag image bundle sudah sama dengan podman-compose.yml:" echo " - lms-backend:latest (untuk service elemes)" echo " - lms-frontend:latest (untuk service elemes-frontend)" echo " - lms-velxio:latest (untuk service velxio)" + echo " â„šī¸ Service compiler-worker & flowchart TIDAK ikut bundle — di VPS" + echo " image-nya di-build otomatis oleh podman-compose dari source (build:)." else echo "❌ Export gagal." fi ;; importall) echo "đŸ“Ļ === Mengimpor Semua Image (Pre-Compiled Bundle) ===" - TAR_FILE="lms-c-precompiled.tar" + TAR_FILE="lms-precompiled.tar" if [ ! -f "$TAR_FILE" ]; then echo "❌ File $TAR_FILE tidak ditemukan!" - echo " Pastikan file sudah ada di direktori ini." + echo " Pastikan file sudah ada di direktori ini (nama default: lms-precompiled.tar)." exit 1 fi @@ -235,7 +237,7 @@ importall) echo "" echo "🔍 Memverifikasi image yang berhasil di-load..." - podman images | grep -E "lms-c-(backend|frontend|velxio)" + podman images | grep -E "lms-(backend|frontend|velxio)" echo "" echo "✅ Selesai! Image berhasil diimpor." diff --git a/test_elemes_sh.sh b/test_elemes_sh.sh index 6287033..8ac855f 100755 --- a/test_elemes_sh.sh +++ b/test_elemes_sh.sh @@ -207,12 +207,37 @@ else || fail "dbrestore tidak memakai compose_exec postgres (psql reset schema)" fi -# ===== 4) Tidak boleh ada container name hard-coded / `podman exec` langsung -if grep -qE "lms-dev_|lms-sinau-c_|podman exec " "$ACCUM"; then - fail "masih ada panggilan container name hard-coded:" - grep -E "lms-dev_|lms-sinau-c_|podman exec " "$ACCUM" || true +# ===== 3c) exportall / importall memakai tag lms-* (bukan lms-c-*) =========== +if ! OUT=$(run_elemes exportall); then + fail "exportall tidak berjalan" else - ok "tidak ada nama container hard-coded di semua panggilan" + grep -q "build -t lms-backend:latest" "$FAKEBIN/calls.log" \ + && ok "exportall build tag lms-backend:latest" \ + || fail "exportall tidak build tag lms-backend:latest" + grep -q "save lms-backend:latest lms-frontend:latest lms-velxio:latest" "$FAKEBIN/calls.log" \ + && ok "exportall save 3 image dengan tag lms-*" \ + || fail "exportall tidak save dengan tag lms-*" + if [ -f "$WORKSPACE/lms-precompiled.tar" ]; then + ok "exportall membuat file lms-precompiled.tar" + else + fail "exportall tidak membuat file lms-precompiled.tar" + fi +fi + +if ! OUT=$(run_elemes importall); then + fail "importall tidak berjalan" +else + grep -q "load -i lms-precompiled.tar" "$FAKEBIN/calls.log" \ + && ok "importall load dari lms-precompiled.tar" \ + || fail "importall tidak load dari lms-precompiled.tar" +fi + +# ===== 4) Tidak boleh ada container name hard-coded / `podman exec` langsung +if grep -qE "lms-dev_|lms-sinau-c_|lms-c-|podman exec " "$ACCUM"; then + fail "masih ada panggilan container name hard-coded / tag lama lms-c-:" + grep -E "lms-dev_|lms-sinau-c_|lms-c-|podman exec " "$ACCUM" || true +else + ok "tidak ada nama container hard-coded / tag lms-c- di semua panggilan" fi # ===== 5) Label filter memakai PROJECT_NAME dinamis