Bitnami GitLab Legacy Virtual Machine

IMPORTANT: This documentation applies to Bitnami Gitlab Stack 8.14.3 or earlier. If you have installed Bitnami Gitlab 8.16.3 or higher, please check the documentation of Bitnami Gitlab Stack. The SSH server is disabled by default in Bitnami virtual machines. You must enable it manually before you can pull code into Gitlab.

Description

GitLab is self-hosted Git management software that's fast, secure, and based on Ruby on Rails. GitLab CI (also included) is an open-source Continuous Integration (CI) server closely integrated with Git and GitLab.

First steps with the Bitnami GitLab Community Edition Legacy Stack

Welcome to your new Bitnami application! This guide includes some basic information you will need to get started with your application.

How to import a Bitnami Virtual Machine?

Check the following instructions to import a Bitnami Virtual Machine:

Importing a Bitnami Virtual Machine in VirtualBox
  • Select the "File -> Import Appliance" menu option and select the .ova file downloaded from the Bitnami website. Then click "Continue".
  • Once it is imported, click the "Start" button in the VirtualBox toolbar.

For a detailed walkthrough, check our Virtualbox tutorial.

Importing a Bitnami Virtual Machine in a VMware product
  • Select the "File -> Import" menu option and select the .ova file downloaded from the Bitnami website. Then click "Continue".
  • Once the import is complete, click "Finish" to start the virtual machine.

For a detailed walkthrough, check our VMware tutorial, which uses VMware Fusion as an example. To learn how to use our virtual machines with other VMware products, refer to the VMware Workstation documentation or the VMware vSphere documentation.

What credentials do I need?

You need two sets of credentials:

  • The application credentials, consisting of a username and password. These credentials allow you to log in to your new Bitnami application.

  • The server credentials, consisting of an SSH username and password. These credentials allow you to log in to your Virtual Machines server using an SSH client and execute commands on the server using the command line.

What is the administrator username set for me to log in to the application for the first time?

Username: user@example.com

What is the administrator password?

Password: The administrator password to log in to your application is randomly generated during the first boot. Check the FAQ to learn how to retrieve it.

What SSH username should I use for secure shell access to my application?

SSH username: bitnami

What is my server IP address?

The IP address is displayed on screen at the end of the boot process, but you can check it at any time by running the following command:

  $ sudo ifconfig

Check server IP address

How do I get my SSH key or password?

You can obtain the SSH password from the virtual machine console when it starts up. Click here for more information.

How to access your application?

Once you have imported your Bitnami Virtual Machine, the IP address for your application is displayed on the virtual machine's login screen. Access the application via your browser by entering this IP address.

Check these instructions about how to remotely access the Bitnami application.

What are the default ports?

A port is an endpoint of communication in an operating system that identifies a specific process or a type of service. Bitnami stacks include several services or servers that require a port.

Remember that if you need to open some ports you can follow the instructions given in the FAQ to learn how to open the server ports for remote access.

Port 22 is the default port for SSH connections.

How to start or stop the services?

Each Bitnami stack includes a control script that lets you easily stop, start and restart services. The script is located at /opt/bitnami/ctlscript.sh. Call it without any service name arguments to start all services:

$ sudo /opt/bitnami/ctlscript.sh start

Or use it to restart a single service, such as Apache only, by passing the service name as argument:

$ sudo /opt/bitnami/ctlscript.sh restart apache

Use this script to stop all services:

$ sudo /opt/bitnami/ctlscript.sh stop

Restart the services by running the script without any arguments:

$ sudo /opt/bitnami/ctlscript.sh restart

Obtain a list of available services and operations by running the script without any arguments:

$ sudo /opt/bitnami/ctlscript.sh

How to configure outbound email settings?

Configure the SMTP settings as below. For example, these are the options to configure it using a Gmail account, in the file /opt/bitnami/apps/gitlab/htdocs/config/environments/production.rb. Replace USERNAME and PASSWORD with your Gmail account username and password respectively.

config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp   
config.action_mailer.perform_deliveries = true
config.action_mailer.smtp_settings = {
    :address => "smtp.gmail.com",
    :port => 587,
    :domain => "gmail.com",
    :authentication => :plain,
    :user_name => "USERNAME@gmail.com",
    :password => "PASSWORD",
    :enable_starttls_auto => true 
} 

If you want to use your Office365 account to send emails, then you have to configure it like this. Replace USERNAME and PASSWORD with your account username and password respectively.

config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp   
config.action_mailer.perform_deliveries = true
config.action_mailer.smtp_settings = {
    :address => "smtp.office365.com",
    :port => 587,
    :domain => "office365.com",
    :authentication => :login,
    :user_name => "USERNAME@hotmail.com",
    :password => "PASSWORD",
    :enable_starttls_auto => true 
} 

Take into account that user_name should be an email address linked to your Office365 account. Typically, this is a Hotmail/Outlook Mail account.

Once done, restart the Sidekiq and Apache servers:

$ sudo /opt/bitnami/ctlscript.sh restart gitlab_sidekiq
$ sudo /opt/bitnami/ctlscript.sh restart apache

To configure the application to use other third-party SMTP services for outgoing email, such as SendGrid or Mandrill, refer to the FAQ.

Troubleshooting Gmail SMTP issues

If you are using Gmail as the outbound email server and you are not able to send email correctly, Google may be blocking sign-in attempts from your apps or devices. Depending on whether or not you use Google Apps, the steps to correct this will differ.

For Google Apps users

If you are a Google Apps user, you will need your administrator to allow users to change the policy for less secure apps. If you are a Google Apps administrator, follow these steps:

  • Browse to the Google Apps administration panel.

  • Click on "Security" and then "Basic settings".

  • Look for the section "Less secure apps" and then click on "Go to settings for less secure apps".

  • Select "Allow users to manage their access to less secure apps".

For other Google users

If you do not use Google Apps, follow the steps in the following sections, depending on whether 2-step verification has been enabled on the account or not.

If 2-step verification has not been enabled on the account, follow these steps:

  • Browse to the "Less secure apps" page and log in using the account you are having problems with. This option is typically required by many popular email clients, such as Outlook and Thunderbird, and should not be considered unsafe.

  • Select the "Turn on" option.

    Security settings

If 2-step verification has been enabled on the account, you have to generate an app password. Follow these steps:

  • Browse to the "App passwords" page.

  • Click "Select app" and choose the app you're using.

  • Click "Select device" and choose the device you're using.

  • Click the "Generate" button.

  • Enter the app password on your device.

  • Click the "Done" button.

