1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/fab-manager_ynh.git synced 2024-09-03 18:36:16 +02:00

Merge pull request #124 from YunoHost-Apps/testing

Testing - v6
This commit is contained in:
Salamandar 2024-06-30 18:48:16 +02:00 committed by GitHub
commit 7b98618b0f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 157 additions and 59 deletions

View file

@ -19,7 +19,7 @@ It shall NOT be edited by hand.
Fab-manager is the Fab Lab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks, and document your marker's projects.
**Shipped version:** 5.6.5~ynh2
**Shipped version:** 6.3.27~ynh1
**Demo:** <https://www.fab-manager.com/fr/demo>

View file

@ -19,7 +19,7 @@ No se debe editar a mano.
Fab-manager is the Fab Lab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks, and document your marker's projects.
**Versión actual:** 5.6.5~ynh2
**Versión actual:** 6.3.27~ynh1
**Demo:** <https://www.fab-manager.com/fr/demo>

View file

@ -19,7 +19,7 @@ EZ editatu eskuz.
Fab-manager is the Fab Lab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks, and document your marker's projects.
**Paketatutako bertsioa:** 5.6.5~ynh2
**Paketatutako bertsioa:** 6.3.27~ynh1
**Demoa:** <https://www.fab-manager.com/fr/demo>

View file

@ -19,7 +19,7 @@ Il NE doit PAS être modifié à la main.
Fab-manager is the Fab Lab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks, and document your marker's projects.
**Version incluse:** 5.6.5~ynh2
**Version incluse:** 6.3.27~ynh1
**Démo:** <https://www.fab-manager.com/fr/demo>

View file

@ -19,7 +19,7 @@ NON debe editarse manualmente.
Fab-manager is the Fab Lab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks, and document your marker's projects.
**Versión proporcionada:** 5.6.5~ynh2
**Versión proporcionada:** 6.3.27~ynh1
**Demo:** <https://www.fab-manager.com/fr/demo>

View file

@ -19,7 +19,7 @@
Fab-manager is the Fab Lab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks, and document your marker's projects.
**分发版本:** 5.6.5~ynh2
**分发版本:** 6.3.27~ynh1
**演示:** <https://www.fab-manager.com/fr/demo>

76
conf/dot_env Normal file
View file

@ -0,0 +1,76 @@
# Add application configuration variables here, as shown below.
# This file is read by dotenv
# Databases
POSTGRES_HOST=localhost
POSTGRES_PASSWORD=__DB_PWD__
REDIS_HOST=localhost
ELASTICSEARCH_HOST=localhost
SECRET_KEY_BASE=__SECRET_KEY_BASE__
# Stripe keys for tests
STRIPE_API_KEY=
STRIPE_PUBLISHABLE_KEY=
# oAuth SSO keys for tests
OAUTH_CLIENT_ID=github-oauth-app-id
OAUTH_CLIENT_SECRET=github-oauth-app-secret
OIDC_CLIENT_ID=oidc-client-id
OIDC_CLIENT_SECRET=oidc-client-secret
# Configure carefully!
DEFAULT_HOST=__DOMAIN__
DEFAULT_PROTOCOL=https
# Email config
DELIVERY_METHOD=smtp
SMTP_ADDRESS=localhost
SMTP_PORT=25
SMTP_USER_NAME=__APP__
SMTP_PASSWORD=__MAIL_PWD__
SMTP_AUTHENTICATION=plain
SMTP_ENABLE_STARTTLS_AUTO=false
SMTP_OPENSSL_VERIFY_MODE=
SMTP_TLS=false
# I18N configuration
RAILS_LOCALE=fr
APP_LOCALE=fr
MOMENT_LOCALE=fr
SUMMERNOTE_LOCALE=fr-FR
ANGULAR_LOCALE=fr-fr
FULLCALENDAR_LOCALE=fr
INTL_LOCALE=fr-FR
INTL_CURRENCY=EUR
FORCE_VERSION_CHECK=false
ALLOW_INSECURE_HTTP=false
POSTGRESQL_LANGUAGE_ANALYZER=french
TIME_ZONE=Paris
WEEK_STARTING_DAY=monday
D3_DATE_FORMAT=%d/%m/%y
UIB_DATE_FORMAT=dd/MM/yyyy
EXCEL_DATE_FORMAT=dd/mm/yyyy
# OpenLab Projects
# do not change this URL
OPENLAB_BASE_URI=https://openprojects.fab-manager.com
OPENLAB_SSL_VERIFY=true
# System settings
LOG_LEVEL=debug
RAILS_LOG_TO_STDOUT=true
DISK_SPACE_MB_ALERT=1024
ADMINSYS_EMAIL=__ADMIN_MAIL__
ENABLE_SENTRY=false
# 5242880 = 5 megabytes
MAX_IMPORT_SIZE=5242880
# 10485760 = 10 megabytes
MAX_IMAGE_SIZE=10485760
# 20971520 = 20 megabytes
MAX_CAO_SIZE=20971520
# 5242880 = 5 megabytes
MAX_SUPPORTING_DOCUMENT_FILE_SIZE=5242880

