-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.bat
More file actions
62 lines (55 loc) · 2.28 KB
/
Copy pathstart.bat
File metadata and controls
62 lines (55 loc) · 2.28 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
@echo off
rem bash.social launcher - one command for Windows (cmd).
rem Auto-detects the environment:
rem 1) Docker Compose - starts app + PostgreSQL + Redis in containers;
rem 2) Native run - starts Redis (in Docker if present, else needs Memurai),
rem creates .venv, installs deps, runs uvicorn.
setlocal
cd /d "%~dp0"
if not exist .env copy .env.example .env >nul
rem* Preferred: everything in containers.
rem? Предпочтительно: всё в контейнерах.
docker compose version >nul 2>&1
if %errorlevel%==0 (
docker info >nul 2>&1
if %errorlevel%==0 (
echo ==^> bash.social: starting app + postgres + redis in containers
docker compose up -d --build
echo ==^> Open http://localhost:8000
exit /b 0
) else (
echo ==^> Docker is installed but the daemon is not running.
echo Start Docker Desktop and run start.bat again.
exit /b 1
)
)
echo ==^> Docker Compose not found - using the native path.
rem* Native path: Redis must be up (it is a separate service).
rem? Нативный путь: Redis должен работать (это отдельный сервис).
docker version >nul 2>&1
if %errorlevel%==0 (
docker inspect redis >nul 2>&1
if not %errorlevel%==0 (
echo ==^> Starting Redis in a container
docker run -d --name redis -p 6379:6379 redis:7
) else (
echo ==^> Redis container already running
)
) else (
echo ==^> No Docker on the system. Redis is not officially supported on Windows.
echo Install Memurai ^(https://www.memurai.com/^) or use WSL2, then rerun start.bat.
exit /b 1
)
rem* Virtualenv with dependencies (installed once).
rem? Виртуальное окружение с зависимостями (ставится один раз).
if not exist .venv py -m venv .venv
call .venv\Scripts\activate.bat
if not exist .venv\.deps-installed (
pip install -q -e ".[dev]"
if %errorlevel%==0 echo installed> .venv\.deps-installed
)
rem* Template .env points at the docker host "db" - use SQLite natively.
rem? Шаблон .env указывает на docker-хост "db" - нативно берём SQLite.
if not defined BS_DATABASE_URL set BS_DATABASE_URL=sqlite+aiosqlite:///./dev.db
echo ==^> bash.social: http://localhost:8000 ^(Ctrl+C to stop^)
uvicorn app.main:app --host 0.0.0.0 --port 8000