# 1.2.8 to 1.3.0 - Upgrade

## Upgrading the Server

### Introduction

**Upgrade Video link** : [https://www.youtube.com/watch?v=NZE2pi6WxWM](https://www.youtube.com/watch?v=NZE2pi6WxWM)

There are 3 main changes between version 1.2.X and 1.3.x:

1. **Go-based Agent Binary:** The introduction of a binary based on Go for the agent, replacing the previous bash scripts. This binary executes much faster and is compatible across different architectures when compiled.
2. **Redis and BullMQ Integration:** The introduction of Redis as a back-end database server and BullMQ as the queue manager for tasks and automation management.
3. **Nginx Configuration:** The addition of an nginx block for the presentation of the /bullboard URL.

Let's go through the two types of upgrades:

### Docker Upgrade

This is quite simple as we just need to add the following in the container configuration for Redis:

1. Add the Redis service
2. Add the Redis configuration in the backend environment
3. Add a new redis\_data volume

<p class="callout warning">**Important:** Ensure you change the Redis password and update it in all three areas where "**your-redis-password-here**" is specified. This password should be secure but some **alphanumeric** characters can cause issues.</p>

#### Docker Compose Ammendments

```yaml
name: patchmon

services:
  redis:
    image: redis:7-alpine
    restart: unless-stopped
    command: redis-server --requirepass your-redis-password-here # CHANGE THIS TO YOUR REDIS PASSWORD
    volumes:
      - redis_data:/data
    healthcheck:
      test: ["CMD", "redis-cli", "--no-auth-warning", "-a", "your-redis-password-here", "ping"] # CHANGE THIS TO YOUR REDIS PASSWORD
      interval: 3s
      timeout: 5s
      retries: 7

  backend:
    environment:
      # Redis Configuration
      REDIS_HOST: redis
      REDIS_PORT: 6379
      REDIS_PASSWORD: your-redis-password-here # CHANGE THIS TO YOUR REDIS PASSWORD
      REDIS_DB: 0
      # ... other environment variables

volumes:
  redis_data:
```

Migration issues

If you get a migration issue like this:

```
backend-1   | Error: P3009
backend-1   | 
backend-1   | migrate found failed migrations in the target database, new migrations will not be applied. Read more about how to resolve migration issues in a production database: https://pris.ly/d/migrate-resolve
backend-1   | The 20251005000000_add_user_sessions migration started at 2025-10-21 22:50:32.244874 UTC failed
backend-1   | 
backend-1   | 
dependency failed to start: container patchmon-backend-1 is unhealthy
```

Then you need to apply the following commands from the directory where the docker-compose.yml file is:

<p class="callout info">Depending on your docker environment and version it may be as `docker compose run` </p>

```
docker-compose run --rm backend npx prisma migrate resolve --rolled-back 20251005000000_add_user_sessions
```

```
docker-compose run --rm backend npx prisma migrate resolve --applied 20251005000000_add_user_sessions
```

### Bare Metal / VM Upgrade

*Instructions for bare metal and VM upgrades will be detailed in the following sections... soon... Still building the script to handle the update ...*