SUSE / Portus

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

Failed to create bus connection | uninitialized constant Portus::DB::Mysql2 #1697

Closed soosap closed 6 years ago

soosap commented 6 years ago

Description

This is day 3 in which I try to run a portus deployment through Kubernetes and Helm. Since I am only familiar with postgresql I am trying to use that particular PORTUS_DB_ADAPTER. I am receiving a series of errors and I am not sure how to resolve them.

Steps to reproduce

  1. First I did this... Deploy portus through my helm chart (see attached the k8s workloads)
  2. Then that... $ kubectl get po $ kubectl logs registry-portus-d49564454-txtfz -c portus
  3. And this happened!
    • Failed to create bus connection: No such file or directory
    • uninitialized constant Portus::DB::Mysql2 Seems like PORTUS_DB_ADAPTER postgresql is being ignored. It still tries to connect w/ Mysql2 for some reason. Please help :)

### Deployment information

**Deployment method**:
Custom helm chart heavily inspired by `https://github.com/kubic-project/caasp-services/blob/master/contrib/helm-charts/portus/` with some customisation.

**Configuration**:
`portusctl bundle exec rake portus:info`
* portus:info
```yml
Failed to create bus connection: No such file or directory
[Mailer config] Host:     registry-portus
[Mailer config] Protocol: https://
Evaluated configuration:
---
email:
  from: portus@company.io
  name: Portus | C O M P A N Y
  reply_to: no-reply@company.io
  smtp:
    enabled: true
    address: smtp.zoho.eu
    port: 465
    user_name: username@example.com
    password: "****"
    domain: company.io
gravatar:
  enabled: true
delete:
  enabled: true
ldap:
  enabled: false
  hostname: ldap_hostname
  port: 389
  method: plain
  base: ''
  filter: ''
  uid: uid
  authentication:
    enabled: false
    bind_dn: ''
    password: "****"
  guess_email:
    enabled: false
    attr: ''
oauth:
  local_login:
    enabled: true
  google_oauth2:
    enabled: false
    id: ''
    secret: ''
    domain: ''
    options:
      hd: ''
  open_id:
    enabled: false
    identifier: ''
    domain: ''
  github:
    enabled: false
    client_id: ''
    client_secret: ''
    organization: ''
    team: ''
    domain: ''
  gitlab:
    enabled: false
    application_id: ''
    secret: ''
    group: ''
    domain: ''
    server: ''
  bitbucket:
    enabled: false
    key: ''
    secret: ''
    domain: ''
    options:
      team: ''
first_user_admin:
  enabled: true
signup:
  enabled: false
check_ssl_usage:
  enabled: true
registry:
  jwt_expiration_time:
    value: 5
  catalog_page:
    value: 100
  timeout:
    value: 2
  read_timeout:
    value: 120
machine_fqdn:
  value: registry-portus
display_name:
  enabled: false
user_permission:
  change_visibility:
    enabled: true
  create_team:
    enabled: true
  manage_team:
    enabled: true
  create_namespace:
    enabled: true
  manage_namespace:
    enabled: true
security:
  clair:
    server: ''
    health_port: 6061
  zypper:
    server: ''
  dummy:
    server: ''
anonymous_browsing:
  enabled: false

Portus version: 2.4.0-dev@46ae80aeed17075974988de5a88a75fd9d4ebb53

COMPUTED VALUES: nginx: config: provided: true global: {} image: pullPolicy: IfNotPresent repository: nginx tag: 1.13.8-alpine replicaCount: 1 service: externalPort: 80 internalPort: 80 type: ClusterIP portus: background: enabled: true resources: requests: cpu: 300m memory: 512Mi config: anonymous_browsing: enabled: false check_ssl_usage: enabled: true delete: enabled: true display_name: enabled: false email: from: portus@company.io name: Portus | C O M P A N Y reply_to: no-reply@company.io smtp: address: smtp.zoho.eu domain: company.io enabled: true port: 465 username: portus@company.io first_user_admin: enabled: true gravatar: enabled: true machine_fqdn: value: registry.company.io signup: enabled: false environment: PORTUS_DB_DATABASE: portus PORTUS_DB_PASSWORD: s3cr3t PORTUS_DB_PORT: 5432 PORTUS_DB_USERNAME: portus PORTUS_EMAIL_SMTP_PASSWORD: s3cr3t global: {} image: pullPolicy: Always repository: portus tag: head ingress: domains:

HOOKS: MANIFEST:


Source: registry/charts/portus/templates/configmap.yaml

apiVersion: v1 kind: ConfigMap metadata: name: registry-portus-config namespace: default data: config-local.yml: | anonymous_browsing: enabled: false check_ssl_usage: enabled: true delete: enabled: true display_name: enabled: false email: from: portus@company.io name: Portus | C O M P A N Y reply_to: no-reply@company.io smtp: address: smtp.zoho.eu domain: company.io enabled: true port: 465 username: portus@company.io first_user_admin: enabled: true gravatar: enabled: true machine_fqdn: value: registry.company.io signup: enabled: false

Source: registry/charts/registry/templates/configmap.yaml

apiVersion: v1 kind: ConfigMap metadata: name: registry-registry-config namespace: default data: config.yml: | health: storagedriver: enabled: false http: addr: :5000 debug: addr: :5001 headers: Access-Control-Allow-Headers:



**Portus version**: 2.4.0-dev@46ae80aeed17075974988de5a88a75fd9d4ebb53
soosap commented 6 years ago

Hi there, I resolved this problem. I accidentally used the wrong database username. Because it failed to connect to postgres, I obtained this error: uninitialized constant Portus::DB::Mysql2. It is a bit misleading but my postgres container revealed that someone tried to login with an non-existent user. That's how I spot the mistake. I feel it, I am almost there to see my repos in the portus ui:) Unfortunately, I went from one to another error 🤕 but I will create a separate issue for that.