Mathesar

An intuitive UI for managing data collaboratively, for users of all technical skill levels. Built on Postgres – connect an existing DB or set up a new one.

Directory Structure

    • .env
    • docker-compose.yml

docker-compose.yml

version: "3.9"
 
service:
    container_name: mathesar_service
    image: mathesar/mathesar-prod:latest
    environment: 
      # First we load the variables configured above.
      <<: *config
 
      DJANGO_SETTINGS_MODULE: config.settings.production
 
      # We set ALLOWED_HOSTS to * (allow all hosts) by default here since we are
      # relying on caddy to manage which domains could access the mathesar web
      # service.  If you do not want to use caddy add the domain(s) that you
      # want to ALLOWED_HOSTS. Doing so will restrict traffic from all other
      # domains.
      ALLOWED_HOSTS: ${ALLOWED_HOSTS:-*}
 
      # WARNING: MATHESAR_DATABASES is deprecated, and will be removed in a future release.
      MATHESAR_DATABASES: ${MATHESAR_DATABASES:-}
    volumes:
      - ./msar/static:/code/static
      - ./msar/media:/code/media
    depends_on:
      db:
        condition: service_healthy
    healthcheck:
      test: curl -f http://localhost:8000
      interval: 10s
      timeout: 5s
      retries: 30
      start_period: 5s
    # If using caddy, expose the internal port 8000 only to other containers and
    # not the docker host.
    expose:
      - "8000"
    # Uncomment the following if not using caddy
    ports:
      - ${HOST_PORT:-8000}:8000
 
  #-----------------------------------------------------------------------------
  # PostgreSQL Database
  #
  # This service provides a Postgres database instance for holding both internal
  # Mathesar data, as well as user data if desired, using the official
  # PostgreSQL image hosted on Docker Hub
  #
  # As configured, this service exposes Postgres' default port (5432) to other
  # services, allowing the Mathesar web sevice to connect to it.
  #
  db:
    image: postgres:13
    container_name: mathesar_db
    # This service needs the config variables defined above.
    environment: *config
    # Expose the internal port 5432 only to other containers and not 
    # the underlying host.
    expose:
      - "5432"
    volumes:
      - ./msar/pgdata:/var/lib/postgresql/data
    healthcheck:
      test: [ "CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
      interval: 5s
      timeout: 1s
      retries: 30
      start_period: 5s

Resources

Website: https://mathesar.org/

GitHub: https://github.com/mathesar-foundation/mathesar

Docker Hub: https://hub.docker.com/r/mathesar/mathesar-prod

Configuration: https://docs.mathesar.org/installation/docker-compose/