services:
  cloudserver:
    image: ${CLOUDSERVER_IMAGE}
    network_mode: "host"
    volumes:
      - /tmp/ssl:/ssl
      - /tmp/ssl-kmip:/tmp/ssl-kmip
      - ${HOME}/.aws/credentials:/root/.aws/credentials
      - /tmp/artifacts/${JOB_NAME}:/artifacts
      - /tmp/coverage/${JOB_NAME}:/coverage/test
      - /logs:/logs
    environment:
      - CI=true
      - ENABLE_LOCAL_CACHE=true
      - REDIS_HOST=0.0.0.0
      - REDIS_PORT=6379
      - REPORT_TOKEN=report-token-1
      - REMOTE_MANAGEMENT_DISABLE=1
      - HEALTHCHECKS_ALLOWFROM=0.0.0.0/0
      - DATA_HOST=0.0.0.0
      - METADATA_HOST=0.0.0.0
      - S3BACKEND
      - S3DATA
      - S3METADATA
      - MPU_TESTING
      - S3VAULT
      - S3_LOCATION_FILE
      - ENABLE_UTAPI_V2
      - BUCKET_DENY_FILTER
      - S3KMS
      - S3KMIP_PORT
      - S3KMIP_HOSTS
      - S3KMIP_COMPOUND_CREATE
      - S3KMIP_BUCKET_ATTRIBUTE_NAME
      - S3KMIP_PIPELINE_DEPTH
      - S3KMIP_KEY
      - S3KMIP_CERT
      - S3KMIP_CA
      - MONGODB_HOSTS=0.0.0.0:27018
      - MONGODB_RS=rs0
      - DEFAULT_BUCKET_KEY_FORMAT
      - METADATA_MAX_CACHED_BUCKETS
      - ENABLE_NULL_VERSION_COMPAT_MODE
      - SCUBA_HOST
      - SCUBA_PORT
      - SCUBA_HEALTHCHECK_FREQUENCY
      - S3QUOTA
      - QUOTA_ENABLE_INFLIGHTS
      - S3_VERSION_ID_ENCODING_TYPE
      - S3_SERVER_ACCESS_LOGS_MODE=ENABLED
      - S3_ENABLE_SERVER_ACCESS_LOGS=true
      - RATE_LIMIT_SERVICE_USER_ARN=arn:aws:iam::123456789013:root
      - RATE_LIMIT_NODES=6
    env_file:
      - creds.env
    depends_on:
      - redis
    extra_hosts:
      - "bucketwebsitetester.s3-website-us-east-1.amazonaws.com:127.0.0.1"
      - "pykmip.local:127.0.0.1"
  redis:
    image: redis:alpine
    network_mode: "host"
  squid:
    network_mode: "host"
    profiles: ['ci-proxy']
    image: scality/ci-squid
    command: >-
      sh -c 'mkdir -p /ssl &&
            openssl req -new -newkey rsa:2048 -sha256 -days 365 -nodes -x509 \
              -subj "/C=US/ST=Country/L=City/O=Organization/CN=CN=scality-proxy" \
              -keyout /ssl/myca.pem  -out /ssl/myca.pem &&
            cp /ssl/myca.pem /ssl/CA.pem &&
            squid -f /etc/squid/squid.conf -N -z &&
            squid -f /etc/squid/squid.conf -NYCd 1'
    volumes:
      - /tmp/ssl:/ssl
  pykmip:
    network_mode: "host"
    profiles: ['pykmip']
    image: ${PYKMIP_IMAGE:-ghcr.io/scality/cloudserver/pykmip}
    volumes:
      - /tmp/artifacts/${JOB_NAME}:/artifacts
      # Allow override certs or config without rebuild
      - ../pykmip/certs:/ssl
      - ../pykmip/policy.json:/etc/pykmip/policies/policy.json
      - ../pykmip/server.conf:/etc/pykmip/server.conf
  localkms:
    network_mode: "host"
    profiles: ['localkms']
    image: ${KMS_IMAGE:-nsmithuk/local-kms:3.11.7}
  mongo:
    network_mode: "host"
    profiles: ['mongo', 'ceph']
    image: ${MONGODB_IMAGE}
  ceph:
    network_mode: "host"
    profiles: ['ceph']
    image: ghcr.io/scality/cloudserver/ci-ceph
  sproxyd:
    network_mode: "host"
    profiles: ['sproxyd']
    image: sproxyd-standalone
    build: ./sproxyd
    user: 0:0
    privileged: yes # for setxattr on local filesystem
    volumes:
      - /tmp/artifacts/${JOB_NAME}/sproxyd:/logs
  vault:
    image: ghcr.io/scality/vault:7.76.0
    profiles: ['vault']
    user: root
    command: sh -c "chmod 400 tests/utils/keyfile && yarn start > /artifacts/vault.log 2> /artifacts/vault-stderr.log"
    network_mode: "host"
    volumes:
      - /tmp/artifacts/${JOB_NAME}:/artifacts
      - ./vault-config.json:/conf/config.json:ro
      - ./vault-db:/data
    environment:
      - VAULT_DB_BACKEND=LEVELDB
      - CI=true
      - ENABLE_LOCAL_CACHE=true
      - REDIS_HOST=0.0.0.0
      - REDIS_PORT=6379
    depends_on:
      - redis
  metadata-standalone:
    image: ghcr.io/scality/metadata:8.11.0-standalone
    profiles: ['metadata-standalone']
    network_mode: 'host'
    volumes:
      - ./md-config.json:/mnt/standalone_workdir/config.json:ro
      - /tmp/artifacts/${JOB_NAME}/md:/mnt/standalone_workdir/log
