Shared Hosting for Everyone, imagined by developers, for developers.
Discovering the Public CloudGitLab is a software development platform with wiki, issue tracking, code review, continuous integration and deployment…
It is possible to install it in Private Cloud - dedicated and Gold servers, here are the steps to follow.
PostgreSQL and Redis must be installed on the server. If it’s not the case, contact the support.
The installation must be done on an empty account. We consider the following information for our example:
foobar
2.7
14.17
GitLab needs these versions which must be defined in the Environment menu.
Create the PostgreSQL database in the menu Databases > PostgreSQL and enable pg_trgm
and btree_gist
extensions.
If you are using a RAM limit of less than 10 GB, increase it in the Advanced > Resources menu.
Launch the following commands in SSH at the root of the account:
npm install --global yarn
git clone https://gitlab.com/gitlab-org/gitaly.git -b 14-4-stable gitaly
cd gitaly/
mkdir ~/local
make git GIT_PREFIX=~/local/
export PATH=~/local/bin/:$PATH
cd
rm -fr ~/gitaly
git clone https://gitlab.com/gitlab-org/gitlab-foss.git -b 14-4-stable gitlab
cd gitlab/
cp config/gitlab.yml.example config/gitlab.yml
sed -i "s,/home/git/,/home/$(whoami)/,g" config/gitlab.yml
sed -i "s,# user: git,user: $(whoami)," config/gitlab.yml
sed -i "s,bin_path: /usr/bin/git,bin_path: /home/$(whoami)/local/bin/git," config/gitlab.yml
File modification - config/gitlab.yml
nano config/gitlab.yml
In the production > gitlab section change:
host: localhost
string to fill in the desired address of the GitLab site. This can be for example the account address: foobar.alwaysdata.net
.email
paragraph with the desired email information. For example:email_from: foobar@alwaysdata.net
email_reply_to: foobar@alwaysdata.net
cp config/secrets.yml.example config/secrets.yml
chmod 0600 config/secrets.yml
mkdir -p public/uploads
chmod 0700 public/uploads
cp config/puma.rb.example config/puma.rb
sed -i "s,/home/git/,/home/$(whoami)/,g" config/puma.rb
git config --global gc.auto 0
git config --global repack.writeBitmaps true
git config --global receive.advertisePushOptions true
git config --global core.fsyncObjectFiles true
cp config/resque.yml.example config/resque.yml
cp config/database.yml.postgresql config/database.yml
File modification - config/database.yml
nano config/database.yml
Replace the database
, username
, host
and password
keys and the first section (production) with those of your account. Example:
database: foobar_gitlab
username: foobar
password: "its password"
host: postgresql-foobar.alwaysdata.net
The database is the one created earlier in this guide.
bundle config set --local deployment 'true'
bundle config set --local without 'development test mysql aws kerberos'
bundle install
bundle exec rake gitlab:shell:install RAILS_ENV=production
bundle exec rake "gitlab:workhorse:install[/home/$(whoami)/gitlab-workhorse]" RAILS_ENV=production
cd
git clone https://gitlab.com/gitlab-org/gitlab-pages.git
cd gitlab-pages
git checkout v$(<~/gitlab/GITLAB_PAGES_VERSION)
make
cd ~/gitlab
bundle exec rake "gitlab:gitaly:install[/home/$(whoami)/gitaly,/home/$(whoami)/repositories]" RAILS_ENV=production
~/gitlab/bin/daemon_with_pidfile ~/gitlab/tmp/pids/gitaly.pid ~/gitaly/_build/bin/gitaly ~/gitaly/config.toml >> ~/gitlab/log/gitaly.log 2>&1 &
bundle exec rake gitlab:db:configure RAILS_ENV=production
cp lib/support/init.d/gitlab ~/init
cp lib/support/init.d/gitlab.default.example ~/default
sed -i "s,/etc/default/gitlab,~/default,g" ~/init
sed -i 's,^exit$,[ "$2" = "-f" ] \&\& sleep infinity,g' ~/init
sed -i "s,app_user=\"git\",app_user=\"$(whoami)\"," ~/default
sed -i 's,-listenNetwork unix -listenAddr $socket_path/gitlab-workhorse.socket,-listenNetwork tcp -listenAddr [::]:8100,' ~/default
bundle exec rake gettext:compile RAILS_ENV=production
yarn install --production --pure-lockfile
bundle exec rake gitlab:assets:compile RAILS_ENV=production NODE_ENV=production
It is this last command that requires a significant amount of RAM. The amount needed depends on the number of cores and it may be necessary to increase it if you encounter errors at this stage.
Create a service with the following details:
~/init restart -f
Create a website with the following details:
foobar.alwaysdata.net
true
This site must listen on port 8100
, check in the explanatory text of the Command field. This is normally the case, since it is the only site.
The default account’s username is root. You will choose its password at the first website connection and will be able to change the username afterwards.