Drone

[Resolved] Source code management is not configured error

Hi, I trying to use Drone in my machine… but get some errors.

In the server when run docker logs drone1 output this:

{"level":"fatal","msg":"main: source code management system not configured","time":"2020-01-03T22:57:26Z"}

My configuration:

DRONE_AGENTS_ENABLED=true
DRONE_GITHUB_SERVER=https://github.com
DRONE_GITHUB_CLIENT_ID=<secret>
DRONE_GITHUB_CLIENT_SECRET=<secret>
DRONE_RPC_SECRET=<secret>
DRONE_SERVER_HOST=drone.domain.com
DRONE_SERVER_PROTO=http
DRONE_RPC_PROTO=http
DRONE_RPC_HOST=drone.domain.com
DRONE_RUNNER_NAME=drone-testing 

Thanks

the only way to receive this error is when the DRONE_GITHUB_CLIENT_SECRET is not properly passed to the Docker container. It is unclear how you are passing these environment variables to the server or whether or not the values were correctly passed (which a docker inspect will help you confirm).

I create a .env file in my project. I run docker inspect drone1 and the output are:

[
    {
        "Id": "3ee61ed20636fc0719affe7a0801f5abfe0d8e6f877ca84dec9d74f3938d6c1e",
        "Created": "2020-01-03T22:31:27.608836842Z",
        "Path": "/bin/drone-server",
        "Args": [],
        "State": {
            "Status": "restarting",
            "Running": true,
            "Paused": false,
            "Restarting": true,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 0,
            "ExitCode": 1,
            "Error": "",
            "StartedAt": "2020-01-04T05:13:32.613393724Z",
            "FinishedAt": "2020-01-04T05:13:32.680867079Z"
        },
        "Image": "sha256:33e222a2826687f20448a3a7509c291c6212f2f8e22e4bd8c645f5b192747491",
        "ResolvConfPath": "/var/lib/docker/containers/3ee61ed20636fc0719affe7a0801f5abfe0d8e6f877ca84dec9d74f3938d6c1e/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/3ee61ed20636fc0719affe7a0801f5abfe0d8e6f877ca84dec9d74f3938d6c1e/hostname",
        "HostsPath": "/var/lib/docker/containers/3ee61ed20636fc0719affe7a0801f5abfe0d8e6f877ca84dec9d74f3938d6c1e/hosts",
        "LogPath": "/var/lib/docker/containers/3ee61ed20636fc0719affe7a0801f5abfe0d8e6f877ca84dec9d74f3938d6c1e/3ee61ed20636fc0719affe7a0801f5abfe0d8e6f877ca84dec9d74f3938d6c1e-json.log",
        "Name": "/drone1",
        "RestartCount": 408,
        "Driver": "overlay2",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": [
                "/var/lib/drone:/data"
            ],
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "default",
            "PortBindings": {
                "443/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "443"
                    }
                ],
                "80/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "80"
                    }
                ]
            },
            "RestartPolicy": {
                "Name": "always",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "CapAdd": null,
            "CapDrop": null,
            "Capabilities": null,
            "Dns": [],
            "DnsOptions": [],
            "DnsSearch": [],
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "private",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 67108864,
            "Runtime": "runc",
            "ConsoleSize": [
                0,
                0
            ],
            "Isolation": "",
            "CpuShares": 0,
            "Memory": 0,
            "NanoCpus": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": [],
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": [],
            "DeviceCgroupRules": null,
            "DeviceRequests": null,
            "KernelMemory": 0,
            "KernelMemoryTCP": 0,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": null,
            "OomKillDisable": false,
            "PidsLimit": null,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0,
            "MaskedPaths": [
                "/proc/asound",
                "/proc/acpi",
                "/proc/kcore",
                "/proc/keys",
                "/proc/latency_stats",
                "/proc/timer_list",
                "/proc/timer_stats",
                "/proc/sched_debug",
                "/proc/scsi",
                "/sys/firmware"
            ],
            "ReadonlyPaths": [
                "/proc/bus",
                "/proc/fs",
                "/proc/irq",
                "/proc/sys",
                "/proc/sysrq-trigger"
            ]
        },
        "GraphDriver": {
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/03ca0704ef5a871133c1ed9fdf2da7d1e6e342fd8b953fded8688776fd2d6462-init/diff:/var/lib/docker/overlay2/809b3642355ed9350db55ccc592a95f79690699d5ae7113312514523764ab26d/diff:/var/lib/docker/overlay2/66ac81678980d77faa711f439bfea02519ab613ca8c7b063806f79013684f855/diff:/var/lib/docker/overlay2/45760bbf6c2f8d966b9b0001dca3b4f8ad8128c8ba633822a3090472650c5ab0/diff:/var/lib/docker/overlay2/f0b073ae77ea612b069cfd77cf3aac828f0492abab20b2ec3f9ee3a9edd931d4/diff",
                "MergedDir": "/var/lib/docker/overlay2/03ca0704ef5a871133c1ed9fdf2da7d1e6e342fd8b953fded8688776fd2d6462/merged",
                "UpperDir": "/var/lib/docker/overlay2/03ca0704ef5a871133c1ed9fdf2da7d1e6e342fd8b953fded8688776fd2d6462/diff",
                "WorkDir": "/var/lib/docker/overlay2/03ca0704ef5a871133c1ed9fdf2da7d1e6e342fd8b953fded8688776fd2d6462/work"
            },
            "Name": "overlay2"
        },
        "Mounts": [
            {
                "Type": "bind",
                "Source": "/var/lib/drone",
                "Destination": "/data",
                "Mode": "",
                "RW": true,
                "Propagation": "rprivate"
            }
        ],
        "Config": {
            "Hostname": "3ee61ed20636",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "443/tcp": {},
                "80/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "DRONE_SERVER_PROTO=",
                "DRONE_AGENTS_ENABLED=true",
                "DRONE_GITHUB_SERVER=https://github.com",
                "DRONE_GITHUB_CLIENT_ID=",
                "DRONE_GITHUB_CLIENT_SECRET=",
                "DRONE_RPC_SECRET=",
                "DRONE_SERVER_HOST=",
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "GODEBUG=netdns=go",
                "XDG_CACHE_HOME=/data",
                "DRONE_DATABASE_DRIVER=sqlite3",
                "DRONE_DATABASE_DATASOURCE=/data/database.sqlite",
                "DRONE_RUNNER_OS=linux",
                "DRONE_RUNNER_ARCH=amd64",
                "DRONE_SERVER_PORT=:80",
                "DRONE_DATADOG_ENABLED=true",
                "DRONE_DATADOG_ENDPOINT=https://stats.drone.ci/api/v1/series"
            ],
            "Cmd": null,
            "Image": "drone/drone:1",
            "Volumes": {
                "/data": {}
            },
            "WorkingDir": "",
            "Entrypoint": [
                "/bin/drone-server"
            ],
            "OnBuild": null,
            "Labels": {
                "org.label-schema.build-date": "2019-12-30T02:20:31Z",
                "org.label-schema.schema-version": "1.0",
                "org.label-schema.vcs-ref": "c42273084f62309ef3cdce35a985e7f404335558",
                "org.label-schema.vcs-url": "https://github.com/drone/drone.git"
            }
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "017805bde5659979d65afe34b17561b3d1430d06328cbd1c19a6e0268764c730",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {},
            "SandboxKey": "/var/run/docker/netns/017805bde565",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "",
            "Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "",
            "IPPrefixLen": 0,
            "IPv6Gateway": "",
            "MacAddress": "",
            "Networks": {
                "bridge": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "67a4405880cc47f7c79369259924fe261e1a096d8c28ec38519fb2297e803b26",
                    "EndpointID": "",
                    "Gateway": "",
                    "IPAddress": "",
                    "IPPrefixLen": 0,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "",
                    "DriverOpts": null
                }
            }
        }
    }
]

