Gerrit Container With MountPath


#1

Hello All,

I deployed the gerrit container and it worked. But when i want to use external volume mount for “/var/gerrit/db, /var/gerrit/index, /var/gerrit/cache, /var/gerrit/git” the gerrit not work.

I tried local and nfs storage for mountPaths but i couldn’t understand why gerrit not work. By the way, i can access the mountPaths in gerrit container and i can Read and Write files in the mountPaths

Note; i have to try different kubernetes versions but same problem still continue.

If you do not use mountpath, gerrit works fine, What is the problem i don’t know. Anybody can help me for this problem?

Best Regards


#2

Please post your specs and any error(s) you may have seen.


#3

Hello, many thanks for your quick response;

Note: Please do not forgot, if i don’t use external volume mountPaths, gerrit works fine… I tried subPath but not solved problem.

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: gerrit
labels:
name: gerrit
spec:
replicas: 1
selector:
matchLabels:
app: gerrit
tier: lan
phase: dev
deployment: v1.0.0
strategy: {}
template:
metadata:
labels:
app: gerrit
tier: lan
phase: dev
deployment: v1.0.0
spec:
volumes:
- name: dbvol
hostPath:
path: /test/db
- name: indexvol
hostPath:
path: /test/index
- name: gitvol
hostPath:
path: /test/git
- name: cachevol
hostPath:
path: /test/cache
containers:
- image: dtr.test.local:443/channels/gerrit:2.14.7
name: gerrit
imagePullPolicy: IfNotPresent
ports:
- containerPort: 29418
name: port-29418
- containerPort: 8080
name: port-8080
volumeMounts:
- mountPath: /var/gerrit/db
name: dbvol
- mountPath: /var/gerrit/index
name: indexvol
- mountPath: /var/gerrit/git
name: gitvol
- mountPath: /var/gerrit/cache
name: cachevol

[root@KUBMINHOST01 ~]# ll /test/
total 0
drwxrwxrwx 2 gerrit gerrit 6 Nov 3 00:43 cache
drwxrwxrwx 2 gerrit gerrit 6 Nov 3 00:43 db
drwxrwxrwx 2 gerrit gerrit 6 Nov 1 13:50 git
drwxrwxrwx 2 gerrit gerrit 6 Nov 2 20:45 index

[root@KUBMINHOST01 ~]# ll /test/*
/test/cache:
total 256
-rw-r–r-- 1 gerrit gerrit 32768 Nov 3 00:53 change_kind.h2.db
-rw-r–r-- 1 gerrit gerrit 32768 Nov 3 00:47 conflicts.h2.db
-rw-r–r-- 1 gerrit gerrit 32768 Nov 3 00:53 diff.h2.db
-rw-r–r-- 1 gerrit gerrit 32768 Nov 3 00:53 diff_intraline.h2.db
-rw-r–r-- 1 gerrit gerrit 32768 Nov 3 00:53 diff_summary.h2.db
-rw-r–r-- 1 gerrit gerrit 32768 Nov 3 00:53 git_tags.h2.db
-rw-r–r-- 1 gerrit gerrit 32768 Nov 3 00:53 mergeability.h2.db
-rw-r–r-- 1 gerrit gerrit 32768 Nov 3 00:47 oauth_tokens.h2.db

/test/db:
total 28
-rw-r–r-- 1 gerrit gerrit 24576 Nov 3 00:53 ReviewDB.h2.db
-rw-r–r-- 1 gerrit gerrit 1078 Nov 3 00:53 ReviewDB.trace.db

/test/git:
total 0

/test/index:
total 0

[2018-11-02 21:27:04,614] [main] INFO com.google.gerrit.server.cache.h2.H2CacheFactory : Enabling disk cache /var/gerrit/cache
[2018-11-02 21:27:06,048] [main] INFO com.google.gerrit.server.config.ScheduleConfig : gc schedule parameter “gc.interval” is not configured
[2018-11-02 21:27:06,048] [main] INFO com.google.gerrit.server.config.ScheduleConfig : changeCleanup schedule parameter “changeCleanup.interval” is not configured
[2018-11-02 21:27:06,752] [main] WARN com.google.gerrit.sshd.SshDaemon : Cannot format SSHD host key [EdDSA]: invalid key type
[2018-11-02 21:27:06,764] [main] WARN com.google.gerrit.server.config.GitwebCgiConfig : gitweb not installed (no /usr/lib/cgi-bin/gitweb.cgi found)
[2018-11-02 21:27:07,513] [main] INFO org.eclipse.jetty.util.log : Logging initialized @6933ms
[2018-11-02 21:27:07,581] [main] INFO com.google.gerrit.server.git.LocalDiskRepositoryManager : Defaulting core.streamFileThreshold to 883m
[2018-11-02 21:27:07,589] [main] ERROR com.google.gerrit.pgm.Daemon : Unable to start daemon
com.google.inject.ProvisionException: Unable to provision, see the following errors:

  1. Schema not yet initialized. Run init to initialize the schema:
    $ java -jar gerrit.war init -d /var/gerrit

1 error
at com.google.gerrit.server.schema.SchemaVersionCheck.start(SchemaVersionCheck.java:59)
at com.google.gerrit.lifecycle.LifecycleManager.start(LifecycleManager.java:92)
at com.google.gerrit.pgm.Daemon.start(Daemon.java:323)
at com.google.gerrit.pgm.Daemon.run(Daemon.java:232)
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)


#4

/var/gerrit/git and /var/gerrit/cache mounted via hostpath and the gerrit works. but /var/gerrit/db and /var/gerrit/index can’t accept hostPath or nfs


#5

Solved!

I used below link;

Step-2: Run Gerrit docker init setup from docker

Uncomment in docker-compose.yaml the Gerrit init step entrypoint and run Gerrit with docker-compose in foreground.

docker-compose up gerrit

Wait until you see in the output the message Initialized /var/gerrit and then the container will exit.

Step-3: Start Gerrit in daemon mode

Comment out the gerrit init entrypoint in docker-compose.yaml and start all the docker-compose nodes:

docker-compose up -d