-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.bat
More file actions
175 lines (158 loc) · 4.4 KB
/
Copy pathdeploy.bat
File metadata and controls
175 lines (158 loc) · 4.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
@echo off
REM Minder AI Deployment Script for Windows
REM This script helps deploy Minder AI using Docker Compose + Caddy
setlocal enabledelayedexpansion
echo ========================================
echo Minder AI Deployment Script
echo ========================================
echo.
REM Check if Docker is installed
docker --version >nul 2>&1
if %ERRORLEVEL% NEQ 0 (
echo Error: Docker is not installed. Please install Docker first.
exit /b 1
)
REM Check if Docker Compose is available
docker compose version >nul 2>&1
if %ERRORLEVEL% EQU 0 (
set COMPOSE_CMD=docker compose
) else (
docker-compose --version >nul 2>&1
if %ERRORLEVEL% EQU 0 (
set COMPOSE_CMD=docker-compose
) else (
echo Error: Docker Compose is not installed. Please install Docker Compose first.
exit /b 1
)
)
if "%1"=="" goto usage
if "%1"=="start" goto start
if "%1"=="stop" goto stop
if "%1"=="restart" goto restart
if "%1"=="rebuild" goto rebuild
if "%1"=="logs" goto logs
if "%1"=="status" goto status
if "%1"=="clean" goto clean
if "%1"=="setup" goto setup
if "%1"=="setup-domain" goto setup_domain
if "%1"=="caddy-reload" goto caddy_reload
goto usage
:usage
echo Usage: %0 [command]
echo.
echo Commands:
echo start Start all services (with Caddy HTTPS)
echo stop Stop all services
echo restart Restart all services
echo rebuild Rebuild and restart all services
echo logs Show logs
echo status Show status of services
echo clean Stop and remove all containers, volumes
echo setup Initial setup (create .env from template)
echo setup-domain Add domain to global Caddy (Linux only)
echo caddy-reload Reload global Caddy config
echo.
exit /b 1
:setup
echo Setting up Minder AI...
if exist ".env" (
echo .env file already exists.
set /p OVERWRITE="Do you want to overwrite it? (y/N) "
if /i not "!OVERWRITE!"=="y" (
echo Setup cancelled.
exit /b 0
)
)
copy .env.docker .env
echo .env file created from template.
echo Please edit .env and fill in your configuration.
echo.
echo Required configuration:
echo - POSTGRES_PASSWORD: Set a secure database password
echo - JWT_SECRET: Set a secure JWT secret
echo - SILICONFLOW_API_KEY or QWEN_API_KEY: At least one for AI features
echo - MINDERAI_DOMAIN: Your domain (default: minderai.heywhale.com)
echo.
echo Caddy will automatically obtain and renew HTTPS certificates!
exit /b 0
:start
if not exist ".env" (
echo Warning: .env file not found.
echo Run '%0 setup' to create one from template.
exit /b 1
)
echo Starting Minder AI services...
%COMPOSE_CMD% up -d --remove-orphans
echo Services started!
echo.
goto show_info
:stop
echo Stopping Minder AI services...
%COMPOSE_CMD% down --remove-orphans
echo Services stopped.
exit /b 0
:restart
if not exist ".env" (
echo Warning: .env file not found.
exit /b 1
)
echo Restarting Minder AI services...
%COMPOSE_CMD% restart
echo Services restarted.
exit /b 0
:rebuild
if not exist ".env" (
echo Warning: .env file not found.
exit /b 1
)
echo Rebuilding Minder AI services...
%COMPOSE_CMD% down --remove-orphans
%COMPOSE_CMD% build --no-cache
%COMPOSE_CMD% up -d --remove-orphans
echo Services rebuilt and started!
echo.
goto show_info
:logs
%COMPOSE_CMD% logs %2 %3 %4
exit /b 0
:status
echo Minder AI Services Status:
echo.
%COMPOSE_CMD% ps
exit /b 0
:clean
echo WARNING: This will remove all containers, networks, and volumes!
echo All data including the database will be lost!
set /p CONFIRM="Are you sure? (y/N) "
if /i "!CONFIRM!"=="y" (
echo Cleaning up...
%COMPOSE_CMD% down -v --remove-orphans
echo Cleanup complete.
) else (
echo Cancelled.
)
exit /b 0
:setup_domain
echo Domain setup must be performed on the Linux server.
echo Run: ./deploy.sh setup-domain
exit /b 0
:caddy_reload
echo Reloading global Caddy configuration...
docker exec caddy-proxy caddy reload --config /etc/caddy/Caddyfile
echo Caddy config reloaded!
exit /b 0
:show_info
echo ========================================
echo Minder AI is now running!
echo ========================================
echo.
echo Production: https://minderai.heywhale.com
echo API Docs: https://minderai.heywhale.com/api/docs
echo Health Check: https://minderai.heywhale.com/api/health
echo.
echo HTTPS managed by global Caddy (caddy-proxy).
echo.
echo To view logs: %0 logs -f
echo Caddy logs: %0 logs -f caddy
echo.
exit /b 0