Skip to content

Commit a8abfee

Browse files
authored
Run the GUI next.js application using docker compose (#1092)
* Configure docker compose with the next.js app * Modify the documentation for running gui * Add brief installation method using docker compose at the README.md
1 parent 24cc5f2 commit a8abfee

File tree

5 files changed

+59
-19
lines changed

5 files changed

+59
-19
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ Your Optimized RAG pipeline is just a few clicks away.
4343

4444
Click the docs to use the AutoRAG GUI beta version! [AutoRAG GUI Docs](https://docs.auto-rag.com/gui/gui.html).
4545

46+
### GUI Installation
47+
48+
1. Clone the repository
49+
2. Run Docker Compose `docker compose up -d`
50+
3. Access the GUI at `http://localhost:3000`
51+
4652
---
4753

4854
## YouTube Tutorial

api/app.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,19 @@
6666
)
6767
logger = logging.getLogger(__name__)
6868

69+
cors_list = ["http://localhost:3000", "http://app:3000"]
70+
6971
# CORS 설정
7072
app = cors(
7173
app,
72-
allow_origin=["http://localhost:3000"],
74+
allow_origin=cors_list,
7375
allow_methods=["GET", "POST", "PUT", "DELETE", "OPTIONS"],
7476
allow_headers=["Content-Type", "Authorization"],
7577
allow_credentials=True,
7678
max_age=3600,
7779
)
7880

79-
print("CORS enabled for http://localhost:3000")
81+
print("CORS enabled for http://localhost:3000 and http://app:3000")
8082

8183
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
8284
ENV = os.getenv("AUTORAG_API_ENV", "dev")
@@ -106,7 +108,7 @@
106108
@app.after_request
107109
def add_cors_headers(response):
108110
origin = request.headers.get("Origin")
109-
if origin == "http://localhost:3000":
111+
if origin in cors_list:
110112
response.headers["Access-Control-Allow-Origin"] = origin
111113
response.headers["Access-Control-Allow-Credentials"] = "true"
112114
response.headers["Access-Control-Allow-Headers"] = "Content-Type, Authorization"
@@ -122,7 +124,7 @@ def add_cors_headers(response):
122124
async def options_handler(path=""):
123125
response = await make_response("")
124126
origin = request.headers.get("Origin")
125-
if origin == "http://localhost:3000":
127+
if origin in cors_list:
126128
response.headers["Access-Control-Allow-Origin"] = origin
127129
response.headers["Access-Control-Allow-Credentials"] = "true"
128130
response.headers["Access-Control-Allow-Headers"] = "Content-Type, Authorization"
@@ -1009,9 +1011,9 @@ async def delete_environment_variable(key: str):
10091011

10101012

10111013
@click.command()
1012-
@click.option("--host", type=str, default="127.0.0.1", help="Host IP address")
1014+
@click.option("--host", type=str, default="0.0.0.0", help="Host IP address")
10131015
@click.option("--port", type=int, default=8000, help="Port number")
1014-
def main(host: str = "127.0.0.1", port: int = 8000):
1016+
def main(host: str = "0.0.0.0", port: int = 8000):
10151017
uvicorn.run("app:app", host=host, port=port, reload=True, loop="asyncio")
10161018

10171019

docker-compose.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ services:
55
image: redis:latest
66
ports:
77
- "6379:6379"
8+
networks:
9+
- app-network
810

911
api:
1012
build:
@@ -27,9 +29,10 @@ services:
2729
- CELERY_RESULT_BACKEND=redis://redis:6379/0
2830
- LOG_LEVEL=DEBUG # 로그 레벨 설정
2931
- PYTHONUNBUFFERED=1 # Python 출력 버퍼링 비활성화
30-
3132
depends_on:
3233
- redis
34+
networks:
35+
- app-network
3336

3437
flower:
3538
image: mher/flower
@@ -44,6 +47,27 @@ services:
4447
depends_on:
4548
- redis
4649
- api
50+
networks:
51+
- app-network
52+
53+
app:
54+
build:
55+
context: ./autorag-frontend
56+
dockerfile: Dockerfile
57+
args:
58+
- NEXT_PUBLIC_API_URL=http://localhost:8000
59+
- NEXT_PUBLIC_HOST_URL=http://localhost
60+
ports:
61+
- "3000:3000"
62+
environment:
63+
- NODE_ENV=production
64+
- NEXT_PUBLIC_API_URL=http://localhost:8000
65+
- NEXT_PUBLIC_HOST_URL=http://localhost
66+
restart: unless-stopped
67+
depends_on:
68+
- api
69+
networks:
70+
- app-network
4771

4872
volumes:
4973
redis_data:

docs/source/gui/gui.md

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Your Optimized RAG pipeline is just a few clicks away.
1818

1919
## Installation
2020

21-
### Use Docker (from source)
21+
### Use Docker Compose (from source)
2222
You can install AutoRAG GUI using Docker and the source from Github.
2323

2424
#### 1. Clone the repository with submodules
@@ -34,7 +34,24 @@ cd AutoRAG
3434
docker compose up
3535
```
3636

37-
#### 3. Build an GUI application and run it
37+
#### 3. Access the GUI
38+
39+
You can use the GUI by accessing `http://localhost:3000` in your web browser right away.
40+
41+
The project files will be stored in the 'projects' directory in the root directory that you cloned the repository.
42+
43+
## Newbie & Pro version
44+
45+
There are two versions of AutoRAG GUI: Newbie and Pro.
46+
The Pro version is under construction.
47+
48+
The Newbie version is for the users who are not familiar with RAG or AI at all.
49+
It provides a simple setting to optimize the RAG pipeline and use it.
50+
If you are a newbie, feel free to check out the Newbie version.
51+
52+
## Run the GUI application from source
53+
54+
#### 1. Build an GUI application and run it
3855

3956
First, go to the autorag-frontend directory.
4057

@@ -57,12 +74,3 @@ npm run start
5774
```
5875

5976
That's it!
60-
61-
## Newbie & Pro version
62-
63-
There are two versions of AutoRAG GUI: Newbie and Pro.
64-
The Pro version is under construction.
65-
66-
The Newbie version is for the users who are not familiar with RAG or AI at all.
67-
It provides a simple setting to optimize the RAG pipeline and use it.
68-
If you are a newbie, feel free to check out the Newbie version.

0 commit comments

Comments
 (0)