89 lines
1.9 KiB
Markdown
89 lines
1.9 KiB
Markdown
---
|
|
title: Deployment
|
|
tags:
|
|
- deployment
|
|
- docker
|
|
- infrastructure
|
|
---
|
|
|
|
# Deployment
|
|
|
|
## Overview
|
|
|
|
Showy can be deployed via Docker Compose (server) or as an Electron desktop app (local). See [[Electron]] for desktop deployment.
|
|
|
|
## Docker Compose
|
|
|
|
> [!info] File: `docker-compose.yml` (v3.9)
|
|
|
|
### Services
|
|
|
|
```mermaid
|
|
graph LR
|
|
FE[Frontend :3000] --> BE[Backend :4000]
|
|
BE --> DB[(MySQL :3306)]
|
|
```
|
|
|
|
#### Frontend
|
|
|
|
- **Build:** Root Dockerfile
|
|
- **Args:** `API_URL`, `TMDB_API_KEY`
|
|
- **Port:** `3000:80`
|
|
- **Depends on:** backend
|
|
- Uses Nginx to serve static files (`frontend/nginx.conf`)
|
|
|
|
#### Backend
|
|
|
|
- **Build:** `backend/Dockerfile`
|
|
- **Port:** `4000:4000`
|
|
- **Depends on:** mysql
|
|
- **Environment:**
|
|
- `MYSQL_HOST=mysql`
|
|
- `MYSQL_DB=Showzy`
|
|
- `MYSQL_USER=root`
|
|
- `MYSQL_PASSWORD=password`
|
|
|
|
#### MySQL
|
|
|
|
- **Image:** `mysql:8.0`
|
|
- **Port:** `3306:3306`
|
|
- **Environment:**
|
|
- `MYSQL_ROOT_PASSWORD=rootpassword`
|
|
- `MYSQL_DATABASE=mydatabase`
|
|
- **Volume:** `db_data:/var/lib/mysql` (persistent)
|
|
|
|
### Build & Run
|
|
|
|
```bash
|
|
docker-compose up -d --build
|
|
```
|
|
|
|
## Backend Dockerfile
|
|
|
|
| Step | Action |
|
|
|---|---|
|
|
| Base | `node:18` (or similar) |
|
|
| Copy | `package.json`, `pnpm-lock.yaml` |
|
|
| Install | `pnpm install` |
|
|
| Copy | All source files |
|
|
| Expose | Port 4000 |
|
|
| CMD | `node server.js` |
|
|
|
|
## Important Files
|
|
|
|
| File | Role |
|
|
|---|---|
|
|
| `docker-compose.yml` | Multi-container orchestration |
|
|
| `backend/Dockerfile` | Backend container build |
|
|
| `frontend/Dockerfile` | Legacy Angular frontend container |
|
|
| `frontend/nginx.conf` | Nginx static file config |
|
|
|
|
> [!note] Legacy Frontend
|
|
> The Docker setup currently uses the Angular frontend (`/frontend`). The React frontend (`/react_frontend`) is the active development target but may not yet be containerized.
|
|
|
|
## See Also
|
|
|
|
- [[Env]] — Environment variables
|
|
- [[Electron]] — Desktop deployment alternative
|
|
- [[Architecture]] — System overview
|