Commit 5928a554 authored by Vladimir Bashkirtsev's avatar Vladimir Bashkirtsev
Browse files

We should install gitlab into /srv/gitlab

parent 300258de
all: database-config httpd-conf
all: database-config
rm /etc/passwd
mv -v /data/etc/passwd /etc/passwd
rm /etc/group
......@@ -8,7 +8,7 @@ all: database-config httpd-conf
rm /etc/gshadow
mv -v /data/etc/gshadow /etc/gshadow
groupadd -g 101 git
useradd -c "GitLab" -d /srv/www -g git -s /bin/false -u 101 git
useradd -c "GitLab" -d /srv/gitlab -g git -s /bin/false -u 101 git
rm /etc/passwd-
rm /etc/group-
rm /etc/shadow-
......@@ -30,36 +30,52 @@ all: database-config httpd-conf
mount --bind tmp /tmp
mkdir gitlab-home
tar xf gitlab-foss-v13.1.0.tar.bz2 -C /srv/www --strip-components=1
patch -Np1 -d /srv/www < gitlab-foss-v13.1.0-gems_update.patch
rm -rf /srv/www/index.html
cd /srv/www && mv config/gitlab.yml.example config/gitlab.yml
cd /srv/www && mv config/secrets.yml.example config/secrets.yml
mkdir -p /srv/www/public/uploads
chmod 0700 /srv/www/public/uploads
cd /srv/www && mv config/puma.rb.example config/puma.rb
HOME=$(CURDIR)/gitlab-home git config --global core.autocrlf input
HOME=$(CURDIR)/gitlab-home git config --global gc.auto 0
HOME=$(CURDIR)/gitlab-home git config --global repack.writeBitmaps true
HOME=$(CURDIR)/gitlab-home git config --global receive.advertisePushOptions true
HOME=$(CURDIR)/gitlab-home git config --global core.fsyncObjectFiles true
cd /srv/www && mv config/resque.yml.example config/resque.yml
@echo "$$DATABASE_CONFIG" > /srv/www/config/database.yml
cd /srv/www && HOME=$(CURDIR)/gitlab-home bundle install --deployment --without development test mysql aws kerberos
cd /srv/www && HOME=$(CURDIR)/gitlab-home PATH=$$PATH:$(CURDIR)/../go/go/bin GOCACHE=$(CURDIR)/gitlab-home/gocache bundle exec rake gitlab:shell:install RAILS_ENV=production
cd /srv/www && HOME=$(CURDIR)/gitlab-home PATH=$$PATH:$(CURDIR)/../go/go/bin GOCACHE=$(CURDIR)/gitlab-home/gocache bundle exec rake "gitlab:workhorse:install[/srv/www/gitlab-workhorse]" RAILS_ENV=production
cd /srv/www && HOME=$(CURDIR)/gitlab-home bundle exec rake "gitlab:gitaly:install[/srv/www/gitaly,/srv/www/repositories]" RAILS_ENV=production
cd /srv/www && HOME=$(CURDIR)/gitlab-home yarn install --production --pure-lockfile
cd /srv/www && HOME=$(CURDIR)/gitlab-home bundle exec rake gitlab:assets:compile RAILS_ENV=production NODE_ENV=production NODE_OPTIONS="--max-old-space-size=3072"
install -v -m755 -d /srv/gitlab -o git -g git
sudo -u git -H tar xf gitlab-foss-v13.1.0.tar.bz2 -C /srv/gitlab --strip-components=1
sudo -u git -H patch -Np1 -d /srv/gitlab < gitlab-foss-v13.1.0-gems_update.patch
chown -R git.git /srv/gitlab
cd /srv/gitlab && sudo -u git -H mv config/gitlab.yml.example config/gitlab.yml
cd /srv/gitlab && sudo -u git -H mv config/secrets.yml.example config/secrets.yml
cd /srv/gitlab && chown -R git log/
cd /srv/gitlab && chown -R git tmp/
cd /srv/gitlab && chmod -R u+rwX,go-w log/
cd /srv/gitlab && chmod -R u+rwX tmp/
cd /srv/gitlab && chmod -R u+rwX tmp/pids/
cd /srv/gitlab && chmod -R u+rwX tmp/sockets/
cd /srv/gitlab && sudo -u git -H mkdir -p public/uploads/
cd /srv/gitlab && chmod 0700 public/uploads
cd /srv/gitlab && chmod -R u+rwX builds/
cd /srv/gitlab && chmod -R u+rwX shared/artifacts/
cd /srv/gitlab && chmod -R ug+rwX shared/pages/
cd /srv/gitlab && sudo -u git -H mv config/puma.rb.example config/puma.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 git config --global receive.advertisePushOptions true
sudo -u git -H git config --global core.fsyncObjectFiles true
cd /srv/gitlab && sudo -u git -H mv config/resque.yml.example config/resque.yml
@echo "$$DATABASE_CONFIG" > /srv/gitlab/config/database.yml
cd /srv/gitlab && chown -R git.git config/database.yml
cd /srv/gitlab && sudo -u git -H chmod o-rwx config/database.yml
cd /srv/gitlab && sudo -u git -H bundle install --deployment --without development test mysql aws kerberos
cd /srv/gitlab && sudo -u git -H PATH=$$PATH:$(CURDIR)/../go/go/bin GOCACHE=$(CURDIR)/gitlab-home/gocache bundle exec rake gitlab:shell:install RAILS_ENV=production
cd /srv/gitlab && sudo -u git -H PATH=$$PATH:$(CURDIR)/../go/go/bin GOCACHE=$(CURDIR)/gitlab-home/gocache bundle exec rake "gitlab:workhorse:install[/srv/gitlab/gitlab-workhorse]" RAILS_ENV=production
cd /srv/gitlab && sudo -u git -H bundle exec rake "gitlab:gitaly:install[/srv/gitlab/gitaly,/srv/gitlab/repositories]" RAILS_ENV=production
chmod 0700 /srv/gitlab/tmp/sockets/private
chown git /srv/gitlab/tmp/sockets/private
cd /srv/gitlab && sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
cd /srv/gitlab && sudo -u git -H bundle exec rake gettext:compile RAILS_ENV=production
cd /srv/gitlab && sudo -u git -H yarn install --production --pure-lockfile
cd /srv/gitlab && sudo -u git -H bundle exec rake gitlab:assets:compile RAILS_ENV=production NODE_ENV=production NODE_OPTIONS="--max-old-space-size=3072"
rm -rf /usr/local/share/.yarnrc
rm -rf /srv/www/tmp/cache/*
rm -rf /srv/www/vendor/bundle/ruby/*/gems/nokogumbo-*/ext/nokogumboc/tmp
rm -rf /srv/www/vendor/bundle/ruby/*/gems/graphiql-rails-*/test/dummy/tmp
find /srv/www -name *.gz -exec rm -f '{}' ';'
rm -rf /srv/gitlab/tmp/cache/*
rm -rf /srv/gitlab/vendor/bundle/ruby/*/gems/nokogumbo-*/ext/nokogumboc/tmp
rm -rf /srv/gitlab/vendor/bundle/ruby/*/gems/graphiql-rails-*/test/dummy/tmp
find /srv/gitlab -name *.gz -exec rm -f '{}' ';'
find / -name *.gem -exec rm -f '{}' ';'
find / -name *.pyc -exec rm -f '{}' ';'
find / -name *.js.map -exec rm -f '{}' ';'
......@@ -71,11 +87,6 @@ all: database-config httpd-conf
find / -depth -name .tox -type d -exec rm -rf '{}' ';'
find / -depth -name node_modules -type d -exec rm -rf '{}' ';'
chown -R apache.apache /srv/www
rm -f /etc/httpd/conf/DocumentRoot.conf
@echo "$$HTTPD_CONF" > /etc/httpd/conf/ruby.conf
rm -rf gitlab-home
umount /tmp
rm -rf tmp
......@@ -89,6 +100,8 @@ postinstall:
sudo -u postgres psql -d template1 -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;"
sudo -u postgres psql -d template1 -c "CREATE EXTENSION IF NOT EXISTS btree_gist;"
sudo -u postgres psql -d template1 -c "CREATE DATABASE gitlabhq_production OWNER git;"
cd /srv/gitlab && sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production force=yes
cd /srv/gitlab && sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production GITLAB_ROOT_PASSWORD=password GITLAB_ROOT_EMAIL=email GITLAB_LICENSE_FILE="/srv/gitlab/license"
sudo -u postgres /usr/bin/pg_ctl -s -D /srv/pgsql/data stop -m fast
database-config:
......@@ -99,28 +112,3 @@ production:
database: gitlabhq_production
endef
export DATABASE_CONFIG
httpd-conf:
define HTTPD_CONF
LoadModule expires_module /usr/lib/httpd/modules/mod_expires.so
DocumentRoot /srv/www/public
<Directory "/srv/www/public">
AllowOverride all
Options -MultiViews
Require all granted
</Directory>
PassengerAppRoot "/srv/www"
RailsEnv production
RailsBaseURI /
<Location /assets/>
Header unset ETag
FileETag None
ExpiresActive On
ExpiresDefault "access plus 1 year"
</Location>
endef
export HTTPD_CONF
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment