Skip to content

Commit 3f9fa03

Browse files
committed
Configure GitLab for unprivileged LXC
Preconfigure /etc/gitlab/gitlab.rb before installation, setting external_url to the container IP and disabling package['modify_kernel_parameters'] to avoid sysctl failures in unprivileged LXCs. Install GitLab CE without EXTERNAL_URL env injection, then explicitly run gitlab-ctl reconfigure. Also update GitLab metadata notes to document this requirement and adjust the CT post-install password command styling.
1 parent 3af1138 commit 3f9fa03

3 files changed

Lines changed: 22 additions & 3 deletions

File tree

‎ct/gitlab.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
5050
echo -e "${INFO}${YW}Access it using the following URL:${CL}"
5151
echo -e "${GATEWAY}${BGN}http://${IP}${CL}"
5252
echo -e "${INFO}${YW}The initial root password is valid for 24 hours:${CL}"
53-
echo -e "${TAB}${GATEWAY}${BGN}cat /etc/gitlab/initial_root_password${CL}"
53+
echo -e "${TAB}${DEFAULT}${BGN}cat /etc/gitlab/initial_root_password${CL}"

‎install/gitlab-install.sh‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,25 @@ setup_deb822_repo \
2727
"$(get_os_info codename)" \
2828
"main"
2929

30+
msg_info "Configuring GitLab"
31+
mkdir -p /etc/gitlab
32+
cat <<EOF >/etc/gitlab/gitlab.rb
33+
external_url 'http://${LOCAL_IP}'
34+
35+
# Omnibus runs 'sysctl -e --system' during reconfigure, which fails in an
36+
# unprivileged LXC because most kernel keys are not writable.
37+
package['modify_kernel_parameters'] = false
38+
EOF
39+
msg_ok "Configured GitLab"
40+
3041
msg_info "Installing GitLab CE (Patience)"
31-
EXTERNAL_URL="http://${LOCAL_IP}" $STD apt install -y gitlab-ce
42+
$STD apt install -y gitlab-ce
3243
msg_ok "Installed GitLab CE"
3344

45+
msg_info "Reconfiguring GitLab (Patience)"
46+
$STD gitlab-ctl reconfigure
47+
msg_ok "Reconfigured GitLab"
48+
3449
motd_ssh
3550
customize
3651
cleanup_lxc

‎json/gitlab.json‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,13 @@
4343
"type": "warning"
4444
},
4545
{
46-
"text": "EXTERNAL_URL is set to the container IP at install time. If you use a domain or a reverse proxy, change external_url in /etc/gitlab/gitlab.rb and run 'gitlab-ctl reconfigure'.",
46+
"text": "external_url is set to the container IP at install time. If you use a domain or a reverse proxy, change external_url in /etc/gitlab/gitlab.rb and run 'gitlab-ctl reconfigure'.",
4747
"type": "info"
4848
},
49+
{
50+
"text": "/etc/gitlab/gitlab.rb sets package['modify_kernel_parameters'] = false. Omnibus otherwise runs 'sysctl -e --system' during reconfigure, which fails in an unprivileged LXC because most kernel keys are not writable. Do not remove that line.",
51+
"type": "warning"
52+
},
4953
{
5054
"text": "Omnibus bundles its own PostgreSQL, Redis and NGINX - do not install those separately in this container. Repositories live in /var/opt/gitlab; back up with 'gitlab-backup create' rather than copying directories.",
5155
"type": "info"

0 commit comments

Comments
 (0)