Initial commit: StreamFlow IPTV platform with Docker Hub deployment

This commit is contained in:
aiulian25 2025-12-17 01:03:57 +00:00
parent 0497a827f5
commit 6c8f9ceb63
6 changed files with 736 additions and 1 deletions

61
.github/workflows/docker-publish.yml vendored Normal file
View file

@ -0,0 +1,61 @@
name: Build and Push to Docker Hub
on:
push:
branches:
- main
tags:
- 'v*'
workflow_dispatch: # Allow manual trigger
env:
DOCKER_USERNAME: aiulian25
IMAGE_NAME: streamflow
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Update Docker Hub description
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
repository: ${{ env.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}
short-description: "StreamFlow - IPTV streaming platform with VPN support"
readme-filepath: ./DOCKER_INSTALLATION.md

208
DOCKER_HUB_DEPLOYMENT.md Normal file
View file

@ -0,0 +1,208 @@
# Docker Hub Deployment Guide
This guide will help you publish the StreamFlow Docker image to Docker Hub so users can easily deploy it.
## Prerequisites
1. Docker Hub account (create one at https://hub.docker.com)
2. Docker installed and running locally
## Step 1: Login to Docker Hub
```bash
docker login
```
Enter your Docker Hub username and password when prompted.
## Step 2: Build the Docker Image
Build the image with your Docker Hub username:
```bash
docker build -t aiulian25/streamflow:latest .
```
You can also create version tags:
```bash
docker build -t aiulian25/streamflow:latest -t aiulian25/streamflow:v1.0.0 .
```
## Step 3: Push to Docker Hub
Push the image to Docker Hub:
```bash
docker push aiulian25/streamflow:latest
```
If you created version tags, push them too:
```bash
docker push aiulian25/streamflow:v1.0.0
```
## Step 4: Verify on Docker Hub
Visit https://hub.docker.com/r/aiulian25/streamflow to verify your image is published.
## Automated Build (Optional)
You can set up GitHub Actions to automatically build and push images:
### Create `.github/workflows/docker-publish.yml`:
```yaml
name: Build and Push Docker Image
on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
branches:
- main
env:
DOCKER_HUB_USERNAME: aiulian25
IMAGE_NAME: streamflow
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_HUB_USERNAME }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
```
### Add Docker Hub Secrets to GitHub:
1. Go to your repository: https://github.com/aiulian25/streamflow
2. Navigate to **Settings****Secrets and variables** → **Actions**
3. Add the following secrets:
- `DOCKER_HUB_USERNAME`: Your Docker Hub username (aiulian25)
- `DOCKER_HUB_TOKEN`: Create a token at https://hub.docker.com/settings/security
## Usage for End Users
After publishing, users can simply run:
```bash
# Download the docker-compose.yml
wget https://raw.githubusercontent.com/aiulian25/streamflow/main/docker-compose.yml
# Create environment file (optional)
cat > .env <<EOF
JWT_SECRET=$(openssl rand -base64 32)
SESSION_SECRET=$(openssl rand -base64 32)
ENABLE_GPU=false
EOF
# Start the application
docker compose up -d
```
## Multi-Architecture Support (Optional)
To support multiple architectures (amd64, arm64):
```bash
# Create and use a new builder
docker buildx create --name mybuilder --use
docker buildx inspect --bootstrap
# Build and push for multiple platforms
docker buildx build --platform linux/amd64,linux/arm64 \
-t aiulian25/streamflow:latest \
-t aiulian25/streamflow:v1.0.0 \
--push .
```
## Quick Commands Reference
```bash
# Build image
docker build -t aiulian25/streamflow:latest .
# Push image
docker push aiulian25/streamflow:latest
# Test locally
docker run -d -p 12345:12345 -p 9000:9000 aiulian25/streamflow:latest
# Check running container
docker ps
# View logs
docker logs streamflow
```
## Image Size Optimization
The current Dockerfile is already optimized with:
- Multi-stage builds
- Minimal base image (node:20-slim)
- Cleaned apt caches
- Only production dependencies
Current estimated size: ~1.5GB (due to ffmpeg, streamlink, yt-dlp requirements)
## Updating the Image
When you make changes:
1. Build with new version tag:
```bash
docker build -t aiulian25/streamflow:v1.0.1 -t aiulian25/streamflow:latest .
```
2. Push both tags:
```bash
docker push aiulian25/streamflow:v1.0.1
docker push aiulian25/streamflow:latest
```
3. Users can update by pulling the latest:
```bash
docker compose pull
docker compose up -d
```

221
DOCKER_INSTALLATION.md Normal file
View file

@ -0,0 +1,221 @@
# StreamFlow - Easy Docker Installation
StreamFlow is a powerful IPTV streaming platform with VPN support, recording capabilities, and more.
## 🚀 Quick Start (3 Steps)
### 1. Download the Docker Compose file
```bash
wget https://raw.githubusercontent.com/aiulian25/streamflow/main/docker-compose.yml
```
Or manually create a file named `docker-compose.yml` with the content from [here](https://github.com/aiulian25/streamflow/blob/main/docker-compose.yml).
### 2. (Optional) Create environment file
Generate secure secrets:
```bash
cat > .env <<EOF
JWT_SECRET=$(openssl rand -base64 32)
SESSION_SECRET=$(openssl rand -base64 32)
ENABLE_GPU=false
EOF
```
### 3. Start the application
```bash
docker compose up -d
```
That's it! 🎉
## 📍 Access the Application
- **Web Interface**: http://localhost:12345
- **Update Server**: http://localhost:9000
### Default Credentials
On first run, create an admin account through the web interface.
## 🔧 Configuration Options
### Environment Variables
Edit the `.env` file or set in `docker-compose.yml`:
| Variable | Default | Description |
|----------|---------|-------------|
| `PORT` | 12345 | Main application port |
| `JWT_SECRET` | (required) | JWT token secret |
| `SESSION_SECRET` | (required) | Session encryption secret |
| `DISABLE_SIGNUPS` | true | Disable new user registration |
| `ENABLE_GPU` | false | Enable GPU hardware acceleration |
| `MAX_RECORDING_SIZE` | 100GB | Maximum recording storage |
### Enable GPU Acceleration
For Intel Quick Sync (already configured in compose file):
```yaml
devices:
- /dev/dri:/dev/dri
```
For NVIDIA GPU, uncomment the deploy section in `docker-compose.yml`:
```yaml
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu, video]
```
## 📊 Management Commands
### View Logs
```bash
docker compose logs -f streamflow
```
### Stop the Application
```bash
docker compose down
```
### Update to Latest Version
```bash
docker compose pull
docker compose up -d
```
### Restart the Application
```bash
docker compose restart
```
### Backup Data
```bash
docker compose down
tar -czf streamflow-backup-$(date +%Y%m%d).tar.gz \
$(docker volume inspect streamflow_streamflow-data -f '{{.Mountpoint}}')
docker compose up -d
```
### Restore from Backup
```bash
docker compose down
tar -xzf streamflow-backup-YYYYMMDD.tar.gz -C /var/lib/docker/volumes/streamflow_streamflow-data/_data/
docker compose up -d
```
## 🔒 Security Recommendations
1. **Change Default Secrets**: Always set unique `JWT_SECRET` and `SESSION_SECRET`
2. **Firewall**: Configure firewall to restrict access if exposed to internet
3. **HTTPS**: Use reverse proxy (nginx, traefik) with SSL for production
4. **Backups**: Regularly backup the `streamflow-data` volume
### Example Nginx Reverse Proxy
```nginx
server {
listen 80;
server_name streamflow.yourdomain.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
server_name streamflow.yourdomain.com;
ssl_certificate /etc/letsencrypt/live/streamflow.yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/streamflow.yourdomain.com/privkey.pem;
location / {
proxy_pass http://localhost:12345;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
```
## 🐛 Troubleshooting
### Container won't start
```bash
# Check logs
docker compose logs streamflow
# Check if ports are already in use
sudo netstat -tulpn | grep -E '12345|9000'
```
### Permission issues
```bash
# Fix volume permissions
docker compose down
docker volume rm streamflow_streamflow-data
docker compose up -d
```
### GPU not working
```bash
# Verify device access
ls -la /dev/dri/
# Check if user has access to render group
groups $(whoami)
# Add user to render group if needed
sudo usermod -a -G render $(whoami)
```
### VPN not working
- Ensure the container runs with `privileged: true` (already set)
- Check VPN configuration files are properly uploaded through the web interface
- Verify sysctls are properly set in docker-compose.yml
## 📦 System Requirements
### Minimum
- 2 CPU cores
- 2GB RAM
- 10GB disk space
- Docker 20.10+ and Docker Compose V2
### Recommended
- 4+ CPU cores
- 4GB+ RAM
- 50GB+ disk space (for recordings)
- GPU for hardware acceleration (Intel Quick Sync, NVIDIA)
## 🌐 Supported Platforms
- Linux (x86_64, arm64)
- Windows (via Docker Desktop)
- macOS (via Docker Desktop)
## 📚 More Information
- [Full Documentation](https://github.com/aiulian25/streamflow/blob/main/README.md)
- [Report Issues](https://github.com/aiulian25/streamflow/issues)
- [Contributing Guide](https://github.com/aiulian25/streamflow/blob/main/CONTRIBUTING.md)
## 📄 License
See the [LICENSE](https://github.com/aiulian25/streamflow/blob/main/LICENSE) file for details.
---
**Need Help?** Open an issue on [GitHub](https://github.com/aiulian25/streamflow/issues)

177
PUBLISHING_STEPS.md Normal file
View file

@ -0,0 +1,177 @@
# 🚀 Quick Start: Publishing StreamFlow to Docker Hub
## What I've Done
✅ Updated `docker-compose.yml` to use Docker Hub image (`aiulian25/streamflow:latest`)
✅ Created deployment guide ([DOCKER_HUB_DEPLOYMENT.md](DOCKER_HUB_DEPLOYMENT.md))
✅ Created user installation guide ([DOCKER_INSTALLATION.md](DOCKER_INSTALLATION.md))
✅ Created automated publish script (`publish-docker.sh`)
✅ Created GitHub Actions workflow for automated builds
## Next Steps to Publish
### Option 1: Manual Publishing (Quick Start)
1. **Login to Docker Hub:**
```bash
docker login
```
2. **Build and push the image:**
```bash
./publish-docker.sh
```
Or with a specific version:
```bash
./publish-docker.sh v1.0.0
```
3. **Verify on Docker Hub:**
Visit: https://hub.docker.com/r/aiulian25/streamflow
### Option 2: Automated Publishing via GitHub Actions
1. **Create Docker Hub Access Token:**
- Go to https://hub.docker.com/settings/security
- Click "New Access Token"
- Name: `github-actions`
- Permissions: Read, Write, Delete
- Copy the token (you'll only see it once!)
2. **Add Secrets to GitHub:**
- Go to https://github.com/aiulian25/streamflow/settings/secrets/actions
- Click "New repository secret"
- Add these secrets:
- Name: `DOCKER_HUB_USERNAME`, Value: `aiulian25`
- Name: `DOCKER_HUB_TOKEN`, Value: `<paste your token>`
3. **Push to GitHub:**
```bash
git add .
git commit -m "Configure Docker Hub deployment"
git push origin main
```
4. **Automatic builds will now run on:**
- Every push to `main` branch → builds `latest` tag
- Every git tag (e.g., `v1.0.0`) → builds version tag
## For Your Users
After publishing, users can install StreamFlow in 3 simple commands:
```bash
# 1. Download docker-compose.yml
wget https://raw.githubusercontent.com/aiulian25/streamflow/main/docker-compose.yml
# 2. (Optional) Create environment file
cat > .env <<EOF
JWT_SECRET=$(openssl rand -base64 32)
SESSION_SECRET=$(openssl rand -base64 32)
ENABLE_GPU=false
EOF
# 3. Start the application
docker compose up -d
```
Then access at: http://localhost:12345
## Update Your GitHub README
Add this badge to your README.md:
```markdown
[![Docker Hub](https://img.shields.io/docker/v/aiulian25/streamflow?label=Docker%20Hub&logo=docker)](https://hub.docker.com/r/aiulian25/streamflow)
[![Docker Pulls](https://img.shields.io/docker/pulls/aiulian25/streamflow)](https://hub.docker.com/r/aiulian25/streamflow)
```
Add installation instructions:
```markdown
## Quick Start
```bash
wget https://raw.githubusercontent.com/aiulian25/streamflow/main/docker-compose.yml
docker compose up -d
```
Access at http://localhost:12345
See [DOCKER_INSTALLATION.md](DOCKER_INSTALLATION.md) for detailed instructions.
```
## Testing the Published Image
```bash
# Pull the image
docker pull aiulian25/streamflow:latest
# Test run
docker run -d -p 12345:12345 -p 9000:9000 aiulian25/streamflow:latest
# Check if running
docker ps
# View logs
docker logs <container_id>
# Clean up test
docker stop <container_id>
docker rm <container_id>
```
## Maintenance
### Publishing a New Version
```bash
# Tag your release
git tag -a v1.0.1 -m "Release v1.0.1"
git push origin v1.0.1
# Or manually:
./publish-docker.sh v1.0.1
```
### Users Update to Latest Version
```bash
docker compose pull
docker compose up -d
```
## Files Created
1. **DOCKER_HUB_DEPLOYMENT.md** - Complete deployment guide for you
2. **DOCKER_INSTALLATION.md** - User-friendly installation guide
3. **publish-docker.sh** - Automated build and push script
4. **.github/workflows/docker-publish.yml** - GitHub Actions workflow
5. **docker-compose.yml** - Updated to use Docker Hub image
## Multi-Architecture Support (Optional)
To support both AMD64 and ARM64 (Raspberry Pi, Apple Silicon):
```bash
# Create builder
docker buildx create --name mybuilder --use
# Build for multiple platforms
docker buildx build --platform linux/amd64,linux/arm64 \
-t aiulian25/streamflow:latest \
--push .
```
GitHub Actions workflow already supports multi-arch builds!
## Summary
Your StreamFlow application is now ready for easy deployment! Users will be able to:
1. Download one file (`docker-compose.yml`)
2. Run `docker compose up -d`
3. Access the application instantly
No complex builds, no dependencies, just pull and run! 🎉

View file

@ -2,7 +2,7 @@
services: services:
streamflow: streamflow:
image: ghcr.io/aiulian25/streamflow-iptv:latest image: aiulian25/streamflow:latest
container_name: streamflow container_name: streamflow
restart: unless-stopped restart: unless-stopped
ports: ports:

68
publish-docker.sh Executable file
View file

@ -0,0 +1,68 @@
#!/bin/bash
# StreamFlow Docker Hub Publishing Script
# This script builds and pushes the Docker image to Docker Hub
set -e # Exit on error
# Configuration
DOCKER_USERNAME="aiulian25"
IMAGE_NAME="streamflow"
VERSION="${1:-latest}" # Use argument or default to 'latest'
echo "========================================="
echo " StreamFlow Docker Hub Publisher"
echo "========================================="
echo ""
echo "Username: $DOCKER_USERNAME"
echo "Image: $IMAGE_NAME"
echo "Version: $VERSION"
echo ""
# Check if Docker is running
if ! docker info > /dev/null 2>&1; then
echo "❌ Error: Docker is not running"
exit 1
fi
# Check if logged in to Docker Hub
if ! docker info | grep -q "Username"; then
echo "⚠️ Not logged in to Docker Hub"
echo "Please run: docker login"
exit 1
fi
echo "📦 Building Docker image..."
echo ""
# Build the image
docker build -t "${DOCKER_USERNAME}/${IMAGE_NAME}:${VERSION}" .
# If version is not 'latest', also tag as latest
if [ "$VERSION" != "latest" ]; then
echo ""
echo "🏷️ Tagging as latest..."
docker tag "${DOCKER_USERNAME}/${IMAGE_NAME}:${VERSION}" "${DOCKER_USERNAME}/${IMAGE_NAME}:latest"
fi
echo ""
echo "⬆️ Pushing to Docker Hub..."
echo ""
# Push the version tag
docker push "${DOCKER_USERNAME}/${IMAGE_NAME}:${VERSION}"
# Push latest tag if we created it
if [ "$VERSION" != "latest" ]; then
docker push "${DOCKER_USERNAME}/${IMAGE_NAME}:latest"
fi
echo ""
echo "✅ Successfully published!"
echo ""
echo "📍 Image URL: https://hub.docker.com/r/${DOCKER_USERNAME}/${IMAGE_NAME}"
echo "🐳 Pull command: docker pull ${DOCKER_USERNAME}/${IMAGE_NAME}:${VERSION}"
echo ""
echo "Users can now run:"
echo " docker compose up -d"
echo ""