diff --git a/active/container_gitlab/gitlab-compose.yaml b/active/container_gitlab/gitlab-compose.yaml new file mode 100644 index 0000000..89da7be --- /dev/null +++ b/active/container_gitlab/gitlab-compose.yaml @@ -0,0 +1,16 @@ +services: + gitlab: + image: gitlab/gitlab-ce:18.7.3-ce.0 + container_name: gitlab + restart: always + hostname: 'gitlab.example.com' + ports: + - '80:80' + - '443:443' + - '22:22' + volumes: + - '$GITLAB_HOME/gitlab.rb:/etc/gitlab/gitlab.rb:ro' + - '$GITLAB_HOME/config:/etc/gitlab' + - '$GITLAB_HOME/logs:/var/log/gitlab' + - '$GITLAB_HOME/data:/var/opt/gitlab' + shm_size: '256m' \ No newline at end of file diff --git a/active/container_gitlab/gitlab.md b/active/container_gitlab/gitlab.md new file mode 100644 index 0000000..d532eaa --- /dev/null +++ b/active/container_gitlab/gitlab.md @@ -0,0 +1,66 @@ +# Gitlab + +## Docker Install + +```bash +# Change the server's SSH port in /etc/ssh/sshd_config +Port = 2424 + +# Then tell selinux about it +semanage port -a -t ssh_port_t -p tcp 2424 +# And add the firewall rule +firewall-cmd --add-port=2424/tcp --permanent +firewall-cmd --reload +# Reload SSH +systemctl restart sshd + +# Make a Gitlab directory +mkdir -p /srv/gitlab + +# Add the following to .bashrc (used in the compose file) +export GITLAB_HOME=/srv/gitlab +``` + +Create your `gitlab-compose.yaml`. See the file in this repo for an example. + +Also create the file `secrets/gitlab.rb` with your configuration. Should look something like this: + +```ruby +# Add any other gitlab.rb configuration here, each on its own line +external_url 'https://gitlab.reeseapps.com' +nginx['listen_port'] = 80 +nginx['listen_https'] = false +nginx['proxy_set_headers'] = { + "X-Forwarded-Proto" => "https", + "X-Forwarded-Ssl" => "on", + "Host" => "gitlab.mydomain.de", + "X-Real-IP" => "$$remote_addr", + "X-Forwarded-For" => "$$proxy_add_x_forwarded_for", + "Upgrade" => "$$http_upgrade", + "Connection" => "$$connection_upgrade" +} +gitlab_rails['smtp_enable'] = true +gitlab_rails['smtp_address'] = "email-smtp.us-east-1.amazonaws.com" +gitlab_rails['smtp_port'] = 465 +gitlab_rails['smtp_user_name'] = "" +gitlab_rails['smtp_password'] = "" +gitlab_rails['smtp_domain'] = "" +gitlab_rails['smtp_authentication'] = "login" +gitlab_rails['smtp_ssl'] = true +gitlab_rails['smtp_force_ssl'] = true +``` + +Copy `gitlab.rb` and `gitlab-compose.yaml` to your server: + +```bash +scp active/container_gitlab/gitlab-compose.yaml gitlab: +scp active/container_gitlab/secrets/gitlab.rb gitlab:/srv/gitlab +``` + +Then docker compose up: + +```bash +docker compose -f gitlab-compose.yaml up -d +``` + +The initial username is root and the password will be at `/srv/gitlab/config/initial_root_password`.