GitLab: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 1: | Line 1: | ||
{| | {| | ||
| valign="top" | | | valign="top" | | ||
Line 13: | Line 8: | ||
export GITLAB_HOME=$HOME/gitlab | export GITLAB_HOME=$HOME/gitlab | ||
|} | |} | ||
{| class="wikitable sortable" | |||
|- | |||
! Local location !! Container location !! Usage | |||
|- | |||
| <code>$GITLAB_HOME/gitlab13/data</code> || <code>/var/opt/gitlab</code> || Application data | |||
|- | |||
| <code>$GITLAB_HOME/gitlab13/logs</code> || <code>/var/log/gitlab</code> || Application Logs | |||
|- | |||
| <code>$GITLAB_HOME/gitlab13/config</code> || <code>/etc/gitlab</code> || GitLab configuration | |||
|} | |||
<source lang="bash"> | <source lang="bash"> | ||
docker run -it --rm \ | docker run -it --rm \ | ||
Line 30: | Line 33: | ||
</source> | </source> | ||
==Docker== | |||
===Debian=== | |||
<source lang="bash" highlight="3,8-11" line> | |||
=== | |||
<source lang="bash"> | |||
docker run --detach \ | docker run --detach \ | ||
--hostname cdn.chorke.org \ | --hostname cdn.chorke.org \ | ||
--env GITLAB_OMNIBUS_CONFIG="external_url 'https://cdn.chorke.org/gitlab'; gitlab_rails['lfs_enabled'] = true;" \ | --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 \ | --publish 4430:443 \ | ||
--publish 9050:80 \ | |||
--publish 4321:22 \ | |||
--name gitlab \ | --name gitlab \ | ||
--restart always \ | --restart always \ | ||
Line 66: | Line 49: | ||
gitlab/gitlab-ce:13.2.3-ce.0 | gitlab/gitlab-ce:13.2.3-ce.0 | ||
</source> | </source> | ||
=== | ===CentOS=== | ||
<source lang="bash"> | <source lang="bash" highlight="3,8-11" line> | ||
docker run --detach \ | docker run --detach \ | ||
--hostname cdn.chorke.org \ | --hostname cdn.chorke.org \ | ||
--env GITLAB_OMNIBUS_CONFIG="external_url 'https://cdn.chorke.org/gitlab'; gitlab_rails['lfs_enabled'] = true;" \ | --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 \ | --publish 4430:443 \ | ||
--publish 9050:80 \ | |||
--publish 4321:22 \ | |||
--name gitlab \ | --name gitlab \ | ||
--restart always \ | --restart always \ | ||
Line 80: | Line 65: | ||
gitlab/gitlab-ce:13.2.3-ce.0 | gitlab/gitlab-ce:13.2.3-ce.0 | ||
</source> | </source> | ||
==Mailer== | |||
<code>docker exec -it gitlab vim /etc/gitlab/gitlab.rb</code> | <code>docker exec -it gitlab vim /etc/gitlab/gitlab.rb</code> | ||
<source lang="ruby" highlight="2-5" start="74" line> | <source lang="ruby" highlight="2-5" start="74" line> | ||
Line 109: | Line 94: | ||
</source> | </source> | ||
==Apache | ==Apache== | ||
===CentOS 7=== | ===CentOS 7=== | ||
<code>vim /etc/httpd/conf.sites.d/00-cdn.chorke.org-le-ssl.conf</code> | <code>vim /etc/httpd/conf.sites.d/00-cdn.chorke.org-le-ssl.conf</code> | ||
Line 140: | Line 125: | ||
</source> | </source> | ||
== | ==Runner== | ||
docker pull gitlab/gitlab-runner:latest | docker pull gitlab/gitlab-runner:latest | ||
docker pull gitlab/gitlab-runner:alpine | docker pull gitlab/gitlab-runner:alpine | ||
===Debian=== | |||
docker run --detach \ | docker run --detach \ | ||
--name gitlab-runner \ | --name gitlab-runner \ | ||
Line 153: | Line 137: | ||
gitlab/gitlab-runner:latest | gitlab/gitlab-runner:latest | ||
===CentOS=== | |||
docker run --detach \ | docker run --detach \ | ||
--name gitlab-runner \ | --name gitlab-runner \ | ||
Line 162: | Line 145: | ||
gitlab/gitlab-runner:v13.2.2 | gitlab/gitlab-runner:v13.2.2 | ||
===MacOS=== | |||
brew install gitlab-runner | brew install gitlab-runner | ||
brew services start gitlab-runner | brew services start gitlab-runner | ||
brew services stop gitlab-runner | brew services stop gitlab-runner | ||
== | ==Knowledge == | ||
'''SSH Local Forwarding:''' | '''SSH Local Forwarding:''' | ||
ssh -L 9050:localhost:9050 [email protected] | ssh -L 9050:localhost:9050 [email protected] | ||
Line 203: | Line 185: | ||
https://docs.gitlab.com/runner/install/docker.html#selinux | https://docs.gitlab.com/runner/install/docker.html#selinux | ||
https://github.com/dpw/selinux-dockersock | https://github.com/dpw/selinux-dockersock | ||
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 | |||
==References== | ==References== |
Revision as of 18:10, 25 August 2020
Linux: export GITLAB_HOME=/srv/gitlab |
MacOS: export GITLAB_HOME=$HOME/gitlab |
Local location | Container location | Usage |
---|---|---|
$GITLAB_HOME/gitlab13/data |
/var/opt/gitlab |
Application data |
$GITLAB_HOME/gitlab13/logs |
/var/log/gitlab |
Application Logs |
$GITLAB_HOME/gitlab13/config |
/etc/gitlab |
GitLab configuration |
docker run -it --rm \
--publish 9050:80 \
--publish 4321:22 \
--publish 4430:443 \
gitlab/gitlab-ce:13.2.3-ce.0 \
bin/bash
id; exit
mkdir -p $GITLAB_HOME/gitlab13/{config,data,logs}
#chown -R 0:0 $GITLAB_HOME/gitlab13/
Docker
Debian
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/gitlab13/config:/etc/gitlab \
--volume $GITLAB_HOME/gitlab13/logs:/var/log/gitlab \
--volume $GITLAB_HOME/gitlab13/data:/var/opt/gitlab \
gitlab/gitlab-ce:13.2.3-ce.0
CentOS
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/gitlab13/config:/etc/gitlab:Z \
--volume $GITLAB_HOME/gitlab13/logs:/var/log/gitlab:Z \
--volume $GITLAB_HOME/gitlab13/data:/var/opt/gitlab:Z \
gitlab/gitlab-ce:13.2.3-ce.0
Mailer
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'
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
docker exec -it gitlab vim /etc/gitlab/gitlab.rb
gitlab_rails['smtp_openssl_verify_mode'] = 'none'
Apache
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
SSLProxyVerify None
ProxyPreserveHost On
AllowEncodedSlashes On
SSLProxyCheckPeerCN Off
SSLProxyCheckPeerName Off
SSLProxyCheckPeerExpire Off
#....misc apache cfg....
<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>
Runner
docker pull gitlab/gitlab-runner:latest docker pull gitlab/gitlab-runner:alpine
Debian
docker run --detach \ --name gitlab-runner \ --restart always \ --volume /var/run/docker.sock:/var/run/docker.sock \ --volume /srv/gitlab-runner/config:/etc/gitlab-runner \ gitlab/gitlab-runner:latest
CentOS
docker run --detach \ --name gitlab-runner \ --restart always \ --volume /var/run/docker.sock:/var/run/docker.sock \ --volume /srv/gitlab-runner/config:/etc/gitlab-runner:Z \ gitlab/gitlab-runner:v13.2.2
MacOS
brew install gitlab-runner brew services start gitlab-runner brew services stop gitlab-runner
Knowledge
SSH Local Forwarding: ssh -L 9050:localhost:9050 [email protected] http://localhost:9050/ user: root pass: 5iveL!fe
Sign-up Restrictions: https://cdn.chorke.org/gitlab/admin/application_settings/general Sign-up enabled (Unchecked)
docker logs gitlab docker restart gitlab docker exec -it gitlab /bin/bash docker exec gitlab update-permissions docker exec -it gitlab vim /etc/gitlab/gitlab.rb
docker logs gitlab-runner docker restart gitlab-runner docker exec -it gitlab-runner gitlab-runner --help docker exec -it gitlab-runner gitlab-runner register
docker exec -it gitlab-runner gitlab-runner list docker exec -it gitlab-runner gitlab-runner verify docker exec -it gitlab-runner gitlab-runner verify --delete
docker-machine create --driver virtualbox default docker-machine start default docker-machine stop default docker-machine ip default docker-machine ls
SELinux: https://docs.gitlab.com/runner/install/docker.html#selinux https://github.com/dpw/selinux-dockersock
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