Hi,
commit 2f74faa64b0bf680faf147db721427d8a03c42ad (HEAD -> master)
Author: Mateusz Grzechociński <...>
Date: Thu Jul 26 14:24:16 2018 +0200
Second change
Change-Id: I9a56f3d29aa3db4e86a3c4b0c4967fa4a38fba36
commit 57d20db51a6a2cbd2b953653dfc891f5e530eca7
Author: Mateusz Grzechociński <...>
Date: Thu Jul 26 14:24:03 2018 +0200
First change
Change-Id: I4c7defd5db80fe3d2fe72fb930b5de262556ed41↪ git push origin HEAD:refs/for/master
Counting objects: 6, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 668 bytes | 668.00 KiB/s, done.
Total 6 (delta 3), reused 0 (delta 0)
remote: Resolving deltas: 100% (3/3)
remote: Processing changes: new: 2, done
remote:
remote: New Changes:
remote: https://localhost/gerrit/#/c/training/+/1904 First change
remote: https://localhost/gerrit/#/c/training/+/1905 Second change
remote:
To ssh://localhost:29418/training
* [new branch] HEAD -> refs/for/master
↪ git push origin HEAD:refs/heads/master
Counting objects: 6, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 668 bytes | 668.00 KiB/s, done.
Total 6 (delta 3), reused 0 (delta 0)
remote: Resolving deltas: 100% (3/3)
remote: Processing changes: done
To ssh://localhost:29418/training
e22700d..2f74faa HEAD -> masterbash-4.4# tree
.
├── 04
│ └── 1904
└── 05
└── 1905bash-4.4# tree
.
├── 04
│ └── 1904
│ └── 1
└── 05
└── 1905
└── 1
bash-4.4# cat 04/1904/1
57d20db51a6a2cbd2b953653dfc891f5e530eca7
bash-4.4# cat 05/1905/1
2f74faa64b0bf680faf147db721427d8a03c42adI use Gerrit 2.15.2 as a Docker image, provided by this repo https://github.com/openfrontier/docker-gerrit. I store whole Gerrit review site as a Docker volume on my machine.After upgrading from Gerrit 2.14.x to 2.15.2 I'm now struggling with an issue when working with the related changes.
Just guessing here, but I believe this has to do with the NoteDb migration or it might be some file system permission issue. Getting some more details will probably help:
- How exactly did you perform the upgrade?
- Did you perform the optional NoteDb migration of change data [1]?
- If so, did you use the online or offline upgrade?
- If so, did you encounter any issues during the migration?
Since Gerrit 2.15, NoteDB is recommended to store account data, group data and change data.
Accounts and Groups are migrated offline to NoteDB automatically during the start up of the container.
Change data can be migrated to NoteDB offline via the MIGRATE_TO_NOTEDB_OFFLINE environment variable.
- What is the current content of the following file: <sitepath>/etc/notedb.config
bash-4.4# find review_site/etc/ -name "notedb.config"
bash-4.4#
- What do you have as configuration settings in your <sitepath>/etc/gerrit.config for noteDb? perform e.g.:
- git config --file <sitepath>/etc/gerrit.config --get-all | grep -Fi notedb
bash-4.4# git config -f review_site/etc/gerrit.config --get-all notedb
error: key does not contain a section: notedb
bash-4.4# git config -f review_site/etc/gerrit.config -l | grep notedb
bash-4.4#
- Could you verify the file system level permissions for the repositories? Can you spot any deviations in owner/group and permissions for those refs before and after?
drwxr-xr-x 3 root root 96 Jul 27 10:26 01drwxr-xr-x 3 root root 96 Jul 27 10:26 02drwxr-xr-x 4 gerrit2 root 128 Jul 27 10:26 04drwxr-xr-x 4 gerrit2 root 128 Jul 27 10:26 05drwxr-xr-x 3 gerrit2 root 96 Jul 26 13:35 06drwxr-xr-x 3 gerrit2 root 96 Jul 26 13:35 07drwxr-xr-x 4 gerrit2 root 128 Jul 27 10:26 08drwxr-xr-x 5 gerrit2 root 160 Jul 27 10:26 09drwxr-xr-x 5 gerrit2 root 160 Jul 27 10:26 10drwxr-xr-x 4 root root 128 Jul 27 10:26 11drwxr-xr-x 3 root root 96 Jul 27 10:26 12drwxr-xr-x 3 root root 96 Jul 27 10:26 21drwxr-xr-x 3 root root 96 Jul 27 10:26 22drwxr-xr-x 5 root root 160 Jul 27 10:26 39drwxr-xr-x 4 root root 128 Jul 27 10:26 40drwxr-xr-x 4 root root 128 Jul 27 10:26 41drwxr-xr-x 4 root root 128 Jul 27 10:26 42
- Do you see any server error logs lines appearing when pushing the changes?
[2018-07-27 09:51:51,464] [HTTP-3093] ERROR com.google.gerrit.server.git.MergeOp : Revision f06f91d1e3000e9d62f0669b653aabb8c431f527 of patch set 1 does not match refs/changes/94/1894/1 for change 1894
[2018-07-27 09:51:51,464] [HTTP-3093] ERROR com.google.gerrit.server.git.MergeOp : Revision a789b41668a91b29698086d4661d37b7af979d3e of patch set 5 does not match refs/changes/83/1883/5 for change 1883
[2018-07-27 09:51:51,464] [HTTP-3093] ERROR com.google.gerrit.server.git.MergeOp : Revision 9dd9e1f456ec1a03b8b10e8091a1e3bff5d1a688 of patch set 7 does not match refs/changes/82/1882/7 for change 1882
For the last two items, I presume it should not report to you that it has created new changes, but you never know... and perhaps I'm looking in the wrong direction here.(I once created a Docker image from a Dockerfile which had an implicit user ID assigned for the Gerrit user on build time. When it changed in this image due to base image changes, and I upgraded the image using site data created with the older version, it resulted in quite some unexpected behavior. I know have checks in place to ensure this doesn't happen anymore. I see that your Docker image is also very implicit and could potentially fall for this [2], as adduser just increments uids/gids from /etc/passwd. Hint: use 'ls -n' to list files with numeric IDs to compare against.)
bash-4.4# tree.├── 08│ └── 1908├── 09│ └── 1909├── 10│ └── 1910│ └── 1Hi, thanks for the response. I answer inline.
[...]
I can't see any differency actually. The only thing which look suspicious is that some folders are created by root, and some by gerrit2:drwxr-xr-x 3 root root 96 Jul 27 10:26 01drwxr-xr-x 3 root root 96 Jul 27 10:26 02drwxr-xr-x 4 gerrit2 root 128 Jul 27 10:26 04drwxr-xr-x 4 gerrit2 root 128 Jul 27 10:26 05drwxr-xr-x 3 gerrit2 root 96 Jul 26 13:35 06drwxr-xr-x 3 gerrit2 root 96 Jul 26 13:35 07drwxr-xr-x 4 gerrit2 root 128 Jul 27 10:26 08drwxr-xr-x 5 gerrit2 root 160 Jul 27 10:26 09drwxr-xr-x 5 gerrit2 root 160 Jul 27 10:26 10drwxr-xr-x 4 root root 128 Jul 27 10:26 11drwxr-xr-x 3 root root 96 Jul 27 10:26 12drwxr-xr-x 3 root root 96 Jul 27 10:26 21drwxr-xr-x 3 root root 96 Jul 27 10:26 22drwxr-xr-x 5 root root 160 Jul 27 10:26 39drwxr-xr-x 4 root root 128 Jul 27 10:26 40drwxr-xr-x 4 root root 128 Jul 27 10:26 41drwxr-xr-x 4 root root 128 Jul 27 10:26 42
This might be the issue?
Yeah, that looks like an issue, definitely. Did you ever run manual commands with a shell in the container? By default it runs as root and the entrypoint appears responsible for su-ing to the gerrit2 user. If you ever run arbitrary commands, you're on your own... It could also be an issue/bug with the Docker image (entrypoint/scripting - a single omission of a su-exec prefix can cause this).Files managed and supposed to be writable by Gerrit (such as git repositories), should be owned by gerrit2 only, in this Docker image if I'm correct. If they are root-owned, they must have been created by a process running as root.I'd suggest to do something like the following:
- Find the numeric uid&gid of the 'gerrit2' user in the container. (e.g. run 'id' in shell inside the container as user gerrit2)
- Stop the container.
- Run a "chown -R <uid>:<gid> <site-path>" on the data.
- Restart the container.
(Oh and welcome to the world of Docker and broken images put on the internet. Running an SQL database next to Gerrit Java in a single container, really...? That scares the hell out of me - Docker should have a single process to manage.)
↪ git push origin HEAD:refs/for/masterCounting objects: 6, done.Delta compression using up to 8 threads.Compressing objects: 100% (5/5), done.Writing objects: 100% (6/6), 634 bytes | 634.00 KiB/s, done.Total 6 (delta 3), reused 0 (delta 0)remote: Resolving deltas: 100% (3/3)remote: Processing changes: new: 1, refs: 1, doneremote:remote: New Changes:remote: https://localhost/gerrit/#/c/training/+/1945 Test3remote:To ssh://localhost:29418/training ! [remote rejected] HEAD -> refs/for/master (internal server error: Error inserting change/patchset)error: failed to push some refs to 'ssh://mateusz.grzechocinski@localhost:29418/training'bash-4.4# tree changes/45
changes/45
└── 1945↪ git push origin HEAD:refs/for/master
Counting objects: 6, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (6/6), 634 bytes | 634.00 KiB/s, done.
Total 6 (delta 3), reused 0 (delta 0)
remote: Resolving deltas: 100% (3/3)
remote: Processing changes: refs: 1, done
To ssh://localhost:29418/training
! [remote rejected] HEAD -> refs/for/master (no new changes)
error: failed to push some refs to 'ssh://mateusz.grzechocinski@localhost:29418/training'Should it be connected with the permission mess as well?
The permission mess is partially caused by the confusing way this Docker image is working. I believe I can rant for quite a while looking at the approach the developer of that container has taken. ;)
Also a general remark: have you looked at Gerrit server logs as well? You don't seem to inspect them, reading your earlier messages. They are usually pretty relevant in such cases to get clues.
Then what's your recommended approach to run Gerrit in an environment where all other services like Jekins, Nginx etc are dockerized? Is there any better approach to Dockerize Gerrit or should I just use it on a host machine?
Well, I cannot find any server log. When Gerrit runs as daemon, it outputs all the logs to stdout so that's what I see. When I run it as supervise, it created error_log file and AFAIK, redirect its output there. That what the docs says: https://github.com/openfrontier/docker-gerrit#override-the-default-startup-action
Last but no least, Gert, could you please answer the question about the file with patchset name? Should they always be created for every single change or not?
That change is actually pushed into refs/changes, but again, no file is created. I still don't know whether that's ok or not. Should there be a file with patchset name?bash-4.4# tree changes/45
changes/45
└── 1945
<sha1> refs/changes/10/210/1
<sha1> refs/changes/10/210/2
<sha1> refs/changes/10/210/metaOn Friday, 27 July 2018 13:40:48 UTC+2, Mateusz Grzechociński wrote:Then what's your recommended approach to run Gerrit in an environment where all other services like Jekins, Nginx etc are dockerized? Is there any better approach to Dockerize Gerrit or should I just use it on a host machine?In general, Docker containers should run a single process. That means each service should have their own container. It's out of scope for this mailing list to discuss that in detail, I think, so I'll keep it to this paragraph. I would definitely recommend running separate containers for the database/PostgreSQL, the reverse HTTP proxy and Gerrit. (However, I have switched to Gerrit/master, dropping the SQL dependency completely.) Managing multiple containers to run a single "service" in your network can be achieved by using tooling that ranges from simple orchestration with docker-compose to advanced/complex setups with Kubernetes and Docker Swarm - many options out there!I believe all of the services involved here are pretty easy to run containerized. Jenkins, Gerrit, PostgreSQL, nginx/Apache, I had them all running "properly" in Docker with relative ease. Whether or not to run it in a container is a choice you'll have to make yourself; it's very opinionated as well as depending on your situation. Personally, I like it from a security point of view as welll as resource efficiency (compared to segregation with virtual machines), but it comes with some downsides too.
Well, I cannot find any server log. When Gerrit runs as daemon, it outputs all the logs to stdout so that's what I see. When I run it as supervise, it created error_log file and AFAIK, redirect its output there. That what the docs says: https://github.com/openfrontier/docker-gerrit#override-the-default-startup-actionIf this image produces the logs to stdout/stderr, use "docker logs <container name>" to access the logs, in a default Docker daemon configuration that should return you the contents.
Last but no least, Gert, could you please answer the question about the file with patchset name? Should they always be created for every single change or not?On Friday, 27 July 2018 13:24:00 UTC+2, Mateusz Grzechociński wrote:That change is actually pushed into refs/changes, but again, no file is created. I still don't know whether that's ok or not. Should there be a file with patchset name?bash-4.4# tree changes/45
changes/45
└── 1945My git filesystem layout knowledge is limited, but I believe that is OK, as there's a 'packed-refs' file having this information. This is a plain textfile with hashes pointing to refs, e.g.:Perhaps check the contents of that file as well!<sha1> refs/changes/10/210/1
<sha1> refs/changes/10/210/2
<sha1> refs/changes/10/210/meta