Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thmosqueiro/d3ed6ad9e318cbf6ec4b5f3bb48b7255 to your computer and use it in GitHub Desktop.
Save thmosqueiro/d3ed6ad9e318cbf6ec4b5f3bb48b7255 to your computer and use it in GitHub Desktop.
This is what I needed to complete Gitlab installation + jupyter notebook rendering

Gitlab from source + viewing ipython notebooks

This is what I needed to complete Gitlab installation by using @martijnvermaat's fork. Some guidelines are provided here. This is supposed to allow you to use a local installation of gitlab capable of rendering Ipython Notebooks. This was based on GitLab's documentation.

Pre-installation

cd
sudo apt-get update -y
sudo apt-get upgrade -y
apt-get install -y pandoc build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev logrotate python-docutils pkg-config cmake nodejs libkrb5-dev git-core
sudo apt-get install pip
sudo pip install pip -U
sudo pip install ipython -U
sudo pip install nbconvert -U
sudo pip install jinja2 -U
sudo pip install pyzmq -U
sudo pip install tornado -U

sudo apt-get remove ruby1.8
mkdir /tmp/ruby && cd /tmp/ruby
curl --remote-name --progress https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.gz
echo 'c39b4001f7acb4e334cb60a0f4df72d434bef711  ruby-2.3.1.tar.gz' | shasum -c - && tar xzf ruby-2.3.1.tar.gz
cd ruby-2.3.1
./configure --disable-install-rdoc
make
sudo make install

sudo gem install bundler --no-ri --no-rdoc

curl --remote-name --progress https://storage.googleapis.com/golang/go1.5.3.linux-amd64.tar.gz
echo '43afe0c5017e502630b1aea4d44b8a7f059bf60d7f29dfd58db454d4e4e0ae53  go1.5.3.linux-amd64.tar.gz' | shasum -a256 -c - && \
  sudo tar -C /usr/local -xzf go1.5.3.linux-amd64.tar.gz
sudo ln -sf /usr/local/go/bin/{go,godoc,gofmt} /usr/local/bin/
rm go1.5.3.linux-amd64.tar.gz

sudo apt-get install -y postgresql postgresql-client libpq-dev postgresql-contrib
sudo -u postgres psql -d template1 -c "CREATE USER git CREATEDB;"
sudo -u postgres psql -d template1 -c "CREATE DATABASE gitlabhq_production OWNER git;"
sudo -u postgres psql -d template1 -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;"

sudo apt-get install redis-server

sudo cp /etc/redis/redis.conf /etc/redis/redis.conf.orig
sudo sed 's/^port .*/port 0/' /etc/redis/redis.conf.orig | sudo tee /etc/redis/redis.conf
sudo echo 'unixsocket /var/run/redis/redis.sock' | sudo tee -a /etc/redis/redis.conf
sudo echo 'unixsocketperm 770' | sudo tee -a /etc/redis/redis.conf
sudo mkdir /var/run/redis
sudo chown redis:redis /var/run/redis
sudo chmod 755 /var/run/redis
if [ -d /etc/tmpfiles.d ]; then
  sudo echo 'd  /var/run/redis  0755  redis  redis  10d  -' | sudo tee -a /etc/tmpfiles.d/redis.conf
fi

sudo service redis-server restart
sudo usermod -aG redis git

Cloning a version of gitlab WITH rendered to ipython notebook

sudo -u git -H git clone  https://github.com/martijnvermaat/gitlabhq.git -b 8-10-stable-blob-ipython-notebook
sudo -u git -H mv gitlabhq gitlab

cd /home/git/gitlab
sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml

Customize gitlab.yml:

sudo -u git -H editor config/gitlab.yml

Resuming...

sudo -u git -H cp config/secrets.yml.example config/secrets.yml
sudo -u git -H chmod 0600 config/secrets.yml
sudo chown -R git log/
sudo chown -R git tmp/
sudo chmod -R u+rwX,go-w log/
sudo chmod -R u+rwX tmp/
sudo chmod -R u+rwX tmp/pids/
sudo chmod -R u+rwX tmp/sockets/

sudo -u git -H mkdir public/uploads/
sudo chmod 0700 public/uploads

sudo chmod -R u+rwX builds/
sudo chmod -R u+rwX shared/artifacts/
sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb
sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb

sudo -u git -H git config --global core.autocrlf input
sudo -u git -H git config --global gc.auto 0
sudo -u git -H git config --global repack.writeBitmaps true
sudo -u git -H cp config/resque.yml.example config/resque.yml

sudo -u git -H cp config/secrets.yml.example config/secrets.yml
sudo -u git -H chmod 0600 config/secrets.yml
sudo chown -R git log/
sudo chown -R git tmp/
sudo chmod -R u+rwX,go-w log/
sudo chmod -R u+rwX tmp/
sudo chmod -R u+rwX tmp/pids/
sudo chmod -R u+rwX tmp/sockets/
sudo -u git -H mkdir public/uploads/
sudo chmod 0700 public/uploads
sudo chmod -R u+rwX builds/
sudo chmod -R u+rwX shared/artifacts/
sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb
sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb

sudo -u git -H git config --global core.autocrlf input
sudo -u git -H git config --global gc.auto 0
sudo -u git -H git config --global repack.writeBitmaps true
sudo -u git -H cp config/resque.yml.example config/resque.yml

Using postgres database

sudo -u git cp config/database.yml.postgresql config/database.yml
sudo -u git -H chmod o-rwx config/database.yml

Resuming...

sudo -u git -H bundle install --deployment --without development test mysql aws kerberos
sudo -u git -H bundle exec rake gitlab:shell:install REDIS_URL=unix:/var/run/redis/redis.sock RAILS_ENV=production SKIP_STORAGE_VALIDATION=true

cd /home/git
sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-workhorse.git
cd gitlab-workhorse
sudo -u git -H git checkout v0.8.2
sudo -u git -H make

cd /home/git/gitlab
sudo -u git -H rm -r db/migrate/20160722221922_nullify_blank_type_on_notes.rb ## this is wrong, but I can't figure out another way!!
sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production

sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
sudo cp lib/support/init.d/gitlab.default.example /etc/default/gitlab
sudo update-rc.d gitlab defaults 21
sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab

Environment info:

sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production

Compiling assets

sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production

Starting it

sudo service gitlab start

Configuring nginx

sudo cp lib/support/nginx/gitlab /etc/nginx/sites-available/gitlab
sudo ln -fs /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab
sudo editor /etc/nginx/sites-available/gitlab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment