> For the complete documentation index, see [llms.txt](https://til.kurianbenoy.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://til.kurianbenoy.com/databases/postgres-database-dockercompose.md).

# Postgres Database Dockercompose

{% embed url="<https://www.youtube.com/watch?v=XeLg525z-eE>" %}

```
#Author: Kurian Benoy
version: '3.7'

services:
  forms-flow-data-analysis-db:
    image: "postgres:13"
    environment:
      POSTGRES_USER: ${DATA_ANALYSIS_DB_USER}
      POSTGRES_PASSWORD: ${DATA_ANALYSIS_DB_PASSWORD}
      POSTGRES_DB: ${DATA_ANALYSIS_DB_NAME}
      POSTGRES_HOST_AUTH_METHOD: "trust"
    volumes:
      - db-data:/var/lib/postgresql/data
    networks:
      - forms-flow-data-analysis-api-network
    ports:
      - '5430:5432'

  forms-flow-data-analysis-api:
    build:
      context: ./
      dockerfile: Dockerfile
    restart: unless-stopped
    links:
      - forms-flow-data-analysis-db
    ports:
      - '5000:5000'
    volumes:
      - ./:/app:rw
    environment:
      DATABASE_URL: ${DATA_ANALYSIS_DB_URL}
      JWT_OIDC_WELL_KNOWN_CONFIG: ${KEYCLOAK_URL}/auth/realms/${KEYCLOAK_URL_REALM:-forms-flow-ai}/.well-known/openid-configuration
      JWT_OIDC_ALGORITHMS: 'RS256'
      JWT_OIDC_JWKS_URI: ${KEYCLOAK_URL}/auth/realms/${KEYCLOAK_URL_REALM:-forms-flow-ai}/protocol/openid-connect/certs
      JWT_OIDC_ISSUER: ${KEYCLOAK_URL}/auth/realms/${KEYCLOAK_URL_REALM:-forms-flow-ai}
      JWT_OIDC_AUDIENCE: ${KEYCLOAK_WEB_CLIENT_ID:-forms-flow-web}
      JWT_OIDC_CACHING_ENABLED: 'True'
      JWT_OIDC_JWKS_CACHE_TIMEOUT: 300
      DATA_ANALYSIS_API_BASE_URL: ${DATA_ANALYSIS_API_BASE_URL}
    stdin_open: true # -i
    tty: true # -t
    networks:
      - forms-flow-data-analysis-api-network

networks:
  forms-flow-data-analysis-api-network:
    driver: 'bridge'

volumes:
  db-data:

```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://til.kurianbenoy.com/databases/postgres-database-dockercompose.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
