Add .env.example file and update docker-compose configurations for environment variables
Some checks failed
Deploy Development / deploy (push) Failing after 1m40s
Some checks failed
Deploy Development / deploy (push) Failing after 1m40s
This commit is contained in:
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:
|
env:
|
||||||
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
|
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
|
||||||
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
||||||
|
|
||||||
run: |
|
run: |
|
||||||
ssh -i ~/.ssh/id_ed25519 $DEPLOY_USER@$DEPLOY_HOST << 'EOF'
|
ssh -i ~/.ssh/id_ed25519 $DEPLOY_USER@$DEPLOY_HOST << 'EOF'
|
||||||
set -e
|
set -e
|
||||||
@@ -75,13 +76,20 @@ jobs:
|
|||||||
|
|
||||||
cd "$DEPLOY_DIR"
|
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 inspect traefik-public >/dev/null 2>&1 || \
|
||||||
docker network create traefik-public
|
docker network create traefik-public
|
||||||
|
docker network inspect crew-app-net >/dev/null 2>&1 || \
|
||||||
|
docker network create crew-app-net
|
||||||
|
|
||||||
echo "🚀 Starting containers"
|
echo "🚀 Starting containers (env vars from .env file)"
|
||||||
export DOMAIN=dev-admin.merchbay.app
|
|
||||||
export APP_URL=https://dev-admin.merchbay.app
|
|
||||||
docker compose up -d
|
docker compose up -d
|
||||||
|
|
||||||
echo "⏳ Waiting for app container"
|
echo "⏳ Waiting for app container"
|
||||||
@@ -106,6 +114,7 @@ jobs:
|
|||||||
echo "✅ Deployment completed"
|
echo "✅ Deployment completed"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
||||||
# 6️⃣ Health check
|
# 6️⃣ Health check
|
||||||
- name: Health check
|
- name: Health check
|
||||||
shell: sh
|
shell: sh
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ services:
|
|||||||
- APP_DEBUG=false
|
- APP_DEBUG=false
|
||||||
- APP_URL=https://dev-admin.merchbay.app
|
- APP_URL=https://dev-admin.merchbay.app
|
||||||
- DB_CONNECTION=mysql
|
- DB_CONNECTION=mysql
|
||||||
- DB_HOST=your-mysql-host
|
- DB_HOST=${DB_HOST}
|
||||||
- DB_PORT=3306
|
- DB_PORT=${DB_PORT:-3306}
|
||||||
- DB_DATABASE=merchbay_admin_dev
|
- DB_DATABASE=${DB_DATABASE}
|
||||||
- DB_USERNAME=your-mysql-user
|
- DB_USERNAME=${DB_USERNAME}
|
||||||
- DB_PASSWORD=your-mysql-password
|
- DB_PASSWORD=${DB_PASSWORD}
|
||||||
volumes:
|
volumes:
|
||||||
- app_storage_dev:/var/www/html/storage
|
- app_storage_dev:/var/www/html/storage
|
||||||
- app_uploads_dev:/var/www/html/public/uploads
|
- app_uploads_dev:/var/www/html/public/uploads
|
||||||
|
|||||||
@@ -8,32 +8,35 @@ services:
|
|||||||
- APP_DEBUG=${APP_DEBUG:-false}
|
- APP_DEBUG=${APP_DEBUG:-false}
|
||||||
- APP_URL=${APP_URL:-http://localhost}
|
- APP_URL=${APP_URL:-http://localhost}
|
||||||
- DB_CONNECTION=mysql
|
- DB_CONNECTION=mysql
|
||||||
- DB_HOST=${DB_HOST:-localhost}
|
- DB_HOST=${DB_HOST}
|
||||||
- DB_PORT=${DB_PORT:-3306}
|
- DB_PORT=${DB_PORT:-3306}
|
||||||
- DB_DATABASE=${DB_DATABASE:-merchbay_admin}
|
- DB_DATABASE=${DB_DATABASE}
|
||||||
- DB_USERNAME=${DB_USERNAME:-root}
|
- DB_USERNAME=${DB_USERNAME}
|
||||||
- DB_PASSWORD=${DB_PASSWORD:-}
|
- DB_PASSWORD=${DB_PASSWORD}
|
||||||
volumes:
|
volumes:
|
||||||
- ./storage:/var/www/html/storage
|
- ./storage:/var/www/html/storage
|
||||||
- ./public/uploads:/var/www/html/public/uploads
|
- ./public/uploads:/var/www/html/public/uploads
|
||||||
labels:
|
labels:
|
||||||
- "traefik.enable=true"
|
- "traefik.enable=true"
|
||||||
- "traefik.http.routers.merchbay-admin.rule=Host(`${DOMAIN:-merchbay-admin.localhost}`)"
|
- "traefik.http.routers.merchbay-admin-dev.rule=Host(`dev-admin.merchbay.app`)"
|
||||||
- "traefik.http.routers.merchbay-admin.entrypoints=websecure"
|
- "traefik.http.routers.merchbay-admin-dev.entrypoints=websecure"
|
||||||
- "traefik.http.routers.merchbay-admin.tls=true"
|
- "traefik.http.routers.merchbay-admin-dev.tls=true"
|
||||||
- "traefik.http.routers.merchbay-admin.tls.certresolver=letsencrypt"
|
- "traefik.http.routers.merchbay-admin-dev.tls.certresolver=letsencrypt"
|
||||||
- "traefik.http.services.merchbay-admin.loadbalancer.server.port=80"
|
- "traefik.http.services.merchbay-admin-dev.loadbalancer.server.port=80"
|
||||||
# HTTP to HTTPS redirect
|
# HTTP to HTTPS redirect
|
||||||
- "traefik.http.routers.merchbay-admin-http.rule=Host(`${DOMAIN:-merchbay-admin.localhost}`)"
|
- "traefik.http.routers.merchbay-admin-dev-http.rule=Host(`dev-admin.merchbay.app`)"
|
||||||
- "traefik.http.routers.merchbay-admin-http.entrypoints=web"
|
- "traefik.http.routers.merchbay-admin-dev-http.entrypoints=web"
|
||||||
- "traefik.http.routers.merchbay-admin-http.middlewares=https-redirect"
|
- "traefik.http.routers.merchbay-admin-dev-http.middlewares=https-redirect"
|
||||||
- "traefik.http.middlewares.https-redirect.redirectscheme.scheme=https"
|
- "traefik.http.middlewares.https-redirect.redirectscheme.scheme=https"
|
||||||
networks:
|
networks:
|
||||||
- traefik-public
|
- traefik-public
|
||||||
|
- crew-app-net
|
||||||
- default
|
- default
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
traefik-public:
|
traefik-public:
|
||||||
external: true
|
external: true
|
||||||
|
crew-app-net:
|
||||||
|
external: true
|
||||||
default:
|
default:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
|
|||||||
Reference in New Issue
Block a user