Sign inSign up

mjpulido/frict:latest-compose

Manifest digest

sha256:6a21a7dfe5f3718a7e059f6b0b6893bcc2e0c630ef8f9b1b81c6b13130f0740a

Last pushed

3 months by mjpulido

Type

Compose

Manifest digest

sha256:6a21a7dfe5f3718a7e059f6b0b6893bcc2e0c630ef8f9b1b81c6b13130f0740a

Compose file content

name: frict
x-app-env: &app-env
  SPRING_PROFILES_ACTIVE: local
  SERVER_SSL_ENABLED: "false"
  APP_COOKIE_SECURE: "false"
  MYSQL_HOST: mysql
  MYSQL_PORT: "3306"
  MYSQL_DATABASE: Frict
  MYSQL_USERNAME: user
  MYSQL_PASSWORD: password
  MONGODB_URI: "mongodb://user:password@mongodb:27017/Frict?authSource=admin&replicaSet=rs0"
  APP_STORAGE_ENDPOINT: http://minio:9000
  APP_STORAGE_PUBLIC_URL: http://localhost:9000/images
  APP_STORAGE_BUCKET_NAME: images
  AWS_ACCESS_KEY_ID: user
  AWS_SECRET_ACCESS_KEY: password
  CORS_ALLOWED_ORIGIN: http://localhost
  # Exclude mail from /actuator/health so an unreachable SMTP server does not
  # mark every instance DOWN in HAProxy (mail sending itself is unaffected).
  MANAGEMENT_HEALTH_MAIL_ENABLED: "false"
x-app-common: &app-common
  image: mjpulido/frict:latest
  restart: unless-stopped
  env_file:
    - path: .env
      required: false
  environment:
    !!merge <<: *app-env
  depends_on:
    mysql:
      condition: service_healthy
    minio:
      condition: service_healthy
    mongodb:
      condition: service_healthy
services:
  haproxy:
    image: haproxy:2.9
    container_name: frict-haproxy
    ports:
      - "80:80"
    configs:
      - source: haproxy_cfg
        target: /usr/local/etc/haproxy/haproxy.cfg
    depends_on:
      - app-1
      - app-2
      - app-3
  # app-1 is the single initializer: it creates the schema (ddl-auto=create-drop)
  # and loads the seed data (app.db.init=all from the local profile). app-2/app-3
  # wait until it is healthy, then start WITHOUT touching the schema or re-seeding,
  # avoiding the deadlocks / duplicate-key errors of 3 instances seeding one DB.
  app-1:
    !!merge <<: *app-common
    container_name: frict-app-1
    healthcheck:
      test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://localhost:8443/actuator/health"]
      interval: 10s
      timeout: 5s
      retries: 20
      start_period: 40s
  app-2:
    !!merge <<: *app-common
    container_name: frict-app-2
    environment:
      !!merge <<: *app-env
      SPRING_JPA_HIBERNATE_DDL_AUTO: none
      APP_DB_INIT: none
      APP_STORAGE_UPLOAD_DEFAULTS: "false"
    depends_on:
      app-1:
        condition: service_healthy
  app-3:
    !!merge <<: *app-common
    container_name: frict-app-3
    environment:
      !!merge <<: *app-env
      SPRING_JPA_HIBERNATE_DDL_AUTO: none
      APP_DB_INIT: none
      APP_STORAGE_UPLOAD_DEFAULTS: "false"
    depends_on:
      app-1:
        condition: service_healthy
  mysql:
    image: mysql:8.0
    container_name: frict-mysql
    restart: unless-stopped
    expose:
      - "3306"
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: Frict
      MYSQL_USER: user
      MYSQL_PASSWORD: password
    volumes:
      - mysql_data:/var/lib/mysql
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-proot"]
      interval: 10s
      timeout: 5s
      retries: 5
      start_period: 30s
  mongodb:
    image: mongo:latest
    container_name: frict-mongo
    restart: unless-stopped
    expose:
      - "27017"
    environment:
      - MONGO_INITDB_ROOT_USERNAME=user
      - MONGO_INITDB_ROOT_PASSWORD=password
    command: >
      sh -c "echo 'frictSuperSecretReplicaKey123456' > /data/keyfile && chmod 400 /data/keyfile && chown 999:999 /data/keyfile && exec /usr/local/bin/docker-entrypoint.sh mongod --replSet rs0 --keyFile /data/keyfile --bind_ip_all"

    volumes:
      - mongodb_data:/data/db
    healthcheck:
      test: >
        mongosh --username user --password password --authenticationDatabase admin --eval "try { rs.status() } catch (e) { rs.initiate({_id:'rs0',members:[{_id:0,host:'mongodb:27017'}]}) }" --quiet

      interval: 10s
      timeout: 5s
      retries: 5
      start_period: 30s
  minio:
    image: minio/minio:RELEASE.2025-09-07T16-13-09Z
    container_name: frict-minio
    restart: unless-stopped
    ports:
      - "9000:9000"
      - "9001:9001"
    environment:
      MINIO_ROOT_USER: "user"
      MINIO_ROOT_PASSWORD: "password"
    command: server /data --console-address ":9001"
    volumes:
      - minio_data:/data
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
      interval: 10s
      timeout: 5s
      retries: 5
volumes:
  mysql_data:
  mongodb_data:
  minio_data:
configs:
  haproxy_cfg:
    content: |
      global
          log stdout format raw local0

      defaults
          log     global
          mode    http
          option  httplog
          timeout connect 5s
          timeout client  60s
          timeout server  60s
          timeout tunnel  1h

      frontend http_front
          bind *:80
          default_backend app_servers

      backend app_servers
          balance roundrobin
          cookie SERVERID insert indirect nocache
          option httpchk GET /actuator/health
          http-check expect status 200

          server app-1 app-1:8443 check cookie app1
          server app-2 app-2:8443 check cookie app2
          server app-3 app-3:8443 check cookie app3

Docker commands

docker compose -f oci://mjpulido/frict:latest-compose up

Use the above command to pull and run the Compose file. Learn more.

Images used

Image + 1 more

MySQL is a widely used, open-source relational database management system (RDBMS).


Pulls

1B+

Stars

16185

Last Updated

4 days

Image + 1 more

MongoDB document databases provide high availability and easy scalability.


Pulls

1B+

Stars

10751

Last Updated

1 day

Image + 1 more

HAProxy - The Reliable, High Performance TCP/HTTP Load Balancer


Pulls

1B+

Stars

2021

Last Updated

12 days

Compose + 1 more


Pulls

3.5K

Stars

0

Last Updated

3 months