Commit 79991d72 authored by mh's avatar mh

add ci step to validate installation in prod like environemnt

this should prepare for any issues we might have due to gems not installable
parent d657a68c
Pipeline #3959 failed with stages
in 17 minutes and 37 seconds
stages:
- test
- prod_setup
image: $CI_REGISTRY/immerda/container-images/ruby:2.5
test:
image: $CI_REGISTRY/immerda/container-images/ruby:2.5
stage: test
tags:
- container
script:
......@@ -10,3 +13,16 @@ test:
- yum install -y rh-ruby25-ruby-devel libxml2-devel gcc openssl-devel postgresql-devel gcc-c++ libsodium sqlite3-devel libsqlite3x-devel easy-rsa tinycdb-devel tar gzip patch git bzip2 nodejs
- bundle install --jobs $(nproc) --with=test --with=development || bundle update rails
- bundle exec rails test
prod_setup_check:
stage: prod_setup
tags:
- container
script:
- cp test/local_conf.yml config/
- yum install -y rh-ruby25-ruby-devel libxml2-devel gcc openssl-devel postgresql-devel gcc-c++ libsodium sqlite3-devel libsqlite3x-devel easy-rsa tinycdb-devel tar gzip patch git bzip2 nodejs
- rm -rf vendor/bundle
- export SECRET_KEY_BASE=$(openssl rand -base64 32)
- export RAILS_ENV=production
- bash -ex ./scripts/prepare_for_prod.sh
#!/bin/bash -e
if [ -z $SECRET_KEY_BASE ]; then
echo "SECRET_KEY_BASE is not defined, which is required!"
exit 1
fi
export RAILS_ENV=${RAILS_ENV:-production}
bundle lock
bundle install --path=vendor/bundle --standalone --without development --without test
bundle exec rake tmp:cache:clear
bundle exec rake assets:clean
export PRECOMPILE=${PRECOMPILE:-1}
bundle exec rake assets:precompile
......@@ -13,10 +13,6 @@ fi
user=$(stat -c%U $base_path)
su - $user -s /bin/bash -c "cd $base_path && git pull -q"
su - $user -s /bin/bash -c "cd $base_path && scl enable rh-ruby25 'bundle lock'"
su - $user -s /bin/bash -c "cd $base_path && scl enable rh-ruby25 'bundle install --path=vendor/bundle --standalone --without development'"
su - $user -s /bin/bash -c "cd $base_path && SECRET_KEY_BASE=$skb scl enable rh-ruby25 'bundle exec rake tmp:cache:clear'"
su - $user -s /bin/bash -c "cd $base_path && SECRET_KEY_BASE=$skb scl enable rh-ruby25 'bundle exec rake assets:clean'"
su - $user -s /bin/bash -c "cd $base_path && PRECOMPILE=1 SECRET_KEY_BASE=$skb scl enable rh-ruby25 'bundle exec rake assets:precompile'"
su - $user -s /bin/bash -c "cd $base_path && SECRET_KEY_BASE=$skb scl enable rh-ruby25 -- $base_path/scripts/prepare_for_prod.sh"
[ "${1}" == 'without-restart' ] || su - $user -s /bin/bash -c "touch ${base_path}/tmp/restart.txt"
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