summaryrefslogtreecommitdiff
path: root/gitlab.configure
diff options
context:
space:
mode:
authorAdam Coldrick <adam.coldrick@codethink.co.uk>2014-05-09 10:52:06 +0000
committerAdam Coldrick <adam.coldrick@codethink.co.uk>2014-05-14 15:37:26 +0000
commit4a38fb3b4acd548351edf45b09a53ec9e3f919e6 (patch)
tree40f7d147d65bc6495eb4088a46c578a6a43b62c1 /gitlab.configure
parent081ffc7de30e07b3c317fc47035a8ffd179718b0 (diff)
downloaddefinitions-4a38fb3b4acd548351edf45b09a53ec9e3f919e6.tar.gz
Add a configure extension and relevant files for installing GitLab
Diffstat (limited to 'gitlab.configure')
-rw-r--r--gitlab.configure70
1 files changed, 70 insertions, 0 deletions
diff --git a/gitlab.configure b/gitlab.configure
new file mode 100644
index 00000000..709c9730
--- /dev/null
+++ b/gitlab.configure
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+# copyright foo bar
+
+# what am i
+#
+# * GITLAB_HOSTNAME
+# * GITLAB_PORT
+# * GITLAB_EMAIL
+# * UNICORN_PORT
+# * CI_PORT
+# * UNICORN_CI_PORT
+#
+
+set -e
+
+ROOT="$1"
+
+
+##########################################################################
+# Substitutions in configuration files
+##########################################################################
+
+echo "Creating /etc/gitlab-setup.sed"
+
+cat <<EOF > "$ROOT"/etc/gitlab-setup.sed
+s/##GITLAB_HOSTNAME##/$GITLAB_HOSTNAME/g
+s/##GITLAB_PORT##/$GITLAB_PORT/g
+s/##GITLAB_EMAIL##/$GITLAB_EMAIL/g
+s/##UNICORN_PORT##/$UNICORN_PORT/g
+s/##CI_PORT##/$CI_PORT/g
+s/##UNICORN_CI_PORT##/$UNICORN_CI_PORT/g
+EOF
+
+echo "Performing substitutions in /usr/share/gitlab config"
+
+sed -f "$ROOT"/etc/gitlab-setup.sed -i \
+ "$ROOT"/usr/share/gitlab-install/gitlab/config/gitlab.yml \
+ "$ROOT"/usr/share/gitlab-install/gitlab/config/unicorn.rb \
+ "$ROOT"/usr/share/gitlab-install/gitlab/lib/support/nginx/gitlab \
+ "$ROOT"/usr/share/gitlab-install/gitlab-shell/config.yml \
+ "$ROOT"/usr/share/gitlab-install/gitlab-ci/config/application.yml \
+ "$ROOT"/usr/share/gitlab-install/gitlab-ci/config/unicorn.rb \
+ "$ROOT"/usr/share/gitlab-install/gitlab-ci/lib/support/nginx/gitlab_ci \
+ "$ROOT"/usr/share/gitlab-install/nginx.conf
+
+##########################################################################
+
+echo "Create gitlab-setup unit file"
+cat <<EOF > "$ROOT/etc/systemd/system/gitlab-setup.service"
+[Unit]
+Description=Run gitlab-setup (once)
+Requires=network.target
+After=network.target
+Requires=local-fs.target
+After=local-fs.target
+
+ConditionPathExists=!/home/git/gitlab
+
+[Service]
+Type=oneshot
+ExecStart=/usr/share/gitlab-setup
+Restart=no
+
+[Install]
+WantedBy=multi-user.target
+EOF
+
+ln -s "/etc/systemd/system/gitlab-setup.service" \
+ "$ROOT/etc/systemd/system/multi-user.target.wants/gitlab-setup.service"