View file

@ -8,9 +8,11 @@ User=__APP__
WorkingDirectory=__INSTALL_DIR__
Environment="__LD_PRELOAD__"
Environment="__YNH_RUBY_LOAD_PATH__"
EnvironmentFile=__INSTALL_DIR__/.env
Environment="RAILS_ENV=production"
ExecStartPre=-rm -f __INSTALL_DIR__/tmp/pids/server.pid
ExecStart=__INSTALL_DIR__/bin/bundle exec rails s puma -p __PORT__ -b 127.0.0.1
ExecStart=__INSTALL_DIR__/bin/bundle exec rails server -u puma -p __PORT__ -b 127.0.0.1
ExecReload=/bin/kill -SIGUSR1 $MAINPID
TimeoutSec=15
Restart=always

View file

@ -8,7 +8,9 @@ User=__APP__
WorkingDirectory=__INSTALL_DIR__
Environment="__LD_PRELOAD__"
Environment="__YNH_RUBY_LOAD_PATH__"
EnvironmentFile=__INSTALL_DIR__/.env
Environment="RAILS_ENV=production"
ExecStart=__INSTALL_DIR__/bin/bundle exec sidekiq -C __INSTALL_DIR__/config/sidekiq.yml
TimeoutSec=15
Restart=always

View file

@ -40,4 +40,3 @@ production:
disk_space_mb_alert: 1024
adminsys_email: '__ADMIN_MAIL__'
allow_insecure_http: false
locked_settings: <%= ENV.fetch("LOCKED_SETTINGS", 'uuid,origin').split(/,/) %>

View file

@ -7,7 +7,7 @@ name = "Fab-manager"
description.en = "Fab Lab management solution"
description.fr = "Solution de gestion de Fab Lab"
version = "5.6.5~ynh2"
version = "6.3.27~ynh1"
maintainers = []
@ -22,8 +22,10 @@ code = "https://github.com/sleede/fab-manager"
yunohost = ">= 11.2.12"
architectures = "all"
multi_instance = false
ldap = false
sso = false
disk = "50M"
ram.build = "50M"
ram.runtime = "50M"
@ -46,8 +48,8 @@ ram.runtime = "50M"
[resources]
[resources.sources.main]
url = "https://api.github.com/repos/sleede/fab-manager/tarball/v5.6.5"
sha256 = "dc6ae9fefd893975ee2b70c5b327a37b3d585dcf223ddffe75cc0b570771102d"
url = "https://github.com/sleede/fab-manager/archive/refs/tags/v6.3.27.tar.gz"
sha256 = "c2ae66d2aa47e16b4664f235908acfb0ac5b67f5f1390baf0f83c85662724421"
autoupdate.strategy = "latest_github_tag"
@ -83,6 +85,8 @@ ram.runtime = "50M"
# For Ruby
"libjemalloc-dev",
"libffi-dev",
"libyaml-dev",
"curl",
"build-essential",
"libreadline-dev",

View file

