services:
  postgres:
    restart: always
    image: "postgres:16"
    ports:
      - "5432"
    environment:
      POSTGRES_DB: thingsboard
      POSTGRES_PASSWORD: postgres
    volumes:
      - postgres-data:/var/lib/postgresql/data
  thingsboard-ce:
    restart: always
    image: "thingsboard/tb-node:4.2.1"
    ports:
      - "8080:8080" # HTTP
      - "7070:7070" # Edge RPC
      - "1883:1883" # MQTT
      - "8883:8883" # MQTT SSL
      - "5683-5688:5683-5688/udp" # CoAP / LwM2M
    logging:
      driver: "json-file"
      options:
        max-size: "100m"
        max-file: "10"
    environment:
      TB_SERVICE_ID: tb-ce-node
      SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/thingsboard
    depends_on:
      - postgres

#  scripts:
#    build:
#      context: .
#      dockerfile: Dockerfile.scripts
#    depends_on:
#      - thingsboard-ce

volumes:
  postgres-data:
    name: tb-postgres-data
    driver: local

