-
-
Save devcurmudgeon/d4875e31c608d6d0e302 to your computer and use it in GitHub Desktop.
gitlab install notes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##################################################### | |
# | |
# GitLab version : 5.x - 6.x | |
# Contributors : davispuh, mtorromeo, axilleas, boeserwolf91 | |
# Downloaded from : https://github.com/gitlabhq/gitlab-recipes/tree/master/init/systemd | |
# | |
#################################################### | |
[Unit] | |
Description=GitLab Sidekiq Worker | |
[Service] | |
Type=forking | |
User=git | |
WorkingDirectory=/home/git/gitlab | |
Environment=RAILS_ENV=production | |
SyslogIdentifier=gitlab-sidekiq | |
PIDFile=/home/git/gitlab/tmp/pids/sidekiq.pid | |
ExecStart=/usr/bin/bundle exec "sidekiq -q post_receive,mailer,system_hook,project_web_hook,gitlab_shell,common,default -e production -P tmp/pids/sidekiq.pid -d -L log/sidekiq.log >> log/sidekiq.log 2>&1" | |
ExecStop=/usr/bin/bundle exec "sidekiqctl stop /home/git/gitlab/tmp/pids/sidekiq.pid >> /home/git/gitlab/log/sidekiq.log 2>&1" | |
[Install] | |
WantedBy=gitlab.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##################################################### | |
# | |
# GitLab version : 5.x - 6.x | |
# Contributors : davispuh, mtorromeo, axilleas, boeserwolf91 | |
# Downloaded from : https://github.com/gitlabhq/gitlab-recipes/tree/master/init/systemd | |
# | |
#################################################### | |
[Unit] | |
Description=GitLab Unicorn Server | |
[Service] | |
User=git | |
WorkingDirectory=/home/git/gitlab | |
Environment=RAILS_ENV=production | |
SyslogIdentifier=gitlab-unicorn | |
PIDFile=/home/git/gitlab/tmp/pids/unicorn.pid | |
ExecStart=/usr/bin/bundle exec "unicorn_rails -c /home/git/gitlab/config/unicorn.rb -E production" | |
ExecStop=/usr/bin/kill -QUIT $MAINPID | |
ExecReload=/usr/bin/kill -USR2 $MAINPID | |
[Install] | |
WantedBy=gitlab.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
########################################################################################### | |
# | |
# GitLab version : 5.x - 6.x | |
# Contributors : davispuh, mtorromeo, axilleas, boeserwolf91 | |
# Downloaded from : https://github.com/gitlabhq/gitlab-recipes/tree/master/init/systemd | |
# | |
########################################################################################### | |
[Unit] | |
Description=GitLab - Self Hosted Git Management | |
Requires=redis.service mysqld.service | |
After=redis.service mysqld.service syslog.target network.target | |
[Install] | |
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=The nginx HTTP and reverse proxy server | |
After=syslog.target network.target remote-fs.target nss-lookup.target | |
[Service] | |
Type=forking | |
PIDFile=/run/nginx.pid | |
ExecStartPre=/usr/sbin/nginx -t -c /home/git/gitlab/lib/support/nginx/gitlab | |
ExecStart=/usr/sbin/nginx | |
ExecReload=/bin/kill -s HUP $MAINPID | |
ExecStop=/bin/kill -s QUIT $MAINPID | |
PrivateTmp=true | |
[Install] | |
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=PostgreSQL database server | |
After=network.target | |
[Service] | |
Type=forking | |
TimeoutSec=120 | |
User=postgres | |
Group=postgres | |
Environment=PGROOT=/home/postgres/pgsql | |
SyslogIdentifier=postgres | |
PIDFile=/var/lib/postgres/data/postmaster.pid | |
ExecStart= /usr/bin/pg_ctl -s -D ${PGROOT}/data start -w -t 120 | |
ExecReload=/usr/bin/pg_ctl -s -D ${PGROOT}/data reload | |
ExecStop= /usr/bin/pg_ctl -s -D ${PGROOT}/data stop -m fast | |
# Due to PostgreSQL's use of shared memory, OOM killer is often overzealous in | |
# killing Postgres, so adjust it downward | |
OOMScoreAdjust=-200 | |
[Install] | |
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Redis Server | |
After=network.target | |
[Service] | |
Type=simple | |
ExecStart=/usr/bin/redis-server | |
ExecStop=/bin/kill -15 $MAINPID | |
PIDFile=/var/run/redis.pid | |
Restart=always | |
[Install] | |
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem install bundle | |
# based on https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/installation.md | |
adduser -D --gecos 'GitLab' git | |
adduser -D postgres | |
# as postgres user | |
su - postgres | |
mkdir -p /home/postgres/pgsql/data | |
pg_ctl -D /home/postgres/pgsql/data initdb | |
pg_ctl -D /home/postgres/pgsql/data -l logfile start | |
# Login to PostgreSQL | |
psql -d template1 | |
# Create a user for GitLab. | |
CREATE USER git; | |
# Create the GitLab production database & grant all privileges on database | |
CREATE DATABASE gitlabhq_production OWNER git; | |
# Quit the database session | |
\q | |
exit # end of postgres user stuff | |
su - git | |
git config --global http.sslVerify false | |
git config --global user.name "GitLab" | |
git config --global user.email "gitlab@localhost" | |
git config --global core.autocrlf input | |
git clone https://gitlab.com/gitlab-org/gitlab-shell.git -b v1.9.3 | |
cd gitlab-shell | |
cp config.yml.example config.yml | |
vi config.yml and set localhost to something sensible # baserock? | |
./bin/install | |
cd .. | |
git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 6-8-stable gitlab | |
cd gitlab | |
cp config/gitlab.yml.example config/gitlab.yml | |
cp config/resque.yml.example config/resque.yml | |
cp config/database.yml.postgresql config/database.yml | |
cp config/unicorn.rb.example config/unicorn.rb | |
cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb | |
chmod -R u+rwX log/ | |
chmod -R u+rwX tmp/ | |
chmod o-rwx config/database.yml | |
# Edit the production config | |
# set 'secure password' with the value you have given to $password | |
vi config/database.yml # change localhost to something sensible | |
vi config/resque.yml # change example.com to 'baserock' or 'localhost' or 127.0.0.1 | |
bundle install --deployment --without development test mysql aws | |
bundle exec rake gitlab:setup RAILS_ENV=production | |
exit # end of git user stuff | |
mkdir -p /etc/default | |
cp /home/git/gitlab/lib/support/init.d/gitlab /etc/init.d/gitlab | |
cp /home/git/gitlab/lib/support/init.d/gitlab.default.example /etc/default/gitlab | |
su - git | |
/etc/init.d/gitlab restart | |
# see if it all worked... | |
cd gitlab | |
bundle exec rake gitlab:check RAILS_ENV=production | |
systemctl start postgres redis gitlab-sidekiq gitlab-unicorn nginx | |
systemctl enable postgres redis gitlab.target gitlab-sidekiq gitlab-unicorn nginx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment