version: '3.6'

services:
  rest:
    image: postgrest/postgrest:v9.0.0
    depends_on:
      - db
    restart: always
    ports:
      - 3000:3000/tcp
    environment:
      PGRST_DB_URI: postgres://postgres:postgres@db:5432/postgres
      PGRST_DB_SCHEMA: public
      PGRST_DB_ANON_ROLE: postgres
      PGRST_JWT_SECRET: super-secret-jwt-token-with-at-least-32-characters-long
      PGRST_LOG_LEVEL: info
      PGRST_DB_SCHEMAS: public, cargo
  db:
    build:
      context: ./postgres
    deploy:
      resources:
        limits:
          cpus: '2'
          memory: 2G
        reservations:
          cpus: '1'
          memory: 1G
    ports:
      - 5432:5432
    environment:
      POSTGRES_DB: postgres
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_PORT: 5432