Here are other options you may try:

  • Browse to the web version of Gmail and sign in to your account. Once you're signed in, try to enable access for the application again.

  • Browse to the "Unlock Captcha" function page and sign in with your Gmail username and password.

  • Disable IMAP from the Gmail web server interface and enable it again.

    IMAP settings

How to create a full backup of GitLab Legacy?

Backup

The Bitnami GitLab Community Edition Legacy Stack is self-contained and the simplest option for performing a backup is to copy or compress the Bitnami stack installation directory. To do so in a safe manner, you will need to stop all servers, so this method may not be appropriate if you have people accessing the application continuously.

Follow these steps:

  • Change to the directory in which you wish to save your backup:

      $ cd /your/directory
    
  • Stop all servers:

      $ sudo /opt/bitnami/ctlscript.sh stop
    
  • Create a compressed file with the stack contents:

      $ sudo tar -pczvf application-backup.tar.gz /opt/bitnami
    
  • Restart all servers:

      $ sudo /opt/bitnami/ctlscript.sh start
    

You should now download or transfer the application-backup.tar.gz file to a safe location.

Restore

Follow these steps:

  • Change to the directory containing your backup:

      $ cd /your/directory
    
  • Stop all servers:

      $ sudo /opt/bitnami/ctlscript.sh stop
    
  • Move the current stack to a different location:

      $ sudo mv /opt/bitnami /tmp/bitnami-backup
    
  • Uncompress the backup file to the original directoryv

      $ sudo tar -pxzvf application-backup.tar.gz -C /
    
  • Start all servers:

      $ sudo /opt/bitnami/ctlscript.sh start
    

If you want to create only a database backup, refer to these instructions for MySQL and PostgreSQL.

How to upgrade Gitlab?

It is strongly recommended to create a backup before starting the update process. If you have important data, create and try to restore a backup to ensure that everything works properly.

Upgrade process for GitLab 8.x

Step 1: Prepare for upgrade
  • Stop all the services:

      $ cd /opt/bitnami
      $ sudo /opt/bitnami/ctlscript.sh stop postgresql
      $ sudo /opt/bitnami/ctlscript.sh stop apache
      $ sudo /opt/bitnami/ctlscript.sh stop redis
      $ sudo /opt/bitnami/ctlscript.sh stop gitlab_sidekiq
      $ sudo /opt/bitnami/ctlscript.sh stop gitlab_workhorse
      $ sudo /opt/bitnami/ctlscript.sh stop gitlabci_multirunner
    
  • Create a backup of your current data. In order to perform the backup, the database servers should be running. Start the PostgreSQL and Redis servers with the following commands:

      $ sudo /opt/bitnami/ctlscript.sh start postgresql
      $ sudo /opt/bitnami/ctlscript.sh start redis
    
  • Change the working directory to the GitLab application repository:

      $ cd /opt/bitnami/apps/gitlab/htdocs/
    
  • Change to use the git user:

      $ sudo su git
    
  • Execute the following command to perform the backup:

      $ bundle exec rake gitlab:backup:create RAILS_ENV=production
    

The backups are stored in the directory /opt/bitnami/apps/gitlab/htdocs/tmp/backups.

