How to change the host IP sent in emails to new GitLab users to a publicly visible IP, not the local


I have set up a <a href="https://bitnami.com/stack/gitlab" rel="nofollow">Bitnami GitLab stack</a> as a running virtual machine instance using VMWare Workstation on my personal dedicated Windows server (host) running out of my home office. My dedicated Windows server host has a publicly visible static IP address.

I have successfully gained public access to the GitLab application running as guest by setting up port forwarding within VMWare Workstation's Virtual Network Editor (using NAT translation, not bridging). I am able to access the GitLab web interface from any internet-connected computer just by typing the static IP (including my chosen port).

I have also successfully set up two Git repositories in the running GitLab instance.

Sending email needs to be enabled, requiring a modification of a settings file, and this worked straightforwardly (<a href="http://wiki.bitnami.com/Applications/BitNami_GitLab#How_to_configure_the_email_settings_of_GitLab.3f" rel="nofollow">here is a link</a> that explains how to set up SMTP properly).

Before inviting new users, I wanted to test the functionality by inviting myself first (using a secondary email address).

When inviting a user, an invitation/confirmation email is sent to that user that provides a link to login to the GitLab instance. <strong>However, I find that the URL provided in the invitation email is the <em>local network</em> IP address</strong> (i.e., <strong>rather than the publicly visible static IP address</strong>.

I do not see any settings in the GitLab web interface itself to change the host IP included with email invitations, so I assume I need to change a setting in a configuration file somewhere. But I have no idea if this should be a GitLab setting, an Nginx setting, a RoR setting, or some other setting; and what the setting / setting file is.

The best links I can find about this (<a href="https://stackoverflow.com/a/12385151/368896" rel="nofollow">here</a>, <a href="https://stackoverflow.com/questions/19456129/how-to-change-url-of-a-working-gitlab-install" rel="nofollow">here</a>, and <a href="https://groups.google.com/forum/#!topic/gitlabhq/aBU99tmLdqM" rel="nofollow">here</a>) do not seem to lead me to sufficient clarity to take an efficient guess as to what to do.

<strong>How do I change the URL (host IP) that is provided in invitation emails to new users via GitLab from the local network IP address to a globally-visible (static) IP address?</strong>


Two hints pointed the way for me, and once I did resolve the issue (as I am about to describe), I found the details laid out in the <a href="http://wiki.bitnami.com/Applications/BitNami_GitLab#How_to_log_in_the_GitLab_application.3f" rel="nofollow">deceptively named subsection of the Bitnami GitLab stack official documentation</a>.

The first hint was to be found in a not-very-highly-upvoted answer <a href="https://stackoverflow.com/a/11690213/368896" rel="nofollow">here</a> (in comparison with other answers and the accepted answer, some of which had many more upvotes). The setting for the host IP and port used in the GitLab account invitation emails is to be found in the gitlab.yml file (as of today, the full path of this file on the VM stack (and probably other) installations is /opt/bitnami/apps/gitlab/htdocs/config/gitlab.yml; see the host and port settings, as well as other overall useful settings). (I'm not experienced with the Rails universe, and using the .yml settings file is a touch, apparently, of the way Rails apps in general do things, if I understand correctly.)

The above step <em>does</em> succeed - but only until the server is restarted. Unfortunately, when the server is restarted, the host setting is overwritten with whatever is present in ifconfig as the IP address (the port entry remains the same as whatever you enter).

The second hint was how to resolve this problem; I found it <a href="http://community.bitnami.com/t/bitnami-gitlab-ldap-server-entry-getting-overwritten-in-gitlab-yml/23392/7" rel="nofollow">here</a>. There is a special script in the init.d folder whose specific purpose is <em>just</em> to reset the host parameter in this (and perhaps other?) .yml settings files. (What a wonderful "convenience" in my scenario.) Simply commenting out the single line exec /opt/bitnami/apps/gitlab/bnconfig --machine_hostname ... in this file (by adding a # at the front of the line) resolved the problem.

Once both of the above changes were made, the problem was resolved. GitLab invitation emails successfully include the desired static IP address (and port) of the server, even through server restarts.

As I mentioned above, once I resolved the problem, I then found that the answer to this question was already laid out in the <a href="http://wiki.bitnami.com/Applications/BitNami_GitLab#How_to_log_in_the_GitLab_application.3f" rel="nofollow">official Bitnami GitLab documentation</a> (note: both hint #1 and hint #2, from above, are tucked away in this same subsection of the documentation - one after the other - they're not prominent; they don't stand out very well; they come across as secondary details upon first reading, I think; the formatting does not draw attention to the file name and path, which would be helpful, I think; and the subsection name in which they are present does not particularly make it clear that this would be the correct subsection to look at, except in retrospect, in my opinion).

<hr />

<strong>ADDENDUM:</strong> For anyone who finds it useful, there's an added detail required to get email working from your own personal server with GitLab - I made only a brief passing mention of this in the question, because I had already done it.

But for completeness for future visitors, I should mention that you need to set up SMTP properly on your GitLab instance by making a modification to a file named production.rb (the full path as of today is /opt/bitnami/apps/gitlab/htdocs/config/environments/production.rb). Specifically, as is also <a href="http://wiki.bitnami.com/Applications/BitNami_GitLab#How_to_configure_the_email_settings_of_GitLab.3f" rel="nofollow">to be found in the official Bitnami GitLab documentation</a>, you must add a config.action_mailer.smtp_settings {...} block and add/uncomment a few other settings in order to be able to send emails from your running GitLab instance.


  • Jenkins coping with spaces in batch file arguments
  • Twitter's Bootstrap popover not working
  • How to filter column on values in list in pyspark?
  • Python: LookupError: unknown encoding: hex
  • loopback connector for ElasticSearch
  • How to automatically apply argument to class constructor?
  • How to export daily disk usage to csv format in shell scripting?
  • Eliminate extra right padding android radio button on Samsung Galaxy S3 on Jellybean API Level 16
  • multiple file download using SkyDrive API
  • Getting the syntax of prepared statements right
  • How to process an integer list row by row sent to a procedure in SQL Server 2008 R2?
  • Weekday as String to number
  • Ruby on Rails - Settting up Reviews functionality
  • Can someone explain how Yii minimizing assets is supposed to work on Heroku?
  • Exporting Records from Acumatica via REST Contract-Based API
  • Visual Studio MSB3721 error when compiling a __device__ function call from another file
  • Custom Timeline items in Glimpse
  • Why am I getting an Argument exception when creating event handler dynamically?
  • How to create OLE Automation to be used with ClearExplorer
  • Google TV VideoView playing YouTube rtsp videos
  • Signed Java web start application with Glassfish 4.1 and Java7
  • How to use array in autohotkey?
  • Ruby regex for matching simpliest Ruby's regexes
  • gnuplot - How to make zmin equal to zmax keeeping autoscale on z axis
  • JavaScript Regex to Match Boundaries of Words with diacritics
  • Change cell value based on cell color in google spreadsheet
  • iphone image to video issue in video speed
  • Android: Unable to detect vertical plane
  • Debug `Unexpected end of JSON input Error` on content script
  • Computing the discrete fourier transform of audio data with FFTW
  • Make checkout phone field optional for specific countries in WooCommerce
  • calling IO Operations from thread in ruby c extension will cause ruby to hang
  • Angular 4: Responsive Grid List
  • Using Service Component Runtime
  • Write to .csv file with PHP (Commas in Data Error)
  • convert json to excel in java
  • Create/delete users from text file using Bash script