version: '3.4'

services:
  broadcast_channel:
    image: postgres:alpine
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
  opal_server:
    image: permitio/opal-server:latest
    environment:
      - OPAL_BROADCAST_URI=postgres://postgres:postgres@broadcast_channel:5432/postgres
      - UVICORN_NUM_WORKERS=4
      - OPAL_POLICY_REPO_URL=https://github.com/sumeshes07/opal-example-policy-repo-new
      - OPAL_POLICY_REPO_WEBHOOK_SECRET=ETS4QrXGOFnYvHNdZtTQR9MexOpLWRqq
      - OPAL_AUTH_MASTER_TOKEN=N5isOv7iEkmJXDmZrzbI5mySQEXkkpCJ
      - OPAL_AUTH_PRIVATE_KEY=-----BEGIN RSA PRIVATE KEY-----_MIIJKgIBAAKCAgEAzU4iyU0bPGOevfVcFHayGgjelMwna7NbbkaojX45UVZ2ihcX_dHqsn73silCp4Y2eWg8D0/85736K3Dl1c3S7O1M7RZ5WTQwNVqpVCCC0sjmIFo68_41o+4RiMINCyrxhOb+5Ucy103ZaydBa8Hwe5C7jpqaUI9x9k6RO/b2oszc5HtFhA_eJzSHnMkC/36hj3Jbz41r2AMkn6uF+0pKZAKTwx3zNvumo1/lJ4A38M4pcJAbEmF_M57eOVkRISeY3eHbivjr8vp3HhbElRPU1ZUdESp/gLUG9sfO8WzjTFEClA+fZVC4_y11CJZAQuztg/ez1PgemgQzb00TxDnBJ2zepN2TB3yeOFIp+opvJgbQPJObNn6dD_CHZk6PsAvyE9nq74z1j5BoY9CV/7L9D8H73wTfKFHYyQjpaGdRyPKhE/Xbad1xWN_z9FLDACI9frGCMDLBVYKH4UajTOyLs3mY46ZbELqn34VKNy2iMv60XFkeDZ2fg5e_eV6HhmTquQTfpxDkq8719jCt2l2qDA6XG81KquLzhQXiPDzxyImw7RVeHcoIbk0J_P/DX03paMUj1MLwBgtrzY9FH6Dt7hRjh/bTunOBoLzMaQCr+eJIbPE9W7eCnKInT_YZUNcvk3Al951RBoONaHfc2Dw86NlaZR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41od9zYPDzo2VplF6bM3PI2VpQP46fkzKqpVqwq9D7w== alegeus\sumesh.s@BLR-9YSN6S3
     
      - OPAL_DATA_CONFIG_SOURCES={"config":{"entries":[{"url":"http://opal_server:7002/policy-data","config":{"headers":{"Authorization":"Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2NjkxOTM3NDcsImV4cCI6MTcwMDcyOTc0NywiYXVkIjoiaHR0cHM6Ly9hcGkub3BhbC5hYy92MS8iLCJpc3MiOiJodHRwczovL29wYWwuYWMvIiwic3ViIjoiNDk3ZjZlY2E2Mjc2NDk5M2JmZWI1M2NiYmJiYTZmMDgiLCJwZWVyX3R5cGUiOiJjbGllbnQifQ.IxfTGRLDJdA0W_Nr2tckjZ_GH4c7_6g36X3nBpV0AjPH3TVKF0nNwSDszshvRZMGj42CEmExifisT-SogzcMLE23jJnMzk1sH9psPDec_O_tFfNlSzzTDFFhu7VAFzUNUModXyqeBsk1H860j0IJFNjrm3Q2H5IxrCLKQTIJCpQkfU2xeL9xn6IBZ4tP4CvY-p2V_tH3hS-yBflQhwMThLLEV32M7oJ6aBS_BqNlXnxWIVvXa8cc8GYDPz229VZxqf5Sl72ohs2FC1jF3ZPIeRn3-oMvmbCohH-4vEwzbT5h_bTR2lKZ_QmJAX8EWk2aprqWyq8e-w1Kh37xkGGQkaI1kK9I2o3LYYJMQfB--jGso9DIySasmyB3QHfodXenAUza2m9in8A69Lyjb9Eo5tthbvRB0IIxo1pnXtz4gtqvFJjemmK1uYD9we4tdJjkl8HBtoMSssKJmgvlVncSQ8Mcfw-4Bp-iUd5ruG2YVO9Oh506T6Mz2GyczScpAxLu49Ku6FPS4aQmPqLC5psgqqOODGUIeyUe26dKSK6EWuam3qtIjhhTvc7EJTNRNtU75qsIMLX9UVfcIikkvlV2dj83tAaod3H9798yIkzKIu899fBn1FqLLh1ecvu51lHj2K8opXu_Q9d45cc6OoP__qkmf8Ioy87ktIjDbXlAgIU"}},"topics":["policy_data"]]}}
      - OPAL_LOG_FORMAT_INCLUDE_PID=true
    ports:
      # exposes opal server on the host machine, you can access the server at: http://localhost:7002
      - "7002:7002"
    depends_on:
      - broadcast_channel
  opal_client:
    # by default we run opal-client from latest official image
    image: permitio/opal-client:latest
    environment:
      - OPAL_SERVER_URL=http://opal_server:7002
      - OPAL_LOG_FORMAT_INCLUDE_PID=true
      - OPAL_INLINE_OPA_LOG_FORMAT=http
      - OPAL_CLIENT_TOKEN=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2NjkxOTM3NDcsImV4cCI6MTcwMDcyOTc0NywiYXVkIjoiaHR0cHM6Ly9hcGkub3BhbC5hYy92MS8iLCJpc3MiOiJodHRwczovL29wYWwuYWMvIiwic3ViIjoiNDk3ZjZlY2E2Mjc2NDk5M2JmZWI1M2NiYmJiYTZmMDgiLCJwZWVyX3R5cGUiOiJjbGllbnQifQ.IxfTGRLDJdA0W_Nr2tckjZ_GH4c7_6g36X3nBpV0AjPH3TVKF0nNwSDszshvRZMGj42CEmExifisT-SogzcMLE23jJnMzk1sH9psPDec_O_tFfNlSzzTDFFhu7VAFzUNUModXyqeBsk1H860j0IJFNjrm3Q2H5IxrCLKQTIJCpQkfU2xeL9xn6IBZ4tP4CvY-p2V_tH3hS-yBflQhwMThLLEV32M7oJ6aBS_BqNlXnxWIVvXa8cc8GYDPz229VZxqf5Sl72ohs2FC1jF3ZPIeRn3-oMvmbCohH-4vEwzbT5h_bTR2lKZ_QmJAX8EWk2aprqWyq8e-w1Kh37xkGGQkaI1kK9I2o3LYYJMQfB--jGso9DIySasmyB3QHfodXenAUza2m9in8A69Lyjb9Eo5tthbvRB0IIxo1pnXtz4gtqvFJjemmK1uYD9we4tdJjkl8HBtoMSssKJmgvlVncSQ8Mcfw-4Bp-iUd5ruG2YVO9Oh506T6Mz2GyczScpAxLu49Ku6FPS4aQmPqLC5psgqqOODGUIeyUe26dKSK6EWuam3qtIjhhTvc7EJTNRNtU75qsIMLX9UVfcIikkvlV2dj83tAaod3H9798yIkzKIu899fBn1FqLLh1ecvu51lHj2K8opXu_Q9d45cc6OoP__qkmf8Ioy87ktIjDbXlAgIU
      
    ports:
      - "7000:7000"
      - "8181:8181"
    depends_on:
      - opal_server
    command: sh -c "./wait-for.sh opal_server:7002 --timeout=20 -- ./start.sh"