NOTE: If you see the following error during the backup create that folder manually and after that delete the previous failed backup before trying again.

   rake aborted!
   Errno::ENOENT: No such file or directory @ realpath_rec - /opt/bitnami/apps/gitlab/htdocs/shared/lfs-objects
   /opt/bitnami/apps/gitlab/htdocs/lib/backup/files.rb:9:in `realpath'

If you see the previous error, run the following command to work around it:

   $ mkdir shared/lfs-objects
   $ bundle exec rake gitlab:backup:create RAILS_ENV=production
Step 2: Update GitLab code
  • For updating the GitLab code, follow the steps below:

      $ cd /opt/bitnami/apps/gitlab/htdocs/
      $ git fetch --all
      $ git checkout -- db/schema.rb Gemfile.lock
      $ git stash
    
  • Please replace the placeholder 8.x.y in the command below with the target version number of your installation:

      $ git checkout v8.x.y
      $ git stash pop
    
Step 3: Update GitLab Shell
  • Execute the following commands for updating the GitLab shell:

      $ cd /opt/bitnami/apps/gitlab/gitlab-shell
      $ git stash save "GitLab Shell before upgrade"
      $ git fetch
      $ git checkout v`cat /opt/bitnami/apps/gitlab/htdocs/GITLAB_SHELL_VERSION` -b v`cat /opt/bitnami/apps/gitlab/htdocs/GITLAB_SHELL_VERSION`
      $ git stash apply
    
Step 4: Update Gitlab-workhorse (requires compilation)

Compile this component from source to get the latest version.

  • Exit from git user shell:

      $ exit
    
  • Change to the temporary directory:

      $ cd /tmp
    
  • Download the proper version according to your architecture:

    • For Linux x64, run the following command:

      $ wget https://storage.googleapis.com/golang/go1.6.linux-amd64.tar.gz
      
    • For Linux x86, run the following command:

      $ wget https://storage.googleapis.com/golang/go1.6.linux-386.tar.gz
      
  • Clone GitLab-workhorse repository:

      $ git clone https://gitlab.com/gitlab-org/gitlab-workhorse.git
      $ cd gitlab-workhorse
      $ git tag -l
      $ git checkout v`cat /opt/bitnami/apps/gitlab/htdocs/GITLAB_WORKHORSE_VERSION` -b v`cat /opt/bitnami/apps/gitlab/htdocs/GITLAB_WORKHORSE_VERSION`
    

NOTE: You may need to install make with this command:

   $ sudo apt-get install make
  • Create backup:

      $ sudo mv /opt/bitnami/apps/gitlab-workhorse/gitlab-workhorse /opt/bitnami/apps/gitlab-workhorse/gitlab-workhorse.back
    
  • Move the binaries to the installation directory:

      $ sudo cp gitlab-workhorse /opt/bitnami/apps/gitlab-workhorse/gitlab-workhorse
    
  • Adjust the permissions:

      $ sudo chown git:git /opt/bitnami/apps/gitlab-workhorse/gitlab-workhorse
    
Step 5: Update gitlab-ci-multi-runner
  • Backup the previous gitlab-ci-multi-runner binary:

      $ cd /opt/bitnami/apps/gitlabci/gitlabci-multirunner
      $ sudo mv gitlab-ci-multi-runner gitlab-ci-multi-runner.back
    
  • Download the already compiled gitlab-ci-multi-runner from the following URL.

    • For Linux x64, run the following command:

      $ sudo wget -O gitlab-ci-multi-runner https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-ci-multi-runner-linux-amd64
      
    • For Linux x86, run the following command:

      $ sudo wget -O gitlab-ci-multi-runner https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-ci-multi-runner-linux-386
      
  • Adjust permissions:

      $ sudo chmod 775 gitlab-ci-multi-runner
      $ sudo chown gitlab_ci:gitlab_ci gitlab-ci-multi-runner
    
Step 6: Install new gems and database migration
  • Change the user to "git user":

      $ sudo su git
    
  • Run bundle install to install new gems:

      $ cd /opt/bitnami/apps/gitlab/htdocs/
      $ bundle install --without development test mysql --deployment
    
  • Run the database migration:

      $ bundle exec rake db:migrate RAILS_ENV=production
    

NOTE: If you see the following error during the database migration, disable the initialize script before trying again:

	git@ip-172-31-37-106:/opt/bitnami/apps/gitlab/htdocs/
	$ bundle exec rake db:migrate RAILS_ENV=production
   	rake aborted!
   	NameError: uninitialized constant GitlabCi::REGISTRATION_TOKEN
   	/opt/bitnami/apps/gitlab/htdocs/config/initializers/write_token.rb:2:in '<top (required)>'

If you see the previous error, run the following commands to work around it:

   $ mv config/initializers/write_token.rb config/initializers/write_token.rb.back
   $ bundle exec rake db:migrate RAILS_ENV=production
  • Clean up assets and cache. This could take a few minutes.

      $ bundle exec rake assets:clean assets:precompile cache:clear RAILS_ENV=production
    
Step 7: Update configuration files (optional)
  • Please replace the placeholders 8-x and 8-y in the command below with the proper numbers for your actual version and your target version in order to check if there is any new configuration option available:

      $ git diff origin/8-x-stable:config/gitlab.yml.example origin/8-y-stable:config/gitlab.yml.example
    

If there is any new feature that requires configuration it will probably be in the /opt/bitnami/apps/gitlab/htdocs/config/gitlab.yml file, which is the main GitLab configuration file.

Step 8: Check results
  • Exit from git user session if it is still in use:

      $ exit
    
  • Start the rest of the services with the general script:

      $ sudo /opt/bitnami/ctlscript.sh start
    
  • Check the environment status with the following command:

      $ bundle exec rake gitlab:env:info RAILS_ENV=production
    
  • Run the check script to see if everything is working correctly:

      $ bundle exec rake gitlab:check RAILS_ENV=production
    

NOTE: If you see the following failed check, you can ignore it. As Bitnami stacks are self-contained and isolated from the system GitLab is not being installed with init scripts. Bitnami uses a general script called ctlscript.sh to manage all the servers required by GitLab.

   Init script exists? ... no
     Try fixing it:
     Install the init script
   For more information see:
     doc/install/installation.md in section "Install Init Script"
     Please fix the error above and rerun the checks.

Upgrade process from GitLab 7.14.3 to 8.4.2

As GtiLab 7.14.3 is the latest version of GitLab 7, we strongly recommend to use this version. These steps have been tested with Bitnami GitLab Community Edition Legacy Stack 8.4.2. Using a newer version could not work as expected.

GtiLab 7.14.3 is the latest version of GitLab 7, we strongly recommend to use this version. These steps have been tested with Bitnami GitLab Community Edition Legacy Stack 8.4.2. Using a newer version could not work as expected.

Step 1: Backup Bitnami GitLab Community Edition Legacy Stack 7.14.3
  • Stop servers:

      $ cd /opt/bitnami
      $ sudo ./ctlscript.sh stop
    
  • Create a backup of your current data. In order to perform the backup, the database servers should be running. Start the PostgreSQL and Redis servers with the following commands:

      $ sudo /opt/bitnami/ctlscript.sh start postgresql
      $ sudo /opt/bitnami/ctlscript.sh start redis
    
  • Change the working directory to the GitLab application repository:

      $ cd /opt/bitnami/apps/gitlab/htdocs
    
  • Change to use the git user:

      $ sudo su git
    
  • Execute the following command to perform the backup:

      $ bundle exec rake gitlab:backup:create RAILS_ENV=production
    

NOTE: If you see the following error during the backup create that folder manually and after that delete the previous failed backup before trying again.

   rake aborted!
   Errno::ENOENT: No such file or directory @ realpath_rec - /opt/bitnami/apps/gitlab/htdocs/shared/lfs-objects
   /opt/bitnami/apps/gitlab/htdocs/lib/backup/files.rb:9:in `realpath'

If you see the previous error, run the following command to work around it:

   $ mkdir shared/lfs-objects
   $ bundle exec rake gitlab:backup:create RAILS_ENV=production
  • Save the backup and mv your installation. Please replace the placeholders TIMESTAMP in the commands below with the proper value:

      $ exit
      $ sudo cp /opt/bitnami/apps/gitlab/htdocs/tmp/backups/TIMESTAMP_gitlab_backup.tar /tmp
      $ sudo /opt/bitnami/ctlscript.sh stop
      $ sudo mv /opt/bitnami /opt/bitnami-backup
    
Step 2: Install Bitnami GitLab Community Edition Legacy Stack 8.4.2
  • You can require Bitnami GitLab Community Edition Legacy Stack 8.4.2 version in https://community.bitnami.com/

  • Stop servers:

      $ cd /opt/bitnami
      $ sudo ./ctlscript.sh stop
    
  • The database servers should be running. Start the PostgreSQL and Redis servers with the following commands:

      $ sudo /opt/bitnami/ctlscript.sh start postgresql
      $ sudo /opt/bitnami/ctlscript.sh start redis
    
Step 3: Create the necessary folders and adjust the permissions
    $ cd /opt/bitnami/apps/gitlab/htdocs
    $ sudo mkdir -p tmp/backups/
    $ sudo cp /tmp/TIMESTAMP_gitlab_backup.tar tmp/backups/
    $ sudo chmod 775 tmp/backups/
    $ sudo chown -R git:git tmp/backups/
    $ sudo mkdir -p public/uploads/
    $ sudo chmod 755 public/uploads/
    $ sudo chown git:git public/uploads/
Step 4: Update Gitlab-workhorse (requires compilation)

Compile this component from source to get the latest version. It is required to install Go.

  • Exit from git user shell:

      $ exit
    
  • Change to the temporary directory:

      $ cd /tmp
    
  • Download the proper version according to your architecture:

    • For Linux x64, run the following command:

      $ wget https://storage.googleapis.com/golang/go1.6.linux-amd64.tar.gz
      
    • For Linux x86, run the following command:

      $ wget https://storage.googleapis.com/golang/go1.6.linux-386.tar.gz
      
  • Add Go to the system PATH:

      $ tar -xzvf go1.6.linux-amd64.tar.gz
      $ sudo mv go /usr/local/
      $ export PATH=$PATH:/usr/local/go/bin
    
NOTE: In order to add Go permanently to the PATH, add the last command from above to your $HOME/.profile file.
  • Clone GitLab-workhorse repository:

      $ git clone https://gitlab.com/gitlab-org/gitlab-workhorse.git
      $ cd gitlab-workhorse
      $ git tag -l
      $ git checkout v`cat /opt/bitnami/apps/gitlab/htdocs/GITLAB_WORKHORSE_VERSION` -b v`cat /opt/bitnami/apps/gitlab/htdocs/GITLAB_WORKHORSE_VERSION`
    
  • Compile the Gitlab-workhorse code with Go:

      $ make
    

NOTE: You may need to install make with this command:

   $ sudo apt-get install make
  • Create backup:

      $ sudo mv /opt/bitnami/apps/gitlab-workhorse/gitlab-workhorse /opt/bitnami/apps/gitlab-workhorse/gitlab-workhorse.back
    
  • Move the binaries to the installation directory:

      $ sudo cp gitlab-workhorse /opt/bitnami/apps/gitlab-workhorse/gitlab-workhorse
    
  • Adjust the permissions:

      $ sudo chown git:git /opt/bitnami/apps/gitlab-workhorse/gitlab-workhorse
    
Step 5: Update gitlab-ci-multi-runner
  • Backup the previous gitlab-ci-multi-runner binary:

      $ cd /opt/bitnami/apps/gitlabci/gitlabci-multirunner
      $ sudo mv gitlab-ci-multi-runner gitlab-ci-multi-runner.back
    
  • Download the already compiled gitlab-ci-multi-runner from the following URL.

    • For Linux x64, run the following command:

      $ sudo wget -O gitlab-ci-multi-runner https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-ci-multi-runner-linux-amd64
      
    • For Linux x86, run the following command:

      $ sudo wget -O gitlab-ci-multi-runner https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-ci-multi-runner-linux-386
      
  • Adjust permissions:

      $ sudo chmod 775 gitlab-ci-multi-runner
      $ sudo chown gitlab_ci:gitlab_ci gitlab-ci-multi-runner
    
Step 6: Install new gems and database migration
  • Run bundle install to install new gems:

      $ cd /opt/bitnami/apps/gitlab/htdocs
      $ bundle install --without development test mysql --deployment
    
  • Run the database migration:

      $ bundle exec rake db:migrate RAILS_ENV=production
    

Note: If you see the following error during the database migration, disable the initialize script before trying again:

   git@ip-172-31-37-106:/opt/bitnami/apps/gitlab/htdocs$ bundle exec rake db:migrate RAILS_ENV=production
   rake aborted!
   NameError: uninitialized constant GitlabCi::REGISTRATION_TOKEN
   /opt/bitnami/apps/gitlab/htdocs/config/initializers/write_token.rb:2:in `<top (required)>'

If you see the previous error, run the following commands to work around it:

   $ mv config/initializers/write_token.rb config/initializers/write_token.rb.back
   $ bundle exec rake db:migrate RAILS_ENV=production
  • Clean up assets and cache. This could take a few minutes.

      $ bundle exec rake assets:clean assets:precompile cache:clear RAILS_ENV=production
    
Step 7: Update configuration files (optional)
  • Please replace the placeholders 8-x and 8-y in the command below with the proper numbers for your actual version and your target version in order to check if there is any new configuration option available:

      $ git diff origin/8-x-stable:config/gitlab.yml.example origin/8-y-stable:config/gitlab.yml.example
    

If there is any new feature that requires configuration it will probably be in the /opt/bitnami/apps/gitlab/htdocs/config/gitlab.yml file, which is the main GitLab configuration file.

Step 8: Check results
  • Exit from git user session if it is still in use:

      $ exit
    
  • Start the rest of the services with the general script:

      $ sudo /opt/bitnami/ctlscript.sh start
    
  • Check the environment status with the following command:

      $ bundle exec rake gitlab:env:info RAILS_ENV=production
    
  • Run the check script to see if everything is working correctly:

      $ bundle exec rake gitlab:check RAILS_ENV=production
    

NOTE: If you see the following failed check, you can ignore it. As Bitnami stacks are self-contained and isolated from the system GitLab is not being installed with init scripts. Bitnami uses a general script called ctlscript.sh to manage all the servers required by GitLab.

   Init script exists? ... no
     Try fixing it:
     Install the init script
     For more information see:
     doc/install/installation.md in section "Install Init Script"
     Please fix the error above and rerun the checks.

Keeping in sync with the GitLab repository at GitHub

  • Add some packages because they are required by GitLab for new versions:

     $ sudo apt-get install zlib1g-dev libkrb5-dev cmake
    
  • Stop all servers and start only PostgreSQL (or MySQL for GitLab < 7.11.4) and Redis servers:

     $ sudo /opt/bitnami/ctlscript.sh stop
     $ sudo /opt/bitnami/ctlscript.sh start postgresql
     $ sudo /opt/bitnami/ctlscript.sh start redis
    
  • Use the git user for running all the commands from now on:

     $ sudo su git
    
  • Update GitLab shell:

     $ cd /opt/bitnami/apps/gitlab/gitlabshell
     $ git stash
     $ git fetch https://github.com/gitlabhq/gitlab-shell
     $ git pull
     $ git checkout v2.6.3  (replace it with the latest version)
     $ git stash apply
    
  • Create a backup of GitLab:

     $ cd /opt/bitnami/apps/gitlab/htdocs
     $ bundle exec rake gitlab:backup:create RAILS_ENV=production
     Dumping database ...
     Dumping MySQL database bitnami_gitlab ... [DONE]
     done
     Dumping repositories ...
     * user/test ... [DONE]
     * user/test.wiki ...  [SKIPPED]
     done
     Dumping uploads ...
     done
     Creating backup archive: 1434969584_gitlab_backup.tar ... done
     Uploading backup archive to remote storage  ... skipped
     Deleting tmp directories ... done
     done
     done
     done
     Deleting old backups ... skipping
    
  • Check the latest stable version of GitLab and run the upgrade process replacing 'v7.11.4' with the latest stable version:

     $ ruby -Ilib -e 'require "gitlab/upgrader"' -e 'class Gitlab::Upgrader' -e 'def latest_version_raw' -e '"v7.11.4"' -e 'end' -e 'end' -e 'Gitlab::Upgrader.new.execute'
    
     GitLab 7 upgrade tool
     Your version is 7.10.5
     Latest available version for GitLab 7 is 7.11.4
     Newer GitLab version is available
     Do you want to upgrade (yes/no)? yes
     Stash changed files
      -> git stash
     Saved working directory and index state WIP on (no branch): 489b413 Version 7.10.5
     HEAD is now at 489b413 Version 7.10.5
      -> OK
     Get latest code
      -> git fetch
      -> OK
     Switch to new version
      -> git checkout v7.11.4
     Previous HEAD position was 489b413... Version 7.10.5
     HEAD is now at b725318... Version 7.11.4
      -> OK
     Install gems
      -> bundle
     Fetching source index from https://rubygems.org/
     Using rake 10.4.2
     ...
     Your bundle is complete!
     Gems in the groups development, test, sqlite, test and sqlite were not installed.
     It was installed into ./vendor/bundle
     Post-install message from httparty:
     When you HTTParty, you must party hard!
      -> OK
     Migrate DB
      -> bundle exec rake db:migrate
     ...
      -> OK
     Recompile assets
      -> bundle exec rake assets:clean assets:precompile
     I, [2015-06-22T11:42:34.973207 #3133]  INFO -- : Writing /opt/bitnami/apps/gitlab/htdocs/public/assets/application-f60a4fe80499ba2aeedc1dc58238c410.js
     I, [2015-06-22T11:42:49.065350 #3133]  INFO -- : Writing /opt/bitnami/apps/gitlab/htdocs/public/assets/application-69698dee48dd3b4bce21deab8d242316.css
      -> OK
     Clear cache
      -> bundle exec rake cache:clear
      -> OK
     Done
    
  • Log out as the git user and start the servers again:

     $ sudo /opt/bitnami/ctlscript.sh start
    

You should see the new version in your GitLab admin panel.

GitLab upgrade

Migration process for GitLab with MySQL (GitLab < 7.11.4)

Migrate the database from an old version to a new one:

  • Back up the gitlab, gitlab_ci databases, the .ssh file in the git and gitlab_ci directories and the uploads folder.

     $ cd /opt/bitnami
     $ /opt/bitnami/mysql/bin/mysqldump -u root -p bitnami_gitlab > bitnami_gitlab_bk.sql
     $ /opt/bitnami/mysql/bin/mysqldump -u root -p bitnami_gitlabci > bitnami_gitlabci_bk.sql
     $ cp -r /home/git/.ssh PATH_TO_BACKUP/git/.ssh
     $ cp -r /home/gitlab_ci/.ssh PATH_TO_BACKUP/gitlab_ci/.ssh
     $ cp -r /opt/bitnami/apps/gitlab/htdocs/public/uploads PATH_TO_BACKUP/uploads
    
  • Start the new Gitlab version.

  • Copy the repositories and .ssh backups to the new version server.

  • Stop all servers and start only MySQL. Note that the installation directory could be different.

     $ sudo /opt/bitnami/ctlscript.sh stop
     $ sudo /opt/bitnami/ctlscript.sh start mysql
    
  • Remove the databases and add back the old ones.

     $ sudo /opt/bitnami/use_gitlab
     $ mysql -u root -p
    
     mysql> drop database bitnami_gitlab;
     mysql> create database bitnami_gitlab;
     mysql> grant all privileges on bitnami_gitlab.* to 'bitnami'@'localhost' identified by 'password';
     mysql> grant all privileges on bitnami_gitlab.* to 'gitlab'@'localhost' identified by 'password';
     mysql> flush privileges;
     mysql> drop database bitnami_gitlabci;
     mysql> create database bitnami_gitlabci;
     mysql> grant all privileges on bitnami_gitlabci.* to 'bitnami'@'localhost' identified by 'password';
     mysql> grant all privileges on bitnami_gitlab.* to 'gitlab'@'localhost' identified by 'password';
     mysql> flush privileges;
    
     mysql -u root -p bitnami_gitlab < PATH_TO_BACKUP/bitnami_gitlab_bk.sql
     mysql -u root -p bitnami_gitlabci < PATH_TO_BACKUP/bitnami_gitlabci_bk.sql
    
  • Update configuration files in the new version so that they correspond to the old version ones. At least you have to update the database.yml files, so open them with a text editor and modify the password fields with the password provided to the database in the previous step. There will be two database.yml files at /opt/bitnami/apps/gitlab/htdocs/config/database.yml and /opt/bitnami/apps/gitlabci/htdocs/config/database.yml.

  • Copy the .ssh backup files and the to the new server

     $ cp -r PATH_TO_BACKUP/git/.ssh /home/git/.ssh
     $ cp -r PATH_TO_BACKUP/gitlab_ci/.ssh /home/gitlab_ci/.ssh
     $ cp -r PATH_TO_BACKUP/uploads /opt/bitnami/apps/gitlab/htdocs/public/uploads
    
  • Run the following command:

     $ cd /opt/bitnami/apps/gitlab/htdocs
     $ bundle install --deployment --without development test sqlite postgres --binstubs
    
  • Log in as the git user and update the database. It may be necessary to also update the database schema as discussed in the GitLab documentation:

     $ sudo su git
     $ ruby bin/rake db:migrate RAILS_ENV=production
     $ exit
    
  • Fix the dashboard.

     $ cd /opt/gitlab/apps/gitlab/htdocs
     $ ruby bin/rake migrate_iids RAILS_ENV=production
    
  • Check with the following command:

     $ bundle exec rake gitlab:check RAILS_ENV=production
    
  • Restart services:

     $ sudo /opt/bitnami/ctlscript.sh restart
    
Troubleshooting

If you get a "Satellite doesn't exist" message during the upgrade, please run the following commands:

    $ sudo su git
    $ bundle exec rake gitlab:satellites:create RAILS_ENV=production
    $ exit

Upgrade Gitlab-shell

To upgrade Gitlab-shell to the specific version of Gitlab you have to check the version of Gitlab-shell that your Gitlab needs. You will find a file called GITLAB_SHELL_VERSION in the repository of the specific version of Gitlab that contains the version of Gitlab-shell.

After that, you will need to update Gitlab-shell as follows:

  • Go to your gitlab-shell folder:

     $ /opt/bitnami/apps/gitlab/gitlab-shell
    
  • Change the user.

     $ sudo su git
    
  • Run the following commands, changing the version as needed:

     $ git stash
     $ git fetch https://github.com/gitlabhq/gitlab-shell
     $ git pull
     $ git checkout v2.6.3
     $ git stash apply
     $ git stash drop
    
  • Change the directory to /opt/bitnami/apps/gitlab/htdocs/ and run the following commands:

     $ cd /opt/bitnami/apps/gitlab/htdocs/
     $ bundle install --deployment --without development test sqlite --binstubs
     $ ruby bin/rake db:migrate RAILS_ENV=production
     $ ruby bin/rake migrate_iids RAILS_ENV=production
     $ bundle exec rake gitlab:satellites:create RAILS_ENV=production
    
  • Now run the rewrite-hooks script

     $ cd /opt/bitnami/apps/gitlab/gitlab-shell/support
     $ ./rewrite-hooks.sh /opt/gitlab/apps/gitlab/repositories
    
  • Change the directory to /opt/bitnami/apps/gitlab/htdocs and run the following commands:

     $ cd /opt/bitnami/apps/gitlab/htdocs/
     $ bundle exec bin/rake gitlab:check RAILS_ENV=production
    

Your Gitlab-shell will be upgraded.

Keeping in sync with the GitLab repository at GitHub

Since the GitLab application is changing very fast, the Bitnami GitLab Community Edition Legacy Stack includes the .git files necessary to sync with the repository.

IMPORTANT: This is an advanced feature that should be used only by someone that knows the application and what is happening at every step of the process described below. A backup of the application directory should be done before moving forward.

As some configuration parameters are adjusted during the installation, there will be some differences between the installed version and the repository even if the installer was built recently.

To synchronize GitLab with its repository at GitHub, follow the steps below:

  • Stop the GitLab Sidekiq service:

     $ cd /opt/bitnami
     $ sudo /opt/bitnami/ctlscript.sh stop gitlab_sidekiq
     $ cd apps/gitlab/htdocs/
     $ sudo su git
    
  • Bitnami modifies both Gemfile and Gemfile.lock files file in order to allow an offline installation. You should check them out and run bundle install after the git checkout:

     $ git checkout Gemfile*
     $ git fetch
     $ git checkout BRANCH (where BRANCH is, for instance, *master* or *5-2-stable*)
    
  • Log in as the root user or use sudo to run the following command:

     $ bundle install --deployment --without development test sqlite postgres --binstubs
    
  • Log in as the git user and update the database. It may be necessary to also update the database schema as discussed in the GitLab documentation:

     $ su git
     $ ruby bin/rake db:migrate RAILS_ENV=production
    
  • Restart services:

     $ sudo /opt/bitnami/ctlscript.sh start gitlab_sidekiq
     $ sudo /opt/bitnami/ctlscript.sh restart apache
    

Now, the GitLab application is up to date.

Troubleshooting

The Charlock_holmes gem requires a modification in the Ruby config.h file. If you find problems compiling it, add the following entry in the /opt/bitnami/ruby/includes/ruby-1.9.1/x86_64-linux/ruby/config.h file:

  #define HAVE_EACCESS 1

How to create an SSL certificate?

OpenSSL is required to create an SSL certificate. A certificate request can then be sent to a certificate authority (CA) to get it signed into a certificate, or if you have your own certificate authority, you may sign it yourself, or you can use a self-signed certificate (because you just want a test certificate or because you are setting up your own CA).

Follow the steps below:

  • Generate a new private key:

     $ sudo openssl genrsa -out /opt/bitnami/apache2/conf/server.key 2048
    
  • Create a certificate:

     $ sudo openssl req -new -key /opt/bitnami/apache2/conf/server.key -out /opt/bitnami/apache2/conf/cert.csr
    
    IMPORTANT: Enter the server domain name when the above command asks for the "Common Name".
  • Send cert.csr to the certificate authority. When the certificate authority completes their checks (and probably received payment from you), they will hand over your new certificate to you.

  • Until the certificate is received, create a temporary self-signed certificate:

     $ sudo openssl x509 -in /opt/bitnami/apache2/conf/cert.csr -out /opt/bitnami/apache2/conf/server.crt -req -signkey /opt/bitnami/apache2/conf/server.key -days 365
    
  • Back up your private key in a safe location after generating a password-protected version as follows:

     $ sudo openssl rsa -des3 -in /opt/bitnami/apache2/conf/server.key -out privkey.pem
    

    Note that if you use this encrypted key in the Apache configuration file, it will be necessary to enter the password manually every time Apache starts. Regenerate the key without password protection from this file as follows:

     $ sudo openssl rsa -in privkey.pem -out /opt/bitnami/apache2/conf/server.key
    

Find more information about certificates at http://www.openssl.org.

How to enable HTTPS support with SSL certificates?

NOTE: The steps below assume that you are using a custom domain name and that you have already configured the custom domain name to point to your cloud server.

Bitnami images come with SSL support already pre-configured and with a dummy certificate in place. Although this dummy certificate is fine for testing and development purposes, you will usually want to use a valid SSL certificate for production use. You can either generate this on your own (explained here) or you can purchase one from a commercial certificate authority.

Once you obtain the certificate and certificate key files, you will need to update your server to use them. Follow these steps to activate SSL support:

  • Use the table below to identify the correct locations for your certificate and configuration files.

    Variable Value
    Current application URL https://[custom-domain]/
      Example: https://my-domain.com/ or https://my-domain.com/appname
    Apache configuration file /opt/bitnami/apache2/conf/bitnami/bitnami.conf
    Certificate file /opt/bitnami/apache2/conf/server.crt
    Certificate key file /opt/bitnami/apache2/conf/server.key
    CA certificate bundle file (if present) /opt/bitnami/apache2/conf/server-ca.crt
  • Copy your SSL certificate and certificate key file to the specified locations.

    NOTE: If you use different names for your certificate and key files, you should reconfigure the SSLCertificateFile and SSLCertificateKeyFile directives in the corresponding Apache configuration file to reflect the correct file names.
  • If your certificate authority has also provided you with a PEM-encoded Certificate Authority (CA) bundle, you must copy it to the correct location in the previous table. Then, modify the Apache configuration file to include the following line below the SSLCertificateKeyFile directive. Choose the correct directive based on your scenario and Apache version:

    Variable Value
    Apache configuration file /opt/bitnami/apache2/conf/bitnami/bitnami.conf
    Directive to include (Apache v2.4.8+) SSLCACertificateFile "/opt/bitnami/apache2/conf/server-ca.crt"
    Directive to include (Apache < v2.4.8) SSLCertificateChainFile "/opt/bitnami/apache2/conf/server-ca.crt"
    NOTE: If you use a different name for your CA certificate bundle, you should reconfigure the SSLCertificateChainFile or SSLCACertificateFile directives in the corresponding Apache configuration file to reflect the correct file name.
  • Once you have copied all the server certificate files, you may make them readable by the root user only with the following commands:

     $ sudo chown root:root /opt/bitnami/apache2/conf/server*
    
     $ sudo chmod 600 /opt/bitnami/apache2/conf/server*
    
  • Open port 443 in the server firewall. Refer to the FAQ for more information.

  • Restart the Apache server.

You should now be able to access your application using an HTTPS URL.

How to force HTTPS redirection with Apache?

Add the following to the top of the /opt/bitnami/apps/gitlab/conf/httpd-prefix.conf file:

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]

After modifying the Apache configuration files:

  • Open port 443 in the server firewall. Refer to the FAQ for more information.

  • Restart Apache to apply the changes.

How to debug Apache errors?

Once Apache starts, it will create two log files at /opt/bitnami/apache2/logs/access_log and /opt/bitnami/apache2/logs/error_log respectively.

  • The access_log file is used to track client requests. When a client requests a document from the server, Apache records several parameters associated with the request in this file, such as: the IP address of the client, the document requested, the HTTP status code, and the current time.

  • The error_log file is used to record important events. This file includes error messages, startup messages, and any other significant events in the life cycle of the server. This is the first place to look when you run into a problem when using Apache.

If no error is found, you will see a message similar to:

Syntax OK

How to find the PostgreSQL database credentials?

How to connect to the PostgreSQL database?

You can connect to the PostgreSQL database from the same computer where it is installed with the psql client tool.

$ psql -U postgres

You will be prompted to enter the *postgres* user password. This is the same as the [application password](/virtual-machine/faq#how-to-find-application-credentials).

How to access phpPgAdmin?

For security reasons, phpPgAdmin is accessible only when using 127.0.0.1 as the hostname. To access it from a remote system, you must create an SSH tunnel that routes requests to the Apache Web server from 127.0.0.1. This implies that you must be able to connect to your server over SSH in order to access these applications remotely.

IMPORTANT: Before following the steps below, ensure that your Apache and PostgreSQL servers are running.
NOTE: The steps below suggest using port 8888 for the SSH tunnel. If this port is already in use by another application on your local machine, replace it with any other port number greater than 1024 and modify the steps below accordingly. Similarly, if you have enabled Varnish, your stack's Apache Web server might be running on port 81. In this case, modify the steps below to use port 81 instead of port 80 for the tunnel endpoint.

Accessing phpPgAdmin on Windows

In order to access phpPgAdmin via SSH tunnel you need an SSH client. In the instructions below we have selected PuTTY, a free SSH client for Windows and UNIX platforms. The first step is having PuTTY configured. Please, check how to configure it in the section how to connect to the server through SSH using an SSH client on Windows.

Once you have your SSH client correctly configured and you tested that you can successfully access to your instance via SSH, you need to create an SSH tunnel in order to access phpPgAdmin. For doing so, follow these steps:

  • In the "Connection -> SSH -> Tunnels" section, add a new forwarded port by introducing the following values:

    • Source port: 8888
    • Destination: localhost:80

    This will create a secure tunnel by forwarding a port (the "destination port") on the remote server to a port (the "source port") on the local host (127.0.0.1 or localhost).

  • Click the "Add" button to add the secure tunnel configuration to the session. (You'll see the added port in the list of "Forwarded ports").

    PuTTY configuration

  • In the "Session" section, save your changes by clicking the "Save" button.
  • Click the "Open" button to open an SSH session to the server. The SSH session will now include a secure SSH tunnel between the two specified ports.
  • Access the phpPgAdmin console through the secure SSH tunnel you created, by browsing to http://127.0.0.1:8888/phppgadmin.
  • Log in to phpPgAdmin by using the following credentials:

    • Username: postgres
    • Password: application password. (Refer to our FAQ to learn how to find your application credentials).

Here is an example of what you should see:

phpPgAdmin

If you are unable to access phpPgAdmin, verify that the SSH tunnel was created by checking the PuTTY event log (accessible via the "Event Log" menu):

PuTTY configuration

Accessing phpPgAdmin on Linux and Mac OS X

To access the application using your Web browser, create an SSH tunnel, as described below.

  • Open a new terminal window on your local system (for example, using "Finder -> Applications -> Utilities -> Terminal" in Mac OS X or the Dash in Ubuntu).
  • Run the following command, remembering to replace SERVER-IP with the public IP address or hostname of your server. Enter your SSH password when prompted.

         $ ssh -N -L 8888:127.0.0.1:80 bitnami@SERVER-IP
    
NOTE: If successful, the above command will create an SSH tunnel but will not display any output on the server console.
  • Access the phpPgAdmin console through the secure SSH tunnel you created, by browsing to http://127.0.0.1:8888/phppgadmin.
  • Log in to phpPgAdmin by using the following credentials:

    • Username: postgres
    • Password: application password. (Refer to our FAQ to learn how to find your application credentials).

Here is an example of what you should see:

phpPgAdmin

How to modify PHP settings?

The PHP configuration file allows you to configure the modules enabled, the email settings or the size of the upload files. It is located at /opt/bitnami/php/etc/php.ini.

For example, to modify the default upload limit for PHP, update the PHP configuration file following these instructions.

After modifying the PHP configuration file, restart both Apache and PHP-FPM for the changes to take effect:

$ sudo /opt/bitnami/ctlscript.sh restart apache
$ sudo /opt/bitnami/ctlscript.sh restart php-fpm

How to modify the allowed limit for uploaded files?

Modify the following options in the /opt/bitnami/php/etc/php.ini file to increase the allowed size for uploads:

; Maximum size of POST data that PHP will accept.
post_max_size = 16M

; Maximum allowed size for uploaded files.
upload_max_filesize = 16M

Restart PHP-FPM and Apache for the changes to take effect.

$ sudo /opt/bitnami/ctlscript.sh restart apache
$ sudo /opt/bitnami/ctlscript.sh restart php-fpm    

Troubleshooting GitLab Legacy

If you see this GitLab error:

  http.rb:763:in `initialize': getaddrinfo: Temporary failure in name resolution (SocketError)

Check that the domain name returns the correct IP address. You can also add the domain name in the /etc/hosts file so gitlab-shell will resolve the domain to 127.0.0.1.

  127.0.0.1     example.com

How to debug errors in GitLab Legacy?

The Gitlab log is stored at /opt/bitnami/apps/gitlab/htdocs/log/production.log. Check this log file if the Sidekiq server cannot be started.

How to change the default address for GitLab?

It is advisable to use a host name instead of an IP address for Gitlab. However, we recommend not using git. in the host name, as this causes problems when accessing Gitlab over HTTP.

Follow these steps:

  • At the server console, run the following command:

     $ sudo /opt/bitnami/apps/gitlab/bnconfig --machine_hostname NAME
    
    IMPORTANT: If you've configured GitLab to use a static domain name, remove or rename the /opt/bitnami/apps/gitlab/bnconfig file to avoid it being reset on the next system reboot. Read more about this tool.

    Alternatively, configure this manually, by modifying the host parameter in the /opt/bitnami/apps/gitlab/htdocs/config/gitlab.yml file:

     host: NAME
    

    In previous versions (GitLab 4.x), it was also necessary to change the ssh_host parameter:

     ssh_host: NAME
    
  • Add the domain in the /etc/hosts file:

     127.0.0.1    NAME
    
  • Restart the Apache server:

     $ sudo /opt/bitnami/ctlscript.sh restart apache
    

How to edit and commit files from the GitLab application?

The GitLab web application allows you to edit a file and commit the changes into the repository. To enable this feature, it is necessary to create the satellites repository. If this repository is missing, you will see an error in the production.log file like this: "RuntimeError: Satellite doesn't exist".

To create this, run the following command after creating a project:

$ sudo su git
$ cd /opt/bitnami/apps/gitlab/htdocs
$ bundle exec bin/rake gitlab:satellites:create RAILS_ENV=production

Now you can edit and commit changes into the repository from the GitLab application itself.

How to push your changes to the GitLab application?

Once you have uploaded your public key to Gitlab, you can upload your repository to the application. These are the basic steps:

$ git config --global user.name "Your full name"
$ git config --global user.email "user@example.com"
$ git checkout master
$ git remote add origin git@SERVER-IP:test/test.git
$ git push -u origin master

How to run rake commands?

To run rake commands, use the rake script located inside the /opt/bitnami/apps/gitlab/htdocs/bin directory.

$ cd /opt/bitnami/apps/gitlab/htdocs
$ ruby bin/rake RAKE_COMMAND

How to use GitLab CI integrated with GitLab?

IMPORTANT: For this integration, the domain name of the machine is set in the configuration files of the repositories that are cloned internally. If the domain of the machine change, GitLab and GitLab CI will continue working automatically, but the internal clone of the repositories will fail. Also, the necessary information for the integration of each project will be out of date too. To fix it, these steps must be repeated for all existing projects.

The Bitnami GitLab stack also ships GitLab CI.

  • GitLab is accessible at http://SERVER-IP:PORT/gitlab
  • GitLab CI is accessible at http://SERVER-IP:PORT/gitlabci

GitLab and GitLab CI have been designed to work jointly, so that when a commit is done on a GitLab project, for instance, GitLab CI is able to detect it and run any defined task. An example of this configuration is described below.

For GitLab versions > 5.4 with GitLab CI 3.0.0

  • Add a project in GitLab.

GitLab project

  • Add the same project on GitLab CI. To do so, log in to GitLab CI. Click the "GitLab Projects" link and the "Add" button of the project.

GitLab CI project

  • Add a runner to the new project. Go to the "Runners" menu inside the project created and click "Add" to add the existing runner to the current project.

GitLab CI runner

  • Enable the service "GitLab CI" on the project at GitLab. In GitLab CI, go to the "Integration" menu of the current project and copy the token and the URL. In GitLab, in the same project, go to the "Services" menu. Add the copied information, tick to activate the service and press both "Save" and "Test" settings. A green circle will appear if everything is correct.

GitLab CI services

The integration is complete! A first build will start automatically in GitLab CI.

GitLab CI integration

For GitLab versions < 5.4 with GitLab CI 2.2.0

  • Add a project on GitLab.

GitLab project

  • Create a SSH key for the gitlab_ci user in this machine without a password. This key will allow GitLab CI to have read access to any chosen repository:

     $ sudo su gitlab_ci -c "ssh-keygen -t rsa"
    
  • Add this key in "Deploy Keys" in the GitLab project. In GitLab, go to the "Projects -> Bitnami sample project -> Settings -> Deploy Keys -> Add deploy key" menu. Paste the key generated earlier and save it.

GitLab keys

  • On your client (if it is different from the server you are using to host the GitLab server), start the repository as it is described at GitLab. This step is not related to the integration with GitLab CI but the repository should be started to complete the integration. Add your personal key under "My profile -> SSH Keys" and run the following commands for a new repository:

     $ mkdir bitnami-sample-project
     $ cd bitnami-sample-project
     $ git init
     $ touch README
     $ git add README
     $ git commit -m 'first commit'
     $ git remote add origin git@DOMAIN:bitnami-sample-project.git
     $ git push -u origin master
    
  • Clone the repository with the gitlab_ci user on the GitLab server.

     $ sudo su gitlab_ci -c "mkdir /opt/bitnami/apps/gitlabci/repositories"
     $ sudo su gitlab_ci -c "/opt/bitnami/git/bin/git config --global user.name 'Administrator'"
     $ sudo su gitlab_ci -c "/opt/bitnami/git/bin/git config --global user.email 'user@example.com'"
     $ sudo su gitlab_ci -c "cd /opt/bitnami/apps/gitlabci/repositories/ && /opt/bitnami/git/bin/git clone $ git@DOMAIN:bitnami-sample-project.git"
        
     Cloning into 'bitnami-sample-project'...
     remote: Counting objects: 3, done.
     Receiving objects: 100% (3/3), 201 bytes, done.
     remote: Total 3 (delta 0), reused 0 (delta 0)
    
  • Create the project on GitLab CI by click the "Add project" link in the GitLab CI application. Add the parameters described below and save it.

     Name: bitnami-sample-project
     Token: (blank)
     Path: /opt/bitnami/apps/gitlabci/repositories/bitnami-sample-project
     Follow branches: master
     Scripts: ls
    
  • Once created, click the "Details" menu. "Project URL" and "Project Token" are required for the next step.

  • Enable GitLab CI for the repository created on GitLab. To do so, go to GitLab and use the "Projects -> Bitnami sample project -> Settings -> Services -> GitLab CI" menu. Select "Active" and fill "Project URL" and "Project Token" with the values from the previous step. Save the changes.

GitLab CI values

GitLab integration with GitLab CI is complete! It can be tested by committing a new file (for instance) from your client (if it is different from the server you are using to host the GitLab server). Then, GitLab CI will show the following:

GitLab CI integration

How to use your .pem file to pull or push?

You can use your server .pem file instead of creating a new key pair.

  • Get your .pem public key, by running the following command:

       $ ssh-keygen -y -f KEYFILE
    
  • Add this key to Gitlab using the application API.

  • Edit (or create if not exists) ~/.ssh/config and add the following lines, replacing SERVER-IP with the IP address or domain name of the GitLab server if necessary and KEYFILE with the full path to the .pem file.

       Host SERVER-IP 
       IdentityFile KEYFILE
    
virtualMachine

Bitnami Documentation