lemonlink/PORTAINER_DEPLOY.md

261 lines
5.2 KiB
Markdown

# 🐳 Portainer Deployment Guide
Deploy LemonLink to your Portainer Docker VM in minutes!
---
## 📋 Prerequisites
- Portainer accessible at `http://your-vm-ip:9000`
- SSH access to your Docker VM
- Files uploaded to Gitea (✓ Done!)
---
## 🎯 Method 1: Git Clone in VM (Recommended)
### Step 1: SSH into Your Docker VM
```bash
ssh root@your-docker-vm-ip
```
### Step 2: Clone from Gitea
```bash
# Create directory
mkdir -p /opt
# Clone your repository
cd /opt
git clone https://git.lemonlink.eu/impulsivefps/lemonlink.git
# Enter directory
cd lemonlink
```
**If Gitea requires authentication:**
```bash
# Use token in URL (replace YOUR_TOKEN)
git clone https://impulsivefps:YOUR_TOKEN@git.lemonlink.eu/impulsivefps/lemonlink.git
```
### Step 3: Verify Files
```bash
ls -la
# Should show: index.html, styles.css, script.js, docker-compose.yml, etc.
```
---
## 🎯 Method 2: Direct File Upload (No Git)
If you prefer not to use Git on the VM:
### From Your Windows Machine:
```powershell
# Using SCP (from PowerShell)
scp index.html styles.css script.js nginx.conf docker-compose.yml root@your-docker-vm-ip:/opt/lemonlink/
# Create directory first if needed:
ssh root@your-docker-vm-ip "mkdir -p /opt/lemonlink"
```
Or use **WinSCP** GUI to drag and drop files to `/opt/lemonlink/`.
---
## 🚀 Deploy in Portainer
### Step 1: Open Portainer
1. Go to: `http://your-docker-vm-ip:9000`
2. Log in to Portainer
### Step 2: Create the Stack
1. Click **Stacks** in the left sidebar
2. Click **+ Add Stack** (or "Add stack" button)
3. Configure:
- **Name**: `lemonlink`
- **Build method**: Select **Web editor**
4. Paste this into the editor:
```yaml
version: '3.8'
services:
lemonlink:
image: nginx:alpine
container_name: lemonlink-landing
restart: unless-stopped
volumes:
- /opt/lemonlink/index.html:/usr/share/nginx/html/index.html:ro
- /opt/lemonlink/styles.css:/usr/share/nginx/html/styles.css:ro
- /opt/lemonlink/script.js:/usr/share/nginx/html/script.js:ro
- /opt/lemonlink/nginx.conf:/etc/nginx/conf.d/default.conf:ro
networks:
- lemonlink-network
ports:
- "8080:80"
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
labels:
- "com.lemonlink.description=LemonLink Landing Page"
networks:
lemonlink-network:
driver: bridge
name: lemonlink-network
```
5. Click **Deploy the stack**
6. Wait for green "up" indicator (takes ~10-20 seconds)
---
## ✅ Verify Deployment
### Check in Portainer:
1. Go to **Containers**
2. Look for `lemonlink-landing`
3. Status should show **running** (green)
### Test the Website:
```bash
# From your local machine
curl http://your-docker-vm-ip:8080
```
Or open browser: `http://your-docker-vm-ip:8080`
You should see your stunning LemonLink page! 🍋
---
## 🔄 Updating After Changes
When you make changes and push to Gitea:
### Option 1: Pull in VM (Recommended)
```bash
ssh root@your-docker-vm-ip
cd /opt/lemonlink
git pull origin master
# Changes reflect instantly - no restart needed!
```
### Option 2: Webhook Auto-Deploy (Advanced)
Set up a webhook in Gitea to auto-deploy on push.
---
## 🔒 Adding HTTPS (Optional)
If you have Traefik or Nginx Proxy Manager:
### With Traefik:
Replace the stack with:
```yaml
version: '3.8'
services:
lemonlink:
image: nginx:alpine
container_name: lemonlink-landing
restart: unless-stopped
volumes:
- /opt/lemonlink/index.html:/usr/share/nginx/html/index.html:ro
- /opt/lemonlink/styles.css:/usr/share/nginx/html/styles.css:ro
- /opt/lemonlink/script.js:/usr/share/nginx/html/script.js:ro
- /opt/lemonlink/nginx.conf:/etc/nginx/conf.d/default.conf:ro
networks:
- traefik-public # Your Traefik network name
# NO PORTS - Traefik handles this
labels:
- "traefik.enable=true"
- "traefik.http.routers.lemonlink.rule=Host(`lemonlink.eu`)"
- "traefik.http.routers.lemonlink.entrypoints=websecure"
- "traefik.http.routers.lemonlink.tls.certresolver=letsencrypt"
- "traefik.http.services.lemonlink.loadbalancer.server.port=80"
networks:
traefik-public:
external: true
```
Then point DNS `lemonlink.eu` → your VM's public IP.
---
## 🛠️ Troubleshooting
### Container won't start
```bash
# Check logs in Portainer:
# Containers → lemonlink-landing → Logs
# Or via SSH:
docker logs lemonlink-landing
```
### "404 Not Found"
Check files exist:
```bash
ls -la /opt/lemonlink/
# Should show index.html, styles.css, script.js
```
### Port already in use
Change port in the stack:
```yaml
ports:
- "8081:80" # Use 8081 instead of 8080
```
### Permission denied
```bash
# Fix permissions
chmod -R 755 /opt/lemonlink/
```
---
## 📊 Useful Portainer Commands
| Action | Location |
|--------|----------|
| View logs | Containers → lemonlink-landing → Logs |
| Restart | Containers → lemonlink-landing → Restart |
| Edit stack | Stacks → lemonlink → Editor |
| Delete | Stacks → lemonlink → Delete |
---
## 🎉 Success!
Your stunning LemonLink landing page is now live at:
**http://your-docker-vm-ip:8080**
---
**Questions?** Check the container logs in Portainer! 🚀