Skip to content

Commit

Permalink
Merge pull request #508 from intuitem/compose_pg_variant
Browse files Browse the repository at this point in the history
Add Docker compose variant with PG
  • Loading branch information
eric-intuitem authored Jun 2, 2024
2 parents ec1ea96 + d2b8c14 commit 067612b
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docker-compose-pg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#! /usr/bin/env bash

echo "This is a sample for running the CISO Assistant Community Edition with a PostgreSQL database"
echo "You should adjust the docker-compose-pg.yml file with right credentials and settings and most likely split the db on a separate server in a production environment"

if [ -d ./db ] ; then
echo "the database seems already created"
echo "you should launch docker compose -f docker-compose-pg.yml up -d"
echo "for clean start, you can remove the database folder and files, run docker compose down and then docker compose rm and start again"
else
docker rmi ghcr.io/intuitem/ciso-assistant-community/backend:latest ghcr.io/intuitem/ciso-assistant-community/frontend:latest 2> /dev/null
docker compose -f docker-compose-pg.yml up -d
docker compose -f docker-compose-pg.yml exec backend python manage.py migrate
echo "initialize your superuser account..."
docker compose -f docker-compose-pg.yml exec backend python manage.py createsuperuser
echo "connect to ciso assistant on https://localhost:8443 or the custom url if you have set it"
echo "for successive runs you can now use docker compose -f docker-compose-pg.yml up"
fi
58 changes: 58 additions & 0 deletions docker-compose-pg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
version: "3.9"

services:
backend:
container_name: backend
image: ghcr.io/intuitem/ciso-assistant-community/backend:latest
restart: always
depends_on:
- postgres
environment:
- ALLOWED_HOSTS=backend
- CISO_ASSISTANT_URL=https://localhost:8443
- DJANGO_DEBUG=True
- POSTGRES_NAME=ciso_assistant
- POSTGRES_USER=ciso_assistant
- POSTGRES_PASSWORD=ciso_assistant
- DB_HOST=postgres
volumes:
- ./db:/code/db

frontend:
container_name: frontend
environment:
- PUBLIC_BACKEND_API_URL=http://backend:8000/api
- PROTOCOL_HEADER=x-forwarded-proto
- HOST_HEADER=x-forwarded-host

image: ghcr.io/intuitem/ciso-assistant-community/frontend:latest
depends_on:
- backend

postgres:
container_name: postgres
image: postgres:16
restart: always
environment:
POSTGRES_DB: ciso_assistant
POSTGRES_USER: ciso_assistant
POSTGRES_PASSWORD: ciso_assistant
volumes:
- ./db/pg:/var/lib/postgresql/data


caddy:
container_name: caddy
image: caddy:2.7.6
restart: unless-stopped
ports:
- 8443:8443
command:
- caddy
- reverse-proxy
- --from
- https://localhost:8443
- --to
- frontend:3000
volumes:
- ./db:/data

0 comments on commit 067612b

Please sign in to comment.