diff --git a/.env.example b/.env.example index 6e4ef55..a86c81c 100644 --- a/.env.example +++ b/.env.example @@ -1,10 +1,13 @@ # Mode Selection (DEV=true for local dev, DEV=false for live production) DEV=false +# Server HTTP Port Configuration (Change if port 80 or 8080 is in use by another app) +HTTP_PORT=8080 + # Django Settings DJANGO_SECRET_KEY=generate-a-strong-random-secret-key-here ALLOWED_HOSTS=localhost,127.0.0.1,YOUR_SERVER_IP -CSRF_TRUSTED_ORIGINS=http://localhost,http://127.0.0.1,http://YOUR_SERVER_IP +CSRF_TRUSTED_ORIGINS=http://localhost,http://127.0.0.1,http://YOUR_SERVER_IP,http://YOUR_SERVER_IP:8080 # Database Configuration (PostgreSQL) POSTGRES_DB=divar_crawler diff --git a/.gitignore b/.gitignore index 7a21939..1ad3797 100644 --- a/.gitignore +++ b/.gitignore @@ -51,4 +51,6 @@ next-steps.md scratch/ *divar*.json - +# Agent settings +.agents/ +.agents/* diff --git a/deploy.sh b/deploy.sh index 5a3a6b1..768048a 100644 --- a/deploy.sh +++ b/deploy.sh @@ -16,6 +16,13 @@ if [ ! -f .env ]; then echo "WARNING: Please edit .env and set your OPENAI_API_KEY and passwords before running!" fi +# Source .env if exists to read HTTP_PORT +if [ -f .env ]; then + export $(grep -v '^#' .env | xargs) +fi + +PORT="${HTTP_PORT:-8080}" + echo "Pulling latest code changes..." git pull origin master || true @@ -27,4 +34,4 @@ echo "Checking container statuses..." docker compose ps echo "=== Deployment Successful! ===" -echo "Access the application at http://localhost or your server's IP address." +echo "Access the application at http://localhost:${PORT} or http://YOUR_SERVER_IP:${PORT}" diff --git a/docker-compose.yml b/docker-compose.yml index d91c587..f79d920 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ services: POSTGRES_USER: ${POSTGRES_USER:-postgres} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres} ports: - - "5432:5432" + - "${POSTGRES_HOST_PORT:-5432}:5432" volumes: - postgres_data:/var/lib/postgresql/data healthcheck: @@ -22,7 +22,7 @@ services: container_name: divar_redis restart: unless-stopped ports: - - "6379:6379" + - "${REDIS_HOST_PORT:-6379}:6379" healthcheck: test: [ "CMD", "redis-cli", "ping" ] interval: 5s @@ -37,7 +37,7 @@ services: restart: unless-stopped command: gunicorn config.wsgi:application --bind 0.0.0.0:8000 --workers 4 ports: - - "8000:8000" + - "${BACKEND_HOST_PORT:-8000}:8000" environment: - REDIS_URL=redis://redis:6379/0 - POSTGRES_HOST=db @@ -101,8 +101,7 @@ services: container_name: divar_frontend restart: unless-stopped ports: - - "80:80" - - "5173:80" + - "${HTTP_PORT:-8080}:80" depends_on: - backend