Skip to content

Instantly share code, notes, and snippets.

@DominicImhof
Last active February 19, 2016 06:05
Show Gist options
  • Save DominicImhof/d48c991c34abbb0b7cd7 to your computer and use it in GitHub Desktop.
Save DominicImhof/d48c991c34abbb0b7cd7 to your computer and use it in GitHub Desktop.
#!/bin/sh
### BEGIN INIT INFO
# Provides: gitit
# Required-Start: $local_fs $remote_fs $network $syslog $time
# Required-Stop: $local_fs $remote_fs $network $syslog $time
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start or stop Gitit daemon
# Description: Start or stop Gitit daemon
### END INIT INFO
set -e
GITIT_USER="gitit"
GITIT_HOME="/home/${GITIT_USER}/data"
GITIT="/home/${GITIT_USER}/.local/bin/gitit"
case "$1" in
start)
su -c "cd ${GITIT_HOME} && ${GITIT} -f my.conf &" $GITIT_USER
;;
stop)
killall gitit
;;
*) echo "Usage: $0 {start|stop}" >&2; exit 1 ;;
esac
exit 0

Installation of Gitit on Ubuntu 14.04 x64

Add Swap

Set timezone

  • echo Europe/Zurich > /etc/timezone && dpkg-reconfigure tzdata

Upgrade packages

  • apt-get update -y && apt-get upgrade -y

Customize ssh config

  • sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config
  • sed -i 's/AcceptEnv LANG LC_*/#AcceptEnv LANG LC_*/g' /etc/ssh/sshd_config
  • service ssh restart

Configure ufw

  • ufw default deny incoming
  • ufw allow ssh
  • ufw allow http
  • ufw allow https
  • ufw enable

Install requirements

  • apt-get install -y git apache2 libtinfo-dev

Add user for Gitit

  • useradd -m gitit && sudo su - gitit

Install Haskell Stack

  • Follow instructions at GitHub
  • stack setup

## Install Gitit

  • Follow instructions at GitHub
  • Checkout right version git fetch origin refs/tags/0.12.0.1:refs/tags/0.12.0.1 && git checkout 0.12.0.1

Add Gitit-Service

  • Copy gitit file to /etc/init.d
  • chmod +x /etc/init.d/gitit
  • update-rc.d gitit defaults
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment