docker-compose.yml 5.6 KB
Newer Older
David's avatar
David committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
version: '3'

services:
  portus:
    image: opensuse/portus:head
    restart: unless-stopped
    dns:
      - 10.10.220.231
    environment:
      - CCONFIG_PREFIX=PORTUS
      - PORTUS_MACHINE_FQDN_VALUE=${MACHINE_FQDN}
      - PORTUS_SECURITY_CLAIR_SERVER=http://clair:6060

      # DB. The password for the database should definitely not be here. You are
      # probably better off with Docker Swarm secrets.
      - PORTUS_DB_ADAPTER=postgresql
      - PORTUS_DB_HOST=sarafan.dark.kow.is
      - PORTUS_DB_DATABASE=portus
      - PORTUS_DB_USERNAME=portus
      - PORTUS_DB_PASSWORD=${DATABASE_PASSWORD}
      - PORTUS_DB_POOL=5

      # Secrets. It can possibly be handled better with Swarm's secrets.
      - PORTUS_SECRET_KEY_BASE=${SECRET_KEY_BASE}
      - PORTUS_KEY_PATH=/certificates/registry.dark.kow.is.key
      - PORTUS_PASSWORD=${PORTUS_PASSWORD}

      # SSL
      - PORTUS_PUMA_TLS_KEY=/certificates/registry.dark.kow.is.key
      - PORTUS_PUMA_TLS_CERT=/certificates/registry.dark.kow.is.crt

      # LDAP
      - PORTUS_LDAP_ENABLED=true
      - PORTUS_LDAP_HOSTNAME=ldap.dark.kow.is
      - PORTUS_LDAP_PORT=389
      - PORTUS_LDAP_UID=uid
      - PORTUS_LDAP_BASE=ou=Users,dc=dark,dc=kow,dc=is
      - PORTUS_LDAP_GROUP_BASE=
      - PORTUS_LDAP_FILTER=(memberOf=cn=dockerRegistry,ou=Access,dc=dark,dc=kow,dc=is)
      - PORTUS_LDAP_AUTHENTICATION_ENABLED=true
      - PORTUS_LDAP_AUTHENTICATION_BIND_DN=cn=portus,ou=Applications,dc=dark,dc=kow,dc=is
      - PORTUS_LDAP_AUTHENTICATION_PASSWORD=${LDAP_PASSWORD}
      - PORTUS_LDAP_GUESS_EMAIL_ATTR=mail
      - PORTUS_LDAP_ENCRYPTION_METHOD=start_tls
      - PORTUS_LDAP_ENCRYPTION_OPTIONS_CA_FILE=/certificates/dark.kow.is.crt
      - PORTUS_LDAP_ENCRYPTION_OPTIONS_SSL_VERSION=TLSv1_2

      # NGinx is serving the assets instead of Puma. If you want to change this,
      # uncomment this line.
      #- RAILS_SERVE_STATIC_FILES='true'
    ports:
      - 3000:3000
    networks: 
      - registry_net
    volumes:
      - ./secrets:/certificates:ro
      - static:/srv/Portus/public

  background:
    image: opensuse/portus:head
    restart: unless-stopped
    depends_on:
      - portus
    dns:
      - 10.10.220.231
    environment:
      # Theoretically not needed, but cconfig's been buggy on this...
      - CCONFIG_PREFIX=PORTUS
      - PORTUS_MACHINE_FQDN_VALUE=${MACHINE_FQDN}
      - PORTUS_SECURITY_CLAIR_SERVER=http://clair:6060

      # DB. The password for the database should definitely not be here. You are
      # probably better off with Docker Swarm secrets.
      - PORTUS_DB_ADAPTER=postgresql
      - PORTUS_DB_HOST=sarafan.dark.kow.is
      - PORTUS_DB_DATABASE=portus
      - PORTUS_DB_USERNAME=portus
      - PORTUS_DB_PASSWORD=${DATABASE_PASSWORD}
      - PORTUS_DB_POOL=5

      # Secrets. It can possibly be handled better with Swarm's secrets.
      - PORTUS_SECRET_KEY_BASE=${SECRET_KEY_BASE}
      - PORTUS_KEY_PATH=/certificates/registry.dark.kow.is.key
      - PORTUS_PASSWORD=${PORTUS_PASSWORD}

      # LDAP
      - PORTUS_LDAP_ENABLED=true
      - PORTUS_LDAP_HOSTNAME=ldap.dark.kow.is
      - PORTUS_LDAP_PORT=389
      - PORTUS_LDAP_UID=uid
      - PORTUS_LDAP_BASE=ou=Users,dc=dark,dc=kow,dc=is
      - PORTUS_LDAP_GROUP_BASE=
      - PORTUS_LDAP_FILTER=(memberOf=cn=dockerRegistry,ou=Access,dc=dark,dc=kow,dc=is)
      - PORTUS_LDAP_AUTHENTICATION_ENABLED=true
      - PORTUS_LDAP_AUTHENTICATION_BIND_DN=cn=portus,ou=Applications,dc=dark,dc=kow,dc=is
      - PORTUS_LDAP_AUTHENTICATION_PASSWORD=${LDAP_PASSWORD}
      - PORTUS_LDAP_GUESS_EMAIL_ATTR=mail
      - PORTUS_LDAP_ENCRYPTION_METHOD=start_tls
      - PORTUS_LDAP_ENCRYPTION_OPTIONS_CA_FILE=/certificates/dark.kow.is.crt
      - PORTUS_LDAP_ENCRYPTION_OPTIONS_SSL_VERSION=TLSv1_2

      - PORTUS_BACKGROUND=true
    networks: 
      - registry_net
    volumes:
      - ./secrets:/certificates:ro

  registry:
    image: library/registry:2.6
    command: ["/bin/sh", "/etc/docker/registry/init"]
    restart: unless-stopped
    dns:
      - 10.10.220.231
    environment:
      # Authentication
      REGISTRY_AUTH_TOKEN_REALM: https://${MACHINE_FQDN}/v2/token
      REGISTRY_AUTH_TOKEN_SERVICE: ${MACHINE_FQDN}
      REGISTRY_AUTH_TOKEN_ISSUER: ${MACHINE_FQDN}
      #REGISTRY_AUTH_TOKEN_ROOTCERTBUNDLE: /secrets/registry.dark.kow.is.crt
      REGISTRY_AUTH_TOKEN_ROOTCERTBUNDLE: /secrets/bundle.crt

      # SSL
      REGISTRY_HTTP_TLS_CERTIFICATE: /secrets/registry.dark.kow.is.crt
      REGISTRY_HTTP_TLS_KEY: /secrets/registry.dark.kow.is.key

      # Portus endpoint
      REGISTRY_NOTIFICATIONS_ENDPOINTS: >
        - name: portus
          url: https://${MACHINE_FQDN}/v2/webhooks/events
          timeout: 2000ms
          threshold: 5
          backoff: 1s
    volumes:
      - /var/lib/portus/registry:/var/lib/registry
      - ./secrets:/secrets:ro
      - ./registry/config.yml:/etc/docker/registry/config.yml:ro
      - ./registry/init:/etc/docker/registry/init:ro
    ports:
      - 5000:5000
      - 5001:5001 # required to access debug service
    networks:
      - registry_net

  nginx:
    image: library/nginx:alpine
    restart: unless-stopped
    dns:
      - 10.10.220.231
    volumes:
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
      - ./secrets:/secrets:ro
      - static:/srv/Portus/public:ro
    ports:
      - 80:80
      - 443:443
    networks:
      - registry_net

  clair:
    image: quay.io/coreos/clair:v2.0.8
    restart: unless-stopped
    dns:
      - 10.10.220.231
    networks:
      - registry_net
    ports:
      - "6060-6061:6060-6061"
    volumes:
      - /tmp:/tmp
      - ./clair/clair.yml:/clair.yml
    command: [-config, /clair.yml]

volumes:
  static:
    driver: local

networks:
  registry_net: