Coder Social home page Coder Social logo

gerrit-docker's Introduction

gerrit-ci docker

This docker image is an extension of the Gerrit docker.

Usage

This project is utilized by the ci-compose project to demonstrate how to start a gerrit-jenkins-nexus environment in seconds. This project can also be utilized as a demo about how to extend the Gerrit docker by adding a nohup script to accomplish some setup works while the Gerrit service is starting up.

Todo

Fix createGerrit.sh, destroyGerrit.sh and upgradeGerrit.sh in order to make it works with the ci project.

gerrit-docker's People

Contributors

mc-slava avatar objectkuan avatar thinkernel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gerrit-docker's Issues

Waiting postgres ready.

Dear expert,

I'm trying to run ~/ci/run.sh to install gerrit on my server, and found that it stucked in "Waiting postgres ready." Please see below messages, I have configured the ~/ci/config to my server IP.

Can you please share some suggestions?

root@csgle:~# ~/ci/run.sh
09aba648abf5edd81c60d5120f2882c5dc35bdfae998e6f31cfd555cf6035cba
ab84d22869224659f7ede25f27f46b40a19c657857fa05b6e98825a97c0b3bc4
openldap-etc-volume
openldap-repo-volume
e172cacddb1e5194e514fe729c500ad68f67acb4cc642871c3fe865a59735eea
Waiting openldap ready.
Waiting openldap ready.
Waiting openldap ready.
Waiting openldap ready.
adding new entry "ou=gerrit,dc=example,dc=com"

adding new entry "ou=accounts,dc=example,dc=com"

adding new entry "cn=group,ou=accounts,dc=example,dc=com"

adding new entry "uid=admin,ou=accounts,dc=example,dc=com"

8795ce7ca6bb3320728c2197d37d58f1935e58b0cadca818821688a2123b93ab
pg-gerrit-volume
e0b1a7b1fbf80687b1390bdbb11600913dff00ce539c7eec0fdef1152ba652e3
Waiting postgres ready.
Waiting postgres ready.

After reviewing the logs of pg-gerrit container, I get the below logs.

PostgreSQL init process complete; ready for start up.

2020-04-18 02:54:00.667 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
2020-04-18 02:54:00.667 UTC [1] LOG: listening on IPv6 address "::", port 5432
2020-04-18 02:54:00.990 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2020-04-18 02:54:01.294 UTC [66] LOG: database system was shut down at 2020-04-18 02:54:00 UTC
2020-04-18 02:54:01.428 UTC [1] LOG: database system is ready to accept connections
2020-04-18 02:56:22.709 UTC [75] LOG: invalid length of startup packet
2020-04-18 02:56:22.712 UTC [76] LOG: invalid length of startup packet
2020-04-18 02:56:22.716 UTC [77] LOG: invalid length of startup packet
2020-04-18 02:56:23.269 UTC [78] LOG: invalid length of startup packet
2020-04-18 02:56:25.080 UTC [79] LOG: invalid length of startup packet
2020-04-18 02:56:25.082 UTC [80] LOG: invalid length of startup packet
2020-04-18 02:56:25.086 UTC [81] LOG: invalid length of startup packet

gerrit container not starting

I've verified that gerrit-docker is up to date and has had no modifications from the stock repo. Trying to start the gerrit container yields:

FATA[0001] Error response from daemon: Cannot start container 936f9931e733f30457269055785653bda80b4dd1d9c650d771d117c688e11a2f: Cannot link to a non running container: /gerrit AS /proxy/gerrit

The gerrit docker container shows that it couldn't contact the pg-gerrit on TCP:

steve@klaatu:~$ sudo docker logs gerrit
First time initialize gerrit...
[2016-02-18 20:57:27,566] [main] INFO com.google.gerrit.server.config.GerritServerConfigProvider : No /var/gerrit/review_site/etc/gerrit.config; assuming defaults
Generating SSH host key ... rsa(simple)... done
Initialized /var/gerrit/review_site

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

Upgrading gerrit...
fatal: DbInjector failed
fatal: Unable to determine SqlDialect
fatal: caused by org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
fatal: caused by java.net.ConnectException: Connection refused

pg-gerrit does have an open port on 5432:
steve@klaatu:~$ sudo docker exec -it pg-gerrit bash
root@3d9c7c520637:/# cat /proc/net/tcp
sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode
0: 00000000:1538 00000000:0000 0A 00000000:00000000 00:00000000 00000000 999 0 2067181 1 0000000000000000 100 0 0 10 0

I noticed that pg-gerrit's log shows that it bounces the database during initialization, but this change to start up script has no effect on the ultimate outcome.

steve@klaatu:~/gerrit-docker (master)$ git diff
diff --git a/createGerrit.sh b/createGerrit.sh
index 879ae9e..574d135 100755
--- a/createGerrit.sh
+++ b/createGerrit.sh
@@ -23,7 +23,7 @@ docker run
-e POSTGRES_DB=reviewdb
-d ${POSTGRES_IMAGE}

-while [ -z "$(docker logs ${PG_GERRIT_NAME} 2>&1 | grep 'autovacuum launcher started')" ]; do
+while [ "$(docker logs ${PG_GERRIT_NAME} 2>&1 | grep 'autovacuum launcher started' | wc -l )" -ge 2 ]; do
echo "Waiting postgres ready."
sleep 1
done

Not sure how to proceed.

Gerrit 3.0.4 NullPointer exception

gerrit 3.0.2 is working fine.

Gerrit 3.0.4 throws this error during startup:

Dec 03 10:39:03 gerrit docker[1473]: /gerrit-entrypoint.sh: ignoring /docker-entrypoint-init.d/*
Dec 03 10:39:03 gerrit docker[1473]: Upgrading gerrit...
Dec 03 10:39:07 gerrit docker[1473]: Exception in thread "main" java.lang.NullPointerException
Dec 03 10:39:07 gerrit docker[1473]:         at java.net.URI$Parser.parse(URI.java:3042)
Dec 03 10:39:07 gerrit docker[1473]:         at java.net.URI.<init>(URI.java:588)
Dec 03 10:39:07 gerrit docker[1473]:         at java.net.URI.create(URI.java:850)
Dec 03 10:39:07 gerrit docker[1473]:         at com.googlesource.gerrit.plugins.oauth.InitOAuth.run(InitOAuth.java:103)
Dec 03 10:39:07 gerrit docker[1473]:         at com.google.gerrit.pgm.init.InitPlugins.initPlugins(InitPlugins.java:180)
Dec 03 10:39:07 gerrit docker[1473]:         at com.google.gerrit.pgm.init.InitPlugins.run(InitPlugins.java:99)
Dec 03 10:39:07 gerrit docker[1473]:         at com.google.gerrit.pgm.init.SitePathInitializer.run(SitePathInitializer.java:93)
Dec 03 10:39:07 gerrit docker[1473]:         at com.google.gerrit.pgm.init.BaseInit.run(BaseInit.java:112)
Dec 03 10:39:07 gerrit docker[1473]:         at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:61)
Dec 03 10:39:07 gerrit docker[1473]:         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Dec 03 10:39:07 gerrit docker[1473]:         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
Dec 03 10:39:07 gerrit docker[1473]:         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Dec 03 10:39:07 gerrit docker[1473]:         at java.lang.reflect.Method.invoke(Method.java:498)
Dec 03 10:39:07 gerrit docker[1473]:         at com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:224)
Dec 03 10:39:07 gerrit docker[1473]:         at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:120)
Dec 03 10:39:07 gerrit docker[1473]:         at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:65)
Dec 03 10:39:07 gerrit docker[1473]:         at Main.main(Main.java:28)

Internal users added by gerrit-create-user.sh won't be effective until the restart

Logs show that user jenkins are added successfully but the exists check after that failed.

2017/8/30 17:13:44[2017-08-30 09:13:44,187] [main] INFO com.google.gerrit.pgm.Daemon : Gerrit Code Review 2.14.3 ready
2017/8/30 17:13:46Creating user: admin
2017/8/30 17:13:46LDAP user admin was found in database
2017/8/30 17:13:46Testing Gerrit Connection
2017/8/30 17:13:46Creating user: jenkins
2017/8/30 17:13:46Target group was not specified, defaulting to non-interactive
2017/8/30 17:13:47User jenkins was created
2017/8/30 17:13:47Testing Jenkins Connection & Key Presence
2017/8/30 17:13:47Retrieving value: id_rsa.pub
2017/8/30 17:13:47Checking if "jenkins" exists
2017/8/30 17:13:47User does not exist: jenkins

Login to the Gerrit as the admin and check the users in the Non-Interactive Group shows an Anonymous Coward instead of a jenkins user has alread been added in the group.

Exec a command like below in the container echoes a 404 as the return code.
curl --output /dev/null --silent --write-out "%{http_code}" "http://localhost:8080/gerrit/accounts/jenkins"

Try to reindex the accounts by using the command below gives an exception shows a write lock.

su-exec ${GERRIT_USER} java ${JAVA_OPTIONS} ${JAVA_MEM_OPTIONS} -jar "${GERRIT_WAR}" reindex --verbose --index accounts -d "${GERRIT_SITE}"

[2017-08-30 09:40:23,978] [main] INFO com.google.gerrit.server.git.LocalDiskRepositoryManager : Defaulting core.streamFileThreshold to 240m
[2017-08-30 09:40:25,858] [main] INFO com.google.gerrit.server.cache.h2.H2CacheFactory : Enabling disk cache /var/gerrit/review_site/cache
Exception in thread "main" com.google.inject.ProvisionException: Unable to provision, see the following errors:

  1. Error injecting constructor, org.apache.lucene.store.LockObtainFailedException: Lock held by another program: /var/gerrit/review_site/index/accounts_0004/write.lock
    at com.google.gerrit.lucene.LuceneAccountIndex.(LuceneAccountIndex.java:95)
    while locating com.google.gerrit.server.index.account.AccountIndex annotated with @com.google.inject.internal.UniqueAnnotations$Internal(value=3)

1 error
at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1028)
at com.google.inject.assistedinject.FactoryProvider2.invoke(FactoryProvider2.java:776)
at com.sun.proxy.$Proxy24.create(Unknown Source)
at com.google.gerrit.server.index.SingleVersionModule$SingleVersionListener.start(SingleVersionModule.java:90)
at com.google.gerrit.server.index.SingleVersionModule$SingleVersionListener.start(SingleVersionModule.java:71)
at com.google.gerrit.lifecycle.LifecycleManager.start(LifecycleManager.java:92)
at com.google.gerrit.pgm.Reindex.run(Reindex.java:95)
at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:204)
at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:108)
at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:63)
at Main.main(Main.java:24)
Caused by: org.apache.lucene.store.LockObtainFailedException: Lock held by another program: /var/gerrit/review_site/index/accounts_0004/write.lock
at org.apache.lucene.store.NativeFSLockFactory.obtainFSLock(NativeFSLockFactory.java:118)
at org.apache.lucene.store.FSLockFactory.obtainLock(FSLockFactory.java:41)
at org.apache.lucene.store.BaseDirectory.obtainLock(BaseDirectory.java:45)
at org.apache.lucene.index.IndexWriter.(IndexWriter.java:776)
at com.google.gerrit.lucene.AutoCommitWriter.(AutoCommitWriter.java:35)
at com.google.gerrit.lucene.AutoCommitWriter.(AutoCommitWriter.java:31)
at com.google.gerrit.lucene.AbstractLuceneIndex.(AbstractLuceneIndex.java:111)
at com.google.gerrit.lucene.LuceneAccountIndex.(LuceneAccountIndex.java:95)
at com.google.gerrit.lucene.LuceneAccountIndex$$FastClassByGuice$$7fe9e296.newInstance()
at com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:89)
at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:111)
at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:90)
at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:268)
at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1019)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1085)
at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1015)
... 15 more

This issue only happens in 2.14.x. The 2.13.x looks good.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.