sshipway / Portus

Authorization service and frontend for Docker registry (v2)
http://port.us.org/
Apache License 2.0
18 stars 11 forks source link

rancher template is broken #14

Open airtonix opened 7 years ago

airtonix commented 7 years ago

docker-compose

db:
  environment:
    MYSQL_DATABASE: portus
    MYSQL_PASSWORD: password
    MYSQL_ROOT_PASSWORD: password
    MYSQL_USER: portus
  labels:
    registry.portus.db: '1'
  tty: true
  image: mysql:5.7.10
  volumes:
  - /srv/docker/services/docker-registry/db:/var/lib/mysql
  stdin_open: true
sslproxy:
  labels:
    io.rancher.scheduler.affinity:container_label_soft: registry.portus.db=1
  tty: true
  image: nginx:1.9.9
  links:
  - portus:portus
  volumes:
  - /srv/docker/services/docker-registry/certs:/etc/nginx/certs:ro
  - /srv/docker/services/docker-registry/proxy:/etc/nginx/conf.d:ro
  stdin_open: true
lb:
  ports:
  - 5000:5000/tcp
  - 443:443/tcp
  labels:
    io.rancher.scheduler.global: 'true'
    io.rancher.scheduler.affinity:not_host_label: registry.enabled=false
    io.rancher.loadbalancer.target.sslproxy: 443=443
    io.rancher.loadbalancer.target.registry: 5000=5000
  tty: true
  image: rancher/load-balancer-service
  links:
  - registry:registry
  - sslproxy:sslproxy
  stdin_open: true
registry:
  environment:
    REGISTRY_AUTH: token
    REGISTRY_AUTH_TOKEN_ISSUER: registry.thelma.lan
    REGISTRY_AUTH_TOKEN_REALM: https://registry.thelma.lan:443/v2/token
    REGISTRY_AUTH_TOKEN_ROOTCERTBUNDLE: /certs/registry.crt
    REGISTRY_AUTH_TOKEN_SERVICE: registry.thelma.lan:5000
    REGISTRY_HTTP_SECRET: httpsecret
    REGISTRY_HTTP_TLS_CERTIFICATE: /certs/registry.crt
    REGISTRY_HTTP_TLS_KEY: /certs/registry.key
    REGISTRY_LOG_LEVEL: warn
    REGISTRY_NOTIFICATIONS_ENDPOINTS: |
      - name: portus
        url: http://portus:3000/v2/webhooks/events
        timeout: 500
        threshold: 5
        backoff: 1
    REGISTRY_STORAGE_DELETE_ENABLED: 'true'
  tty: true
  image: registry:2.3.1
  links:
  - portus:portus
  volumes:
  - /srv/docker/services/docker-registry/certs:/certs
  - /srv/docker/services/docker-registry/data:/var/lib/registry
  stdin_open: true
portus:
  environment:
    PORTUS_CHECK_SSL_USAGE_ENABLED: 'true'
    PORTUS_GRAVATAR_ENABLED: 'true'
    PORTUS_KEY_PATH: /certs/registry.key
    PORTUS_LDAP_AUTHENTICATION_BIND_DN: ou=portus,dc=company,dc=com
    PORTUS_LDAP_AUTHENTICATION_ENABLED: 'false'
    PORTUS_LDAP_AUTHENTICATION_PASSWORD: password
    PORTUS_LDAP_BASE: ou=People,dc=company,dc=com
    PORTUS_LDAP_ENABLED: 'false'
    PORTUS_LDAP_GUESS_EMAIL_ATTR: mail
    PORTUS_LDAP_GUESS_EMAIL_ENABLED: 'true'
    PORTUS_LDAP_HOSTNAME: ldap.company.com
    PORTUS_LDAP_METHOD: starttls
    PORTUS_LDAP_PORT: '389'
    PORTUS_LDAP_UID: cn
    PORTUS_MACHINE_FQDN: registry.thelma.lan
    PORTUS_PASSWORD: password
    PORTUS_PORT: '443'
    PORTUS_PRODUCTION_DATABASE: portus
    PORTUS_PRODUCTION_HOST: db
    PORTUS_PRODUCTION_PASSWORD: password
    PORTUS_PRODUCTION_USERNAME: portus
    PORTUS_SECRET_KEY_BASE: password
    PORTUS_SMTP_ENABLED: 'false'
    REGISTRY_HOSTNAME: registry.thelma.lan
    REGISTRY_NAME: Registry
    REGISTRY_PORT: '5000'
    REGISTRY_SSL_ENABLED: 'true'
  labels:
    registry.portus.app: '1'
    io.rancher.container.pull_image: always
    io.rancher.scheduler.affinity:container_label_soft: registry.portus.db=1
  tty: true
  image: sshipway/portus:2.0.5
  links:
  - db:db
  volumes:
  - /srv/docker/services/docker-registry/certs:/certs
  - /srv/docker/services/docker-registry/proxy:/etc/nginx/conf.d
  stdin_open: true