And my docker run command is:

docker run \ 
  --volume=/var/lib/drone:/data \               
  --env=DRONE_AGENTS_ENABLED=true \      
  --env=DRONE_GITHUB_SERVER=https://github.com \
  --env=DRONE_GITHUB_CLIENT_ID=${DRONE_GITHUB_CLIENT_ID} \
  --env=DRONE_GITHUB_CLIENT_SECRET=${DRONE_GITHUB_CLIENT_SECRET} \
  --env=DRONE_RPC_SECRET=${DRONE_RPC_SECRET} \
  --env=DRONE_SERVER_HOST=${DRONE_SERVER_HOST} \
  --env=DRONE_SERVER_PROTO=${DRONE_SERVER_PROTO} \
  --publish=80:80 \
  --publish=443:443 \        
  --restart=always \     
  --detach=true \
  --name=drone1 \
  drone/drone:1

Regards,

as you can see from docker inspect the environment variables are empty:

                "DRONE_SERVER_PROTO=",
                "DRONE_AGENTS_ENABLED=true",
                "DRONE_GITHUB_SERVER=https://github.com",
                "DRONE_GITHUB_CLIENT_ID=",
                "DRONE_GITHUB_CLIENT_SECRET=",

I can say with certainty that this is a configuration issue that can be resolved by correctly passing the environment variable values to the server.

Nice! Now the server is running nicely!

Thank very much @ashwilliams1 for the help!