Commit 613cd5fe authored by Vladimir Bashkirtsev's avatar Vladimir Bashkirtsev

Reset config/secrets.yml upon installation and moved pid files to /run/gitlab

parent c9097a5b
...@@ -43,12 +43,11 @@ all: database-config resque-yml nginx-conf ...@@ -43,12 +43,11 @@ all: database-config resque-yml nginx-conf
cd /srv/gitlab && sed -e "s|/home/git/.ssh/|/srv/gitlab/.ssh/|" -i config/gitlab.yml cd /srv/gitlab && sed -e "s|/home/git/.ssh/|/srv/gitlab/.ssh/|" -i config/gitlab.yml
cd /srv/gitlab && sed -e "s|/home/git/repositories/|/var/lib/gitlab/repositories/|" -i config/gitlab.yml cd /srv/gitlab && sed -e "s|/home/git/repositories/|/var/lib/gitlab/repositories/|" -i config/gitlab.yml
cd /srv/gitlab && sed -e "s|/home/git|/srv|" -i config/gitlab.yml cd /srv/gitlab && sed -e "s|/home/git|/srv|" -i config/gitlab.yml
cd /srv/gitlab && sudo -u git -H mv config/secrets.yml.example config/secrets.yml cd /srv/gitlab && sudo -u git -H cp config/secrets.yml.example config/secrets.yml
cd /srv/gitlab && chown -R git log/ cd /srv/gitlab && chown -R git log/
cd /srv/gitlab && chown -R git tmp/ cd /srv/gitlab && chown -R git tmp/
cd /srv/gitlab && chmod -R u+rwX,go-w log/ 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/
cd /srv/gitlab && chmod -R u+rwX tmp/pids/
cd /srv/gitlab && chmod -R u+rwX tmp/sockets/ cd /srv/gitlab && chmod -R u+rwX tmp/sockets/
cd /srv/gitlab && sudo -u git -H mkdir -p public/uploads/ cd /srv/gitlab && sudo -u git -H mkdir -p public/uploads/
cd /srv/gitlab && chmod 0700 public/uploads cd /srv/gitlab && chmod 0700 public/uploads
...@@ -57,6 +56,7 @@ all: database-config resque-yml nginx-conf ...@@ -57,6 +56,7 @@ all: database-config resque-yml nginx-conf
cd /srv/gitlab && chmod -R ug+rwX shared/pages/ cd /srv/gitlab && chmod -R ug+rwX shared/pages/
cd /srv/gitlab && sudo -u git -H mv config/puma.rb.example config/puma.rb cd /srv/gitlab && sudo -u git -H mv config/puma.rb.example config/puma.rb
cd /srv/gitlab && sed -e "s|/home/git|/srv|" -i config/puma.rb cd /srv/gitlab && sed -e "s|/home/git|/srv|" -i config/puma.rb
cd /srv/gitlab && sed -e "s|/srv/gitlab/tmp/pids|/run/gitlab|" -i config/puma.rb
@echo "$$DATABASE_CONFIG" > /srv/gitlab/config/database.yml @echo "$$DATABASE_CONFIG" > /srv/gitlab/config/database.yml
cd /srv/gitlab && chown -R git.git config/database.yml cd /srv/gitlab && chown -R git.git config/database.yml
...@@ -65,6 +65,8 @@ all: database-config resque-yml nginx-conf ...@@ -65,6 +65,8 @@ all: database-config resque-yml nginx-conf
@echo "$$RESQUE_YML" > /srv/gitlab/config/resque.yml @echo "$$RESQUE_YML" > /srv/gitlab/config/resque.yml
cd /srv/gitlab && chown -R git.git config/resque.yml cd /srv/gitlab && chown -R git.git config/resque.yml
cd /srv/gitlab && sudo -u git -H chmod o-rwx config/resque.yml cd /srv/gitlab && sudo -u git -H chmod o-rwx config/resque.yml
@echo "d /run/gitlab 755 git git -" > /usr/lib/tmpfiles.d/gitlab.conf
chmod o+w /srv chmod o+w /srv
cd /srv/gitlab && sudo -u git -H HOME=$(CURDIR)/gitlab-home bundle install --deployment --without development test mysql aws kerberos cd /srv/gitlab && sudo -u git -H HOME=$(CURDIR)/gitlab-home bundle install --deployment --without development test mysql aws kerberos
...@@ -79,13 +81,14 @@ all: database-config resque-yml nginx-conf ...@@ -79,13 +81,14 @@ all: database-config resque-yml nginx-conf
cd /srv/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" cd /srv/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"
sudo -u git /usr/bin/redis-server /etc/redis/redis.conf --daemonize yes --supervised no sudo -u git /usr/bin/redis-server /etc/redis/redis.conf --daemonize yes --supervised no
install -v -m775 -o git -g git -d /run/gitlab
install -v -m775 -o postgres -g postgres -d /run/postgresql 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 /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 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 pg_trgm;"
sudo -u postgres psql -d template1 -c "CREATE EXTENSION IF NOT EXISTS btree_gist;" 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;" sudo -u postgres psql -d template1 -c "CREATE DATABASE gitlabhq_production OWNER git;"
sudo -u git -H sh -c "/srv/gitlab/bin/daemon_with_pidfile /srv/gitlab/tmp/pids/gitaly.pid /srv/gitaly/gitaly /srv/gitaly/config.toml >> /srv/gitlab/log/gitaly.log 2>&1 &" sudo -u git -H sh -c "/srv/gitlab/bin/daemon_with_pidfile /run/gitlab/gitaly.pid /srv/gitaly/gitaly /srv/gitaly/config.toml >> /srv/gitlab/log/gitaly.log 2>&1 &"
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 force=yes
cd /srv/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 cd /srv/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 postgres /usr/bin/pg_ctl -s -D /srv/pgsql/data stop -m fast
...@@ -101,8 +104,12 @@ all: database-config resque-yml nginx-conf ...@@ -101,8 +104,12 @@ all: database-config resque-yml nginx-conf
sed -e "s/redis-server/redis/" -i /etc/init.d/gitlab sed -e "s/redis-server/redis/" -i /etc/init.d/gitlab
install -v -m644 /srv/gitlab/lib/support/init.d/gitlab.default.example /etc/default/gitlab install -v -m644 /srv/gitlab/lib/support/init.d/gitlab.default.example /etc/default/gitlab
sed -e "s/\/home\/\(\$$app_user\|git\)/\/srv/" -i /etc/default/gitlab sed -e "s/\/home\/\(\$$app_user\|git\)/\/srv/" -i /etc/default/gitlab
sed -e "s/\$$app_root\/tmp\/pids/\/run\/gitlab/" -i /etc/default/gitlab
systemctl enable gitlab.service systemctl enable gitlab.service
cd /srv/gitlab && sudo -u git -H mv -f config/secrets.yml.example config/secrets.yml
sudo -u git psql -d gitlabhq_production -c "UPDATE application_settings SET runners_registration_token_encrypted = null;"
rm -rf /usr/local/share/.yarnrc rm -rf /usr/local/share/.yarnrc
/bin/sh cleanup gitlab dev doc git tests cache ports man patches node_modules windows macos bytecode maps packed_assets /bin/sh cleanup gitlab dev doc git tests cache ports man patches node_modules windows macos bytecode maps packed_assets
......
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