Git Projects not visible on mirror UI after successful replication

574 views
Skip to first unread message

tech....@gmail.com

unread,
Sep 12, 2020, 9:07:30 AM9/12/20
to Repo and Gerrit Discussion
Hello Guys,

We have set up master > mirror for gerrit, we use master for R/W and mirror gerrit is only for read access.

Gerrit Version (on both 2.x and 3.x)

Here is my setup. Quite straight forward and typical.

replication.config
==============
[gerrit]
        replicateOnStartup = false
        defaultForceUpdate = false
        autoReload = true
[remote "Shanghai-alias"]
        url = gerrit@<alias>:/data/gerrit/git/${name}.git
        push = +refs/heads/*:refs/heads/*
        push = +refs/tags/*:refs/tags/*
        push = +refs/changes/*:refs/changes/*
        timeout = 70
        threads = 4
        replicationDelay = 15
        authGroup = Administrators
        mirror = true
        rescheduleDelay = 5


Replication log after successful replication of project.

[2020-09-12 18:24:07,913] [] scheduled replication5:refs/heads/master => [e90e3302] push gerrit@<alias>.com:/data/gerrit/git/replication5.git to run after 15s
[2020-09-12 18:24:10,661] [] Created remote repository: gerrit@<alias>.com:/data/gerrit/git/replication5.git
[2020-09-12 18:24:22,906] [0c1f15dd] Replication to gerrit@<alias>com:/data/gerrit/git/replication5.git started...
[2020-09-12 18:24:22,909] [e94b93e1] Push to gerrit@<alias>com:/data/gerrit/git/replication5.git references: [RemoteRefUpdate[remoteName=refs/heads/master, NOT_ATTEMPTED, (null)...a6c76989cb9c60c6054ab488ab92e76afb52b6b0, srcRef=refs/heads/master, forceUpdate, message=null]]
[2020-09-12 18:24:32,305] [698a4345] Replication to gerrit@<alias>com:/data/gerrit/git/replication5.git completed in 9396ms, 15000ms delay, 0 retries


Here is the magic happens.

1. Projects shows up on the backend of the mirror gerrit under ${site}/git
2. If you try to browse project URL directly it shows up.

3. You can clone the project using ssh/https by giving the mirror URL clone command.


But project not shows up on the mirror UI , on  List project or after filtering the project on UI.

https://<aliaz>.com/#/admin/projects/?filter=replication5

NOTE: some times it shows up after we do a restart of mirror gerrit service.

So , can you help me resolving this one, if we are missing something here. 








Björn Pedersen

unread,
Sep 14, 2020, 6:13:55 AM9/14/20
to Repo and Gerrit Discussion
Hi,

that is expected behaviour. The mirror is only a slave for cloning/fetching (you should start gerrit as slave, then no UI would show up). What you  want is a full multi-master setup, see https://gerrit.googlesource.com/plugins/multi-master/+/refs/heads/master/src/main/resources/Documentation/config.md for more information.

Björn

tech....@gmail.com

unread,
Sep 23, 2020, 5:46:48 AM9/23/20
to Repo and Gerrit Discussion
Hello experts,

Can anybody will help us on this topic.

Is there any way to get those repos on mirror UI. Could it be achieved by implementing any hooks.

Or is there nay other way doing this??  

Luca Milanesio

unread,
Sep 23, 2020, 5:50:09 AM9/23/20
to tech....@gmail.com, Luca Milanesio, Repo and Gerrit Discussion

On 23 Sep 2020, at 10:46, tech....@gmail.com <tech....@gmail.com> wrote:

Hello experts,

Can anybody will help us on this topic.

Is there any way to get those repos on mirror UI. Could it be achieved by implementing any hooks.

Or is there nay other way doing this??  

You should have a multi-site setup for achieving what you want.

See the project at [1] and the overview of its design at [2].

HTH
Luca.


--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/37be3973-e24f-4124-8629-7a24f6d3e47cn%40googlegroups.com.

tech....@gmail.com

unread,
Sep 23, 2020, 5:51:43 AM9/23/20
to Repo and Gerrit Discussion
Hello Bjorn,

WE want  to set up mirrors as read replica of gerrit master.
Users only can browse the repos via mirror.

NOTE: we can see repos by accessing the direct repo URL as below but why the repos are not listed/visible on Projects>List.

E:G:

Matthias Sohn

unread,
Sep 23, 2020, 9:44:54 AM9/23/20
to tech....@gmail.com, Repo and Gerrit Discussion
On Wed, Sep 23, 2020 at 11:51 AM tech....@gmail.com <tech....@gmail.com> wrote:
Hello Bjorn,

WE want  to set up mirrors as read replica of gerrit master.
Users only can browse the repos via mirror.

NOTE: we can see repos by accessing the direct repo URL as below but why the repos are not listed/visible on Projects>List.

Please void top posting since it makes it harder to follow the conversation across a mail thread.

Gerrit replica servers are head-less, this means they don't serve the UI and REST API.
They are meant to offload git read-only traffic from the primary RW server.

If you want the UI on all nodes you can go for the multi-site setup mentioned by Luca.

-Matthias
 
--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.

mmh19...@gmail.com

unread,
Sep 23, 2020, 10:32:13 PM9/23/20
to Repo and Gerrit Discussion

maybe you can try  exec   flush-caches   and  index   for  slave gerrit server.

ssh ${L_GERRIT_HOST} gerrit flush-caches --all
ssh ${L_GERRIT_HOST} gerrit index start projects --force

Luca Milanesio

unread,
Sep 24, 2020, 4:15:37 AM9/24/20
to mmh19...@gmail.com, Luca Milanesio, Repo and Gerrit Discussion

On 24 Sep 2020, at 03:32, mmh19...@gmail.com <mmh19...@gmail.com> wrote:


maybe you can try  exec   flush-caches   and  index   for  slave gerrit server.

Gerrit replicas (we don’t use the term “slave” anymore) do not have a GUI and have no index.
I believe the question was more about a multi-node setup of Gerrit *primary* Servers (not replicas)


ssh ${L_GERRIT_HOST} gerrit flush-caches --all

If you create a project, you do not need to flush all the caches, it doesn’t make sense as they are not impacted.
Only the project list entry needs to be refreshed.

ssh ${L_GERRIT_HOST} gerrit index start projects --force

That operation may take *ages* and can also bring down the entire server: the projects full reindex is a very expensive operation.
You should instead just index the individual project entry that has been created.

The multi-site plugin takes care of doing the right thing on cached and indexes automatically.
Of course, you could also rewrite the plugin in terms of a combination of scripts and cronjobs, but why doing it if there is already a working solution to the problem?

HTH

Luca.


tech....@gmail.com

unread,
Sep 28, 2020, 2:33:43 AM9/28/20
to Repo and Gerrit Discussion
Hi Luca/*,

Yes,
ssh ${L_GERRIT_HOST} gerrit flush-caches --all
ssh ${L_GERRIT_HOST} gerrit index start projects --force

Does the work, projects appears on mirrors/slaves and yes it will take ages if we will do it on thousands of repos. But this is not the solution.

@Luca, we are not planning to hve multisite gerrit for now. but we are planning to have master (Push) >> mirrors (Only Pull) which are on different geo locations.

So what should be the ideal replication.config file to replicate ssh-pub-keys, permissions, uesrs, groups from master to mirrors.
So that managing access control on mirrors will not be a bottle neck, and should not we bother about project list on mirrors.

Please have a look on my set up.

replication.config
==============
[gerrit]
        replicateOnStartup = false
        defaultForceUpdate = false
        autoReload = true
[remote "BG - awsohlx108as"]
        url = ger...@awsohlx108as.ad.com:/data/gerrit/git/${name}.git
        push = +refs/heads/*:refs/heads/*
        push = +refs/tags/*:refs/tags/*
        push = +refs/changes/*:refs/changes/*
        timeout = 45
        threads = 4
        replicationDelay = 5
        authGroup = Administrators
        mirror = true
        rescheduleDelay = 5
        push = +refs/meta/config/*:refs/meta/config/*
        push = +refs/users/*:refs/users/*
        push = +refs/groups/*:refs/groups/*
        push = +refs/meta/external-ids/*:refs/meta/external-ids/*
        push = +refs/sequences/accounts/*:refs/sequences/accounts/*


Log from replication_log after adding any pubkeys on master by any user.

[2020-09-24 08:02:03,916] [cee69d85] Replication to ger...@awsmblx108as.ad.com:/data/gerrit-Amit/git/All-Users.git started...
[2020-09-24 08:02:03,918] [cee69d85] Push to ger...@awsmblx108as.ad.com:/data/gerrit-Amit/git/All-Users.git references: 
RemoteRefUpdate{refSpec=refs/users/01/1000001:refs/users/01/1000001, status=NOT_ATTEMPTED, id=(null)..AnyObjectId[4b9606c9f818b094600e84607c32d09b1c40ab70], 
force=yes, delete=no, ffwd=no

NOTE: but after the successfull replication as we can see from logs, user still not able to do ssh -p 29418 <mirror>, which should generally work after uploading the pub key.

And user is not able to login on mirror UI using ldap account, logs from mirror

[sperwez@awsohlx108as601 ~]$ tail -100 /data/gerrit/logs/error_log
[2020-09-28 06:31:04,325] [HTTP POST /login/%2Fq%2Fstatus%3Aopen (N/A from 10.92.48.44)] ERROR com.google.gerrit.server.account.AccountManager : Authentication with external ID gerrit:sperwez failed. Account 1000000 doesn't exist.
[2020-09-28 06:31:04,326] [HTTP POST /login/%2Fq%2Fstatus%3Aopen (N/A from 10.92.48.44)] WARN  com.google.gerrit.httpd.auth.ldap.LdapLoginServlet : 'sperwez' failed to sign in
com.google.gerrit.server.account.AccountException: Authentication error, account not found

As you can see account details on master. (1000000    id)


Luca Milanesio

unread,
Sep 28, 2020, 3:57:00 AM9/28/20
to tech....@gmail.com, Luca Milanesio, Repo and Gerrit Discussion

On 28 Sep 2020, at 07:33, tech....@gmail.com <tech....@gmail.com> wrote:

Hi Luca/*,

Yes,
ssh ${L_GERRIT_HOST} gerrit flush-caches --all
ssh ${L_GERRIT_HOST} gerrit index start projects --force

Does the work, projects appears on mirrors/slaves and yes it will take ages if we will do it on thousands of repos. But this is not the solution.

@Luca, we are not planning to hve multisite gerrit for now. but we are planning to have master (Push) >> mirrors (Only Pull) which are on different geo locations.

Your configuration *is supported* as long as the mirror is started as a Gerrit replica.
If you are starting the mirror as a Gerrit non-replica, then it won’t work without the multi-site plugin.

HTH

Luca.

tech....@gmail.com

unread,
Sep 29, 2020, 2:03:19 AM9/29/20
to Repo and Gerrit Discussion
Hi Luca,

Seems I am getting same errors even after getting gerrit mirror as a slave. Resulting disabling the mirror GUI.

gerrit mirror config.

[container]
        javaOptions = "-Dflogger.backend_factory=com.google.common.flogger.backend.log4j.Log4jBackendFactory#getInstance"
        javaOptions = "-Dflogger.logging_context=com.google.gerrit.server.logging.LoggingContext#getInstance"
        user = gerrit
        javaHome = /usr/java/latest/jre
        #slave = true
        replica = true
[index]
        type = LUCENE
        autoReindexIfStale = true
        scheduledIndexer = true

Matthias Sohn

unread,
Sep 29, 2020, 3:33:49 AM9/29/20
to tech....@gmail.com, Repo and Gerrit Discussion
On Tue, Sep 29, 2020 at 8:03 AM tech....@gmail.com <tech....@gmail.com> wrote:
Hi Luca,

Seems I am getting same errors even after getting gerrit mirror as a slave. Resulting disabling the mirror GUI.

As already mentioned earlier in this thread, replicas are head-less and neither provide GUI nor REST API.
 
gerrit mirror config.

[container]
        javaOptions = "-Dflogger.backend_factory=com.google.common.flogger.backend.log4j.Log4jBackendFactory#getInstance"
        javaOptions = "-Dflogger.logging_context=com.google.gerrit.server.logging.LoggingContext#getInstance"
        user = gerrit
        javaHome = /usr/java/latest/jre
        #slave = true
        replica = true
 
"replica" is the new term for the term "slave" which we don't use anymore. The old config setting is still
accepted as a synonym for the new one to ensure backwards compatibility.
 

JianFeng Zhu

unread,
Feb 4, 2021, 4:22:35 AM2/4/21
to Repo and Gerrit Discussion
@tech  do you solve the problem. i have the same issue.

tech....@gmail.com

unread,
Jul 31, 2021, 9:24:22 AM7/31/21
to Repo and Gerrit Discussion

Hello All,

I am reopening this topic. 
Previously we have accepted the feature of projects not showing up after replication to mirrors.
Mirrors should be read only replica and this feature justified that, which is cool.

My current issue:
- This time we conducted an upgrade of gerrit master and mirrors from 3.0.11 to 3.2.11, in which we have reindexed the mirrors as well.
- After update and reindex projects are showing up on mirrors as well, which was hidden from 1 year and users are able to see all mirror projects on UI ,which they are not supposed to, what we have been told from last year.

Now the question is how should we manage the access of mirrors,  is there any way to replicate users, permissions to mirrors as well.
Or can we go back to hidden UI on mirrors 

luca.mi...@gmail.com

unread,
Jul 31, 2021, 10:23:30 AM7/31/21
to tech....@gmail.com, Repo and Gerrit Discussion


Sent from my iPhone

On 31 Jul 2021, at 16:24, tech....@gmail.com <tech....@gmail.com> wrote:



Hello All,

I am reopening this topic. 
Previously we have accepted the feature of projects not showing up after replication to mirrors.
Mirrors should be read only replica and this feature justified that, which is cool.

My current issue:
- This time we conducted an upgrade of gerrit master and mirrors from 3.0.11 to 3.2.11, in which we have reindexed the mirrors as well.
- After update and reindex projects are showing up on mirrors as well, which was hidden from 1 year and users are able to see all mirror projects on UI ,which they are not supposed to, what we have been told from last year.

What do you mean by “showing up”?
Gerrit replicas do not have a GUI.

Luca

Shad Perwez

unread,
Jul 31, 2021, 1:05:40 PM7/31/21
to Luca Milanesio, Repo and Gerrit Discussion
Hello,

When a project gets replicate via replication plugin to a mirror, that project doesnt comes up on mirror GUI. 
Only after reindexing it comes up on GUI.
Which is okay , we want it to be hidden on GUI, and users can do git clone to download it on terminal.

It was kind of normal and helping us from last year.

But , after updating the version, reindex happened and all projects again shows up on mirror GUI, 

So, we want help how restrict mirror GUI. If we can achieve it by replicating permissions, groups, to mirror .

luca.mi...@gmail.com

unread,
Aug 1, 2021, 8:42:46 AM8/1/21
to Shad Perwez, Repo and Gerrit Discussion


Sent from my iPhone

On 31 Jul 2021, at 20:05, Shad Perwez <tech....@gmail.com> wrote:


Hello,

When a project gets replicate via replication plugin to a mirror, that project doesnt comes up on mirror GUI. 

Ah, what you call “mirror” is in reality a Gerrit Primary node !

That configuration is called “multi-site” and you would need the multi-site plugin to make it work.

Only after reindexing it comes up on GUI.
Which is okay , we want it to be hidden on GUI, and users can do git clone to download it on terminal.

It was kind of normal and helping us from last year.

Interesting: you relied on a non working setup as a feature? What is the user benefit of having a multi-site with outdated indexes and caches?

Luca
Reply all
Reply to author
Forward
0 new messages