GitLab: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
Line 50: Line 50:
--volume $GITLAB_HOME/data:/var/opt/gitlab \
--volume $GITLAB_HOME/data:/var/opt/gitlab \
gitlab/gitlab-ce:latest
gitlab/gitlab-ce:latest
</source>
===Mailer Config===
<code>docker exec -it gitlab vim /etc/gitlab/gitlab.rb</code>
<source lang="ruby"  highlight="2,4-6" start="617" line>
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "mail.chorke.org"
gitlab_rails['smtp_port'] = 25
gitlab_rails['smtp_user_name'] = "[email protected]"
gitlab_rails['smtp_password'] = "p@$$w0rd"
gitlab_rails['smtp_domain'] = "mail.chorke.org"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = false
gitlab_rails['smtp_tls'] = false
###! **Can be: 'none', 'peer', 'client_once', 'fail_if_no_peer_cert'**
###! Docs: http://api.rubyonrails.org/classes/ActionMailer/Base.html
gitlab_rails['smtp_openssl_verify_mode'] = 'none'
</source>
<code>docker exec -it gitlab vim /etc/gitlab/gitlab.rb</code>
<source lang="ruby"  highlight="2-5" start="74" line>
gitlab_rails['gitlab_email_enabled'] = true
gitlab_rails['gitlab_email_from'] = '[email protected]'
gitlab_rails['gitlab_email_display_name'] = 'GitLab'
gitlab_rails['gitlab_email_reply_to'] = '[email protected]'
gitlab_rails['gitlab_email_subject_suffix'] = 'GitLab'
</source>
</source>



Revision as of 01:09, 15 June 2020

Quick install

curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash

Docker Install

Linux:
export GITLAB_HOME=/srv/gitlab
MacOS:
export GITLAB_HOME=$HOME/gitlab

Volumes Location

Local location Container location Usage
$GITLAB_HOME/data /var/opt/gitlab For storing application data
$GITLAB_HOME/logs /var/log/gitlab For storing logs
$GITLAB_HOME/config /etc/gitlab For storing the GitLab configuration files
docker run --detach \
--hostname cdn.chorke.org \
--publish 4430:443 --publish 9050:80 --publish 4321:22 \
--name gitlab \
--restart always \
--volume $GITLAB_HOME/config:/etc/gitlab \
--volume $GITLAB_HOME/logs:/var/log/gitlab \
--volume $GITLAB_HOME/data:/var/opt/gitlab \
gitlab/gitlab-ce:latest

External URL

docker run --detach \
--hostname cdn.chorke.org \
--env GITLAB_OMNIBUS_CONFIG="external_url 'https://cdn.chorke.org/gitlab'; gitlab_rails['lfs_enabled'] = true;" \
--publish 4430:443 --publish 9050:80 --publish 4321:22 \
--name gitlab \
--restart always \
--volume $GITLAB_HOME/config:/etc/gitlab \
--volume $GITLAB_HOME/logs:/var/log/gitlab \
--volume $GITLAB_HOME/data:/var/opt/gitlab \
gitlab/gitlab-ce:latest

Mailer Config

docker exec -it gitlab vim /etc/gitlab/gitlab.rb

gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "mail.chorke.org"
gitlab_rails['smtp_port'] = 25
gitlab_rails['smtp_user_name'] = "[email protected]"
gitlab_rails['smtp_password'] = "p@$$w0rd"
gitlab_rails['smtp_domain'] = "mail.chorke.org"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = false
gitlab_rails['smtp_tls'] = false

###! **Can be: 'none', 'peer', 'client_once', 'fail_if_no_peer_cert'**
###! Docs: http://api.rubyonrails.org/classes/ActionMailer/Base.html
gitlab_rails['smtp_openssl_verify_mode'] = 'none'

docker exec -it gitlab vim /etc/gitlab/gitlab.rb

gitlab_rails['gitlab_email_enabled'] = true
gitlab_rails['gitlab_email_from'] = '[email protected]'
gitlab_rails['gitlab_email_display_name'] = 'GitLab'
gitlab_rails['gitlab_email_reply_to'] = '[email protected]'
gitlab_rails['gitlab_email_subject_suffix'] = 'GitLab'

Apache Proxy

CentOS 7

vim /etc/httpd/conf.sites.d/00-cdn.chorke.org-le-ssl.conf

<IfModule mod_ssl.c>
<VirtualHost *:443>
    SSLProxyEngine On
    ProxyRequests Off
    ProxyPreserveHost On
    AllowEncodedSlashes Off
    # more apache cfg skipped

    <Location /gitlab>
        Order Allow,Deny
        Allow from all
        ProxyPass https://localhost:4430/gitlab nocanon
        ProxyPassReverse https://localhost:4430/gitlab
    </Location>

    Include /etc/letsencrypt/options-ssl-apache.conf
    SSLCertificateFile /etc/letsencrypt/live/cdn.chorke.org/cert.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/cdn.chorke.org/privkey.pem
    SSLCertificateChainFile /etc/letsencrypt/live/cdn.chorke.org/chain.pem
</VirtualHost>
</IfModule>

Good To Know

SSH Local Forwarding:
ssh -L 9050:localhost:9050 [email protected]
http://localhost:9050/
user: root
pass: 5iveL!fe
docker logs gitlab
docker restart gitlab
docker exec -it gitlab /bin/bash
docker exec gitlab update-permissions

References