Skip to content

Commit 8210173

Browse files
committed
Add one-command self-hosting with Docker Compose
- Add docker-compose.yml for one-command deploy (git clone && docker compose up -d) - Add docker-compose.coolify.yml for Coolify deployments - Add GitHub Actions workflow to publish cap-media-server image - Add standalone Dockerfile for media-server - Update README with quick start section - Rewrite self-hosting docs with clear instructions Self-hosting now works with zero configuration for local testing. For production, users set environment variables for URLs and passwords.
1 parent a4b845d commit 8210173

File tree

8 files changed

+648
-34
lines changed

8 files changed

+648
-34
lines changed
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: "Docker Build Media Server"
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: "Tag for the Docker image"
8+
required: false
9+
default: "latest"
10+
type: string
11+
push:
12+
branches:
13+
- main
14+
paths:
15+
- "apps/media-server/**"
16+
17+
jobs:
18+
build:
19+
name: Build Docker Image (${{ matrix.platform }})
20+
runs-on: ${{ matrix.runner }}
21+
strategy:
22+
matrix:
23+
include:
24+
- platform: amd64
25+
runner: ubuntu-24.04
26+
- platform: arm64
27+
runner: ubuntu-24.04-arm
28+
fail-fast: false
29+
permissions:
30+
contents: read
31+
packages: write
32+
33+
steps:
34+
- name: Checkout Repository
35+
uses: actions/checkout@v4
36+
37+
- name: Set up Docker Buildx
38+
uses: docker/setup-buildx-action@v3
39+
40+
- name: Login to GitHub Container Registry
41+
uses: docker/login-action@v3
42+
with:
43+
registry: ghcr.io
44+
username: ${{ github.actor }}
45+
password: ${{ secrets.GITHUB_TOKEN }}
46+
47+
- name: Downcase GITHUB_REPOSITORY_OWNER
48+
run: |
49+
echo "REPOSITORY_OWNER=${GITHUB_REPOSITORY_OWNER@L}" >>${GITHUB_ENV}
50+
51+
- name: Build and Push Platform Image
52+
id: build
53+
uses: docker/build-push-action@v5
54+
with:
55+
context: ./apps/media-server
56+
file: ./apps/media-server/Dockerfile.standalone
57+
platforms: linux/${{ matrix.platform }}
58+
push: true
59+
outputs: type=image,name=ghcr.io/${{ env.REPOSITORY_OWNER }}/cap-media-server,push-by-digest=true
60+
cache-from: type=gha,scope=media-server-${{ matrix.platform }}
61+
cache-to: type=gha,mode=max,scope=media-server-${{ matrix.platform }}
62+
63+
- name: Export Digest
64+
run: |
65+
mkdir -p /tmp/digests
66+
digest="${{ steps.build.outputs.digest }}"
67+
touch "/tmp/digests/${digest#sha256:}"
68+
69+
- name: Upload Digest
70+
uses: actions/upload-artifact@v4
71+
with:
72+
name: digests-media-server-${{ matrix.platform }}
73+
path: /tmp/digests/*
74+
if-no-files-found: error
75+
retention-days: 1
76+
77+
merge:
78+
name: Create Multi-Architecture Manifest
79+
needs: build
80+
runs-on: ubuntu-latest
81+
permissions:
82+
contents: read
83+
packages: write
84+
85+
steps:
86+
- name: Download Digests
87+
uses: actions/download-artifact@v4
88+
with:
89+
path: /tmp/digests
90+
pattern: digests-media-server-*
91+
merge-multiple: true
92+
93+
- name: Set up Docker Buildx
94+
uses: docker/setup-buildx-action@v3
95+
96+
- name: Login to GitHub Container Registry
97+
uses: docker/login-action@v3
98+
with:
99+
registry: ghcr.io
100+
username: ${{ github.actor }}
101+
password: ${{ secrets.GITHUB_TOKEN }}
102+
103+
- name: Downcase GITHUB_REPOSITORY_OWNER
104+
run: |
105+
echo "REPOSITORY_OWNER=${GITHUB_REPOSITORY_OWNER@L}" >>${GITHUB_ENV}
106+
107+
- name: Create Image Manifest
108+
run: |
109+
docker buildx imagetools create -t ghcr.io/${{ env.REPOSITORY_OWNER }}/cap-media-server:${{ inputs.tag || 'latest' }} \
110+
$(find /tmp/digests -type f -not -path "*/\.*" -exec basename {} \; | xargs -I {} echo "ghcr.io/${{ env.REPOSITORY_OWNER }}/cap-media-server@sha256:{}")

