Ao seguir as instruções do vídeo e setar a variável DB_HOST com o valor 'mysql' o pipeline quebrou apresentando o erro "Unknown MySQL server host 'mysql' (-2)". Segue meu arquivo gilab-ci.yml
image: docker:stable
stages:
- pre-build
- build
- test
- deploy
build-docker:
services:
- docker:dind
before_script:
- docker info
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD
stage: pre-build
script:
- docker build -t minha-imagem .
- docker tag minha-imagem anderson021285/minha-imagem:latest
- docker push anderson021285/minha-imagem:latest
build-project:
image: anderson021285/minha-imagem:latest
services:
- docker:dind
- mysql:5.7
variables:
MYSQL_USER: devops_dev
MYSQL_PASSWORD: mestre
MYSQL_DATABASE: todo_dev
MSQL_ROOT_PASSWORD: senha
DB_NAME: 'todo_dev'
DB_USER: 'devops_dev'
DB_PASSWORD: 'mestre'
DB_PORT: '3306'
DB_HOST: 'mysql'
SECRET_KEY: 'r*5ltfzw-61ksdm41fuul8+hxs$86yo9%k1%k=(!@=-wv4qtyv'
stage: build
tags:
- executor-tarefas
dependencies:
- build-docker
script:
- python manage.py makemigrations
- python manage.py migrate
A syout de erro no gitlab é muito grande para colocar aqui, tem como enviar por outro canal ? Acredito que seja algo relacionado a permissão entre os containers, mas não consegui resolver.
Segue parte do log que mostra que devo inserir mais informações para iniciar o banco
*** WARNING: Service runner-8x25xs87-project-21195393-concurrent-0-5397c0b5e9fccd4b-mysql-1 probably didn't start properly.
Health check error:
service "runner-8x25xs87-project-21195393-concurrent-0-5397c0b5e9fccd4b-mysql-1-wait-for-service" timeout
Health check container logs:
Service container logs:
2020-09-22T23:49:09.548512681Z 2020-09-22 23:49:09+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.31-1debian10 started.
2020-09-22T23:49:10.250485047Z 2020-09-22 23:49:10+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2020-09-22T23:49:10.305393888Z 2020-09-22 23:49:10+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.31-1debian10 started.
2020-09-22T23:49:10.913031643Z 2020-09-22 23:49:10+00:00 [ERROR] [Entrypoint]: Database is uninitialized and password option is not specified
2020-09-22T23:49:10.913108520Z You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD