Drone

DRONE_UISER_CREATE not working

Hi,

I’ve built drone from source (as we’re self hosting and qualify for the enterprise features) and wrapped it into a docker image , which is then used in a docker compose file (see end of question for these)

I run the server via (omitting other variables - which all work fine):

DRONE_USER_CREATE=username:mattcopas,admin:true docker-compose up --force-recreate -V

I’ve taken the DRONE_USER_CREATE part from the documentaton here

The server starts fine, and I can go to 127.0.0.1:8080, and am logged in successfully as mattcopas. However, I don’t have admin rights, and when I go into the mysql database, I can see the user_admin for mattcopas is false.

Am I doing something wrong? Is the documentation out of date?

Thanks for your help

Docker image:

FROM golang:1.11.13
# See https://github.com/drone/drone/blob/master/BUILDING for general build instructions
# and https://discourse.drone.io/t/licensing-and-subscription-faq/3839 for the required tag
# to enable enterprise mode

# Enable Go Modules
ENV GO111MODULE=on

RUN git clone https://github.com/drone/drone
WORKDIR ./drone
RUN go install github.com/drone/drone/cmd/drone-agent
RUN go install github.com/drone/drone/cmd/drone-controller
RUN go install -tags nolimit github.com/drone/drone/cmd/drone-server

EXPOSE 8080

ENTRYPOINT drone-server

Docker compose file:

version: '2'
services:
  drone-server:
    image: drone-test-2
    ports:
    - 8080:8080
    restart: always
    environment:
    - DRONE_AGENTS_ENABLED: 'true'
    - DRONE_GITHUB_SERVER=https://github.com
    - DRONE_SERVER_HOST=${DRONE_SERVER_HOST}
    - DRONE_SERVER_PROTO=${DRONE_SERVER_PROTO}
    - DRONE_GITHUB_CLIENT_ID=${DRONE_GITHUB_CLIENT_ID}
    - DRONE_GITHUB_CLIENT_SECRET=${DRONE_GITHUB_CLIENT_SECRET}
    - DRONE_RPC_SECRET=${DRONE_RPC_SECRET}
    - DRONE_DATABASE_DRIVER=mysql
    - DRONE_DATABASE_DATASOURCE=root:${MYSQL_PASSWORD}@tcp(mysql:3306)/drone?parseTime=true
  drone-agent:
    image: drone/agent:1
    ports:
    - 3000:3000
    restart: always
    volumes:
    - /var/run/docker.sock:/var/run/docker.sock
    environment:
    - DRONE_RPC_PROTO=${DRONE_RPC_PROTO}
    - DRONE_RPC_HOST=${DRONE_SERVER_HOST}
    - DRONE_RPC_SECRET=${DRONE_RPC_SECRET}

  mysql:
    image: mysql
    ports:
    - 3306:3306
    environment:
    - MYSQL_ROOT_PASSWORD=${MYSQL_PASSWORD}
    - MYSQL_DATABASE=drone
    volumes:
    - mysql:/var/lib/mysql
volumes:
  mysql:

The documentation is correct and there are no known issues with this particular variable. You can enable debug and trace logging to get more details. Also since you are building from source you might consider taking a look at the relevant code here.