.env.example
파일 복제 후.env
파일 생성- 그 외 key 값은 개별 문의
-
cd backend
-
python 가상 환경 생성, requirements.txt 설치
- 3.12.4 이상 환경 필수
# 1. generate python bubble python -m venv env # 2. activate source env/bin/activate # mac env\Scripts\activate.bat # window # 3. install dependencies pip install -r requirements.txt # 4. deactivate bubble # deactivate
- chroma폴더의
chroma.sqlite3.zip
파일 압축 해제 - gitignore 되어 있어서 push해도 깃헙에 업로드 안됨 (100mb 이상 파일이므로)
cd frontend
- frontend 폴더 내부의
.env
파일에VITE_API_URL=http://localhost:5000
설정 npm install
npm run dev
- localhost:3000으로 접속
- 별 이상 없다면
docker-compose up --build -d
만 해주면 됨
docker-compose down # 실행 중인 모든 컨테이터, 볼륨, 이미지 삭제
docker-compose up --build -d # 이미지 설치후 백그라운드에서 실행
# docker system prune
brew services restart nginx
main.py
에서 CORS 허용되는 도메인은localhost:3000
과hike.cau.ac.kr
으로 설정함- gunicorn으로 실행하는 경우 debug=False가 되므로 개발모드 실행은
python main.py
해주면 될 듯
# source env/bin/activate
# pip install -r requirements.txt
cd backend
gunicorn -b 0.0.0.0:5000 main:app
- /chatbot이란 하위경로로 도메인을 붙이기 위해
nuxt.config.ts
에 하위경로 설정
app: {
baseURL: '/chatbot/',
},
- CORS 에러, proxy 등 설정
location /chatbot/ {
# 비밀번호 설정
auth_basic "Security";
auth_basic_user_file /usr/local/etc/nginx/.htpasswd;
# proxy 설정
proxy_pass http://localhost:3000/chatbot/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# WebSocket 지원을 위한 설정 (필요한 경우)
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# CORS 헤더 설정
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Credentials true;
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
add_header Access-Control-Allow-Headers 'Origin, Content-Type, Accept, Authorization';
}
- frontend 폴더 내부의
.env
파일에VITE_API_URL=http://165.194.115.109:5000
설정 - 로컬에서 실행하는 백엔드와 연결하고 싶다면
VITE_API_URL=http://localhost:5000
로 변경
cd frontend
npm run build
node .output/server/index.mjs