58 lines
1.7 KiB
Batchfile
58 lines
1.7 KiB
Batchfile
@echo off
|
|
REM Production deployment script for Windows
|
|
REM Usage: deploy.bat [git_repo_url] [branch] [commit_hash]
|
|
|
|
set GIT_REPO_URL=%1
|
|
set GIT_BRANCH=%2
|
|
if "%GIT_BRANCH%"=="" set GIT_BRANCH=ui-fix
|
|
set GIT_COMMIT=%3
|
|
|
|
REM Check if .env.production exists
|
|
if exist .env.production (
|
|
echo Loading production environment variables...
|
|
for /f "delims=" %%x in (.env.production) do (
|
|
set "%%x"
|
|
)
|
|
) else (
|
|
echo Warning: .env.production not found. Make sure environment variables are set!
|
|
)
|
|
|
|
REM Validate critical environment variables
|
|
if "%NEXTAUTH_SECRET%"=="" (
|
|
echo ERROR: NEXTAUTH_SECRET must be set to a secure random string!
|
|
echo Generate one with: openssl rand -base64 32
|
|
exit /b 1
|
|
)
|
|
|
|
@REM if "%NEXTAUTH_SECRET%"=="YOUR_SUPER_SECURE_SECRET_KEY_HERE_AT_LEAST_32_CHARACTERS_LONG" (
|
|
@REM echo ERROR: NEXTAUTH_SECRET must be changed from the default value!
|
|
@REM echo Generate one with: openssl rand -base64 32
|
|
@REM exit /b 1
|
|
@REM )
|
|
|
|
if "%NEXTAUTH_URL%"=="" (
|
|
echo ERROR: NEXTAUTH_URL must be set to your production URL!
|
|
exit /b 1
|
|
)
|
|
|
|
if "%GIT_REPO_URL%"=="" (
|
|
echo Building from local files...
|
|
docker-compose -f docker-compose.prod.yml build
|
|
) else (
|
|
echo Building from git repository: %GIT_REPO_URL%
|
|
echo Branch: %GIT_BRANCH%
|
|
if not "%GIT_COMMIT%"=="" echo Commit: %GIT_COMMIT%
|
|
|
|
set GIT_REPO_URL=%GIT_REPO_URL%
|
|
set GIT_BRANCH=%GIT_BRANCH%
|
|
set GIT_COMMIT=%GIT_COMMIT%
|
|
docker-compose -f docker-compose.prod.yml build
|
|
)
|
|
|
|
echo Starting production deployment...
|
|
docker-compose -f docker-compose.prod.yml down
|
|
docker-compose -f docker-compose.prod.yml up -d
|
|
|
|
echo Deployment completed successfully!
|
|
echo Application is running at http://localhost:3001
|