1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/redmine_ynh.git synced 2024-09-03 20:16:16 +02:00
This commit is contained in:
ericgaspar 2020-12-23 12:05:22 +01:00
parent 28cb29f8d6
commit 0207126bd2
No known key found for this signature in database
GPG key ID: 574F281483054D44
2 changed files with 19 additions and 5 deletions

View file

@ -19,6 +19,19 @@ BUNDLER_VERSION="2.2.3"
# EXPERIMENTAL HELPERS # EXPERIMENTAL HELPERS
#================================================= #=================================================
# Execute a command as another user
# usage: ynh_exec_as USER COMMAND [ARG ...]
ynh_exec_as() {
local USER=$1
shift 1
if [[ $USER = $(whoami) ]]; then
eval "$@"
else
sudo -u "$USER" "$@"
fi
}
#================================================= #=================================================
# FUTURE OFFICIAL HELPERS # FUTURE OFFICIAL HELPERS
#================================================= #=================================================

View file

@ -76,8 +76,6 @@ ynh_script_progression --message="Installing Rails & Bunlder..." --time --weight
ynh_install_ruby --ruby_version=$RUBY_VERSION ynh_install_ruby --ruby_version=$RUBY_VERSION
gem install bundler
#================================================= #=================================================
# CREATE A POSTGRESQL DATABASE # CREATE A POSTGRESQL DATABASE
#================================================= #=================================================
@ -133,9 +131,11 @@ cp -a ../conf/configuration.example.yml $final_path/config/configuration.yml
ynh_print_info "Compile Redmine..." ynh_print_info "Compile Redmine..."
pushd $final_path pushd $final_path
bundle install --without development test rmagick gem install bundler
RAILS_ENV=production bin/rake generate_secret_token ynh_exec_as $app bundle install --without development test --path vendor/bundle
RAILS_ENV=production bin/rake db:migrate ynh_exec_as $app bundle exec rake generate_secret_token
ynh_exec_as $app RAILS_ENV=production bundle exec rake db:migrate
ynh_exec_as $app RAILS_ENV=production REDMINE_LANG=en bundle exec rake redmine:load_default_data
popd popd
#================================================= #=================================================
@ -160,6 +160,7 @@ ynh_add_nginx_config
# Set permissions to app files # Set permissions to app files
chown -R $app:$app $final_path chown -R $app:$app $final_path
chmod -R 755 $final_path
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT