Skip to content

Container deployment

This guide provides example instructions for deploying SerenityGPT using containers and Docker Compose. Container deployment offers flexibility and consistency across different environments.

Tip

Running the application in Docker Compose is not recommended for production environments. However, because many organizations have their own deployment preferences, Docker Compose is a good way of explaining the basic requirements of a deployment.

Prerequisites

Before you begin, ensure you have:

  • A container runtime (such as Docker) installed on your system.
  • Access to the SerenityGPT container registry.
  • Your SerenityGPT license key.
  • A PostgreSQL database with pgvector extension (see Provisioning a Database).

Steps

Note

This is a simplified summary of steps documented in Getting the container images. Refer to that guide for more detailed instructions.

  1. Pull the SerenityGPT image.
  2. Configure environment variables.
  3. Deploy using Docker Compose.
  4. Verify the deployment.

1. Pull the SerenityGPT image:

Log in to the SerenityGPT container registry:

docker login serenitygpt.azurecr.io -u <your-username> -p <your-password>

Pull the latest SerenityGPT image:

docker pull serenitygpt.azurecr.io/serenitygpt:latest

2. Configure environment variables:

Create a .env file with the necessary configuration. Here are the key variables you need to set:

# Database configuration
DB_NAME=serenitydb
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_HOST=your_db_host
DB_PORT=5432

# Azure Entra ID configuration
AAD_TENANT_ID=your_tenant_id
AAD_CLIENT_ID=your_client_id
AAD_CLIENT_SECRET=your_client_secret
AAD_REDIRECT_URI=https://your-serenitygpt-hostname/login/aad/callback

For a complete list of configuration options, refer to the Configuration Reference.

3. Deploy using Docker Compose:

Create a docker-compose.yml file with the following content:

version: '3'
services:
  serenitygpt:
    image: serenitygpt.azurecr.io/serenitygpt:latest
    env_file: .env
    ports:
      - "8080:8080"
    depends_on:
      - db

  db:
    image: pgvector/pgvector:pg16
    environment:
      POSTGRES_DB: ${DB_NAME}
      POSTGRES_USER: ${DB_USER}
      POSTGRES_PASSWORD: ${DB_PASSWORD}
    volumes:
      - pgdata:/var/lib/postgresql/data

volumes:
  pgdata:

Start the SerenityGPT services:

docker-compose up -d

4. Verify the deployment:

Check if the containers are running:

docker-compose ps

Access the SerenityGPT web interface at http://localhost:8080.

That completes the deployment process for a test instance!

Troubleshooting

If you encounter issues:

  1. Check container logs: docker-compose logs serenitygpt
  2. Verify environment variables: docker-compose exec serenitygpt env
  3. Ensure the database is accessible from the container

Troubleshooting the database connection

If you're having trouble connecting to the database, check that the DB_HOST in your .env file is set correctly.
For local deployments, you may need to use host.docker.internal instead of localhost.

For more detailed configuration options and best practices, refer to the Configuration Reference.

Conclusion

You should now have a working SerenityGPT instance that you can use to test and experiment with the features of SerenityGPT! To deploy a production instance, refer to the next section of this documentation.