One place for hosting & domains

      GitLab

      Deploy GitLab with One-Click Apps


      Updated by Linode

      Contributed by

      Linode

      GitLab One-Click App

      GitLab is a complete solution for all aspects of your software development. At its core, GitLab serves as your centralized remote Git repository. GitLab also features built-in tools that represent every task in your development workflow, from planning to testing to releasing.

      Self-hosting your software development with GitLab offers total control of your codebase. At the same time, its familiar interface will ease collaboration for you and your team. GitLab is the most popular self-hosted Git repository software, so you’ll benefit from a robust set of integrated tools and an active community.

      Deploy a GitLab One-Click App

      One-Click Apps allow you to easily deploy software on a Linode using the Linode Cloud Manager. To access Linode’s One-Click Apps:

      1. Log in to your Linode Cloud Manager account.

      2. From the Linode dashboard, click on the Create button in the top left-hand side of the screen and select Linode from the dropdown menu.

      3. The Linode creation page will appear. Select the One-Click tab.

      4. Under the Select App section, select the app you would like to deploy:

        Select a One-Click App to deploy

      5. Once you have selected the app, proceed to the app’s Options section and provide values for the required fields.

      GitLab Options

      You can configure your GitLab App by providing values for the following fields:

      Field Description
      Domain Your GitLab site’s domain name. This domain will also be used by Postfix to send mail. Setting a value for this field will not automatically set up DNS for your app, so be sure to follow the DNS instructions in the Access your GitLab Site section. If you do not have a domain name, you can leave this field blank and Postfix will use your Linode’s default Reverse DNS to send email instead (i.e. gitlab@li926-227.members.linode.com). Advanced Configuration.
      SSH public key Your SSH public key. The public key will be stored in the /root/.ssh/authorized_keys file on your Linode. Advanced Configuration.

      Linode Options

      After providing the app specific options, provide configurations for your Linode server:

      Configuration Description                                                                                              
      Select an Image Debian 9 is currently the only image supported by the GitLab One-Click App, and it is pre-selected on the Linode creation page. Required.
      Region The region where you would like your Linode to reside. In general, it’s best to choose a location that’s closest to you. For more information on choosing a DC, review the How to Choose a Data Center guide. You can also generate MTR reports for a deeper look at the network routes between you and each of our data centers. Required.
      Linode Plan Your Linode’s hardware resources. We recommend that you use, at minimum, an 8GB Linode plan for your GitLab server. For more information on GitLab’s system requirements see their official documentation. If you decide that you need more or fewer hardware resources after you deploy your app, you can always resize your Linode to a different plan. Required.
      Linode Label The name for your Linode, which must be unique between all of the Linodes on your account. This name will be how you identify your server in the Cloud Manager’s Dashboard. Required.
      Root Password The primary administrative password for your Linode instance. This password must be provided when you log in to your Linode via SSH. It must be at least 6 characters long and contain characters from two of the following categories: lowercase and uppercase case letters, numbers, and punctuation characters. Your root password can be used to perform any action on your server, so make it long, complex, and unique. Required.

      When you’ve provided all required Linode Options, click on the Create button. Your GitLab app will complete installation anywhere between 3-7 minutes after your Linode has finished provisioning.

      Getting Started after Deployment

      Access your GitLab Site

      After GitLab has finished installing, you will be able to access your GitLab site over http:// with your Linode’s IPv4 address or the domain name entered when deploying your GitLab One-Click App.

      1. Access your GitLab instance:

        With your Linode’s IP Address

        You will be able to access your GitLab site by copying your Linode’s IPv4 address and entering it in the browser of your choice. To find your Linode’s IPv4 address:

        1. Click on the Linodes link in the sidebar. You will see a list of all your Linodes.

        2. Find the Linode you just created when deploying your app and select it.

        3. Navigate to the Networking tab.

        4. Your IPv4 address will be listed under the Address column in the IPv4 table.

        5. Copy and paste the IPv4 address into a browser window. Ensure you are using http://.

        With a Domain Name

        If you deployed your GitLab One-Click App with a value set for the Domain field, you will need to separately set up DNS for your app. Specifically, you’ll need to create an A record associated with the IPv4 address for your Linode. Review the DNS Manager guide for instructions on setting up DNS records.

        Once your DNS records are created (and the changes have propagated to your internet service provider), you can then enter the domain name in a browser window to access your GitLab site. Ensure you are using http:// when visiting your site.

        Note

      2. Once you have accessed your GitLab site, you will be brought to GitLab’s password reset screen. Provide a secure password for the administrator’s account:

        Create a password for the adminstrator's account.

      3. You will be redirected to the login screen. Enter root as the username and the password you just created to log in. You can now begin creating GitLab repositories, users, and more. See GitLab’s official documentation for more information.

      Add a Domain after Deploying your GitLab Instance

      If you configured your GitLab One-Click App without providing a domain, you can configure one after the app has been deployed. Begin by setting up DNS for your domain:

      1. Create an A record associated with the IPv4 address for your Linode. Review the DNS Manager guide for instructions on setting up DNS records.

      2. Wait for your new DNS records to propagate to your internet service provider.

      After setting up DNS, you will need to update your GitLab instance’s /etc/gitlab/gitlab.rb file with your domain name. This will ensure that any emails sent to users by the GitLab instance will use your site’s domain.

      1. Connect to your Linode via SSH.

      2. With a text editor of your choice (nano, for example), open the /etc/gitlab/gitlab.rb file and modify the value of external_url. Ensure you replace http://example.com with your domain:

        /etc/gitlab/gitlab.rb
        1
        2
        3
        4
        5
        
        ## GitLab URL
        ##! URL on which GitLab will be reachable.
        ##! For more details on configuring external_url see:
        ##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
        external_url 'http://example.com'
      3. Issue the following command to enable your new configuration:

        gitlab-ctl reconfigure
        
      4. Navigate to the domain in a browser window and verify that you are directed to your GitLab instance.

      Software Included

      The GitLab One-Click App will install the following required software on your Linode:

      Software Description
      GitLab Remote Git repository software.
      Postfix Postfix is a free and open-source mail transfer agent that routes and delivers electronic mail.
      UFW Firewall utility. Ports 22/tcp, 80/tcp, 443/tcp, 25, 587, and 110 for IPv4 and IPv6 will allow outgoing and incoming traffic.
      Fail2ban Fail2Ban is an intrusion prevention software framework that protects computer servers from brute-force attacks.

      More Information

      You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.

      Find answers, ask questions, and help others.

      This guide is published under a CC BY-ND 4.0 license.



      Source link

      Install GitLab on Ubuntu 18.04


      Updated by Linode

      Contributed by

      Linode

      GitLab is a complete solution for all aspects of your software development life-cycle. At its core, GitLab serves as your centralized Git repository. It also features built-in tools that represent every task in your development workflow, from planning to testing to releasing. You can host your own GitLab instance on a Linode, instead of using third-party hosting. Self-hosting your software development with GitLab offers total control of your codebase while providing an easy to use interface for team members. GitLab is the most popular self-hosted Git repository, so you’ll benefit from a robust set of integrated tools and an active community.

      This guide will walk you through the steps to install GitLab on an 8GB Linode running Ubuntu 18.04. This installation can support up to 100 users.

      System Requirements

      Before installing GitLab you should consider how many users will collaborate on your self-hosted instance, the size of the repositories you will store, and the recommended minimum system requirements. This criteria will will effect the needed storage, CPU, and memory. This guide will use an 8GB Linode plan to fulfill GitLab’s minimum system requirements. The suggested hardware is as follows:

      • Storage The required storage depends on the size of the repositories you will store in GitLab. You should plan to have at least as much free space as all the repositories combined require.
      • CPU: 2 cores is the recommended number and supports up to 500 users. While you can use 1 CPU core to support 100 users, the application may run slower because all workers and background jobs will run on the same core.
      • Memory: 8 GB to support up to 100 users.

      Before You Begin

      1. Familiarize yourself with our Getting Started guide and complete the steps for setting your Linode’s hostname and timezone.

      2. This guide will use sudo wherever possible. Complete the sections of our Securing Your Server to create a standard user account, harden SSH access and remove unnecessary network services.

      3. Add a domain zone, NS record, and A/AAA record for the domain you will use to access your GitLab installation. See the DNS Manager guide for details. If you will access your GitLab instance via your Linode’s IP address, you can skip this step.

      4. Create an SSL Certificate, if you will be using SSL encryption for your domain (this is recommended). Be sure to note the location that Certbot uses to store all generated keys and issued certificates.

      5. Update your system:

        sudo apt-get update && sudo apt-get upgrade
        

      Install GitLab

      1. Install all required dependencies:

        sudo apt-get install -y curl openssh-server ca-certificates
        
      2. Install Postfix to send email notifications:

        sudo apt-get install -y postfix
        

        When prompted, select Internet Site and press Enter. Use your server’s external DNS for mail name and press Enter.

      3. Add the GitLab package repository:

        curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash
        
      4. Install the GitLab package. Replace gitlab.example.com with the domain you will use to access your GitLab installation. The installation will automatically configure and start GitLab.

        sudo EXTERNAL_URL="http://gitlab.example.com" apt-get install gitlab-ee
        
      5. In your browser of choice, navigate to the URL you provided in the previous step. You will be redirected to GitLab’s password reset screen. You should provide a password for the GitLab administrator account.

        GitLab password reset

      6. You will be redirected to the login screen. Enter root as the username and the password you just created to log in.

        GitLab welcome screen

      Configure SSL Encryption

      Note

      If you did not generate an SSL certificate using Certbot prior to the installation of GitLab, you may need to first stop GitLab and then generate the SSL certificate to bypass any errors related to Certbot’s certificate challenge. To stop GitLab run the following command:

        sudo gitlab-ctl stop
      

      Once you are done generating the certificate, restart GitLab with the following command:

        sudo gitlab-ctl start
      
      1. Edit the /etc/gitlab/gitlab.rb to use HTTPS. This is done by modifying the value of external_url to use https instead of http:

        /etc/gitlab/gitlab.rb
        1
        2
        3
        4
        5
        6
        
        ## GitLab URL
        ##! URL on which GitLab will be reachable.
        ##! For more details on configuring external_url see:
        ##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
        external_url 'https://gitlab.example.com'
              
      2. Edit the /etc/gitlab/gitlab.rb file to point to the location of your SSL certificate and key. The path should be the location used by Certbot to store the certificates when they were initially created.

        /etc/gitlab/gitlab.rb
        1
        2
        3
        
        nginx['ssl_certificate'] = "/etc/letsencrypt/live/gitlab.example.com/fullchain.pem"
        nginx['ssl_certificate_key'] = "/etc/letsencrypt/live/gitlab.example.com/privkey.pem"
              
      3. Redirect all HTTP traffic to HTTPS:

        /etc/gitlab/gitlab.rb
        1
        2
        
        nginx['redirect_http_to_https'] = true
              
      4. Issue the following command to enable your new configurations:

        sudo gitlab-ctl reconfigure
        
      5. Navigate to your GitLab instance domain and verify that you are directed to https.

      You are now ready to begin using GitLab as your remote version control system. Refer to GitLab’s official documentation for details on how to get started administering your GitLab instance.

      More Information

      You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.

      Find answers, ask questions, and help others.

      This guide is published under a CC BY-ND 4.0 license.



      Source link

      Install GitLab with Docker


      Updated by Linode

      Contributed by

      Linode

      GitLab is a free Git repository management application, like GitHub or Bitbucket, that you can run on your own Linode. This guide will show you how to install GitLab using the official GitLab Docker image.

      The GitLab application has a number of services it depends on, including PostgreSQL, Nginx, and Redis. A major benefit of using Docker to install GitLab is that these dependencies are isolated to a single easy-to-update and self-contained image.

      Before You Begin

      Choose An Appropriately Sized Linode

      GitLab is a resource-intensive application. To get the most out of GitLab, we recommend a Linode with at least 8GB of memory and at least 2 CPU cores. For more information on system requirements, visit the GitLab Hardware Requirements page.

      Note

      This guide was written for and tested with Ubuntu 18.04. You may be able to adapt this guide to other operating systems supported by Docker. When following this guide under another OS, use the Docker installation instructions for that OS.

      Secure your Server

      Review and implement the measures in the How to Secure your Server guide, including creating a limited user account.

      Change your Linode’s Default SSH Port

      One of GitLab’s features is the ability for you to push and fetch code changes to and from your repository over SSH. When installing GitLab, the software will need to bind to port 22, which is the standard port for SSH. Your system’s SSH service already runs on this port by default, so you will receive an error from GitLab if you don’t address this conflict.

      To fix this, you’ll want to change the port that your system’s SSH service listens on. This can be accomplished by editing your Linode’s /etc/ssh/sshd_config file and changing the Port assignment. The example snippet below changes the port from 22 to port 26:

      /etc/ssh/sshd_config

      When editing the file, you may also need to uncomment the Port line by removing the # character from the start of the line, if one is present. After updating this file and saving the change, restart the SSH service:

      sudo systemctl restart sshd
      

      Close your current SSH session and create a new one, making sure to specify the new port. You can do this by supplying the -p flag:

      ssh your_limited_user@192.0.2.2 -p 26
      

      (Optional) Update your DNS Records

      Assign a domain or subdomain to your GitLab server. This step is optional, as you can always access GitLab via your server’s IP address. However, using a domain is necessary if you would like to take advantage of GitLab’s built in SSL support, which uses Let’s Encrypt to issue certificates. This guide’s examples will use gitlab.example.com.

      It takes some time for DNS changes to propagate through the internet, so it’s suggested that you do this before you set up GitLab. There are several options for updating your DNS records:

      • If you already use Linode’s name servers, or if you would like to use them for your domain, review the DNS Manager guide. You will need to set up an A record which is assigned your Linode’s IP address.

      • If you use a different DNS provider, review that provider’s documentation for setting up a new A record.


        Updating DNS records at common nameserver authorities

        The following support documents describe how to update DNS records at common nameserver authorities:

      You can test to see if your DNS changes have propagated with the dig command:

      dig +short gitlab.example.com
      
        
      192.0.2.2
      
      

      Once your changes have propagated, you can move forward with the installation.

      Install Docker

      You must have Docker installed on your Linode to continue.

      These steps install Docker Community Edition (CE) using the official Ubuntu repositories. To install on another distribution, see the official installation page.

      1. Remove any older installations of Docker that may be on your system:

        sudo apt remove docker docker-engine docker.io
        
      2. Make sure you have the necessary packages to allow the use of Docker’s repository:

        sudo apt install apt-transport-https ca-certificates curl software-properties-common
        
      3. Add Docker’s GPG key:

        curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
        
      4. Verify the fingerprint of the GPG key:

        sudo apt-key fingerprint 0EBFCD88
        

        You should see output similar to the following:

          
        pub   4096R/0EBFCD88 2017-02-22
                Key fingerprint = 9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
        uid                  Docker Release (CE deb) 
        sub   4096R/F273FCD8 2017-02-22
        
        
      5. Add the stable Docker repository:

        sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
        
      6. Update your package index and install Docker CE:

        sudo apt update
        sudo apt install docker-ce
        
      7. Add your limited Linux user account to the docker group:

        sudo usermod -aG docker $USER
        

        Note

        After entering the usermod command, you will need to close your SSH session and open a new one for this change to take effect.

      8. Check that the installation was successful by running the built-in “Hello World” program:

        docker run hello-world
        

      Install the GitLab EE Image

      After installing Docker, download the latest GitLab Enterprise Edition Docker image from DockerHub. This image contains everything GitLab needs in order to run: PostgreSQL, Nginx, Redis, etc. To download the image, run the following pull command:

      sudo docker pull gitlab/gitlab-ee:latest
      


      Community Edition or Enterprise Edition?

      The GitLab Enterprise Edition software does not actually require you to have a license to use it. If you do not supply a license after installation, it will automatically show you the GitLab Community Edition feature set instead.

      If you’d like, you can instead opt to download GitLab Community Edition. This will offer the same features as an unlicensed Enterprise Edition installation. The key difference between these software packages is that the features of the EE installation can be upgraded at any time by entering a license.

      The primary reason someone might download the Community Edition is if they prefer to only download open source software. For more information on GitLab’s licensing, review the GitLab article on this subject. To download the GitLab CE Docker image, run this command:

      sudo docker pull gitlab/gitlab-ce:latest
      

      It may take a few minutes to download the image. When the download is complete, you can view a list of all installed Docker images with the images command:

      sudo docker images
      

      Configure and Run GitLab

      In order to configure and run the GitLab container, you need to provide a few options at runtime.

      1. Consider the following command, a version of which you will use to start the GitLab container:

        sudo docker run --detach 
          --hostname gitlab.example.com 
          --publish 443:443 --publish 80:80 --publish 22:22 
          --name gitlab-linode 
          --restart always 
          --volume /srv/gitlab/config:/etc/gitlab 
          --volume /srv/gitlab/logs:/var/log/gitlab 
          --volume /srv/gitlab/data:/var/opt/gitlab 
          --env GITLAB_OMNIBUS_CONFIG="external_url 'https://gitlab.example.com/';" 
          gitlab/gitlab-ee:latest
        


        Descriptions for each option

        --detach runs the Docker container as a background process, as opposed to running it in the foreground.

        --hostname defines the container’s internal hostname.

        --publish tells the container to publish ports, or ranges of ports, to the host. Because GitLab accepts connections on the HTTP (80), HTTPS (443), and SSH (22) ports, this option is declared three times. If you wanted to access GitLab from a non-standard port on your host, you would provide the host port first, and the container port second after the semi-colon. For instance if you wanted to access GitLab SSH on port 3333, you would write --publish 3333:22.

        --name allows you to apply a label to your container, for use when referencing the container within a Docker network.

        --restart specifies a restart policy for the container. Here it is set to always, meaning that the container, if exited, will automatically be restarted.

        --volume defines the host mounted volumes the container uses to store persistent data. These three volumes store application data, log files, and configuration files. The value to the left of the the semi-colon is the local location, and the value to the right is the container location.

        --env supplies the variable GITLAB_OMNIBUS_CONFIG, which can hold a series of values, separated by a colon, that correspond to the GitLab Omnibus configuration settings. In this case, an external URL is supplied. Some additional settings might include SMTP configuration values so that GitLab can send activity emails.

        As of GitLab 10.7, if you provide an external URL with a HTTPS protocol, GitLab will automatically set up SSL certificates using Let’s Encrypt, and all traffic will be forwarded to HTTPS. For more information about this functionality, read the GitLab SSL Documentation

        As an alternative to specifying the GITLAB_OMNIBUS_CONFIG variable via the --env option, you can edit the GitLab configuration file directly. For more instructions on how to do that, visit the Configure GitLab documentation.

      2. In the above command, replace the values for the --hostname option and for the external_url configuration setting with the domain or subdomain for your GitLab site. If you did not set up DNS for your site, enter http://your_linode_ip (not https) for the external_url setting. Then, run the command.

        Note

        If you are using the GitLab Community Edition image, replace gitlab/gitlab-ee:latest with gitlab/gitlab-ce:latest

        The container may take a few moments to start. After it starts, you’ll be given a container ID like the following:

          
        1093d89f9a0af8e4c79e0352e57721b09050d07c86c37d601145a856f3ed1502
        
        
      3. It will take an additional few minutes to be able to access GitLab in your browser after the container starts. You can find out more information about the startup process by monitoring the logs:

        sudo docker logs -f gitlab-linode
        

        To exit from the log monitoring process, enter CTRL-C. This will not stop the container from running.

      4. Load the GitLab site in your web browser. If you try to load it too shortly after starting the container, you may see an HTTP 502 error. If this happens, try waiting for a few more minutes and then refresh your page.

      5. The first time you access the site it will prompt you to enter an administrative password. Enter a complex password and record it somewhere safe.

      6. Log in to your GitLab site by entering root as the user along with the password you created in the previous step.

      Create your First Project

      Each repository in GitLab belongs to a project. A project includes: a repository for your files, an issues tracker, a section for merge requests, a wiki, continuous integration and continuous delivery (CI/CD) pipelines, and other features to support your development.

      1. To create your first repository, click Create a project.

        From the welcome screen, click "Create a project"

      2. You will be taken to the New Project page. Enter the project name. You can optionally alter the project’s slug, enter a description, or change the visibility of the project. Once you’re done, click Create project.

        Fill out the required information to make a new project

      3. Once your project has been created, you’ll be provided with an empty project repository:

        An empty project on GitLab

      4. If you didn’t have GitLab create a README.md file during project setup, instructions on how to start using your repository from the command line will be shown.

        Enter those commands on your computer to add a new README.md to your repository and push it back up to your GitLab repository. Change the domain in the git clone command to your site’s domain:

        git clone https://gitlab.example.com/testuser/example-project.git
        cd example-project
        touch README.md  # Or create the file in your editor and enter a project description
        git add README.md
        git commit -m "add README"
        git push -u origin master
        

      Manage the GitLab Container

      To view all of your running containers, you can issue the ps command:

      sudo docker ps
      

      To stop the GitLab container, issue the stop command by supplying the container ID you procured with the ps command, or supply the container name:

      sudo docker stop gitlab-linode
      

      To start a stopped container, issue the start command by supplying the container ID or container name:

      sudo docker start gitlab-linode
      

      Once the container has stopped, you can remove the container using the rm command, again supplying the container ID or container name:

      sudo docker container rm gitlab-linode
      

      Note

      Removing the container will not delete your projects and repositories.

      Upgrading GitLab

      To upgrade GitLab to the newest version, you must stop and remove the container, pull the newest image, and then recreate the container:

      sudo docker stop gitlab-linode
      sudo docker rm gitlab-linode
      sudo docker pull gitlab/gitlab-ee:latest
      
      sudo docker run --detach 
        --hostname gitlab.example.com 
        --publish 443:443 --publish 80:80 --publish 22:22 
        --name gitlab-linode 
        --restart always 
        --volume /srv/gitlab/config:/etc/gitlab 
        --volume /srv/gitlab/logs:/var/log/gitlab 
        --volume /srv/gitlab/data:/var/opt/gitlab 
        --env GITLAB_OMNIBUS_CONFIG="external_url 'https://gitlab.example.com/';" 
        gitlab/gitlab-ee:latest
      

      Remember to provide your own hostname, name, and external URL. If you are using GitLab Community Edition, specify the gitlab/gitlab-ce:latest image instead.

      Next Steps

      GitLab offers many features that are worth taking the time to understand and utilize. Here are a few next steps to take after you’ve completed this guide:

      • Upload an SSH key to your GitLab account so that you can transfer files over SSH.

      • Explore CI/CD pipelines to streamline your development practices.

      • Using your root GitLab account, explore the Admin settings to customize the functionality of GitLab.

      • Review Linode’s Git documentation:

      More Information

      You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.

      Find answers, ask questions, and help others.

      This guide is published under a CC BY-ND 4.0 license.



      Source link