|
| 1 | +# Nexent Upgrade Guide |
| 2 | + |
| 3 | +## 🚀 Upgrade Overview |
| 4 | + |
| 5 | +Follow these four steps to upgrade Nexent safely: |
| 6 | + |
| 7 | +1. Clean up existing containers and images |
| 8 | +2. Pull the latest code and run the deployment script |
| 9 | +3. Apply database migrations |
| 10 | +4. Verify the deployment in your browser |
| 11 | + |
| 12 | +--- |
| 13 | + |
| 14 | +## 🧹 Step 1: Clean up old images |
| 15 | + |
| 16 | +Remove cached resources to avoid conflicts when redeploying: |
| 17 | + |
| 18 | +```bash |
| 19 | +# Stop and remove existing containers |
| 20 | +docker compose down |
| 21 | + |
| 22 | +# Inspect Nexent images |
| 23 | +docker images --filter "reference=nexent/*" |
| 24 | + |
| 25 | +# Remove Nexent images |
| 26 | +# Windows PowerShell: |
| 27 | +docker images -q --filter "reference=nexent/*" | ForEach-Object { docker rmi -f $_ } |
| 28 | +# Linux/WSL: |
| 29 | +docker images -q --filter "reference=nexent/*" | xargs -r docker rmi -f |
| 30 | + |
| 31 | +# (Optional) prune unused images and caches |
| 32 | +docker system prune -af |
| 33 | +``` |
| 34 | +
|
| 35 | +> ⚠️ Notes |
| 36 | +> - Back up critical data before deleting images. |
| 37 | +> - To preserve database data, do not delete the mounted database volume (`/nexent/docker/volumes` or your custom path). |
| 38 | +
|
| 39 | +--- |
| 40 | +
|
| 41 | +## 🔄 Step 2: Update code and redeploy |
| 42 | +
|
| 43 | +```bash |
| 44 | +git pull |
| 45 | +cd nexent/docker |
| 46 | +cp .env.example .env |
| 47 | +bash deploy.sh |
| 48 | +``` |
| 49 | +
|
| 50 | +> 💡 Tip |
| 51 | +> - `.env.example` works for default deployments. |
| 52 | +> - Configure speech models (STT/TTS) in `.env` when needed. A frontend configuration flow is coming soon. |
| 53 | +
|
| 54 | +--- |
| 55 | +
|
| 56 | +## 🗄️ Step 3: Apply database migrations |
| 57 | +
|
| 58 | +Run the SQL scripts shipped with each release to keep your schema up to date. |
| 59 | +
|
| 60 | +### ✅ Method A: Use a SQL editor (recommended) |
| 61 | +
|
| 62 | +1. Open your SQL client and create a new PostgreSQL connection. |
| 63 | +2. Retrieve connection settings from `/nexent/docker/.env`: |
| 64 | + - Host |
| 65 | + - Port |
| 66 | + - Database |
| 67 | + - User |
| 68 | + - Password |
| 69 | +3. Test the connection. When successful, you should see tables under the `nexent` schema. |
| 70 | +4. Open a new query window. |
| 71 | +5. Navigate to `/nexent/docker/sql`. Each file contains one migration script with its release date in the filename. |
| 72 | +6. Execute every script dated after your previous deployment, in chronological order. |
| 73 | +
|
| 74 | +> ⚠️ Important |
| 75 | +> - Always back up the database first, especially in production. |
| 76 | +> - Run scripts sequentially to avoid dependency issues. |
| 77 | +> - `.env` keys may be named `POSTGRES_HOST`, `POSTGRES_PORT`, and so on—map them accordingly in your SQL client. |
| 78 | +
|
| 79 | +### 🧰 Method B: Use the command line (no SQL client required) |
| 80 | +
|
| 81 | +1. Switch to the Docker directory: |
| 82 | +
|
| 83 | + ```bash |
| 84 | + cd nexent/docker |
| 85 | + ``` |
| 86 | +
|
| 87 | +2. Read database connection details from `.env`, for example: |
| 88 | +
|
| 89 | + ```bash |
| 90 | + POSTGRES_HOST=localhost |
| 91 | + POSTGRES_PORT=5432 |
| 92 | + POSTGRES_DB=nexent |
| 93 | + POSTGRES_USER=root |
| 94 | + POSTGRES_PASSWORD=your_password |
| 95 | + ``` |
| 96 | +
|
| 97 | +3. Execute SQL files sequentially (host machine example): |
| 98 | +
|
| 99 | + ```bash |
| 100 | + # Example: If today is November 6th and your last update was on October 20th, |
| 101 | + # and there are two new files 1030-update.sql and 1105-update.sql, |
| 102 | + # execute the following commands (please replace the placeholders with your actual values) |
| 103 | + docker exec -i nexent-postgresql psql -U [YOUR_POSTGRES_USER] -d [YOUR_POSTGRES_DB] < ./sql/1030-update.sql |
| 104 | + docker exec -i nexent-postgresql psql -U [YOUR_POSTGRES_USER] -d [YOUR_POSTGRES_DB] < ./sql/1105-update.sql |
| 105 | + ``` |
| 106 | +
|
| 107 | + Execute the scripts in chronological order based on your deployment date. |
| 108 | +
|
| 109 | +> 💡 Tips |
| 110 | +> - Load environment variables first if they are defined in `.env`: |
| 111 | +> |
| 112 | +> **Windows PowerShell:** |
| 113 | +> ```powershell |
| 114 | +> Get-Content .env | Where-Object { $_ -notmatch '^#' -and $_ -match '=' } | ForEach-Object { $key, $value = $_ -split '=', 2; [Environment]::SetEnvironmentVariable($key.Trim(), $value.Trim(), 'Process') } |
| 115 | +> ``` |
| 116 | +> |
| 117 | +> **Linux/WSL:** |
| 118 | +> ```bash |
| 119 | +> export $(grep -v '^#' .env | xargs) |
| 120 | +> # Or use set -a to automatically export all variables |
| 121 | +> set -a; source .env; set +a |
| 122 | +> ``` |
| 123 | +> |
| 124 | +> - Create a backup before running migrations: |
| 125 | +> |
| 126 | +> ```bash |
| 127 | +> docker exec -i nexent-postgres pg_dump -U [YOUR_POSTGRES_USER] [YOUR_POSTGRES_DB] > backup_$(date +%F).sql |
| 128 | +> ``` |
| 129 | +
|
| 130 | +--- |
| 131 | +
|
| 132 | +## 🌐 Step 4: Verify the deployment |
| 133 | +
|
| 134 | +After deployment: |
| 135 | +
|
| 136 | +1. Open `http://localhost:3000` in your browser. |
| 137 | +2. Review the [User Guide](https://doc.nexent.tech/en/user-guide/) to validate agent functionality. |
| 138 | +
|
| 139 | +
|
0 commit comments