[FEAT] Full function and deployed version
This commit is contained in:
55
deploy/deploy.sh
Executable file
55
deploy/deploy.sh
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
|
||||
# OHMJ Deployment Script
|
||||
|
||||
set -e
|
||||
|
||||
cd /home/jbnadal/sources/jb/ohmj/ohmj2
|
||||
|
||||
echo "=== OHMJ Deploy Script ==="
|
||||
|
||||
# 1. Remove old zip
|
||||
echo "[1/7] Removing old zip..."
|
||||
rm -f _builds/deploy_ohmj.zip
|
||||
|
||||
# 2. Generate JWT_SECRET
|
||||
echo "[2/7] Generating JWT_SECRET..."
|
||||
JWT_SECRET=$(openssl rand -base64 32)
|
||||
echo "JWT_SECRET=$JWT_SECRET" > api/.env
|
||||
echo "SCORES_PATH=/data/scores/" >> api/.env
|
||||
|
||||
# 3. Set production API URL in frontend .env
|
||||
echo "[3/7] Setting production API URL..."
|
||||
echo "VITE_API_URL=https://ohmj-api.c.nadal-fr.com" > partitions/.env
|
||||
|
||||
# 4. Clean and build frontend
|
||||
echo "[4/7] Cleaning and building frontend..."
|
||||
cd partitions
|
||||
rm -rf build
|
||||
npm run build
|
||||
|
||||
# Copy .mjs to .js for correct MIME type
|
||||
cp build/pdf.worker.min.mjs build/pdf.worker.min.js 2>/dev/null || echo "pdf.worker.min.mjs not found"
|
||||
cd ..
|
||||
|
||||
# 5. Create symlink for frontend directory
|
||||
echo "[5/7] Creating frontend symlink..."
|
||||
rm -f frontend
|
||||
ln -sfn partitions/build frontend
|
||||
|
||||
# 6. Copy nginx config to frontend
|
||||
echo "[6/7] Adding nginx config..."
|
||||
mkdir -p partitions/build
|
||||
cp /home/jbnadal/sources/jb/ohmj/ohmj2/partitions/nginx.conf partitions/build/nginx.conf 2>/dev/null || echo "nginx.conf not found in partitions/"
|
||||
|
||||
# 7. Create zip (without tests.php and legacy)
|
||||
echo "[7/7] Creating zip..."
|
||||
zip -r _builds/deploy_ohmj.zip api frontend -x "*.DS_Store" "node_modules/*" ".svelte-kit/*"
|
||||
|
||||
echo "=== Done! ==="
|
||||
echo "Zip created: _builds/deploy_ohmj.zip"
|
||||
echo ""
|
||||
echo "To deploy:"
|
||||
echo " 1. Upload zip to server"
|
||||
echo " 2. Extract to /var/www/"
|
||||
echo " 3. Configure web server"
|
||||
32
deploy/docker-compose.yml
Normal file
32
deploy/docker-compose.yml
Normal file
@@ -0,0 +1,32 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
api:
|
||||
image: php:8.3-cli
|
||||
container_name: ohmj-api
|
||||
hostname: api
|
||||
ports:
|
||||
- "8000:80"
|
||||
volumes:
|
||||
- /mnt/tools/docker/ohmj/api:/var/www/html
|
||||
- /mnt/tools/docker/ohmj/Scores:/var/www/html/legacy/Scores
|
||||
environment:
|
||||
- JWT_SECRET=${JWT_SECRET}
|
||||
command: php -S 0.0.0.0:80 -t /var/www/html router.php
|
||||
networks:
|
||||
- ohmj-network
|
||||
|
||||
frontend:
|
||||
image: nginx:alpine
|
||||
container_name: ohmj-frontend
|
||||
hostname: partitions
|
||||
ports:
|
||||
- "8080:80"
|
||||
volumes:
|
||||
- /mnt/tools/docker/ohmj/frontend:/usr/share/nginx/html:ro
|
||||
networks:
|
||||
- ohmj-network
|
||||
|
||||
networks:
|
||||
ohmj-network:
|
||||
driver: bridge
|
||||
Reference in New Issue
Block a user