diff options
author | Soeren Grunewald <soeren.grunewald@desy.de> | 2014-07-08 17:35:12 +0200 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2014-09-04 12:05:51 -0400 |
commit | ddb15dbe9e592c60c842fe8c2a2cdeef56244474 (patch) | |
tree | ef64a10ab221ec5139ae0c65195c5de6d53d9719 | |
parent | bd6cc8190a8d1d5270cbf63cd2df21949653866d (diff) | |
download | gitblit-ddb15dbe9e592c60c842fe8c2a2cdeef56244474.tar.gz gitblit-ddb15dbe9e592c60c842fe8c2a2cdeef56244474.zip |
distrib: Add script to install gitblit on fedora
The script will create a environment file keeping all the major settings and
installs a systemd unit file.
The script (mainly the unit file part) should also work for other systemd
based distributions like ArchLinux. But /etc/sysconfig may not exist there.
Signed-off-by: Soeren Grunewald <soeren.grunewald@desy.de>
-rwxr-xr-x | src/main/distrib/linux/install-service-fedora.sh | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/main/distrib/linux/install-service-fedora.sh b/src/main/distrib/linux/install-service-fedora.sh new file mode 100755 index 00000000..281fa409 --- /dev/null +++ b/src/main/distrib/linux/install-service-fedora.sh @@ -0,0 +1,36 @@ +#!/bin/bash -x +# This script installes gitblit on a system running under systemd. +# The script assumes the server is running as user giblit + +# First create a file with the default settings +cat > /tmp/gitblit.defaults << EOF +GITBLIT_PATH=/opt/gitblit +GITBLIT_BASE_FOLDER=/opt/gitblit/data +GITBLIT_HTTP_PORT=0 +GITBLIT_HTTPS_PORT=8443 +GITBLIT_LOG=/var/log/gitblit.log +EOF +# Create a systemd service file +cat > /tmp/gitblit.service << EOF +[Unit] +Description=Gitblit managing, viewing, and serving Git repositories. +After=network.target + +[Service] +User=gitblit +Group=gitblit +Environment="ARGS=-server -Xmx1024M -Djava.awt.headless=true -jar" +EnvironmentFile=-/etc/sysconfig/gitblit +WorkingDirectory=/opt/gitblit +ExecStart=/usr/bin/java \$ARGS gitblit.jar --httpsPort \$GITBLIT_HTTPS_PORT --httpPort \$GITBLIT_HTTP_PORT --baseFolder \$GITBLIT_BASE_FOLDER --dailyLogFile +ExecStop=/usr/bin/java \$ARGS gitblit.jar --baseFolder \$GITBLIT_BASE_FOLDER --stop + +[Install] +WantedBy=multi-user.target +EOF + +# Finally copy the files to the destination and register the systemd unit. +sudo su -c "cp /tmp/gitblit.defaults /etc/sysconfig/gitblit && cp /tmp/gitblit.service /usr/lib/systemd/system/" +sudo su -c "systemctl daemon-reload && systemctl enable gitblit.service && systemctl start gitblit.service" +# Prepare the logfile +sudo su -c "touch /var/log/gitblit.log && chown gitblit:gitblit /var/log/gitblit.log" |