Drone server with autoscaler doesn't work on AWS Elastic Beanstack

Hi everyone.

I’m trying to run Drone.io on AWS Elastic Beanstack on the platform “Docker” and platform branch “ECS running on 64bit Amazon Linux 2”.

Before doing it, I run locally drone and runner to check that I don’t miss any configuration param.

Then I started to create the configuration files for drone server and drone runner.

Drone server (env drone-server):

{
  "AWSEBDockerrunVersion": 2,
  "volumes": [
    {
     "name": "root",
     "host": {
        "sourcePath": "/"
      }
    },
    {
     "name": "run",
     "host": {
        "sourcePath": "/var/run/"
     }
    },
    {
     "name": "sys",
     "host": {
        "sourcePath": "/sys/"
      }
    },
    {
     "name": "docker",
     "host": {
        "sourcePath": "/var/lib/docker/"
      }
    },
    {
     "name": "cgroup",
     "host": {
        "sourcePath": "/cgroup/"
      }
    },
    {
     "name": "dockersock",
     "host": {
        "sourcePath": "/var/run/docker.sock"
      }
    },
    {
     "name": "varlibdrone",
     "host": {
        "sourcePath": "/var/lib/drone"
      }
    },
    {
     "name": "varlibautoscaler",
     "host": {
        "sourcePath": "/var/lib/autoscaler"
      }
    }
  ],
  "containerDefinitions": [
    {
      "name": "drone-server-env",
      "image": "drone/drone:2.13.0",
      "essential": true,
      "memory": 2500,
      "mountPoints": [
        {
          "sourceVolume": "varlibdrone",
          "containerPath": "/var/lib/drone"
        }
      ],
      "environment": [
        {
          "name": "DRONE_GITLAB_SERVER",
          "value": "https://gitlab.com"
        },
        {
          "name": "DRONE_OPEN",
          "value": "true"
        },
        {
          "name": "DRONE_SERVER_HOST",
          "value": "drone.mydomain.com"
        },
                {
          "name": "DRONE_SERVER_PROTO",
          "value": "https"
        },
        {
          "name": "DRONE_GITLAB",
          "value": "true"
        },
        {
          "name": "DRONE_GITLAB_CLIENT_ID",
          "value": "APPLICATION_ID_FROM_GITLAB"
        },
        {
          "name": "DRONE_GITLAB_CLIENT_SECRET",
          "value": "APPLICATION_SECRET_FROM_GITLAB"
        },
        {
          "name": "DRONE_RPC_SECRET",
          "value": "some-strong-secret"
        },
        {
          "name": "DRONE_GITLAB_PRIVATE_MODE",
          "value": "true"
        },
        {
          "name": "DRONE_ADMIN",
          "value": "user"
        },
        {
          "name": "DRONE_DATABASE_DRIVER",
          "value": "postgres"
        },
        {
          "name": "DRONE_DATABASE_DATASOURCE",
          "value": "postgres://root:PSWD@postgres-droneio.1234567.eu-west-1.rds.amazonaws.com:5432/dronedb?sslmode=disable"
        },
        {
          "name": "DRONE_TLS_AUTOCERT",
          "value": "false"
        },
        {
          "name": "DRONE_LOGS_DEBUG",
          "value": "true"
        }
      ],
      "portMappings": [
        {
          "hostPort": 80,
          "containerPort": 80
        }
      ]
    },
    {
      "name": "drone-autoscaler",
      "image": "drone/autoscaler:1.8.2",
      "essential": true,
      "memory": 1000,
      "mountPoints": [
        {
          "sourceVolume": "varlibautoscaler",
          "containerPath": "/data"
        }
      ],
      "environment": [
        {
          "name": "DRONE_POOL_MIN",
          "value": "1"
        },
        {
          "name": "DRONE_POOL_MAX",
          "value": "2"
        },
        {
          "name": "DRONE_SERVER_PROTO",
          "value": "https"
        },
        {
          "name": "DRONE_SERVER_HOST",
          "value": "drone.mydomain.com"
        },
        {
          "name": "DRONE_SERVER_TOKEN",
          "value": "GITLAB_USER_ACCESS_TOKEN"
        },
        {
          "name": "DRONE_AGENT_TOKEN",
          "value": "some-strong-secret"
        },
        {
          "name": "DRONE_AMAZON_REGION",
          "value": "eu-west-1"
        },
        {
          "name": "DRONE_AMAZON_SUBNET_ID",
          "value": "subnet-1234567"
        },
        {
          "name": "DRONE_AMAZON_SECURITY_GROUP",
          "value": "sg-aaaa234"
        },
        {
          "name": "DRONE_AMAZON_SSHKEY",
          "value": "drone"
        },
        {
          "name": "DRONE_AMAZON_INSTANCE",
          "value": "c5.large"
        },
        {
          "name": "AWS_IAM",
          "value": "true"
        }
      ],
      "portMappings": [
        {
          "hostPort": 8080,
          "containerPort": 8080
        }
      ]
    }
  ]
}

Drone runner (env drone-agent):

{
  "AWSEBDockerrunVersion": 2,
  "volumes": [
    {
     "name": "root",
     "host": {
        "sourcePath": "/"
      }
    },
    {
     "name": "run",
     "host": {
        "sourcePath": "/var/run/"
     }
    },
    {
     "name": "sys",
     "host": {
        "sourcePath": "/sys/"
      }
    },
    {
     "name": "docker",
     "host": {
        "sourcePath": "/var/lib/docker/"
      }
    },
    {
     "name": "cgroup",
     "host": {
        "sourcePath": "/cgroup/"
      }
    },
    {
     "name": "dockersock",
     "host": {
        "sourcePath": "/var/run/docker.sock"
      }
    }
  ],
  "containerDefinitions": [
    {
      "name": "drone-agent",
      "image": "drone/drone-runner-docker:1.8.2",
      "essential": true,
      "memory": 2000,
      "mountPoints": [
        {
          "sourceVolume": "dockersock",
          "containerPath": "/var/run/docker.sock"
        }
      ],
      "environment": [
        {
          "name": "DRONE_RPC_PROTO",
          "value": "https"
        },
        {
          "name": "DRONE_RPC_HOST",
          "value": "drone.mydomain.com"
        },
        {
          "name": "DRONE_RPC_SECRET",
          "value": "some-strong-secret"
        },
        {
          "name": "DRONE_RUNNER_CAPACITY",
          "value": "2"
        },
        {
          "name": "DRONE_HEALTHCHECK",
          "value": "true"
        },
        {
          "name": "DRONE_RUNNER_NAME",
          "value": "runner"
        }
      ],
      "portMappings": [
        {
          "hostPort": 80,
          "containerPort": 3000
        }
      ]
    }
  ]
}

In the logs I see only one error:
{“error”:“Get "https://drone.mydomain.com/api/queue\”: dial tcp 11.11.213.345:443: i/o timeout",“id”:“1uue8VwWTEYV3tCV”,“level”:“error”,“msg”:“cannot calculate unfinished jobs”,“time”:“2022-10-06T09:01:29Z”}

It doesn’t work.

Do you have any ideas what I’m doing wrong?

Thanks

i/o timeout is an error from the Go http library that indicates a DNS timeout when attempting to reach drone.mydomain.com. Do you need to replace drone.mydomain.com with your actual Drone domain name? Or is there a DNS issue in your environment?

Hi Brad.
Thanks for your help.

Actually, this url is not available because drone-server container doesn’t provide any service between host and container. The configuration worked before with the version Drone 0.8 (with small changes in the env params). But now in a new version it doesn’t work.

This is the reason I ask the question and share my configuration. Maybe you can pay attention to what I missed.

Thanks