README.md

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,38 @@ Cap is the open source alternative to Loom. It's a video messaging tool that all
2424

2525
# Self Hosting
2626

27-
Cap Web is available to self-host using Docker or Railway, see our [self-hosting docs](https://cap.so/docs/self-hosting) to learn more.
28-
You can also use the button below to deploy Cap Web to Railway:
27+
### Quick Start (One Command)
28+
29+
```bash
30+
git clone https://github.com/CapSoftware/Cap.git && cd Cap && docker compose up -d
31+
```
32+
33+
Cap will be running at `http://localhost:3000`. That's it!
34+
35+
> **Note:** Login links appear in the logs (`docker compose logs cap-web`) since email isn't configured by default.
36+
37+
### Other Deployment Options
38+
39+
| Method | Best For |
40+
|--------|----------|
41+
| **Docker Compose** | VPS, home servers, any Docker host |
42+
| **[Railway](https://railway.com/new/template/PwpGcf)** | One-click managed hosting |
43+
| **Coolify** | Self-hosted PaaS (use `docker-compose.coolify.yml`) |
2944

3045
[![Deploy on Railway](https://railway.com/button.svg)](https://railway.com/new/template/PwpGcf)
3146

32-
Cap Desktop can connect to your self-hosted Cap Web instance regardless of if you build it yourself or [download from our website](https://cap.so/download).
47+
### Production Configuration
48+
49+
For production, create a `.env` file:
50+
51+
```bash
52+
CAP_URL=https://cap.yourdomain.com
53+
S3_PUBLIC_URL=https://s3.yourdomain.com
54+
```
55+
56+
See our [self-hosting docs](https://cap.so/docs/self-hosting) for full configuration options including email setup, AI features, and SSL.
57+
58+
Cap Desktop can connect to your self-hosted instance via Settings → Cap Server URL.
3359

3460
# Monorepo App Architecture
3561

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM oven/bun:1-alpine
2+
3+
RUN apk add --no-cache ffmpeg
4+
5+
WORKDIR /app
6+
7+
COPY package.json ./
8+
RUN bun install --production
9+
10+
COPY src ./src
11+
12+
ENV PORT=3456
13+
EXPOSE 3456
14+
15+
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
16+
CMD wget -qO- http://localhost:${PORT}/health || exit 1
17+
18+
CMD ["bun", "run", "src/index.ts"]

apps/web/content/docs/self-hosting.mdx

Lines changed: 148 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ image: "/docs/self-hosting.webp"
88
Cap Web is our web application for uploading and sharing Caps - it's what runs right here on [cap.so](https://cap.so).
99
You can upload videos to it from the dashboard or from Cap Desktop.
1010

11-
This guide describes our two supported deployment methods, how to connect Cap Desktop,
12-
and how to configure email login links.
13-
1411
<div style={{ position: "relative", paddingBottom: "56.25%", height: 0 }}>
1512
<iframe
1613
src="https://cap.so/embed/k310v2vf41d6ffp"
@@ -27,49 +24,170 @@ and how to configure email login links.
2724
></iframe>
2825
</div>
2926

30-
## Deployment Methods
27+
## Quick Start (One Command)
28+
29+
The fastest way to self-host Cap is with Docker Compose. This single command will start everything you need:
30+
31+
```bash
32+
git clone https://github.com/CapSoftware/Cap.git
33+
cd Cap
34+
docker compose up -d
35+
```
36+
37+
That's it! Cap will be available at `http://localhost:3000`.
38+
39+
Login links will appear in the logs since email isn't configured:
40+
```bash
41+
docker compose logs cap-web
42+
```
43+
44+
## Deployment Options
45+
46+
### Option 1: Docker Compose (Recommended)
47+
48+
Best for VPS, home servers, or any Docker-capable host.
49+
50+
**What's included:**
51+
- Cap Web application
52+
- Media server (FFmpeg processing)
53+
- MySQL database
54+
- MinIO (S3-compatible storage)
3155

32-
### Deploying with Railway
56+
**Steps:**
57+
1. Clone the repository
58+
2. Run `docker compose up -d`
59+
3. Access Cap at `http://localhost:3000`
3360

34-
One-click deployment via Railway is the easiest way to deploy Cap Web.
35-
The button below will take you to the Cap Web Railway template,
36-
which will deploy the Cap Web Docker image, a MySQL database,
37-
and [MinIO](https://min.io) for storing videos.
61+
**Custom configuration:**
62+
63+
Create a `.env` file to customize your deployment:
64+
65+
```bash
66+
# Public URL (required for production)
67+
CAP_URL=https://cap.yourdomain.com
68+
69+
# S3 public URL (for video playback)
70+
S3_PUBLIC_URL=https://s3.yourdomain.com
71+
72+
# Optional: Custom ports
73+
CAP_PORT=3000
74+
MINIO_PORT=9000
75+
76+
# Optional: Custom passwords (auto-generated if not set)
77+
MYSQL_PASSWORD=your-secure-password
78+
MINIO_ROOT_PASSWORD=your-minio-password
79+
```
80+
81+
### Option 2: Railway (One-Click)
3882

3983
[![Deploy on Railway](https://railway.com/button.svg)](https://railway.com/new/template/PwpGcf)
4084

41-
Once deployed, login email links will be available in Railway’s Deploy Logs.
85+
Railway provides a fully managed deployment with automatic SSL and scaling.
86+
Login credentials appear in Railway's Deploy Logs after deployment.
4287

43-
### Custom Deployment with Docker
88+
### Option 3: Coolify
4489

45-
The [Cap Web Docker image](https://github.com/CapSoftware/Cap/pkgs/container/cap-web)
46-
allows you to deploy Cap Web anywhere you like.
47-
You will need to connect your own MySQL database and S3-compatible storage.
48-
Refer to the [Docker Compose template](https://github.com/CapSoftware/Cap/blob/main/docker-compose.template.yml)
49-
for an example setup, including necessary environment variables.
90+
For Coolify users, use `docker-compose.coolify.yml` which includes environment variable placeholders:
91+
92+
1. Create a new Docker Compose project in Coolify
93+
2. Point to the Cap repository
94+
3. Set compose file to `docker-compose.coolify.yml`
95+
4. Configure environment variables in Coolify's UI
96+
5. Deploy
5097

5198
## Connecting Cap Desktop
5299

53-
Copy the URL of your Cap Web deployment, and set the 'Cap Server URL'
54-
in Cap Desktop's settings page to this URL.
55-
Uploads from Cap Desktop will now be sent to your Cap Web deployment.
100+
1. Open Cap Desktop settings
101+
2. Set 'Cap Server URL' to your deployment URL (e.g., `https://cap.yourdomain.com`)
102+
3. Uploads will now go to your self-hosted instance
56103

57-
## Email Login Links
104+
## Email Configuration
58105

59-
If the `RESEND_API_KEY` and `RESEND_FROM_DOMAIN` environment variables are not set,
60-
login links will be written to the server logs.
61-
To send login links via email, you'll need to configure [Resend](https://resend.com):
106+
By default, login links are printed to the server logs. To send emails:
62107

63108
1. Create an account at [Resend](https://resend.com)
64-
2. Connect a domain and set it as `RESEND_FROM_DOMAIN`
65-
3. Generate an API key and set it as `RESEND_API_KEY`
109+
2. Add these environment variables:
110+
```bash
111+
RESEND_API_KEY=re_xxxxx
112+
RESEND_FROM_DOMAIN=yourdomain.com
113+
```
114+
115+
## Optional Features
66116

67-
## Other Configuration
117+
### AI Features
68118

69-
See [`env/server.ts`](https://github.com/CapSoftware/Cap/blob/main/packages/env/server.ts) for a description of all environment variables you can configure.
119+
For video transcription and AI summaries:
120+
121+
```bash
122+
DEEPGRAM_API_KEY=your-key # Transcription
123+
GROQ_API_KEY=your-key # AI summaries (preferred)
124+
OPENAI_API_KEY=your-key # AI summaries (fallback)
125+
```
126+
127+
### Google OAuth
128+
129+
```bash
130+
GOOGLE_CLIENT_ID=your-client-id
131+
GOOGLE_CLIENT_SECRET=your-secret
132+
```
133+
134+
## Production Checklist
135+
136+
> **Important:** The default configuration uses placeholder passwords suitable for local testing only. For production, you must set secure values via environment variables.
137+
138+
For production deployments:
139+
140+
- [ ] Set secure passwords: `MYSQL_PASSWORD`, `MINIO_ROOT_PASSWORD`
141+
- [ ] Set secure secrets: `DATABASE_ENCRYPTION_KEY`, `NEXTAUTH_SECRET`, `MEDIA_SERVER_WEBHOOK_SECRET` (use `openssl rand -hex 32`)
142+
- [ ] Set `CAP_URL` to your public URL
143+
- [ ] Set `S3_PUBLIC_URL` to your MinIO/S3 public URL
144+
- [ ] Configure a reverse proxy (nginx, Caddy, Traefik) with SSL
145+
- [ ] Set up email with Resend
146+
- [ ] Configure backups for MySQL and MinIO volumes
147+
148+
## Architecture
149+
150+
```
151+
┌─────────────────┐ ┌─────────────────┐
152+
│ Cap Desktop │────▶│ Cap Web │
153+
└─────────────────┘ │ (port 3000) │
154+
└────────┬────────┘
155+
156+
┌────────────┼────────────┐
157+
▼ ▼ ▼
158+
┌──────────┐ ┌──────────┐ ┌──────────┐
159+
│ MySQL │ │ MinIO │ │ Media │
160+
│ (3306) │ │ (9000) │ │ Server │
161+
└──────────┘ └──────────┘ └──────────┘
162+
```
163+
164+
## Environment Variables Reference
165+
166+
See [`packages/env/server.ts`](https://github.com/CapSoftware/Cap/blob/main/packages/env/server.ts) for all available options.
167+
168+
## Troubleshooting
169+
170+
**Can't access Cap after starting:**
171+
```bash
172+
docker compose logs cap-web
173+
```
174+
175+
**Database migration issues:**
176+
```bash
177+
docker compose down -v # Warning: deletes data
178+
docker compose up -d
179+
```
180+
181+
**Reset everything:**
182+
```bash
183+
docker compose down -v
184+
docker compose up -d
185+
```
70186

71187
## Support
72188

73-
If you encounter a problem with the Docker image or think this documentation is lacking,
74-
please [open an issue](https://github.com/CapSoftware/Cap/issues/new).
75-
We do not offer support services for self-hosted deployments.
189+
If you encounter issues with self-hosting:
190+
- [Open a GitHub issue](https://github.com/CapSoftware/Cap/issues/new)
191+
- Check existing issues for solutions
192+
193+
We do not offer direct support for self-hosted deployments.

0 commit comments

Comments
 (0)