@ -4,10 +4,8 @@
# COMMON VARIABLES
#=================================================
ruby_version="2.6.10"
bundler_version=2.1.4
nodejs_version="14"
ruby_version="3.2.2"
nodejs_version="18"
# Workaround for Mastodon on Bullseye
# See https://github.com/mastodon/mastodon/issues/15751#issuecomment-873594463
@ -27,30 +25,44 @@ fi
# PERSONAL HELPERS
#=================================================
check_password_policy() {
password="$1"
# 12 caractères minimum, au moins une lettre majuscule, une lettre minuscule, un chiffre et un caractère spécial
msg=""
if (( ${#password} < 10 )); then
msg="is too short"
elif [[ $password != *[[:digit:]]* ]]; then
msg="does not contain any digit"
elif [[ $password != *[[:lower:]]* ]]; then
msg="does not contain any lower case letter"
elif [[ $password != *[[:upper:]]* ]]; then
msg="does not contain any upper case letter"
elif [[ "$password" =~ ^[0-9a-zA-Z]*$ ]]; then
msg="does not contain any special character"
fi
if [ -n "$msg" ]; then
ynh_die "Password should have min 12 chars, at least one lowercase, one uppercase, one digit and one special character, but it $msg."
fi
}
env_ruby() {
ynh_exec_as "$app" "$ynh_ruby_load_path" "$@"
}
fabmanager_build_ruby() {
pushd "$install_dir"
ynh_use_ruby
ynh_exec_warn_less $ynh_gem install "bundler:$bundler_version"
ynh_exec_warn_less bin/bundle config --global frozen 1
ynh_exec_warn_less bin/bundle config set --local without 'development test doc'
ynh_exec_warn_less bin/bundle install
ynh_exec_warn_less bin/bundle binstubs --all
popd
}
$ynh_gem update --system --no-document
$ynh_gem install bundler rake --no-document
fabmanager_seed_db() {
pushd "$install_dir"
ynh_replace_string --match_string="DateTime.current" --replace_string="DateTime.current - 1.days" --target_file="$install_dir/db/seeds.rb"
ynh_exec_warn_less ynh_exec_as "$app" env RAILS_ENV=production "$ynh_ruby_load_path" $ld_preload \
bin/bundle exec rake db:seed ADMIN_EMAIL="$admin_mail" ADMIN_PASSWORD="$password"
popd
}
fabmanager_migrate_db() {
pushd "$install_dir"
ynh_psql_execute_as_root --database="$db_name" --sql="ALTER USER $db_user WITH SUPERUSER;"
ynh_exec_warn_less ynh_exec_as "$app" env RAILS_ENV=production "$ynh_ruby_load_path" $ld_preload bin/bundle exec rake db:migrate
ynh_psql_execute_as_root --database="$db_name" --sql="ALTER USER $db_user WITH NOSUPERUSER;"
env_ruby bin/bundle config --global frozen 1
env_ruby bin/bundle config set without 'development test doc'
env_ruby bin/bundle config set path 'vendor/bundle'
env_ruby bin/bundle install
env_ruby bin/bundle binstubs --all
popd
}
@ -58,13 +70,30 @@ fabmanager_build_ui() {
pushd "$install_dir"
ynh_use_nodejs
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn install
#ynh_exec_warn_less ynh_exec_as "$app" env RAILS_ENV=production "$ynh_ruby_load_path" $ld_preload yarn install
#ynh_exec_warn_less ynh_exec_as "$app" env RAILS_ENV=production "$ynh_ruby_load_path" $ld_preload bin/webpack
ynh_exec_warn_less ynh_exec_as "$app" env RAILS_ENV=production "$ynh_ruby_load_path" $ld_preload bin/bundle exec rake assets:precompile
env_ruby bash -c "set -a; source '$install_dir/.env'; set +a ; RAILS_ENV=production bin/bundle exec rake assets:precompile"
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn cache clean --all
popd
}
fabmanager_seed_db() {
pushd "$install_dir"
ynh_replace_string --match_string="DateTime.current" --replace_string="DateTime.current - 1.days" --target_file="$install_dir/db/seeds.rb"
# Need superuser for the extensions configuration…
ynh_psql_execute_as_root --database="$db_name" --sql="ALTER USER $db_user WITH SUPERUSER;"
env_ruby bash -c "set -a; source '$install_dir/.env'; set +a ; RAILS_ENV=production ADMIN_EMAIL='$admin_mail' ADMIN_PASSWORD='$password' bin/bundle exec rails db:schema:load"
ynh_psql_execute_as_root --database="$db_name" --sql="ALTER USER $db_user WITH NOSUPERUSER;"
env_ruby bash -c "set -a; source '$install_dir/.env'; set +a ; RAILS_ENV=production ADMIN_EMAIL='$admin_mail' ADMIN_PASSWORD='$password' bin/bundle exec rails db:seed"
popd
}
fabmanager_migrate_db() {
pushd "$install_dir"
ynh_psql_execute_as_root --database="$db_name" --sql="ALTER USER $db_user WITH SUPERUSER;"
env_ruby bash -c "set -a; source '$install_dir/.env'; set +a ; RAILS_ENV=production bin/bundle exec rails db:migrate"
ynh_psql_execute_as_root --database="$db_name" --sql="ALTER USER $db_user WITH NOSUPERUSER;"
popd
}
#=================================================
# EXPERIMENTAL HELPERS

View file

@ -16,6 +16,8 @@ admin_mail=$(ynh_user_get_info --username="$admin" --key=mail)
secret_key_base=$(ynh_string_random --length=30)
ynh_app_setting_set --app="$app" --key="secret_key_base" --value="$secret_key_base"
check_password_policy "$password"
#=================================================
# INSTALL DEPENDENCIES
#=================================================
@ -25,17 +27,6 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version="$nodejs_version"
ynh_script_progression --message="Installing Ruby..." --weight=4
ynh_exec_warn_less ynh_install_ruby --ruby_version="$ruby_version"
#=================================================
# CREATE A POSTGRESQL DATABASE
#=================================================
ynh_script_progression --message="Configuring $app's PostgreSQL database..." --weight=1
ynh_psql_execute_as_root --database="$db_name" --sql="ALTER USER $db_user WITH SUPERUSER;"
ynh_psql_execute_as_root --database="$db_name" --sql="CREATE EXTENSION IF NOT EXISTS unaccent;"
ynh_psql_execute_as_root --database="$db_name" --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;"
ynh_psql_execute_as_root --database="$db_name" --sql="CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;"
ynh_psql_execute_as_root --database="$db_name" --sql="ALTER USER $db_user WITH NOSUPERUSER;"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -55,9 +46,9 @@ chown -R "$app:www-data" "$data_dir"
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_add_config --template="secrets.yml" --destination="$install_dir/config/secrets.yml"
chmod 400 "$install_dir/config/secrets.yml"
chown "$app:$app" "$install_dir/config/secrets.yml"
ynh_add_config --template="dot_env" --destination="$install_dir/.env"
chmod 400 "$install_dir/.env"
chown "$app:$app" "$install_dir/.env"
ynh_add_config --template="database.yml" --destination="$install_dir/config/database.yml"
chmod 400 "$install_dir/config/database.yml"
@ -69,11 +60,8 @@ chown "$app:$app" "$install_dir/config/database.yml"
ynh_script_progression --message="Building app..." --weight=7
fabmanager_build_ruby
fabmanager_migrate_db
fabmanager_seed_db
fabmanager_build_ui
fabmanager_seed_db
ynh_secure_remove --file="$install_dir/.cache"

View file

@ -56,7 +56,6 @@ ynh_psql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name"
ynh_script_progression --message="Building app..." --weight=7
fabmanager_build_ruby
fabmanager_build_ui
#=================================================

View file

@ -82,11 +82,10 @@ ynh_secure_remove --file="$install_dir/node_modules"
ynh_secure_remove --file="$install_dir/tmp/cache"
fabmanager_build_ruby
fabmanager_build_ui
fabmanager_migrate_db
fabmanager_build_ui
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================