Unified multiple Docker Compose files into one for easier usage

This commit is contained in:
croumegous
2022-12-28 13:00:53 +01:00
parent 43550f62d7
commit 64206895ff
9 changed files with 119 additions and 156 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
# Backend Development Setup
Run `docker compose up` to start a database. The default settings are already configured to connect to the database at `localhost:5432`.
In root directory, run `docker compose up backend-dev` to start a database. The default settings are already configured to connect to the database at `localhost:5432`.
Make sure you have all requirements installed. You can do this by running `pip install -r requirements.txt` inside the `backend` folder and `pip install -e .` inside the `oasst-shared` folder.
Then, run the backend using the `run-local.sh` script. This will start the backend server at `http://localhost:8080`.
@@ -1,23 +0,0 @@
version: "3.7"
services:
db:
image: postgres
restart: always
ports:
- 5432:5432
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgres"]
interval: 2s
timeout: 2s
retries: 10
adminer:
image: adminer
restart: always
ports:
- 8089:8080
-14
View File
@@ -1,14 +0,0 @@
# End to End Demo
This sets up an entire stack needed to run Open Assistant, including the
website, backend, and associated dependent services.
To start the service, do the following:
```sh
docker compose up --build
```
Then, navigate to `http://localhost:3000` and interact with the website. When
logging in, navigate to `http://localhost:1080` to get the magic email login
link.
-58
View File
@@ -1,58 +0,0 @@
version: "3.7"
services:
# This DB is for the FastAPI Backend.
db:
extends:
file: ../frontend-development/docker-compose.yaml
service: db
# This DB is for Web Authentication and data caching.
webdb:
extends:
file: ../frontend-development/docker-compose.yaml
service: webdb
environment:
POSTGRES_DB: oasst_web
# This lets you manually inspect the web and backend databases.
adminer:
extends:
file: ../frontend-development/docker-compose.yaml
service: adminer
# This fakes an SMTP email server used by website authentication.
# User registration emails can be found by going to localhost:1080 and
# opening the emails listed.
maildev:
extends:
file: ../frontend-development/docker-compose.yaml
service: maildev
# The oassist backend service.
backend:
extends:
file: ../frontend-development/docker-compose.yaml
service: backend
# The oassist web service.
web:
build:
dockerfile: docker/Dockerfile.website
context: ../../
image: oasst-web
environment:
- DATABASE_URL=postgres://postgres:postgres@webdb/oasst_web
- FASTAPI_URL=http://backend:8080
- FASTAPI_KEY=1234
- NEXTAUTH_SECRET=O/M2uIbGj+lDD2oyNa8ax4jEOJqCPJzO53UbWShmq98=
- EMAIL_SERVER_HOST=maildev
- EMAIL_SERVER_PORT=1025
- EMAIL_FROM=info@example.com
- NEXTAUTH_URL=http://localhost:3000
depends_on:
webdb:
condition: service_healthy
ports:
- "3000:3000"
command: bash wait-for-postgres.sh node server.js
+1 -1
View File
@@ -1,5 +1,5 @@
# Frontend Development Setup
Run `docker compose up --build` to start a database and the backend server.
In root directory run `docker compose up frontend-dev --build` to start a database and the backend server.
Then, point your frontend at `http://localhost:8080` to start developing. During development, any API key will be accepted.
@@ -1,58 +0,0 @@
version: "3.7"
services:
# This DB is for the FastAPI Backend.
db:
extends:
file: ../backend-development/docker-compose.yaml
service: db
# This DB is for Web Authentication and data caching.
webdb:
image: postgres
restart: always
ports:
- 5433:5432
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: ocgpt_website
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgres"]
interval: 2s
timeout: 2s
retries: 10
# This lets you manually inspect the web and backend databases.
adminer:
extends:
file: ../backend-development/docker-compose.yaml
service: adminer
backend:
build:
dockerfile: docker/Dockerfile.backend
context: ../..
image: oasst-backend
environment:
- POSTGRES_HOST=db
- DEBUG_SKIP_API_KEY_CHECK=True
- MAX_WORKERS=1
depends_on:
db:
condition: service_healthy
ports:
- "8080:8080"
# This fakes an SMTP email server used by website authentication.
# User registration emails can be found by going to localhost:1080 and
# opening the emails listed.
maildev:
image: maildev/maildev
restart: always
environment:
- MAILDEV_WEB_PORT=1080
- MAILDEV_SMTP_PORT=1025
ports:
- "1080:1080"
- "1025:1025"
@@ -2,7 +2,7 @@
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
# switch to bot directory
pushd "$parent_path/../../bot"
pushd "$parent_path/../../discord-bot"
python3 __main__.py