openfrontier / docker-gerrit

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

Gerrit container stopped and invoked an unknown error. #113

Open Abhishekqwerty opened 5 years ago

Abhishekqwerty commented 5 years ago

Hi when I ran docker run as follows: docker run --name new_gerrit -p 8084:8080 -e WEBURL=http://:8084 -e DATABASE_TYPE=mysql -e DATABASE_HOSTNAME=172.x.x.x -e DATABASE_PORT=3306 -e DATABASE_DATABASE=ReviewDb -e DATABASE_USERNAME=gerrit -e DATABASE_PASSWORD=gerrit -e AUTH_TYPE=DEVELOPMENT_BECOME_ANY_ACCOUNT -e GERRIT_INIT_ARGS='--install-plugin=download-commands' -v /home/cloud_user/gerrit_vol:/var/gerrit/review_site -d openfrontier/gerrit

Container fails to start in few seconds. Following is the error log of docker container:

ls: /var/gerrit/review_site/git: No such file or directory First time initialize gerrit... [2019-03-18 09:41:30,817] [main] INFO com.google.gerrit.server.config.GerritServerConfigProvider : No /var/gerrit/review_site/etc/gerrit.config; assuming defaults Generating SSH host key ... rsa... ed25519... ecdsa 256... ecdsa 384... ecdsa 521... done Initialized /var/gerrit/review_site Reindexing projects: 100% (2/2) Reindexed 2 documents in projects index in 0.2s (11.5/s) /gerrit-entrypoint.sh: ignoring /docker-entrypoint-init.d/* Waiting for database connection 172.17.0.2:3306 ... Upgrading gerrit... Downloading https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.43/mysql-connector-java-5.1.43.jar ... OK Checksum mysql-connector-java-5.1.43.jar OK Exception in thread "main" java.lang.IllegalArgumentException: One of setGitDir or setWorkTree must be called. at org.eclipse.jgit.lib.BaseRepositoryBuilder.requireGitDirOrWorkTree(BaseRepositoryBuilder.java:623) at org.eclipse.jgit.lib.BaseRepositoryBuilder.setup(BaseRepositoryBuilder.java:587) at org.eclipse.jgit.internal.storage.file.FileRepository.(FileRepository.java:153) at com.google.gerrit.pgm.init.api.GitRepositoryManagerOnInit.openRepository(GitRepositoryManagerOnInit.java:46) at com.google.gerrit.server.notedb.RepoSequence.acquire(RepoSequence.java:269) at com.google.gerrit.server.notedb.RepoSequence.next(RepoSequence.java:197) at com.google.gerrit.pgm.init.api.SequencesOnInit.nextAccountId(SequencesOnInit.java:49) at com.google.gerrit.pgm.init.InitAdminUser.postRun(InitAdminUser.java:113) at com.google.gerrit.pgm.init.SitePathInitializer.postRun(SitePathInitializer.java:151) at com.google.gerrit.pgm.init.BaseInit.run(BaseInit.java:146) at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:61) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

thinkernel commented 5 years ago

Hi @Abhishekqwerty. Thanks for trying this docker image. About your issue, my guess is on the volume. Would you please remove "-v /home/cloud_user/gerrit_vol:/var/gerrit/review_site" from your command and try it again?

Abhishekqwerty commented 5 years ago

Thanks for your reply but then how to achieve persistent volume to store data on server. This problem is not only docker but also when installing gerrit on server without using docker. I removed "-v /home/cloud_user/gerrit_vol:/var/gerrit/review_site" from docker run command but still facing same issue.

thinkernel commented 5 years ago
docker volume create gerrit_volume
docker run -v gerrit_volume:/var/gerrit/review_site ...

I'm changing the README about how to use named volume instead of host directory. However if this issue is not only in docker but also on server installation, it might be a bug of the Gerrit. In that case you should report it to the gerrit project.

Abhishekqwerty commented 5 years ago

Thanks for your response. I was having issues for new versions of gerrit like from 2.15.x But I tried openfrontier/gerrit:2.14.18 and it is working fine and also gerrit version 2.14.9 is working on normal server.

thinkernel commented 5 years ago

Frankly speaking, I don't see any strange parameters in your command lines except AUTH_TYPE=DEVELOPMENT_BECOME_ANY_ACCOUNT. I always use AUTH_TYPE=LDAP in my envrionments. Both 2.14.x and 2.15.x are working fine in my daily work. I might give it a try on your command line and get back to you later.