132 lines
3.0 KiB
Batchfile
132 lines
3.0 KiB
Batchfile
@echo off
|
|
REM Quick start script for BDFR Web Interface with Docker (Windows)
|
|
REM This script sets up and starts the Docker environment
|
|
|
|
echo ======================================
|
|
echo BDFR Web Interface - Docker Quick Start
|
|
echo ======================================
|
|
echo.
|
|
|
|
REM Check if Docker is installed
|
|
docker --version >nul 2>&1
|
|
if %errorlevel% neq 0 (
|
|
echo Error: Docker is not installed
|
|
echo Please install Docker Desktop from: https://docs.docker.com/desktop/install/windows-install/
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo Docker is installed
|
|
echo.
|
|
|
|
REM Check if Docker Compose is installed
|
|
docker-compose --version >nul 2>&1
|
|
if %errorlevel% neq 0 (
|
|
docker compose version >nul 2>&1
|
|
if %errorlevel% neq 0 (
|
|
echo Error: Docker Compose is not installed
|
|
echo Please ensure Docker Desktop is properly installed
|
|
pause
|
|
exit /b 1
|
|
)
|
|
)
|
|
|
|
echo Docker Compose is installed
|
|
echo.
|
|
|
|
REM Create required directories
|
|
echo Creating required directories...
|
|
if not exist "downloads" mkdir downloads
|
|
if not exist "data" mkdir data
|
|
if not exist "config" mkdir config
|
|
if not exist "logs" mkdir logs
|
|
|
|
echo Directories created
|
|
echo.
|
|
|
|
REM Check if .env file exists
|
|
if not exist ".env" (
|
|
echo Creating .env file from template...
|
|
if exist ".env.example" (
|
|
copy .env.example .env >nul
|
|
echo .env file created
|
|
echo.
|
|
echo IMPORTANT: Edit .env file with your Reddit OAuth credentials
|
|
echo Get credentials from: https://www.reddit.com/prefs/apps
|
|
echo.
|
|
pause
|
|
) else (
|
|
echo Warning: .env.example not found
|
|
)
|
|
) else (
|
|
echo .env file already exists
|
|
)
|
|
echo.
|
|
|
|
REM Build and start containers
|
|
echo Building Docker image...
|
|
echo This may take a few minutes on first run...
|
|
echo.
|
|
|
|
docker-compose --version >nul 2>&1
|
|
if %errorlevel% equ 0 (
|
|
docker-compose build
|
|
) else (
|
|
docker compose build
|
|
)
|
|
|
|
if %errorlevel% neq 0 (
|
|
echo.
|
|
echo Error: Failed to build Docker image
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo.
|
|
echo Build complete!
|
|
echo.
|
|
|
|
echo Starting containers...
|
|
docker-compose --version >nul 2>&1
|
|
if %errorlevel% equ 0 (
|
|
docker-compose up -d
|
|
) else (
|
|
docker compose up -d
|
|
)
|
|
|
|
if %errorlevel% neq 0 (
|
|
echo.
|
|
echo Error: Failed to start containers
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo.
|
|
echo ======================================
|
|
echo BDFR Web Interface is starting!
|
|
echo ======================================
|
|
echo.
|
|
echo Web Interface: http://localhost:8000
|
|
echo API Documentation: http://localhost:8000/docs
|
|
echo.
|
|
echo Useful commands:
|
|
echo View logs: docker-compose logs -f
|
|
echo Stop container: docker-compose down
|
|
echo Restart: docker-compose restart
|
|
echo.
|
|
echo For more information, see DOCKER.md
|
|
echo.
|
|
|
|
REM Wait a moment and check if container is running
|
|
timeout /t 3 >nul
|
|
|
|
docker ps | findstr "bdfr-web-interface" >nul 2>&1
|
|
if %errorlevel% equ 0 (
|
|
echo Container is running successfully!
|
|
) else (
|
|
echo Warning: Container may not be running. Check logs with:
|
|
echo docker-compose logs
|
|
)
|
|
|
|
echo.
|
|
pause |