openfrontier / docker-gerrit

Build a Docker image with the Gerrit code review system
Apache License 2.0
197 stars 116 forks source link

local mysql #55

Open xinglongjian opened 7 years ago

xinglongjian commented 7 years ago

May I use local mysql in the docker-gerrit? What variables need to set?

issues occured: ➜ ~ docker run --name gerrit -e GERRIT_START_ACTION=supervise -v ~/gerrit_volume:/var/gerrit/review_site -p 8080:8080 -p 29418:29418 -e DATABASE_TYPE=mysql -e DB_ENV_MYSQL_USER=gerrit2 -e DB_ENV_MYSQL_PASSWORD=secret -e DB_ENV_MYSQL_DB=reviewdb -e USER_NAME=xxx openfrontier/gerrit:2.12.3

/gerrit-entrypoint.sh: ignoring /docker-entrypoint-init.d/*

Upgrading gerrit... fatal: DbInjector failed fatal: Unable to determine SqlDialect fatal: caused by com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure fatal: fatal: The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. fatal: caused by java.net.ConnectException: Connection refused

thinkernel commented 7 years ago

Hi @xinglongjian You should let the gerrit know where your mysql server is by providing 2 environment variables below. -e DB_PORT_3306_TCP_ADDR=your mysql host IP addrss -e DB_PORT_3306_TCP_PORT=your mysql port

xinglongjian commented 7 years ago

I set those 2 environment variables and the result is same!

~docker run --name gerrit -e GERRIT_START_ACTION=supervise -v ~/gerrit_volume:/var/gerrit/review_site -p 8080:8080 -p 29418:29418 -e DATABASE_TYPE=mysql -e MYSQL_USER=gerrit2 -e MYSQL_PASSWORD=secret -e MYSQL_DB=reviewdbb -e DB_PORT_3306_TCP_ADDR=localhost -e DB_PORT_3306_TCP_PORT=3306 -e USER_NAME=xinglongjian openfrontier/gerrit:2.12.3

/gerrit-entrypoint.sh: ignoring /docker-entrypoint-init.d/*

Upgrading gerrit... fatal: DbInjector failed fatal: Unable to determine SqlDialect fatal: caused by com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure fatal: fatal: The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. fatal: caused by java.net.ConnectException: Connection refused

qinshulei commented 7 years ago

You need wait mysql container ready.