dev #2
23
.env.server.example
Normal file
23
.env.server.example
Normal file
@@ -0,0 +1,23 @@
|
||||
# Server .env file for Development Environment
|
||||
#
|
||||
# Instructions:
|
||||
# 1. SSH to your server: ssh webmaster@YOUR_SERVER_IP
|
||||
# 2. Create directory: mkdir -p /var/www/merchbay_admin_dev
|
||||
# 3. Create this file: nano /var/www/merchbay_admin_dev/.env
|
||||
# 4. Copy the content below (fill in YOUR_DB_PASSWORD)
|
||||
# 5. Save and secure: chmod 600 /var/www/merchbay_admin_dev/.env
|
||||
|
||||
APP_ENV=development
|
||||
APP_DEBUG=true
|
||||
APP_URL=https://dev-admin.merchbay.app
|
||||
DB_HOST=mysql
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=merchcbay_db
|
||||
DB_USERNAME=crewapp
|
||||
DB_PASSWORD=YOUR_DB_PASSWORD_HERE
|
||||
DOMAIN=dev-admin.merchbay.app
|
||||
|
||||
# Notes:
|
||||
# - DB_HOST=mysql (your MySQL container name on crew-app-net network)
|
||||
# - Replace YOUR_DB_PASSWORD_HERE with your actual MySQL password
|
||||
# - This file should NEVER be committed to git
|
||||
@@ -60,6 +60,7 @@ jobs:
|
||||
env:
|
||||
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
|
||||
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
||||
|
||||
run: |
|
||||
ssh -i ~/.ssh/id_ed25519 $DEPLOY_USER@$DEPLOY_HOST << 'EOF'
|
||||
set -e
|
||||
@@ -75,13 +76,20 @@ jobs:
|
||||
|
||||
cd "$DEPLOY_DIR"
|
||||
|
||||
echo "🌐 Ensure Traefik network"
|
||||
echo "🔍 Checking .env file"
|
||||
if [ ! -f .env ]; then
|
||||
echo "❌ .env file not found at $DEPLOY_DIR/.env"
|
||||
echo "Please create it first. See DEPLOYMENT-SETUP.md"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "🌐 Ensure networks"
|
||||
docker network inspect traefik-public >/dev/null 2>&1 || \
|
||||
docker network create traefik-public
|
||||
docker network inspect crew-app-net >/dev/null 2>&1 || \
|
||||
docker network create crew-app-net
|
||||
|
||||
echo "🚀 Starting containers"
|
||||
export DOMAIN=dev-admin.merchbay.app
|
||||
export APP_URL=https://dev-admin.merchbay.app
|
||||
echo "🚀 Starting containers (env vars from .env file)"
|
||||
docker compose up -d
|
||||
|
||||
echo "⏳ Waiting for app container"
|
||||
@@ -106,6 +114,7 @@ jobs:
|
||||
echo "✅ Deployment completed"
|
||||
EOF
|
||||
|
||||
|
||||
# 6️⃣ Health check
|
||||
- name: Health check
|
||||
shell: sh
|
||||
|
||||
@@ -14,11 +14,11 @@ services:
|
||||
- APP_DEBUG=false
|
||||
- APP_URL=https://dev-admin.merchbay.app
|
||||
- DB_CONNECTION=mysql
|
||||
- DB_HOST=your-mysql-host
|
||||
- DB_PORT=3306
|
||||
- DB_DATABASE=merchbay_admin_dev
|
||||
- DB_USERNAME=your-mysql-user
|
||||
- DB_PASSWORD=your-mysql-password
|
||||
- DB_HOST=${DB_HOST}
|
||||
- DB_PORT=${DB_PORT:-3306}
|
||||
- DB_DATABASE=${DB_DATABASE}
|
||||
- DB_USERNAME=${DB_USERNAME}
|
||||
- DB_PASSWORD=${DB_PASSWORD}
|
||||
volumes:
|
||||
- app_storage_dev:/var/www/html/storage
|
||||
- app_uploads_dev:/var/www/html/public/uploads
|
||||
|
||||
@@ -8,32 +8,35 @@ services:
|
||||
- APP_DEBUG=${APP_DEBUG:-false}
|
||||
- APP_URL=${APP_URL:-http://localhost}
|
||||
- DB_CONNECTION=mysql
|
||||
- DB_HOST=${DB_HOST:-localhost}
|
||||
- DB_HOST=${DB_HOST}
|
||||
- DB_PORT=${DB_PORT:-3306}
|
||||
- DB_DATABASE=${DB_DATABASE:-merchbay_admin}
|
||||
- DB_USERNAME=${DB_USERNAME:-root}
|
||||
- DB_PASSWORD=${DB_PASSWORD:-}
|
||||
- DB_DATABASE=${DB_DATABASE}
|
||||
- DB_USERNAME=${DB_USERNAME}
|
||||
- DB_PASSWORD=${DB_PASSWORD}
|
||||
volumes:
|
||||
- ./storage:/var/www/html/storage
|
||||
- ./public/uploads:/var/www/html/public/uploads
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.merchbay-admin.rule=Host(`${DOMAIN:-merchbay-admin.localhost}`)"
|
||||
- "traefik.http.routers.merchbay-admin.entrypoints=websecure"
|
||||
- "traefik.http.routers.merchbay-admin.tls=true"
|
||||
- "traefik.http.routers.merchbay-admin.tls.certresolver=letsencrypt"
|
||||
- "traefik.http.services.merchbay-admin.loadbalancer.server.port=80"
|
||||
- "traefik.http.routers.merchbay-admin-dev.rule=Host(`dev-admin.merchbay.app`)"
|
||||
- "traefik.http.routers.merchbay-admin-dev.entrypoints=websecure"
|
||||
- "traefik.http.routers.merchbay-admin-dev.tls=true"
|
||||
- "traefik.http.routers.merchbay-admin-dev.tls.certresolver=letsencrypt"
|
||||
- "traefik.http.services.merchbay-admin-dev.loadbalancer.server.port=80"
|
||||
# HTTP to HTTPS redirect
|
||||
- "traefik.http.routers.merchbay-admin-http.rule=Host(`${DOMAIN:-merchbay-admin.localhost}`)"
|
||||
- "traefik.http.routers.merchbay-admin-http.entrypoints=web"
|
||||
- "traefik.http.routers.merchbay-admin-http.middlewares=https-redirect"
|
||||
- "traefik.http.routers.merchbay-admin-dev-http.rule=Host(`dev-admin.merchbay.app`)"
|
||||
- "traefik.http.routers.merchbay-admin-dev-http.entrypoints=web"
|
||||
- "traefik.http.routers.merchbay-admin-dev-http.middlewares=https-redirect"
|
||||
- "traefik.http.middlewares.https-redirect.redirectscheme.scheme=https"
|
||||
networks:
|
||||
- traefik-public
|
||||
- crew-app-net
|
||||
- default
|
||||
|
||||
networks:
|
||||
traefik-public:
|
||||
external: true
|
||||
crew-app-net:
|
||||
external: true
|
||||
default:
|
||||
driver: bridge
|
||||
|
||||
Reference in New Issue
Block a user