From 6cec5b579514ec254efd10e2a70463c4f8351e9e Mon Sep 17 00:00:00 2001 From: Damien Laureaux Date: Thu, 14 Nov 2024 20:38:54 +0100 Subject: [PATCH] fix(docker): fix Docker compose to use .env files --- .env.example | 3 +++ README.md | 22 +++++++++++++++++----- docker-compose.yaml | 9 ++++----- ui/.env.example | 3 ++- 4 files changed, 26 insertions(+), 11 deletions(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..75ef611 --- /dev/null +++ b/.env.example @@ -0,0 +1,3 @@ +NEXT_PUBLIC_WS_URL=ws://localhost:3001 +NEXT_PUBLIC_API_URL=http://localhost:3001/api +SEARXNG_API_URL=http://searxng:8080 \ No newline at end of file diff --git a/README.md b/README.md index 4aa17cb..8e3cf42 100644 --- a/README.md +++ b/README.md @@ -77,13 +77,25 @@ There are mainly 2 ways of installing Perplexica - With Docker, Without Docker. - `SIMILARITY_MEASURE`: The similarity measure to use (This is filled by default; you can leave it as is if you are unsure about it.) -5. Ensure you are in the directory containing the `docker-compose.yaml` file and execute: +5. Rename the `.env.example` file to `.env` and fill in all necessary fields. - ```bash - docker compose up -d - ``` + ```bash + mv .env.example .env + ``` -6. Wait a few minutes for the setup to complete. You can access Perplexica at http://localhost:3000 in your web browser. +6. Rename the `./ui/.env.example` file to `./ui/.env` and fill in all necessary fields. + + ```bash + mv ./ui/.env.example ./ui/.env + ``` + +7. Ensure you are in the directory containing the `docker-compose.yaml` file and execute: + + ```bash + docker compose up -d + ``` + +8. Wait a few minutes for the setup to complete. You can access Perplexica at http://localhost:3000 in your web browser. **Note**: After the containers are built, you can start Perplexica directly from Docker without having to open a terminal. diff --git a/docker-compose.yaml b/docker-compose.yaml index 25d6ec2..35b9320 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -14,8 +14,6 @@ services: context: . dockerfile: backend.dockerfile image: itzcrazykns1337/perplexica-backend:main - environment: - - SEARXNG_API_URL=http://searxng:8080 depends_on: - searxng ports: @@ -27,15 +25,14 @@ services: - 'host.docker.internal:host-gateway' networks: - perplexica-network + env_file: + - ./.env restart: unless-stopped perplexica-frontend: build: context: . dockerfile: app.dockerfile - args: - - NEXT_PUBLIC_API_URL=http://127.0.0.1:3001/api - - NEXT_PUBLIC_WS_URL=ws://127.0.0.1:3001 image: itzcrazykns1337/perplexica-frontend:main depends_on: - perplexica-backend @@ -43,6 +40,8 @@ services: - 3000:3000 networks: - perplexica-network + env_file: + - ./.env restart: unless-stopped networks: diff --git a/ui/.env.example b/ui/.env.example index 57a3ed9..75ef611 100644 --- a/ui/.env.example +++ b/ui/.env.example @@ -1,2 +1,3 @@ NEXT_PUBLIC_WS_URL=ws://localhost:3001 -NEXT_PUBLIC_API_URL=http://localhost:3001/api \ No newline at end of file +NEXT_PUBLIC_API_URL=http://localhost:3001/api +SEARXNG_API_URL=http://searxng:8080 \ No newline at end of file