MySQL is started on a custom hostname, database
, so you need to connect to database:3306
.
Last active
August 23, 2017 14:40
-
-
Save krisleech/dc9e68626b739240732e66aabad9be20 to your computer and use it in GitHub Desktop.
Drone 0.7 MySQL
pipeline:
build:
image: our_company/ruby:2.4.0
commands:
- apt-get install realpath -y
- wget -t 3 -nv https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh
- chmod +x ./wait-for-it.sh
- ./wait-for-it.sh 127.0.0.1:3306 -t 0
- bundle install
- rake db:create db:schema:load
- rspec
services:
database:
image: mysql:5.7
detach: true
environment:
- MYSQL_ROOT_PASSWORD=root
Without detach: true
the build stage never starts, with it the build stage starts but port 3306 is never open, wait-for-it.sh
waits 'forever'. Without wait-for-it.sh
I get a mySQL connection error.
I've also tried MYSQL_{USER, PASSWORD}
and SQL_ALLOW_EMPTY_PASSWORD
.
I tried adding:
ports:
- 3306:3306
I tried localhost
versus 127.0.0.1
.
database stage
Initializing database
Certificates initialized
MySQL init process in progress...
[Note] mysqld: Shutdown complete
MySQL init process done. Ready for start up.
[Note] mysqld: ready for connections.
Version: '5.7.19' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
[Note] Executing 'SELECT * FROM INFORMATION_SCHEMA.TABLES;' to get a list of tables using the deprecated partition engine. You may use the startup option '--disable-partition-engine-check' to skip this check.
[Note] Beginning of list of non-natively partitioned tables
[Note] End of list of non-natively partitioned tables
There is no exit code after this. The stage is shown in the UI with a yellow spinner.
build stage
wait-for-it.sh: waiting for 127.0.0.1:3306 without a timeout
Here it waits 'forever', so it seems port 3306 is never opened.
For reference this is the database connection information, which should not matter until MySQL is not running on port 3006.
test:
adapter: mysql2
encoding: utf8
pool: 5
username: root
password: root
database: drone_test
host: 127.0.0.1
# socket: /var/run/mysqld/mysqld.sock
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment