Skip to content

Deploying a GitLab CE Server with network access via apache config

Notifications You must be signed in to change notification settings

jotasixto/containerGitLabCE_apacheProxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

containerGitLabCE_apacheProxy

Deploying a GitLab CE Server with network access via apache config

We need a machine with apache and docker engine installed.

Now enable the apache modules needed for proxying capabilities:

[email protected]_: # a2enmod proxy
[email protected]: # a2enmod proxy_http

Config the virtual host apache that mapped the docker container with GitLab CE server. Enabled the reverse proxy too. Create the file /etc/apache2/sites-available/gitlab.conf with this content:

<VirtualHost *:80>
    ServerName gitlab.machine.local #your hostname that use for GitLab Serve access  

    ServerAdmin [email protected]

    <IfModule mod_proxy.c>
        <Proxy *>
            Allow from localhost
        </Proxy>
        ProxyPass / http://localhost:8091/
        ProxyPassReverse / http://localhost:8091/
    </IfModule>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Enable the new apache virtual host and restart apache service.

[email protected]: # ln -s /etc/apache2/sites-available/gitlab.conf /etc/apache2/sites-enabled/gitlab.conf
[email protected]: # /etc/init.d/apache2 force-reload
[email protected]: # /etc/init.d/apache2 restart

Getting the docker image GitLab CE and start a container with the config needed.

[email protected]: # docker pull gitlab/gitlab-ce
[email protected]: # docker run -d --restart=always --hostname=gitlab.machine.local \
           -p 2234:22 -p 8091:80 -p 4431:443 \
           -v /etc/gitlab:/etc/gitlab \
           -v /var/opt/gitlab:/var/opt/gitlab \
           -v /var/log/gitlab:/var/log/gitlab \
           --name gitlab_server gitlab/gitlab-ce

-d :: Start the container in the background --restart=always :: When the container exits docker engine will restart it. --hostname=gitlab.machine.local :: Set the hostname that use the container -p 2234:22 -p 8091:80 -p 4431:443 :: This params config tunnels between host port and container port. -v /paths/files/host:/path/files/container :: This shared filesystems, binding a mount volume to host source path. --name gitlab_server :: Set a name to docker container gitlab/gitlab-ce :: The docker image of GitLab CE to be used

When the container started correctly we can edit the config file /etc/gitlab/gitlab.rb with the params needed. Set this two values on /etc/gitlab/gitlab.rb

# external_url 'GENERATED_EXTERNAL_URL' # default: http://hostname
external_url "http://gitlab.xendebian.local:80/"
## GitLab Shell settings for GitLab
gitlab_rails['gitlab_shell_ssh_port'] = 2234

This configuration will allow to GitLabCE generate the correct links on the web

Now we can browse to http://gitlab.machine.local and the defaults credentials is user: root password: 5iveL!fe

About

Deploying a GitLab CE Server with network access via apache config

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published