Ensuring the website can be built and deployed fully in docker. This includes an end to end docker-compose configuration as a simple demonstration.

This commit is contained in:
Keith Stevens
2022-12-20 20:28:53 +09:00
parent 2dbdd92791
commit c056a31d2f
13 changed files with 194 additions and 28 deletions
+18
View File
@@ -0,0 +1,18 @@
# 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
cd ../../website
npx prisma db push
```
NOTE: we're working on making the prisma step integrated into the docker
initialization process.
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.
+89
View File
@@ -0,0 +1,89 @@
version: "3.7"
services:
# This DB is for the FastAPI Backend.
db:
image: postgres
restart: always
ports:
- 5432:5432
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgres"]
interval: 2s
timeout: 2s
retries: 10
# This DB is for Web Authentication and data caching.
webdb:
image: postgres
restart: always
ports:
- 5433:5432
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgres"]
interval: 2s
timeout: 2s
retries: 10
# This lets you manually inspect the web and backend databases.
adminer:
image: adminer
restart: always
ports:
- 8089: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"
# The oassist backend service.
backend:
build:
dockerfile: docker/Dockerfile.backend
context: ../../
image: oasst-backend
environment:
- POSTGRES_HOST=db
- ALLOW_ANY_API_KEY=True
- MAX_WORKERS=1
depends_on:
db:
condition: service_healthy
ports:
- "8080:8080"
# The oassist web service.
web:
build:
dockerfile: docker/Dockerfile.website
context: ../../
image: oasst-web
environment:
- DATABASE_URL=postgres://postgres:postgres@webdb/ocgpt_website
- 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"
@@ -47,8 +47,9 @@ services:
ports:
- "8080:8080"
# This fakes and SMTP email server. User registration emails can be found by going to
# localhost:1080 and opening the emails listed.
# 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