rancher-compose

db:
  scale: 1
sslproxy:
  scale: 1
lb:
  load_balancer_config:
    haproxy_config: {}
  health_check:
    port: 42
    interval: 2000
    unhealthy_threshold: 3
    strategy: recreate
    response_timeout: 2000
    healthy_threshold: 2
registry:
  scale: 1
portus:
  scale: 1

Trying to initially access the web app 2016-12-29_08-00-38

portus logs

12/29/2016 7:52:16 AMrake aborted!
12/29/2016 7:52:16 AMMysql2::Error: Can't connect to MySQL server on 'db' (111)
12/29/2016 7:52:16 AM/portus/lib/tasks/portus.rake:4:in `block (2 levels) in <top (required)>'
12/29/2016 7:52:16 AMTasks: TOP => portus:create_api_account
12/29/2016 7:52:16 AM(See full trace by running task with --trace)
12/29/2016 7:52:16 AMCreating rancher password
12/29/2016 7:52:17 AMWARNING: Nokogiri was built against LibXML version 2.9.1, but has dynamically loaded 2.8.0
12/29/2016 7:52:18 AM[Mailer config] Host:     registry.thelma.lan
12/29/2016 7:52:18 AM[Mailer config] Protocol: https://
12/29/2016 7:52:18 AMfatal: Not a git repository (or any of the parent directories): .git
12/29/2016 7:52:18 AMError running migration! Please review database configuration
12/29/2016 7:52:18 AMYou have to provide a value for `password'
12/29/2016 7:52:18 AMChecking registry definition for registry.thelma.lan:5000
12/29/2016 7:52:19 AMWARNING: Nokogiri was built against LibXML version 2.9.1, but has dynamically loaded 2.8.0
12/29/2016 7:52:20 AM[Mailer config] Host:     registry.thelma.lan
12/29/2016 7:52:20 AM[Mailer config] Protocol: https://
12/29/2016 7:52:20 AMfatal: Not a git repository (or any of the parent directories): .git
12/29/2016 7:52:20 AMError running migration! Please review database configuration
12/29/2016 7:52:20 AMrake aborted!
12/29/2016 7:52:20 AMMysql2::Error: Can't connect to MySQL server on 'db' (111)
12/29/2016 7:52:20 AM/portus/lib/tasks/sshipway.rake:11:in `block (2 levels) in <top (required)>'
12/29/2016 7:52:20 AMTasks: TOP => sshipway:registry
12/29/2016 7:52:20 AM(See full trace by running task with --trace)
12/29/2016 7:52:20 AMStarting chrono
12/29/2016 7:52:20 AMStarting Portus
12/29/2016 7:52:20 AM[72] Puma starting in cluster mode...
12/29/2016 7:52:20 AM[72] * Version 2.14.0 (ruby 2.2.2-p95), codename: Fuchsia Friday
12/29/2016 7:52:20 AM[72] * Min threads: 0, max threads: 16
12/29/2016 7:52:20 AM[72] * Environment: development
12/29/2016 7:52:20 AM[72] * Process workers: 3
12/29/2016 7:52:20 AM[72] * Phased restart available
12/29/2016 7:52:20 AM[72] * Listening on tcp://0.0.0.0:3000
12/29/2016 7:52:20 AM[72] Use Ctrl-C to stop
12/29/2016 7:52:21 AMWARNING: Nokogiri was built against LibXML version 2.9.1, but has dynamically loaded 2.8.0
12/29/2016 7:52:21 AMWARNING: Nokogiri was built against LibXML version 2.9.1, but has dynamically loaded 2.8.0
12/29/2016 7:52:21 AMWARNING: Nokogiri was built against LibXML version 2.9.1, but has dynamically loaded 2.8.0
12/29/2016 7:52:21 AMWARNING: Nokogiri was built against LibXML version 2.9.1, but has dynamically loaded 2.8.0
12/29/2016 7:52:22 AM[Mailer config] Host:     registry.thelma.lan
12/29/2016 7:52:22 AM[Mailer config] Protocol: https://
12/29/2016 7:52:22 AMfatal: Not a git repository (or any of the parent directories): .git
12/29/2016 7:52:22 AM[Mailer config] Host:     registry.thelma.lan
12/29/2016 7:52:22 AM[Mailer config] Protocol: https://
12/29/2016 7:52:22 AM[Mailer config] Host:     registry.thelma.lan
12/29/2016 7:52:22 AM[Mailer config] Protocol: https://
12/29/2016 7:52:22 AM[Mailer config] Host:     registry.thelma.lan
12/29/2016 7:52:22 AM[Mailer config] Protocol: https://
12/29/2016 7:52:22 AMfatal: Not a git repository (or any of the parent directories): .git
12/29/2016 7:52:22 AMfatal: Not a git repository (or any of the parent directories): .git
12/29/2016 7:52:22 AMfatal: Not a git repository (or any of the parent directories): .git
12/29/2016 7:52:22 AMError running migration! Please review database configuration
12/29/2016 7:52:23 AM[72] - Worker 0 (pid: 76) booted, phase: 0
12/29/2016 7:52:23 AMError running migration! Please review database configuration
12/29/2016 7:52:23 AMError running migration! Please review database configuration
12/29/2016 7:52:23 AM[72] - Worker 2 (pid: 84) booted, phase: 0
12/29/2016 7:52:23 AMError running migration! Please review database configuration
12/29/2016 7:52:23 AMCan't connect to MySQL server on 'db' (111)
12/29/2016 7:52:23 AM/usr/local/bundle/gems/mysql2-0.3.18/lib/mysql2/client.rb:70:in `connect'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/mysql2-0.3.18/lib/mysql2/client.rb:70:in `initialize'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/connection_adapters/mysql2_adapter.rb:18:in `new'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/connection_adapters/mysql2_adapter.rb:18:in `mysql2_connection'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:438:in `new_connection'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:448:in `checkout_new_connection'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in `acquire_connection'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in `block in checkout'
12/29/2016 7:52:23 AM/usr/local/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in `checkout'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in `block in connection'
12/29/2016 7:52:23 AM/usr/local/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in `connection'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:567:in `retrieve_connection'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/connection_handling.rb:87:in `connection'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/attributes.rb:93:in `columns'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/attributes.rb:98:in `columns_hash'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/relation/query_methods.rb:970:in `block in create_binds'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/relation/query_methods.rb:967:in `each'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/relation/query_methods.rb:967:in `partition'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/relation/query_methods.rb:967:in `create_binds'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/relation/query_methods.rb:954:in `build_where'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/relation/query_methods.rb:584:in `where!'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/relation/query_methods.rb:574:in `where'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/relation/finder_methods.rb:84:in `find_by'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/relation.rb:213:in `find_or_create_by'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/querying.rb:6:in `find_or_create_by'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/crono-0.9.0/lib/crono/job.rb:102:in `model'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/crono-0.9.0/lib/crono/job.rb:49:in `load'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/crono-0.9.0/lib/crono/scheduler.rb:11:in `add_job'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/crono-0.9.0/lib/crono/performer_proxy.rb:11:in `every'
12/29/2016 7:52:23 AM/portus/config/cronotab.rb:2:in `<top (required)>'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `require'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `require'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:274:in `block in require'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:240:in `load_dependency'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/activesupport-4.2.2/lib/active_support/dependencies.rb:274:in `require'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/crono-0.9.0/lib/crono/cronotab.rb:7:in `process'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/crono-0.9.0/lib/crono/cli.rb:24:in `run'
12/29/2016 7:52:23 AM/usr/local/bundle/gems/crono-0.9.0/exe/crono:8:in `<top (required)>'
12/29/2016 7:52:23 AM/usr/local/bundle/bin/crono:16:in `load'
12/29/2016 7:52:23 AM/usr/local/bundle/bin/crono:16:in `<main>'
12/29/2016 7:52:23 AM[72] - Worker 1 (pid: 79) booted, phase: 0
cheGGo commented 7 years ago

It looks like the community-catalog compose files, isn't it? I've deployed a functional version with this compose files a few minutes ago.. It seems to be a rarely occuring timing problem raising the containers, especially the db-container.

In my case it works after deleting the stack and re-deploy.

For any other db error you should see an unhealthy status in rancher, the most db problems are shared storage related, for example when running on a nfs cluster without locks.