Updating WEVA
Follow this tutorial to upgrade the WEVA services while preserving device configurations and historical data.
1. Backup Existing Dataβ
Before performing any update, if using the older version, it is critical to backup the database data to avoid any data loss.
Linux and Mac
- Create a file
update.sh. - Copy this into the file π:
#!/usr/bin/env bash
# Exit immediately if a command exits with a non-zero status
set -e
# --- CONFIGURATION ---
CONTAINER_NAME="mysql-db" # Name of your MySQL container
DB_USER="root" # MySQL User
DB_PASSWORD="mypassword" # MySQL Password
DB_NAME="wagopa" # Database to back up
BACKUP_DIR="./db_dumps" # Local directory to store backups
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
BACKUP_FILE="${BACKUP_DIR}/backup_${DB_NAME}_${TIMESTAMP}.sql"
echo "π Starting clean container update workflow..."
# 1. Ensure backup directory exists
mkdir -p "$BACKUP_DIR"
# 2. Database Backup (Failsafe Mechanism)
echo "πΎ Backing up MySQL database..."
if docker exec "$CONTAINER_NAME" mysqldump -u"$DB_USER" -p"$DB_PASSWORD" "$DB_NAME" > "$BACKUP_FILE"; then
echo "β
Backup saved successfully to: $BACKUP_FILE"
else
echo "β CRITICAL: MySQL backup failed! Aborting update to protect system integrity."
exit 1
fi
# 3. Pull New Images (Staging)
echo "π₯ Pulling the latest container images..."
docker compose pull
# 4. Clean Tear Down
echo "π Tearing down the old container stack..."
docker compose down
# 5. Bring up the Updated Stack
echo "π Booting up the updated containers..."
docker compose up -d
echo "π Clean update completed successfully!"
- Run this in your terminal to ensure the file is executable:
chmod +x update.sh
Windows
- Create a file
update.ps1. - Copy this into the file π:
# --- CONFIGURATION ---
[cite_start]$ContainerName = "mysql-db" # Name of your MySQL container
[cite_start]$DbUser = "root" # MySQL User
[cite_start]$DbPassword = "mypassword" # MySQL Password
[cite_start]$DbName = "wagopa" # Database to back up
[cite_start]$BackupDir = "./db_dumps" # Local directory to store backups
$Timestamp = Get-Date -Format "yyyyMMdd_HHmmss"
$BackupFile = "$BackupDir/backup_${DbName}_${Timestamp}.sql"
Write-Host "π Starting clean container update workflow..." -ForegroundColor Cyan
# 1. Ensure the backup directory exists
if (-not (Test-Path $BackupDir)) {
New-Item -ItemType Directory -Path $BackupDir | Out-Null
}
# 2. Database Backup (Failsafe Mechanism)
Write-Host "πΎ Backing up MySQL database..." -ForegroundColor Yellow
# We use --resultvariable to accurately catch errors across the Docker-to-PowerShell CLI stream
docker exec $ContainerName mysqldump -u"$DbUser" -p"$DbPassword" "$DbName" 2>$null | Out-File -FilePath $BackupFile -Encoding utf8
if ($LASTEXITCODE -eq 0) {
Write-Host "β
Backup saved successfully to: $BackupFile" -ForegroundColor Green
} else {
Write-Host "β CRITICAL: MySQL backup failed! Aborting update to protect system integrity." -ForegroundColor Red
# Clean up the empty or corrupted file if the dump failed
if (Test-Path $BackupFile) { Remove-Item $BackupFile }
exit 1
}
# 3. Pull New Images (Staging)
Write-Host "π₯ Pulling the latest container images..." -ForegroundColor Yellow
docker compose pull
# 4. Clean Tear Down
Write-Host "π Tearing down the old container stack..." -ForegroundColor Yellow
docker compose down
# 5. Bring up the Updated Stack
Write-Host "π Booting up the updated containers..." -ForegroundColor Green
docker compose up -d
Write-Host "π Clean update completed successfully!" -ForegroundColor Green
Run this in your powershell to give execution permission:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
2. Post-Update Checksβ
- Verify the version number in the footer of the WEVA dashboard.
- Check the logs for any migration errors:
docker logs weva
Screenshot: Terminal output showing Successful container creation and startup.