Drone

Mysql service does not start in .drone.yml

Environment

drone version

  • drone/drone:1.3.1
  • drone/agent:1.3.1

Problem

Mysql service does not start in .drone.yml.

services:
  database:
    image: mysql:5.7
    commands:
      - mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_bin
    environment:
      - MYSQL_DATABASE=xxxx
      - MYSQL_ROOT_PASSWORD=xxxx

It was running when the drone version was 0.8.
When drone version was upgraded to 1.3.1, the following error was output.
Please tell me what is the problem.

+ mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_bin
2 2019-10-03T11:55:11.195251Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
3 2019-10-03T11:55:11.195322Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
4 2019-10-03T11:55:11.360035Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
5 2019-10-03T11:55:11.361780Z 0 [Note] mysqld (mysqld 5.7.27) starting as process 12 ...
6 2019-10-03T11:55:11.363223Z 0 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
7
8 2019-10-03T11:55:11.363250Z 0 [ERROR] Aborting
9
10 2019-10-03T11:55:11.363271Z 0 [Note] Binlog end
11 2019-10-03T11:55:11.363315Z 0 [Note] mysqld: Shutdown complete

Where are you running this on?
We’re running on drone 1.3.1 host with drone 1.2.1 agent (i just noticed).
With the following:

services:
- name: database
  pull: default
  image: mysql:5.7
  environment:
    MYSQL_DATABASE: service
    MYSQL_PASSWORD: service
    MYSQL_ROOT_PASSWORD: service
    MYSQL_USER: service

that works.

Are you running the agents on dedicated machines or are you using k8s integration perhaps?
In case of k8s i could imagine that certain secuirty permissions are in place which prohibit starting processes inside containers with root privileges (afaik this kind of stuff exits).

Maybe the overriding of the startup commandis removing essential startup logic, that’s possible too

The drone agent is running on a dedicated host.
Probably I think it has failed in the following character set.
What is the problem?

commands:
  - mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_bin

see these examples of how to configure mysql with custom options in 1.0
https://docker-runner.docs.drone.io/examples/service/mysql
https://docker-runner.docs.drone.io/examples/service/mysql/#database-options