|
1 | | -## Checking requirements |
2 | 1 |
|
3 | | -Check that the server satisfifes the [requirements](installation.html#web-server-configuration). In particular pay attention the PHP extensions. |
| 2 | + |
| 3 | +## Upgrading Lychee docker installations from v6 to v7 |
| 4 | + |
| 5 | +> {note} **Critical Breaking Changes**: Version 7 introduces significant architectural changes to the Docker setup. **You must update your docker-compose configuration** when upgrading from v6 to v7. Simply changing the image tag will not work. |
| 6 | +
|
| 7 | +### Major Changes in Version 7 |
| 8 | + |
| 9 | +Version 7 marks a fundamental shift in Lychee's Docker architecture: |
| 10 | + |
| 11 | +1. **FrankenPHP replaces nginx + PHP-FPM**: The application now runs on FrankenPHP with Laravel Octane for dramatically improved performance |
| 12 | +2. **Simplified volume mounts**: Individual directory mounts have been consolidated into cleaner volume structures |
| 13 | +3. **Optional worker service**: Background job processing can now be scaled independently |
| 14 | +4. **New environment variables**: Worker mode configuration requires specific settings |
| 15 | + |
| 16 | +Do note that this change also has consequences in the way Lychee reads your `.env` |
| 17 | +file. Updating values in the `.env` file will now require a container restart to take effect. |
| 18 | + |
| 19 | +### Volume Mount Changes |
| 20 | + |
| 21 | +#### Version 6 Volume Structure (OLD) |
| 22 | +```yaml |
| 23 | +volumes: |
| 24 | + - ./lychee/conf:/conf |
| 25 | + - ./lychee/uploads:/uploads |
| 26 | + - ./lychee/sym:/sym |
| 27 | + - ./lychee/logs:/logs |
| 28 | + - ./lychee/tmp:/lychee-tmp |
| 29 | +``` |
| 30 | +
|
| 31 | +#### Version 7 Volume Structure (NEW) |
| 32 | +```yaml |
| 33 | +volumes: |
| 34 | + - ./lychee/uploads:/app/public/uploads |
| 35 | + - ./lychee/storage/app:/app/storage/app |
| 36 | + - ./lychee/logs:/app/storage/logs |
| 37 | + - ./lychee/tmp:/app/storage/tmp # so that uploads are not filling up the memory of the container |
| 38 | + - ./lychee/conf/.env:/app/.env:ro |
| 39 | + - ./conf/user.css:/app/public/dist/user.css # optional |
| 40 | + - ./conf/custom.js:/app/public/dist/custom.js # optional |
| 41 | +``` |
| 42 | +
|
| 43 | +> {note} Notice the key changes: uploads are now at `/app/public/uploads`, storage at `/app/storage/app`, tmp at `/app/storage/tmp`, and the `.env` file is mounted read-only. |
| 44 | + |
| 45 | +### Service Architecture Changes |
| 46 | + |
| 47 | +Version 7 introduces a multi-service architecture with an optional worker service for background job processing. |
| 48 | + |
| 49 | +#### Basic Setup (Single Service) |
| 50 | + |
| 51 | +For basic installations without background workers: |
| 52 | + |
| 53 | +```yaml |
| 54 | +services: |
| 55 | + lychee_api: |
| 56 | + image: ghcr.io/lycheeorg/lychee:edge |
| 57 | + container_name: lychee |
| 58 | + ports: |
| 59 | + - "${APP_PORT:-8000}:8000" |
| 60 | + volumes: |
| 61 | + - ./lychee/uploads:/app/public/uploads |
| 62 | + - ./lychee/storage/app:/app/storage/app |
| 63 | + - ./lychee/logs:/app/storage/logs |
| 64 | + - ./lychee/tmp:/app/storage/tmp |
| 65 | + - .env:/app/.env:ro |
| 66 | + environment: |
| 67 | + - DB_CONNECTION=mysql |
| 68 | + - DB_HOST=lychee_db |
| 69 | + - DB_PORT=3306 |
| 70 | + - DB_DATABASE=lychee |
| 71 | + - DB_USERNAME=lychee |
| 72 | + - DB_PASSWORD=your_password |
| 73 | + # ... other environment variables |
| 74 | + depends_on: |
| 75 | + - lychee_db |
| 76 | + networks: |
| 77 | + - lychee |
| 78 | +``` |
| 79 | + |
| 80 | +#### Advanced Setup (With Workers) |
| 81 | + |
| 82 | +For better performance with background job processing: |
| 83 | + |
| 84 | +```yaml |
| 85 | +services: |
| 86 | + lychee_api: |
| 87 | + image: ghcr.io/lycheeorg/lychee:edge |
| 88 | + container_name: lychee |
| 89 | + ports: |
| 90 | + - "${APP_PORT:-8000}:8000" |
| 91 | + volumes: |
| 92 | + - ./lychee/uploads:/app/public/uploads |
| 93 | + - ./lychee/storage/app:/app/storage/app |
| 94 | + - ./lychee/logs:/app/storage/logs |
| 95 | + - ./lychee/tmp:/app/storage/tmp |
| 96 | + - .env:/app/.env:ro |
| 97 | + environment: |
| 98 | + - DB_CONNECTION=mysql |
| 99 | + - DB_HOST=lychee_db |
| 100 | + - QUEUE_CONNECTION=database # CRITICAL for worker mode |
| 101 | + # ... other environment variables |
| 102 | + depends_on: |
| 103 | + - lychee_db |
| 104 | + networks: |
| 105 | + - lychee |
| 106 | +
|
| 107 | + lychee_worker: |
| 108 | + image: ghcr.io/lycheeorg/lychee:edge |
| 109 | + container_name: lychee_worker |
| 110 | + volumes: |
| 111 | + - ./lychee/uploads:/app/public/uploads |
| 112 | + - ./lychee/storage/app:/app/storage/app |
| 113 | + - ./lychee/logs:/app/storage/logs |
| 114 | + - ./lychee/tmp:/app/storage/tmp |
| 115 | + - .env:/app/.env:ro |
| 116 | + environment: |
| 117 | + - LYCHEE_MODE=worker # CRITICAL: Tells container to run in worker mode |
| 118 | + - DB_CONNECTION=mysql |
| 119 | + - DB_HOST=lychee_db |
| 120 | + - DB_PORT=3306 |
| 121 | + - DB_DATABASE=lychee |
| 122 | + - DB_USERNAME=lychee |
| 123 | + - DB_PASSWORD=your_password |
| 124 | + - QUEUE_CONNECTION=database # CRITICAL: Must match API service |
| 125 | + # ... other environment variables |
| 126 | + depends_on: |
| 127 | + - lychee_db |
| 128 | + - lychee_api |
| 129 | + networks: |
| 130 | + - lychee |
| 131 | +``` |
| 132 | + |
| 133 | +> {note} **Critical**: When using worker services, you **must** set `QUEUE_CONNECTION=database` (or `redis` if using Redis) in **both** the API and worker services. Without this, jobs will not be processed properly. |
| 134 | + |
| 135 | +### Worker Service Benefits |
| 136 | + |
| 137 | +The worker service provides several advantages: |
| 138 | + |
| 139 | +- **Parallel Processing**: Scale workers independently by running multiple instances |
| 140 | +- **Better Performance**: Offload heavy tasks (photo processing, imports) from the main API |
| 141 | +- **Resource Management**: Allocate different resources to API and workers |
| 142 | + |
| 143 | +#### Scaling Workers |
| 144 | + |
| 145 | +You can run multiple worker instances for parallel processing: |
| 146 | + |
| 147 | +```yaml |
| 148 | +lychee_worker: |
| 149 | + image: ghcr.io/lycheeorg/lychee:edge |
| 150 | + deploy: |
| 151 | + replicas: 3 # Run 3 worker instances |
| 152 | + # ... rest of configuration |
| 153 | +``` |
| 154 | + |
| 155 | +Or manually with different container names: |
| 156 | + |
| 157 | +```yaml |
| 158 | +lychee_worker_1: |
| 159 | + image: ghcr.io/lycheeorg/lychee:edge |
| 160 | + container_name: lychee_worker_1 |
| 161 | + environment: |
| 162 | + - LYCHEE_MODE=worker |
| 163 | + # ... rest of configuration |
| 164 | +
|
| 165 | +lychee_worker_2: |
| 166 | + image: ghcr.io/lycheeorg/lychee:edge |
| 167 | + container_name: lychee_worker_2 |
| 168 | + environment: |
| 169 | + - LYCHEE_MODE=worker |
| 170 | + # ... rest of configuration |
| 171 | +``` |
| 172 | + |
| 173 | +### Migration Steps |
| 174 | + |
| 175 | +Follow these steps to migrate from v6 to v7: |
| 176 | + |
| 177 | +#### 1. **Backup Everything** |
| 178 | + |
| 179 | +```bash |
| 180 | +# Backup your database |
| 181 | +docker exec lychee_db mysqldump -u lychee -p lychee > lychee_backup.sql |
| 182 | +
|
| 183 | +# Backup your uploads and configuration |
| 184 | +cp -r ./lychee ./lychee_backup |
| 185 | +``` |
| 186 | + |
| 187 | +#### 2. **Stop Your Current v6 Services** |
| 188 | + |
| 189 | +```bash |
| 190 | +docker-compose down |
| 191 | +``` |
| 192 | + |
| 193 | +#### 3. **Update Your docker-compose.yml** |
| 194 | + |
| 195 | +Replace your v6 docker-compose.yml with the v7 configuration. You can find the complete example at: [https://github.com/LycheeOrg/Lychee/blob/master/docker-compose.yaml](https://github.com/LycheeOrg/Lychee/blob/master/docker-compose.yaml) |
| 196 | + |
| 197 | +#### 4. **Reorganize Your Volume Data** (if needed) |
| 198 | + |
| 199 | +If your current directory structure doesn't match the new volume mounts, reorganize: |
| 200 | + |
| 201 | +```bash |
| 202 | +# The uploads directory structure should remain compatible |
| 203 | +# Ensure your uploads are in ./lychee/uploads/ |
| 204 | +``` |
| 205 | + |
| 206 | +#### 5. **Update Environment Variables** |
| 207 | + |
| 208 | +Key changes to your environment configuration: |
| 209 | +- If using workers: Add `QUEUE_CONNECTION=database` or `QUEUE_CONNECTION=redis` |
| 210 | +- If using workers: Add `LYCHEE_MODE=worker` to worker service only |
| 211 | +- Review other environment variables for any deprecated options |
| 212 | + |
| 213 | +#### 6. **Start v7 Services** |
| 214 | +```bash |
| 215 | +docker-compose up -d |
| 216 | +``` |
| 217 | + |
| 218 | +#### 7. **Run Migrations** |
| 219 | +```bash |
| 220 | +docker exec lychee php artisan migrate |
| 221 | +``` |
| 222 | + |
| 223 | +#### 8. **Verify Installation** |
| 224 | + |
| 225 | +Check that all services are running: |
| 226 | +```bash |
| 227 | +docker-compose ps |
| 228 | +``` |
| 229 | + |
| 230 | +Check logs for errors: |
| 231 | +```bash |
| 232 | +docker-compose logs -f lychee |
| 233 | +``` |
| 234 | + |
| 235 | +### Troubleshooting |
| 236 | + |
| 237 | +**Workers not processing jobs** |
| 238 | +- Verify `QUEUE_CONNECTION=database` is set in both API and worker services |
| 239 | +- Verify `LYCHEE_MODE=worker` is set in worker service |
| 240 | +- Check worker logs: `docker-compose logs -f lychee_worker` |
| 241 | + |
| 242 | +**Upload issues** |
| 243 | +- Verify volume mounts point to the correct paths |
| 244 | +- Check file permissions on host directories |
| 245 | +- Ensure uploads directory: `./lychee/uploads` exists and is writable |
| 246 | + |
| 247 | +**Performance issues** |
| 248 | +- Consider adding worker services for background processing |
| 249 | +- Check FrankenPHP is running (should see FrankenPHP in logs, not nginx) |
| 250 | +- Verify `QUEUE_CONNECTION` is set for async job processing |
| 251 | + |
| 252 | +**Database connection errors** |
| 253 | +- Ensure database service name matches `DB_HOST` value |
| 254 | +- Verify database credentials are correct |
| 255 | +- Check database service is healthy: `docker-compose ps lychee_db` |
| 256 | + |
| 257 | +For more help, visit our [GitHub Discussions](https://github.com/LycheeOrg/Lychee/discussions) or [Discord server](https://discord.gg/y4aUbnF). |
| 258 | + |
| 259 | + |
| 260 | +## Upgrading from Lychee v3 to v4 |
| 261 | + |
| 262 | +### Checking requirements |
| 263 | + |
| 264 | +Check that the server satisfies the [requirements](installation.html#web-server-configuration). In particular pay attention the PHP extensions. |
4 | 265 | You can display installed PHP extensions using `phpinfo()`. |
5 | 266 |
|
6 | | -## Preparing the files |
| 267 | +### Preparing the files |
7 | 268 |
|
8 | 269 | Assuming the following tree: |
9 | 270 | ``` |
@@ -32,14 +293,14 @@ mv Lychee-v3/uploads/small/* Lychee/public/uploads/small/ |
32 | 293 | mv Lychee-v3/uploads/thumb/* Lychee/public/uploads/thumb/ |
33 | 294 | ``` |
34 | 295 |
|
35 | | -## Preparing the server |
| 296 | +### Preparing the server |
36 | 297 |
|
37 | 298 | > {note} The big difference between Lychee version 3 and Lychee version 4 is the served directory, i.e. where you webserver needs to point to. |
38 | 299 |
|
39 | 300 | - In the version 3, this was the root `.` of Lychee. |
40 | 301 | - In the version 4, this is the `public` directory inside Lychee. |
41 | 302 |
|
42 | | -### Using Apache |
| 303 | +#### Using Apache |
43 | 304 |
|
44 | 305 | **Make sure you have the module rewrite available and enabled: `a2enmod rewrite`**. |
45 | 306 |
|
@@ -74,12 +335,10 @@ Restart apache2: |
74 | 335 | systemctl restart apache2 |
75 | 336 | ``` |
76 | 337 |
|
77 | | -Process with the |
78 | | - |
79 | | -### Using Nginx |
| 338 | +#### Using Nginx |
80 | 339 |
|
81 | 340 | If you are using Nginx, an example configuration can be found [here](installation.html#web-server-configuration). |
82 | 341 |
|
83 | | -### Run the migrations |
| 342 | +#### Run the migrations |
84 | 343 |
|
85 | | -Make sure you have `DB_OLD_LYCHEE_PREFIX` set in your `.env` to correspond the table prefix of your old database, then run `php artisan migrate`. |
| 344 | +Make sure you have `DB_OLD_LYCHEE_PREFIX` set in your `.env` to correspond the table prefix of your old database, then run `php artisan migrate`. |
0 commit comments