openchatai / OpenChat

LLMs custom-chatbots console ⚡
https://open.cx
MIT License
5.17k stars 642 forks source link

Can't use in windows #11

Closed haorunze closed 1 year ago

haorunze commented 1 year ago

so many linux command in Makefile. Cant't run in windows.

JeremiLorenti commented 1 year ago

Hey, I was able to modify the Makefile to work with Windows 11. I basically removed the "sleep" commands, comments, and changed the cp copy lines to

copy /Y backend-server\.env.example backend-server\.env
copy /Y common.env llm-server\.env"
DOCKER_COMPOSE = docker-compose
BUILD_OPTS = 

install:
    @echo "=== Putting the services down (if already running) ==="
    ${DOCKER_COMPOSE} down --remove-orphans

    @echo "=== Setting up Docker environment ==="
    @echo "=== This will overwrite your .env files, you still have some time to abort ==="
    @echo "=== Copying .env files ==="
    copy /Y backend-server\.env.example backend-server\.env
    copy /Y common.env llm-server\.env
    ${DOCKER_COMPOSE} build ${BUILD_OPTS}
    ${DOCKER_COMPOSE} up -d 
    @echo "=== Waiting for services to start (~20 seconds) ==="

    @echo "=== Clearing backend server config cache ==="
    ${DOCKER_COMPOSE} exec backend-server php artisan config:cache

    @echo "=== Run backend server server migrations ==="
    ${DOCKER_COMPOSE} exec backend-server php artisan migrate --seed
    ${DOCKER_COMPOSE} exec backend-server php artisan storage:link
    ${DOCKER_COMPOSE} run -d backend-server php artisan queue:work --timeout=200

    @echo "=== Installation completed ==="
    @echo "=== 🔥🔥 You can now access the dashboard at -> http://localhost:8000 ==="
    @echo "=== Enjoy! ==="

run-worker:
    ${DOCKER_COMPOSE} exec backend-server php artisan queue:work --timeout=200

db-setup:
    ${DOCKER_COMPOSE} exec backend-server php artisan migrate:fresh --seed

down:
    ${DOCKER_COMPOSE} down --remove-orphans

exec-backend-server:
    ${DOCKER_COMPOSE} exec backend-server bash
.PHONY: install down
seoeaa commented 1 year ago

Before using the .bat script, make sure Docker is installed and working properly. Create a bat file paste the code and run.

` @echo off SET DOCKER_COMPOSE=docker-compose

REM Colors SET COLOR_RESET= SET COLOR_BOLD= SET COLOR_GREEN= SET COLOR_YELLOW=

REM Targets :install echo %COLOR_BOLD%=== Putting the services down (if already running) ===%COLOR_RESET% %DOCKER_COMPOSE% down --remove-orphans

echo %COLOR_BOLD%=== Setting up Docker environment ===%COLOR_RESET% REM Copy .env.example to .env for backend-server REM Show warning before continue, and wait for 10 seconds echo %COLOR_BOLD%=== This will overwrite your .env files, you still have some time to abort ===%COLOR_RESET% timeout /t 10 > NUL echo %COLOR_BOLD%=== Copying .env files ===%COLOR_RESET% copy /y backend-server.env.example backend-server.env > NUL 2>&1 || (echo. & echo File already exists.) copy /y common.env llm-server.env > NUL 2>&1 || (echo. & echo File already exists.) %DOCKER_COMPOSE% build %DOCKER_COMPOSE% up -d echo %COLOR_BOLD%=== Waiting for services to start (~20 seconds) ===%COLOR_RESET% timeout /t 20 > NUL

echo %COLOR_BOLD%=== Clearing backend server config cache ===%COLOR_RESET% %DOCKER_COMPOSE% exec backend-server php artisan config:cache

echo %COLOR_BOLD%=== Run backend server migrations ===%COLOR_RESET% %DOCKER_COMPOSE% exec backend-server php artisan migrate --seed %DOCKER_COMPOSE% exec backend-server php artisan storage:link %DOCKER_COMPOSE% run -d backend-server php artisan queue:work --timeout=200

echo %COLOR_BOLD%=== Installation completed ===%COLOR_RESET% echo %COLOR_BOLD%=== 🔥🔥 You can now access the dashboard at -> http://localhost:8000 ===%COLOR_RESET% echo %COLOR_BOLD%=== Enjoy! ===%COLOR_RESET% goto :EOF

:run-worker %DOCKER_COMPOSE% exec backend-server php artisan queue:work --timeout=200 goto :EOF

:db-setup %DOCKER_COMPOSE% exec backend-server php artisan migrate:fresh --seed goto :EOF

:down %DOCKER_COMPOSE% down --remove-orphans goto :EOF

:exec-backend-server %DOCKER_COMPOSE% exec backend-server bash goto :EOF `

gharbat commented 1 year ago

Introduced windows support in https://github.com/openchatai/OpenChat/releases/tag/0.3.0 if you have any other issues, please feel free to open a new issue :)