1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/redmine_ynh.git synced 2024-09-03 20:16:16 +02:00

Merge branch 'testing' into feature-ldap-config

This commit is contained in:
OniriCorpe 2024-02-24 21:55:55 +01:00 committed by GitHub
commit 5aff6637e6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 147 additions and 196 deletions

View file

@ -1,5 +1,5 @@
<!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/readme_generator
It shall NOT be edited by hand.
-->
@ -29,6 +29,7 @@ Redmine is a flexible project management web application written using Ruby on R
* Official app website: <https://www.redmine.org>
* Upstream app code repository: <https://github.com/redmine/redmine>
* YunoHost Store: <https://apps.yunohost.org/app/redmine>
* Report a bug: <https://github.com/YunoHost-Apps/redmine_ynh/issues>
## Developer info
@ -43,4 +44,4 @@ or
sudo yunohost app upgrade redmine -u https://github.com/YunoHost-Apps/redmine_ynh/tree/testing --debug
```
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>

View file

@ -1,5 +1,5 @@
<!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/readme_generator
It shall NOT be edited by hand.
-->
@ -29,6 +29,7 @@ Redmine est une application web de gestion de projet flexible écrite à l'aide
* Site officiel de lapp : <https://www.redmine.org>
* Dépôt de code officiel de lapp : <https://github.com/redmine/redmine>
* YunoHost Store: <https://apps.yunohost.org/app/redmine>
* Signaler un bug : <https://github.com/YunoHost-Apps/redmine_ynh/issues>
## Informations pour les développeurs

View file

@ -1,3 +1,5 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
packaging_format = 2
id = "redmine"
@ -33,10 +35,10 @@ ram.runtime = "50M"
default = "visitors"
[resources]
[resources.sources.main]
url = "https://github.com/redmine/redmine/archive/refs/tags/5.0.6.tar.gz"
sha256 = "ecdfd7fd377ff3812726a8e0d6d82f6a0fa2be09c271b03472b071f5ed4713f6"
autoupdate.strategy = "latest_github_tag"
[resources.sources.main]
url = "https://github.com/redmine/redmine/archive/refs/tags/5.0.6.tar.gz"
sha256 = "ecdfd7fd377ff3812726a8e0d6d82f6a0fa2be09c271b03472b071f5ed4713f6"
autoupdate.strategy = "latest_github_tag"
[resources.system_user]
@ -45,8 +47,36 @@ ram.runtime = "50M"
[resources.permissions]
main.url = "/"
[resources.ports]
main.default = 8095
[resources.apt]
packages = "postgresql, libpq-dev"
packages = [
"postgresql", "libpq-dev",
# For Ruby
"autoconf",
"build-essential",
"libdb-dev",
"libffi-dev",
"libgdbm-dev",
"libgdbm6",
"libgmp-dev",
"libjemalloc-dev",
"libncurses5-dev",
"libsqlite3-dev",
"libreadline6-dev",
"libssl-dev",
"libxml2-dev",
"libxslt-dev",
"libyaml-dev",
"patch",
"rustc",
"uuid-dev",
"zlib1g-dev",
"openssl",
]
[resources.database]
type = "postgresql"

View file

@ -4,12 +4,23 @@
# COMMON VARIABLES
#=================================================
ruby_version=3.0
ruby_version=3.1
#=================================================
# PERSONAL HELPERS
#=================================================
_redmine_ruby_install() {
pushd "$install_dir"
ynh_use_ruby
"$ynh_gem" update --system --no-document
"$ynh_gem" install bundler passenger --no-document
bundle config set --local without 'development test rmagick'
bundle add 'webrick' --version '~> 1.7'
bundle install
popd
}
#=================================================
# EXPERIMENTAL HELPERS
#=================================================

View file

@ -22,24 +22,20 @@ ynh_print_info --message="Declaring files to be backed up..."
ynh_backup --src_path="$install_dir"
#=================================================
# BACKUP THE NGINX CONFIGURATION
# SYSTEM CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP LOGROTATE
#=================================================
ynh_backup --src_path="/etc/logrotate.d/$app"
ynh_backup --src_path="/etc/systemd/system/$app.service"
#=================================================
# BACKUP SYSTEMD
# BACKUP VARIOUS FILES
#=================================================
ynh_backup --src_path="/etc/systemd/system/$app.service"
ynh_backup --src_path="/var/log/$app/"
#=================================================
# BACKUP THE POSTGRESQL DATABASE

View file

@ -16,7 +16,7 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
ynh_systemd_action --service_name="$app" --action="stop" --log_path="/var/log/$app/$app.log"
#=================================================
# MODIFY URL IN NGINX CONF
@ -30,10 +30,10 @@ ynh_change_url_nginx_config
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_script_progression --message="Starting $app's systemd service..." --weight=1
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="WEBrick::HTTPServer#start"
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" --line_match="WEBrick::HTTPServer#start"
#=================================================
# END OF SCRIPT

View file

@ -13,7 +13,7 @@ source /usr/share/yunohost/helpers
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=1
ynh_script_progression --message="Installing Ruby..." --weight=1
ynh_exec_warn_less ynh_install_ruby --ruby_version=$ruby_version
@ -26,35 +26,23 @@ ynh_setup_source --dest_dir="$install_dir"
mkdir -p "$install_dir/files" "$install_dir/log" "$install_dir/tmp" "$install_dir/public/plugin_assets"
chmod 750 "$install_dir"
chmod 755 "$install_dir/files" "$install_dir/log" "$install_dir/tmp" "$install_dir/public/plugin_assets"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
chown -R "$app:www-data" "$install_dir"
#=================================================
# SPECIFIC SETUP
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_script_progression --message="Adding $app's configuration file..." --weight=1
ynh_add_config --template="../conf/database.example.yml" --destination="$install_dir/config/database.yml"
ynh_add_config --template="database.example.yml" --destination="$install_dir/config/database.yml"
chmod 400 "$install_dir/config/database.yml"
chown $app:$app "$install_dir/config/database.yml"
chown "$app:$app" "$install_dir/config/database.yml"
ynh_add_config --template="../conf/configuration.yml.example" --destination="$install_dir/config/configuration.yml"
ynh_add_config --template="configuration.yml.example" --destination="$install_dir/config/configuration.yml"
chmod 400 "$install_dir/config/configuration.yml"
chown $app:$app "$install_dir/config/configuration.yml"
ynh_add_config --template="db-ldap.sql" --destination="$install_dir/config/db-ldap.sql"
chown "$app:$app" "$install_dir/config/configuration.yml"
ynh_add_config --template="../conf/db-ldap.sql" --destination="$final_path/config/db-ldap.sql"
@ -63,12 +51,9 @@ ynh_add_config --template="../conf/db-ldap.sql" --destination="$final_path/confi
#=================================================
ynh_script_progression --message="Building app..." --weight=1
pushd $install_dir
ynh_use_ruby
ynh_gem update --system --no-document
ynh_gem install bundler passenger --no-document
bundle config set --local without 'development test rmagick'
bundle install
_redmine_ruby_install
pushd "$install_dir"
ynh_exec_warn_less bundle exec rake generate_secret_token RAILS_ENV=production
ynh_exec_warn_less bundle exec rake db:migrate RAILS_ENV=production
@ -79,44 +64,33 @@ pushd $install_dir
#ynh_exec_warn_less bundle exec rake redmine:load_default_data RAILS_ENV=production
popd
chmod 750 "$install_dir/public"
chmod -R o-rwx "$install_dir/public"
chown -R $app:www-data "$install_dir/public"
# Setting up LDAP authentification
ynh_add_config --template="db-ldap.sql" --destination="$install_dir/config/db-ldap.sql"
ynh_psql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < "$install_dir/config/db-ldap.sql"
ynh_secure_remove --file="$install_dir/config/db-ldap.sql"
#=================================================
# SETUP SYSTEMD
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
# Create a dedicated systemd config
ynh_add_systemd_config
yunohost service add "$app" --log="/var/log/$app/$app.log"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=1
mkdir -p "/var/log/$app"
chown -R $app:$app "/var/log/$app"
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_script_progression --message="Starting $app's systemd service..." --weight=1
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="WEBrick::HTTPServer#start"
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" --line_match="WEBrick::HTTPServer#start"
#=================================================
# END OF SCRIPT

View file

@ -11,16 +11,13 @@ source ynh_install_ruby__2
source /usr/share/yunohost/helpers
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
# REMOVE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null
then
ynh_script_progression --message="Removing $app service integration..." --weight=1
yunohost service remove $app
if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then
yunohost service remove "$app"
fi
# Remove the dedicated systemd config

View file

@ -11,6 +11,13 @@ source ../settings/scripts/_common.sh
source ../settings/scripts/ynh_install_ruby__2
source /usr/share/yunohost/helpers
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling Ruby..." --weight=1
ynh_exec_warn_less ynh_install_ruby --ruby_version=$ruby_version
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
@ -21,87 +28,52 @@ ynh_restore_file --origin_path="$install_dir"
ynh_secure_remove --file="$install_dir/tmp"
mkdir -p "$install_dir/files" "$install_dir/log" "$install_dir/tmp" "$install_dir/public/plugin_assets"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
chown -R "$app:www-data" "$install_dir"
#=================================================
# SPECIFIC RESTORATION
# RESTORE THE POSTGRESQL DATABASE
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1
ynh_exec_warn_less ynh_install_ruby --ruby_version=$ruby_version
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Restoring the MySQL database..." --weight=1
ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
ynh_psql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql
#=================================================
# BUILD APP
#=================================================
ynh_script_progression --message="Building app..." --weight=1
pushd $install_dir
ynh_use_ruby
ynh_gem update --system --no-document
ynh_gem install bundler passenger --no-document
bundle config set --local without 'development test rmagick'
bundle install
popd
_redmine_ruby_install
chmod 750 "$install_dir/public"
chmod -R o-rwx "$install_dir/public"
chown -R $app:www-data "$install_dir/public"
chown -R "$app:www-data" "$install_dir/public"
#=================================================
# RESTORE SYSTEMD
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet
systemctl enable "$app.service" --quiet
yunohost service add "$app" --log="/var/log/$app/$app.log"
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
mkdir -p "/var/log/$app"
chown -R $app:$app "/var/log/$app"
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
# RESTORE VARIOUS FILES
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --log="/var/log/$app/$app.log"
ynh_restore_file --origin_path="/var/log/$app/"
#=================================================
# START SYSTEMD SERVICE
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="WEBrick::HTTPServer#start"
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" --line_match="WEBrick::HTTPServer#start"
ynh_systemd_action --service_name=nginx --action=reload

View file

@ -10,54 +10,35 @@ source _common.sh
source ynh_install_ruby__2
source /usr/share/yunohost/helpers
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_script_progression --message="Stopping $app's systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --keep="config/database.yml config/configuration.yml"
fi
mkdir -p "$install_dir/files" "$install_dir/log" "$install_dir/tmp" "$install_dir/public/plugin_assets"
chmod 750 "$install_dir"
chmod 755 "$install_dir/files" "$install_dir/log" "$install_dir/tmp" "$install_dir/public/plugin_assets"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
ynh_systemd_action --service_name="$app" --action="stop" --log_path="/var/log/$app/$app.log"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=1
ynh_script_progression --message="Upgrading Ruby..." --weight=1
ynh_exec_warn_less ynh_install_ruby --ruby_version=$ruby_version
#=================================================
# NGINX CONFIGURATION
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
ynh_script_progression --message="Upgrading source files..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep="config/database.yml config/configuration.yml config/initializers/secret_token.rb"
mkdir -p "$install_dir/files" "$install_dir/log" "$install_dir/tmp" "$install_dir/public/plugin_assets"
chmod 750 "$install_dir/files" "$install_dir/log" "$install_dir/tmp" "$install_dir/public/plugin_assets"
chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
#=================================================
# SPECIFIC UPGRADE
@ -66,56 +47,41 @@ ynh_add_nginx_config
#=================================================
ynh_script_progression --message="Building app..." --weight=1
pushd $install_dir
ynh_use_ruby
ynh_gem update --system --no-document
ynh_gem install bundler passenger --no-document
bundle config set --local without 'development test rmagick'
bundle install
ynh_exec_warn_less bundle exec rake db:migrate RAILS_ENV=production
_redmine_ruby_install
pushd "$install_dir"
ynh_exec_warn_less bundle exec rake db:migrate RAILS_ENV=production
popd
#Setting up LDAP authentification
ynh_psql_connect_as $db_user $db_pwd $db_name < $install_dir/config/db-ldap.sql
rm -f $install_dir/config/db-ldap.sql
# Setting up LDAP authentification
ynh_add_config --template="db-ldap.sql" --destination="$install_dir/config/db-ldap.sql"
ynh_psql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < "$install_dir/config/db-ldap.sql"
ynh_secure_remove --file="$install_dir/config/db-ldap.sql"
chmod 750 "$install_dir/public"
chmod -R o-rwx "$install_dir/public"
chown -R $app:www-data "$install_dir/public"
chown -R "$app:www-data" "$install_dir/public"
#=================================================
# SETUP SYSTEMD
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
# Create a dedicated systemd config
ynh_add_systemd_config
yunohost service add "$app" --log="/var/log/$app/$app.log"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
mkdir -p "/var/log/$app"
chown -R $app:$app "/var/log/$app"
# Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_script_progression --message="Starting $app's systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="WEBrick::HTTPServer#start"
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" --line_match="WEBrick::HTTPServer#start"
#=================================================
# END OF SCRIPT

View file

@ -35,7 +35,7 @@ build_pkg_dependencies="$build_pkg_dependencies $build_ruby_dependencies"
# However, $PATH is duplicated into $ruby_path to outlast any manipulation of $PATH
# You can use the variable `$ynh_ruby_load_path` to quickly load your Ruby version
# in $PATH for an usage into a separate script.
# Exemple: $ynh_ruby_load_path $final_path/script_that_use_gem.sh`
# Exemple: $ynh_ruby_load_path $install_dir/script_that_use_gem.sh`
#
#
# Finally, to start a Ruby service with the correct version, 2 solutions
@ -80,7 +80,7 @@ ynh_use_ruby () {
ynh_ruby_load_path="PATH=$PATH"
# Sets the local application-specific Ruby version
pushd $final_path
pushd $install_dir
$rbenv_install_dir/bin/rbenv local $ruby_version
popd
}
@ -215,7 +215,8 @@ ynh_install_ruby () {
final_ruby_version=$ruby_version
fi
ynh_print_info --message="Installing Ruby-$final_ruby_version"
CONFIGURE_OPTS="--disable-install-doc --with-jemalloc" MAKE_OPTS="-j2" rbenv install --skip-existing $final_ruby_version > /dev/null 2>&1
CONFIGURE_OPTS="--disable-install-doc --with-jemalloc" MAKE_OPTS="-j2" rbenv install --skip-existing $final_ruby_version
# > /dev/null 2>&1
# Store ruby_version into the config of this app
ynh_app_setting_set --app=$YNH_APP_INSTANCE_NAME --key=ruby_version --value=$final_ruby_version
@ -286,7 +287,7 @@ ynh_cleanup_ruby () {
required_ruby_versions="${installed_app_ruby_version}\n${required_ruby_versions}"
fi
done
# Remove no more needed Ruby versions
local installed_ruby_versions=$(rbenv versions --bare --skip-aliases | grep -Ev '/')
for installed_ruby_version in $installed_ruby_versions

View file

@ -1,7 +1,9 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json
test_format = 1.0
[default]
# ------------
# Tests to run
# ------------
# ------------