1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/huginn_ynh.git synced 2024-09-03 19:26:13 +02:00

Fix services

This commit is contained in:
yalh76 2022-03-25 22:59:08 +01:00
parent 0b1ff20ad5
commit c550dc7fa4
5 changed files with 32 additions and 12 deletions

View file

@ -8,8 +8,9 @@ User=__APP__
Group=__APP__ Group=__APP__
WorkingDirectory=__FINALPATH__/ WorkingDirectory=__FINALPATH__/
EnvironmentFile=__FINALPATH__/.env EnvironmentFile=__FINALPATH__/.env
ExecStart=/opt/rbenv/versions/__RUBY_VERSION__/bin/bundle exec rails runner bin/threaded.rb Environment="__YNH_RUBY_LOAD_PATH__"
StandardOutput=append:/var/log/__APP__/__APP__-jobs.log ExecStart=/opt/rbenv/versions/__APP__/bin/bundle exec rails runner bin/threaded.rb
StandardOutput=append:__FINALPATH__/log/__APP__-jobs.log
StandardError=inherit StandardError=inherit
[Install] [Install]

View file

@ -8,8 +8,9 @@ User=__APP__
Group=__APP__ Group=__APP__
WorkingDirectory=__FINALPATH__/ WorkingDirectory=__FINALPATH__/
EnvironmentFile=__FINALPATH__/.env EnvironmentFile=__FINALPATH__/.env
ExecStart=/opt/rbenv/versions/__RUBY_VERSION__/bin/bundle exec unicorn -c config/unicorn.rb Environment="__YNH_RUBY_LOAD_PATH__"
StandardOutput=append:/var/log/__APP__/__APP__-web.log ExecStart=/opt/rbenv/versions/__APP__/bin/bundle exec unicorn -c config/unicorn.rb
StandardOutput=append:__FINALPATH__/log/__APP__-web.log
StandardError=inherit StandardError=inherit
[Install] [Install]

View file

@ -138,8 +138,8 @@ pushd $final_path
ynh_use_ruby ynh_use_ruby
cp config/unicorn.rb.example config/unicorn.rb cp config/unicorn.rb.example config/unicorn.rb
chown -R $app:www-data "$final_path/config/unicorn.rb" chown -R $app:www-data "$final_path/config/unicorn.rb"
#ynh_gem update --system ynh_gem update --system --no-document
ynh_gem install bundler foreman --no-document ynh_gem install rake bundler foreman --no-document
bundle install --deployment --without development test bundle install --deployment --without development test
bundle exec rake db:create RAILS_ENV=production bundle exec rake db:create RAILS_ENV=production
bundle exec rake db:migrate RAILS_ENV=production bundle exec rake db:migrate RAILS_ENV=production
@ -169,7 +169,7 @@ ynh_add_systemd_config --service="$app-jobs" --template="jobs.service"
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add "$app-web" --log="/var/log/$app/$app-web.log" yunohost service add "$app-web" --log="$final_path/log/unicorn.log"
yunohost service add "$app-jobs" --log="/var/log/$app/$app-jobs.log" yunohost service add "$app-jobs" --log="/var/log/$app/$app-jobs.log"
#================================================= #=================================================
@ -178,7 +178,7 @@ yunohost service add "$app-jobs" --log="/var/log/$app/$app-jobs.log"
ynh_script_progression --message="Starting a systemd service..." ynh_script_progression --message="Starting a systemd service..."
# Start a systemd service # Start a systemd service
ynh_systemd_action --service_name="$app-web" --action="start" --log_path="/var/log/$app/$app-web.log" --line_match="Started" ynh_systemd_action --service_name="$app-web" --action="start" --log_path="$final_path/log/unicorn.log" --line_match="Started"
ynh_systemd_action --service_name="$app-jobs" --action="start" --log_path="/var/log/$app/$app-jobs.log" --line_match="Started" ynh_systemd_action --service_name="$app-jobs" --action="start" --log_path="/var/log/$app/$app-jobs.log" --line_match="Started"
#================================================= #=================================================

View file

@ -82,7 +82,6 @@ ynh_script_progression --message="Reinstalling dependencies..."
# Define and install dependencies # Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies $build_pkg_dependencies ynh_install_app_dependencies $pkg_dependencies $build_pkg_dependencies
ynh_install_ruby --ruby_version=$ruby_version ynh_install_ruby --ruby_version=$ruby_version
ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# RESTORE THE MYSQL DATABASE # RESTORE THE MYSQL DATABASE
@ -93,6 +92,25 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#=================================================
# BUILD APP
#=================================================
ynh_script_progression --message="Building app..."
pushd $final_path
ynh_use_ruby
ynh_gem update --system --no-document
ynh_gem install rake bundler foreman --no-document
bundle install --deployment --without development test
bundle exec rake assets:clean assets:precompile tmp:cache:clear RAILS_ENV=production
popd
ynh_install_app_dependencies $pkg_dependencies
chmod 750 "$final_path/public"
chmod -R o-rwx "$final_path/public"
chown -R $app:www-data "$final_path/public"
#================================================= #=================================================
# RESTORE SYSTEMD # RESTORE SYSTEMD
#================================================= #=================================================

View file

@ -134,11 +134,11 @@ pushd $final_path
ynh_use_ruby ynh_use_ruby
cp -f config/unicorn.rb.example config/unicorn.rb cp -f config/unicorn.rb.example config/unicorn.rb
chown -R $app:www-data "$final_path/config/unicorn.rb" chown -R $app:www-data "$final_path/config/unicorn.rb"
#ynh_gem update --system ynh_gem update --system --no-document
ynh_gem install bundler foreman --no-document ynh_gem install rake bundler foreman --no-document
bundle install --deployment --without development test bundle install --deployment --without development test
bundle exec rake db:migrate RAILS_ENV=production bundle exec rake db:migrate RAILS_ENV=production
bundle exec rake assets:precompile RAILS_ENV=production bundle exec rake assets:clean assets:precompile tmp:cache:clear RAILS_ENV=production
popd popd
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies