Gerrit to gerrit replication cannot view refs/changes - gerrit

This issue has been troubling me for a while. I have set up gerrit replication recently.
After sync started, everything else works fine, branches are synced, tags are synced. However even I explicitly set to replicate refs/changes, and I see it is in logs too, I'm unable to find it in the replication server.
Gerrit version: 2.12
Replication version 2.12
replication.config:
[remote "hostname"]
url = gerrit2#remotehostname.com:/gerrit/review_site/git/myproject.git
projects = myproject
push = +refs/heads/*:refs/heads/*
push = +refs/tags/*:refs/tags/*
push = +refs/changes/*:refs/changes/*
replication.log has this:
[2018-05-03 12:02:33,783] [b4044bc4] Replication to gerrit2#remote-hostname.com:/gerrit/review_site/git/myproject.git started...
[2018-05-03 12:02:34,425] [b4044bc4] Push to gerrit2#remote-hostname.com:/gerrit/review_site/git/myproject.git references: [RemoteRefUpdate[remoteName=refs/changes/79/64079/11, NOT_ATTEMPTED, (null)...f6e058179c5253366fd6e81fcda079cdf2212034, srcRef=refs/changes/79/64079/11, forceUpdate, message=null]]
[2018-05-03 12:02:57,987] [] scheduling replication myproject:/changes/25/64325/4 => gerrit2#remote-hostname:/gerrit/review_site/git/myproject.git
[2018-05-03 12:02:57,988] [] scheduled myproject:refs/changes/25/64325/4 => [74c813f5] push gerrit2#remote-hostname:/gerrit/review_site/git/myproject.git to run after 15s
[2018-05-03 12:04:01,384] [b4044bc4] Replication to gerrit2#remote-hostname.com:/gerrit/review_site/git/myproject.git completed in 87601ms, 15001ms delay, 0 retries
Everything seems succeeded
I started the replication with command:ssh -p 29418 localhost replication start
I tried to push a CL to the replication server and I'm able to do so and see the CL from UI. So I assume there is no permission issue on this
Besides I did not find anything synced under /gerrit/review_site/git/myproject.git/refs/changes
If we cannot have refs/changes synced, it would not be possible to fail over on slave if master is down.
Anyone has seen this issue and can help me understand why?
Thanks a lot!

We figured it out. It is because the database was not replicated properly. After we successfully replicated the database, all the ref changes are showed up correctly.

Related

Rails app already deployed to Heroku cannot be updated

I have successfully deployed by rails app to Heroku, no problems. But now I am unable to update it with changes that I make to my code. When I try:
git add .
git commit -m "asdasd"
git push heroku master
I am told:
On branch master
Your branch is up-to-date with 'heroku/master'.
nothing to commit, working tree clean
I have tried Heroku ps, which gives me this:
Free dyno hours quota remaining this month: 541h 43m (98%)
Free dyno usage for this app: 0h 0m (0%)
For more information on dyno sleeping and how to upgrade, see:
https://devcenter.heroku.com/articles/dyno-sleeping
=== web (Free): bin/rails server -p $PORT -e $RAILS_ENV (1)
web.1: up 2019/01/18 14:37:10 -0600 (~ 2m ago)
So it seems like nothing is really going on, and for some reason there is no way of reaching the heroku site through the cli. The logs don't show anything interesting, just simply fetching pages and the like.
The only other thing is that I changed the name of the site in the heroku website, and I think there was something I should have done in the cli, but now I've lost it. In the cli the name of the app is the same so I guess this isn't a problem.
Can anyone help? Much thanks :-)
You can search on the web interface settings your project's git repository url and check if is the same that your local remote has.
.git/config
[remote "heroku"]
url = https://dir/repo.git
fetch = +refs/heads/*:refs/remotes/heroku/*

Heroku Everything Up-To-Date

So i've googled this error messages and went through the various stack overflow posts with regards to this. My issue came yesterday when the Dyn DNS were under a DDoS attack. Anyway the initial problem was that when i tried doing git push heroku master it constantly returned everything up-to-date
I tried everything i found in the various relevant stack overflow posts. From doing git remote rm heroku then adding it back, to checking out a new branch then doing git push heroku <branch name>:master but nothing worked.
After trying various other things i gave up and decided to simply delete my heroku app and try pushing all over.
Now the weird thing (which may just be my lack of understanding of how all these works) would be even after deleting my app and not creating a new one, when i run the command git push heroku master it still returns everything up-to-date. Why is that so when there is no longer any app there?
Additionally i have also tried heroku create before trying to push it and it returns everything up-to-date as well. I read that everything is up and running on heroku's side so i'm not quite sure what is the problem.
I can't seem to find any updated documentation on this issue as well so i'm hoping that someone can point me in the right direction or steps to take.
You can try using force (worked for me when I had this problem in the past):
git push -f heroku
This will make Heroku to receive the files and build again, no matter if it thinks everything is up to date. (They even recommend it)
Also, as you've created a new application, make sure you've set the remote to point to this new app:
heroku git:remote -a app_name

How can I debug e-mail sending on Gitlab?

My Gitlab (version 5) is not sending any e-mails and I am lost trying to figure out what is happening. The logs give no useful information. I configured it to used sendmail.
I wrote a small script that sends e-mail through ActionMailer (I guess it is what gitlab uses to send e-mail, right?). And it sends the e-mail correctly.
But, on my Gitlab, I can guarantee that sendmail is not even being called.
Do I need to enable something to get e-mail notifications? How can I debug my issue?
Update
The problem is that I can not find any information anywhere. The thing just fails silently. Where can I find some kind of log? The logs in the log dir provide no useful information.
My question is, how can I make Gitlab be more verbose? How can I make it tell me what is going on?
Update 2
I just found a lot of mails scheduled on the Background jobs section. A lot of unprocessed Sidekiq::Extensions::DelayedMailer. What does it mean? Why were these jobs not processed?
Stumbled upon this issue today, here's my research:
Debugging SMTP connections in the GitLab GUI is not supported yet. However there is a pending feature request and a command line solution.
Set the desired SMTP settings /etc/gitlab/gitlab.rb and run gitlab-ctl reconfigure (see https://docs.gitlab.com/omnibus/settings/smtp.html).
Start the console running gitlab-rails console -e production.
Show the configured delivery method (should be :smtp) running the command ActionMailer::Base.delivery_method. Show all configured SMTP settings running ActionMailer::Base.smtp_settings.
To send a test mail run
Notify.test_email('youremail#example.com', 'Hello World', 'This is a test message').deliver_now
On the admin page in GitLab, the section »Background jobs« shows information about all jobs. Failing SMTP connections are listed there as well.
Please note, you may need to restart the GitLab instance in order to use the newly configured SMTP settings (on my instance the console was able to send mails, the GUI required a restart). Run gitlab-ctl restart to restart your instance.
First, I will tell what was my problem: The sidekiq is responsible for handling sending e-mails. For some reason my sidekiq was stuck, restarting it solved the problem.
Where I found information about problems I found on Gitlab:
The logs dir. It has a few informations.
On admin page, the section "Background jobs" gives information about the sidekiq.
The javascript console (if your browser supports it) also has useful information. Only if your problem is related to javascript.
And if you reach this point, you may modify Gitlab's code so you can "trace it" writing to a file:
File.open('/tmp/logfile','a') { |file| file.write("Hello World!\n") }
Maybe try enabling delivery errors in production mode and see what happens
config.action_mailer.raise_delivery_errors = true
I had the same problem and found that I needed to mod application.rb:
diff --git a/config/application.rb b/config/application.rb
index d85bcab..274976f 100644
--- a/config/application.rb
+++ b/config/application.rb
## -11,6 +11,8 ## end
module Gitlab
class Application < Rails::Application
+ config.action_mailer.sendmail_settings = { :arguments => "-i" }
+
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
Note: I'm running Debian 7 which uses exim for mail.
In the admin section under Background Jobs if you have lots of items in the Scheduled tab try restarting sidekiq:
cd /home/git/gitlab
exec rake sidekiq:start RAILS_ENV=production

Can I update a single source file on Heroku without recompiling the slug?

I'm working on a rails project that's being hosted on Heroku.
I'm wondering if it's possible to update one file, without restarting the app.
Why. I have a bug, but I can't track it down. It works perfectly on my local system, but it seems to stop mid way through processing on heroku.
As there are no break points, I'm scattering status updates in the code. (to be removed later)
But adding one line of code to a rails app is like a five minute process.
change file
stage file to git
commit file
push git (all the above is quite fast)
wait for heroku to pull down the app, do what looks like a gem install, or at least a gem update.
change a few files to reflect the local url
start up the service again.
Is there a way to push the git without running all those other things? Perhaps a special parameter to add to the push?
A further annoyance is that my git now has a bunch of check-ins that I don't want my co-workers to see. I'm targeting a my own non-production instance of heroku (testing only) and there's no reason to include all these attempts in the global source control.
There's a good reason as to why it's not possible. When you push to Heroku, they produce a 'slug' of your application (https://devcenter.heroku.com/articles/slug-compiler). To provide the massive scalability that Heroku provides this slug is read only so that it can be spun up on multiple dynos which are likely to be distributed across many different physical machines. Each of these dynos runs a separate instance of your application whilst the routing mesh ensures that requests to your application goes to the correct dynos.
Now consider what would occur if any of these instances were writeable, if you're running 5 dynos you'd have your application running on 5 seperate instances - if a file is written how is it then distributed across of your running dynos? Yes, Heroku could have considered some kind of shared file system for running applications out of but that's complicated. By making the file system read only (https://devcenter.heroku.com/articles/read-only-filesystem) this problem is alleviated.
If you've built an app and deployed to Heroku but forgotten to use S3 type peristant storage your application will let you upload files to it (via Paperclip of such like in the Ruby world) but that uploaded asset will only exist on the dyno that received it and will then be lost when new code is deployed or the application restarted as the dyno receives the latest code from the slug.
If you're debugging against Heroku don't forget you've got the usual git arsenal available, git commit --amend. Alternatively work in a branch and deploy that to directly to Heroku (git push heroku <yourbranchname>:master) then when you've isolated the problem rebase (http://git-scm.com/book/en/Git-Branching-Rebasing) your branch onto master squashing any commits you no longer need.
XY Problem
This is a classic XY Problem. X is your non-working code; Y is your search for a non-existent Git misfeature.
How Git Works
Git commits fundamentally work at the tree level, not the file level. As a gross over-simplification, a commit points to a tree, which points to a set of files. When you push a commit, you have to push all the objects related to that commit unless the objects already exist on the receiver.
How Heroku Works
Heroku compiles the application in your Git repository into a slug. While you can ignore certain files during compilation, you can't avoid compiling the slug. That's just the way the platform works.
This is not a problem if you have a reasonable slug size; my Heroku apps only take a couple of seconds to compile. If your slugs are very large, and therefore take a long time to compile (you claim it takes you 5+ minutes), then you have another XY problem on your hands if you're trying to solve for "don't compile."
Debugging on Heroku
Heroku has lots of features and add-ons to aid debugging. Here's a short list to get you started.
interactive console sessions
logging
Exceptional Add-On
See Also
https://devcenter.heroku.com/articles/read-only-filesystem
https://devcenter.heroku.com/articles/dynos#ephemeral_filesystem
It's not possible. The way heroku is setup, every time you push up a change the server will restart.
Yes you can.
First, list all the files that have been modified since the last commit.
git status
Add the files you want to commit individually.
git add location/file_name.rb
git add location/file_name2.rb
...
Make commit to the files you added to push.
git commit -m "committing files one at a time or two at a time"
Now push
git push heroku

Rails - Heroku - Git - Problems connecting to repo with os x 10.6.5

I am trying to clone git repo to my local with terminal runnin OS X 10.6.5 and it seems like I am getting a connection error when I do: "git clone git#heroku.com:APPNAME.git /my/path". It says "Read from socket failed: connection reset by peer". I have created a key and everything, it's just a problem with connecting and reading.
I have searched about this problem and it appears that it is possible that I am behind a firewall that is preventing me from pulling up the repo. I have tried to get the repo using the HTTPS method instead but I don't think I am getting the URL right because it gives me "fatal: HTTP request failed" when I try "git clone https://git.heroku.com/APPNAME.git". I am not sure if that is the right URL or if heroku even supports HTTPS.
I have submitted a ticket to heroku so I am waiting on that as well. If anyone knows how to get the repo with https method from heroku I would greatly appreciate it.
Thanks!
the git URL for your app is available from the my apps page in the Heroku website console.
Also I'm pretty sure that git clone runs over SSH which by it's name is 'secure'

Resources