Commit 201170e9 authored by Vladimir Bashkirtsev's avatar Vladimir Bashkirtsev

Fixed Makefile to build gitlab properly

parent f53237dd
......@@ -8,7 +8,7 @@ all: database-config
rm /etc/gshadow
mv -v /data/etc/gshadow /etc/gshadow
groupadd -g 101 git
useradd -c "GitLab" -d /srv/gitlab -g git -s /bin/false -u 101 git
useradd -c "GitLab" -g git -s /bin/false -u 101 git
rm /etc/passwd-
rm /etc/group-
rm /etc/shadow-
......@@ -27,82 +27,85 @@ all: database-config
mkswap swap
swapon swap
mkdir tmp
chown -R git.git tmp
mount --bind tmp /tmp
mkdir gitlab-home
chown -R git.git gitlab-home
install -v -m755 -d /home/git -o git -g git
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
ln -s /srv/gitlab /home/git/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 tar xf gitlab-foss-v13.1.0.tar.bz2 -C /home/git/gitlab --strip-components=1
sudo -u git -H patch -Np1 -d /home/git/gitlab < gitlab-foss-v13.1.0-gems_update.patch
chown -R git.git /home/git/gitlab
cd /home/git/gitlab && sudo -u git -H mv config/gitlab.yml.example config/gitlab.yml
cd /home/git/gitlab && sudo -u git -H mv config/secrets.yml.example config/secrets.yml
cd /home/git/gitlab && chown -R git log/
cd /home/git/gitlab && chown -R git tmp/
cd /home/git/gitlab && chmod -R u+rwX,go-w log/
cd /home/git/gitlab && chmod -R u+rwX tmp/
cd /home/git/gitlab && chmod -R u+rwX tmp/pids/
cd /home/git/gitlab && chmod -R u+rwX tmp/sockets/
cd /home/git/gitlab && sudo -u git -H mkdir -p public/uploads/
cd /home/git/gitlab && chmod 0700 public/uploads
cd /home/git/gitlab && chmod -R u+rwX builds/
cd /home/git/gitlab && chmod -R u+rwX shared/artifacts/
cd /home/git/gitlab && chmod -R ug+rwX shared/pages/
cd /home/git/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 /home/git/gitlab && sudo -u git -H mv config/resque.yml.example config/resque.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"
@echo "$$DATABASE_CONFIG" > /home/git/gitlab/config/database.yml
cd /home/git/gitlab && chown -R git.git config/database.yml
cd /home/git/gitlab && sudo -u git -H chmod o-rwx config/database.yml
rm -rf /usr/local/share/.yarnrc
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 '{}' ';'
find / -name *.css.map -exec rm -f '{}' ';'
find / -depth -name .cache -type d -exec rm -rf '{}' ';'
find / -depth -name .pytest_cache -type d -exec rm -rf '{}' ';'
find / -depth -name .mypy_cache -type d -exec rm -rf '{}' ';'
find / -depth -name __pycache__ -type d -exec rm -rf '{}' ';'
find / -depth -name .tox -type d -exec rm -rf '{}' ';'
find / -depth -name node_modules -type d -exec rm -rf '{}' ';'
rm -rf gitlab-home
umount /tmp
rm -rf tmp
swapoff swap
rm -rf swap
cd /home/git/gitlab && sudo -u git -H HOME=$(CURDIR)/gitlab-home bundle install --deployment --without development test mysql aws kerberos
cd /home/git/gitlab && sudo -u git -H HOME=$(CURDIR)/gitlab-home PATH=$$PATH:$(CURDIR)/../go/go/bin GOCACHE=$(CURDIR)/gitlab-home/gocache bundle exec rake gitlab:shell:install RAILS_ENV=production
mv /home/git/gitlab-shell /srv/gitlab-shell
ln -s /srv/gitlab-shell /home/git/gitlab-shell
chown -R git.git /home/git/gitlab-shell
chmod o+w /srv
cd /home/git/gitlab && sudo -u git -H HOME=$(CURDIR)/gitlab-home PATH=$$PATH:$(CURDIR)/../go/go/bin GOCACHE=$(CURDIR)/gitlab-home/gocache bundle exec rake "gitlab:workhorse:install[/srv/gitlab-workhorse]" RAILS_ENV=production
ln -s /srv/gitlab-workhorse /home/git/gitlab-workhorse
chown -R git.git /home/git/gitlab-workhorse
cd /home/git/gitlab && sudo -u git -H HOME=$(CURDIR)/gitlab-home PATH=$$PATH:$(CURDIR)/../go/go/bin GOCACHE=$(CURDIR)/gitlab-home/gocache VERBOSE=1 bundle exec rake "gitlab:gitaly:install[/srv/gitaly,/home/git/repositories]" RAILS_ENV=production
ln -s /srv/gitaly /home/git/gitaly
chown -R git.git /home/git/gitaly
chmod o-w /srv
chmod 0700 /home/git/gitlab/tmp/sockets/private
chown git /home/git/gitlab/tmp/sockets/private
cd /home/git/gitlab && sudo -u git -H HOME=$(CURDIR)/gitlab-home bundle exec rake gettext:compile RAILS_ENV=production
cd /home/git/gitlab && sudo -u git -H HOME=$(CURDIR)/gitlab-home yarn install --production --pure-lockfile
cd /home/git/gitlab && sudo -u git -H HOME=$(CURDIR)/gitlab-home bundle exec rake gitlab:assets:compile RAILS_ENV=production NODE_ENV=production NODE_OPTIONS="--max-old-space-size=3072"
postinstall:
install -v -m775 -o git -g git -d /var/run/redis
sudo -u git /usr/bin/redis-server /etc/redis/redis.conf --daemonize yes --unixsocket /var/run/redis/redis.sock --supervised no
install -v -m775 -o postgres -g postgres -d /run/postgresql
sudo -u postgres /usr/bin/pg_ctl -s -D /srv/pgsql/data start -w -t 120
sudo -u postgres psql -d template1 -c "CREATE USER git CREATEDB;"
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 git -H sh -c "/home/git/gitlab/bin/daemon_with_pidfile /home/git/gitlab/tmp/pids/gitaly.pid /home/git/gitaly/gitaly /home/git/gitaly/config.toml >> /home/git/gitlab/log/gitaly.log 2>&1 &"
cd /home/git/gitlab && sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production force=yes
cd /home/git/gitlab && sudo -u git -H HOME=$(CURDIR)/gitlab-home PATH=$$PATH:$(CURDIR)/../go/go/bin GOCACHE=$(CURDIR)/gitlab-home/gocache bundle exec rake gitlab:env:info RAILS_ENV=production
sudo -u postgres /usr/bin/pg_ctl -s -D /srv/pgsql/data stop -m fast
sudo -u git /usr/bin/redis-cli shutdown nosave
rm -rf /usr/local/share/.yarnrc
/bin/sh cleanup gitlab bundler dev doc git tests cache ports man patches node_modules windows macos bytecode maps packed_assets
rm -rf gitlab-home
umount /tmp
rm -rf tmp
swapoff swap
rm -rf swap
database-config:
define DATABASE_CONFIG
......
#!/bin/sh
pkg=$1
if [ "$#" != "0" ]; then
shift
for group in $@; do
removegroups+=("$group")
done
fi
load_regexps() {
local groupfile=$1.groups
local group
set -f
unset regexps
if [ -f $groupfile ]; then
while read -r line
do
if [ -n "$line" ] ; then
if [[ ! $line =~ ^/ ]]; then
group=$line
else
if [ -z $removegroups ] ; then
regexps+=("$line")
else
for remove in ${removegroups[@]} ; do
if [[ $group == $remove ]] ; then
regexps+=("$line")
fi
done
fi
fi
fi
done < "$groupfile"
fi
set +f
}
check_regexps() {
declare -a matches
set -f
count=0
for regexp in ${regexps[@]} ; do
if [[ "$1" =~ ^$regexp$ ]] ; then
matches+=("$regexp")
((count++))
fi
done
set +f
if [[ $count == 0 ]]; then
return 1
elif [[ $count == 1 ]] ; then
return 0
else
echo "File $1 matches multiple groups patterns, check your groups file"
echo "Patterns: ${matches[@]}"
return 0
fi
}
load_regexps $pkg
while read -r filename
do
if check_regexps "$filename" ; then
rm -f "$filename"
fi
done <<< $(find / -type f)
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