-
Notifications
You must be signed in to change notification settings - Fork 0
rails integration
Romain Tartière edited this page Jun 6, 2022
·
1 revision
Deploy a bundled application, run the database migration as the application user and activate it the passenger way:
# site-modules/profile/manifests/application/rails.pp
class profile::application::rails {
application::kind { 'rails':
after_deploy_content => @(SH),
#!/bin/sh
set -e
sudo=''
if [ -n "${USER_MAPPING_user}" ]; then
if [ $(id -u) -ne $(id -u "${USER_MAPPING_user}") ]; then
sudo="sudo -u ${USER_MAPPING_user}"
fi
fi
$sudo RAILS_ENV="${ENVIRONMENT}" SECRET_KEY_BASE="secretsecretsecret" bundle exec rake db:migrate
| SH
after_activate_content => @(SH),
#!/bin/sh
set -e
sudo=''
if [ -n "${USER_MAPPING_user}" ]; then
if [ $(id -u) -ne $(id -u "${USER_MAPPING_user}") ]; then
sudo="sudo -u ${USER_MAPPING_user}"
fi
fi
$sudo touch tmp/restart.txt
| SH
}
}