Access denied when trying to login to Gogs for the first time


#1

Hello, I just pulled the drone.io image and did the basic configuration to allow it to connect to my self hosted Gogs, but I get an authentication error when trying to login after that.

I created a webhook on Gogs but I have no clue if I even should have done this.

Here is my docker-compose file with the settings from drone-server, drone-agent and Gogs:

  drone-server:
    image: drone/drone:0.8
    labels:
      - "traefik.backend=drone"
      - "traefik.port=8000"
      - "traefik.frontend.rule=Host:drone.mydomain.me"
    ports:
      - 8002:80
      - 8000:8000
      - 9001:9000
    volumes:
      - /var/lib/drone:/var/lib/drone/
    restart: always
    environment:
      - DRONE_OPEN=false
      - DRONE_HOST=http://drone.mydomain.me
      - DRONE_GOGS=true
      - DRONE_GOGS_URL=http://git.mydomain.me
      - DRONE_GOGS_PRIVATE_MODE=false
      - DRONE_GOGS_SKIP_VERIFY=true
      - DRONE_SECRET=SomeRandomString

  drone-agent:
    image: drone/agent:0.8
    ports:
      - 3001:3000
    command: agent
    restart: always
    depends_on:
      - drone-server
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - DRONE_SERVER=drone-server:9001
      - DRONE_SECRET=SomeRandomString
  gogs:
    image: gogs/gogs
    ports:
      - "3000:3000"
      - "10022:22"
    volumes:
      - "/var/gogs:/data"
    labels:
      - "traefik.docker.networks=default"
      - "traefik.port=3000"
      - "traefik.frontend.rule=Host:git.mydomain.me"

What should I do?

Thank you in advance


#2

It looks like you have disabled registration, but forgot to set the DRONE_ADMIN variable. See http://docs.drone.io/user-registration/#closed-registration


#3

Thank you, you were right, It all works now!


#4

This post was flagged by the community and is temporarily hidden.


#5

this is because it is missing the scheme in the url (http:// or https://)


#6

What environment variable should write?


#7

I believe DRONE_GOGS_SERVER, but it would be helpful if you would provide your configuration. It makes our job easier :slight_smile:


#8

This post was flagged by the community and is temporarily hidden.


#9

Apparently Drone does not correctly call the APi Gogs for authorization, since according to the description of the api in github there is no such call …

With this env also error

Login Failed. Get gogs. gogs. 192. 168. 5. 187. xip. io/api/v1/users/admin/tokens: unsupported protocol scheme “”

  - env:
    - name: DRONE_ALWAYS_AUTH
      value: "false"
    - name: DRONE_DATABASE_DATASOURCE
      value: /var/lib/drone/drone.sqlite
    - name: DRONE_DATABASE_DRIVER
      value: sqlite3
    - name: DRONE_GOGS_SERVER
      value: gogs. gogs. 192. 168. 5. 187. xip. io
    - name: DRONE_KUBERNETES_ENABLED
      value: "true"
    - name: DRONE_KUBERNETES_NAMESPACE
      value: default
    - name: DRONE_KUBERNETES_SERVICE_ACCOUNT
      value: drone-drone-pipeline
    - name: DRONE_LOGS_DEBUG
      value: "false"
    - name: DRONE_PRIVATE_MODE
      value: "false"
    - name: DRONE_SERVER_HOST
      value: drone. drone. 192. 168. 5. 187. xip. io
    - name: DRONE_SERVER_PROTO
      value: http
    - name: DRONE_TLS_AUTOCERT
      value: "false"
    - name: DRONE_RPC_SECRET
      valueFrom:
        secretKeyRef:
          key: secret
          name: drone-drone
          optional: false

#10

I am sorry :((((((

DRONE_GOGS_SERVER=http :// !!! and all work!!!