From 44d1fbe09e036ea7ea56be36e8773f4e13eedc75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Thu, 14 Mar 2024 19:06:40 +0100 Subject: [PATCH 01/28] Bump version, add email config, remove supervisor code - from eric_g --- manifest.toml | 8 +++++--- scripts/_common.sh | 5 ++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/manifest.toml b/manifest.toml index 7192848..e92e144 100644 --- a/manifest.toml +++ b/manifest.toml @@ -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.9~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.9.tar.gz" + sha256 = "b6a68bf91009678a3a666cfd5cab8e3c636ac9fbb920e3e4e4bd29b093c7f43d" autoupdate.strategy = "latest_github_tag" diff --git a/scripts/_common.sh b/scripts/_common.sh index 375c5cf..9c96708 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,10 +4,9 @@ # COMMON VARIABLES #================================================= -ruby_version="2.6.10" -bundler_version=2.1.4 +ruby_version="3.1" -nodejs_version="14" +nodejs_version="18" # Workaround for Mastodon on Bullseye # See https://github.com/mastodon/mastodon/issues/15751#issuecomment-873594463 From af0f897d227cba332d3320590771fb2f52c8fe61 Mon Sep 17 00:00:00 2001 From: Gredin67 Date: Tue, 27 Feb 2024 09:19:17 +0100 Subject: [PATCH 02/28] remove fetch settings at build --- conf/secrets.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/conf/secrets.yml b/conf/secrets.yml index bdc877a..36e4da1 100644 --- a/conf/secrets.yml +++ b/conf/secrets.yml @@ -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(/,/) %> From 118d200ae79092dd58834d1490f1e26c39f37e5b Mon Sep 17 00:00:00 2001 From: Gredin67 Date: Mon, 26 Feb 2024 10:09:18 +0100 Subject: [PATCH 03/28] ruby 3.2.2 nodejs 18.15 see https://github.com/sleede/fab-manager/blob/master/CHANGELOG.md --- scripts/_common.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 9c96708..e22f7bc 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,9 +4,9 @@ # COMMON VARIABLES #================================================= -ruby_version="3.1" +ruby_version="3.2.2" -nodejs_version="18" +nodejs_version="18.15" # Workaround for Mastodon on Bullseye # See https://github.com/mastodon/mastodon/issues/15751#issuecomment-873594463 From 84b93eecda719e00b44b4e1114a3e37025e15103 Mon Sep 17 00:00:00 2001 From: Gredin67 Date: Wed, 27 Mar 2024 11:14:37 +0100 Subject: [PATCH 04/28] ffi and yaml deps --- manifest.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/manifest.toml b/manifest.toml index e92e144..14387cf 100644 --- a/manifest.toml +++ b/manifest.toml @@ -85,6 +85,8 @@ ram.runtime = "50M" # For Ruby "libjemalloc-dev", + "libffi-dev", + "libyaml-dev", "curl", "build-essential", "libreadline-dev", From a3ce6c0ef1b747aba25e19d65adbdd570e540551 Mon Sep 17 00:00:00 2001 From: Gredin67 Date: Thu, 28 Mar 2024 00:24:18 +0100 Subject: [PATCH 05/28] bundler_version locked_settings --- conf/secrets.yml | 1 + scripts/_common.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/conf/secrets.yml b/conf/secrets.yml index 36e4da1..eb32e20 100644 --- a/conf/secrets.yml +++ b/conf/secrets.yml @@ -40,3 +40,4 @@ production: disk_space_mb_alert: 1024 adminsys_email: '__ADMIN_MAIL__' allow_insecure_http: false + locked_settings: <%= ENV.fetch("LOCKED_SETTINGS", 'uuid,origin').split(/,/) %> \ No newline at end of file diff --git a/scripts/_common.sh b/scripts/_common.sh index e22f7bc..c0e3ace 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= ruby_version="3.2.2" - +bundler_version=2.1.4 nodejs_version="18.15" # Workaround for Mastodon on Bullseye From 11f6f7026d65f74a1f0fa100c53454f4fdf41e3f Mon Sep 17 00:00:00 2001 From: Gredin67 Date: Thu, 28 Mar 2024 01:04:33 +0100 Subject: [PATCH 06/28] locked_settings --- conf/secrets.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/conf/secrets.yml b/conf/secrets.yml index eb32e20..36e4da1 100644 --- a/conf/secrets.yml +++ b/conf/secrets.yml @@ -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(/,/) %> \ No newline at end of file From 23d7f7992232af9a007ccbafa9f26a1e8f063c60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 13 May 2024 08:27:58 +0200 Subject: [PATCH 07/28] Update manifest.toml --- manifest.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest.toml b/manifest.toml index 14387cf..dae3160 100644 --- a/manifest.toml +++ b/manifest.toml @@ -7,7 +7,7 @@ name = "Fab-manager" description.en = "Fab Lab management solution" description.fr = "Solution de gestion de Fab Lab" -version = "6.3.9~ynh1" +version = "6.3.22~ynh1" maintainers = [] @@ -48,8 +48,8 @@ ram.runtime = "50M" [resources] [resources.sources.main] - url = "https://github.com/sleede/fab-manager/archive/refs/tags/v6.3.9.tar.gz" - sha256 = "b6a68bf91009678a3a666cfd5cab8e3c636ac9fbb920e3e4e4bd29b093c7f43d" + url = "https://github.com/sleede/fab-manager/archive/refs/tags/v6.3.22.tar.gz" + sha256 = "5ba874b2c9a80c80dcea2af51d8e8ece3fbacd43de3f359bea8f6612194b62c4" autoupdate.strategy = "latest_github_tag" From cc3a4652e185fd82da66306a84704878bdda0ef9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 13 May 2024 08:29:07 +0200 Subject: [PATCH 08/28] Update _common.sh --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index c0e3ace..eca3b21 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,7 +6,7 @@ ruby_version="3.2.2" bundler_version=2.1.4 -nodejs_version="18.15" +nodejs_version="18" # Workaround for Mastodon on Bullseye # See https://github.com/mastodon/mastodon/issues/15751#issuecomment-873594463 From dcd4039119b08cd1fd689a4ab44c9369f432f998 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Thu, 27 Jun 2024 22:10:05 +0000 Subject: [PATCH 09/28] Auto-update READMEs --- README.md | 2 +- README_es.md | 2 +- README_eu.md | 2 +- README_fr.md | 2 +- README_gl.md | 2 +- README_zh_Hans.md | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 05827eb..622a17f 100644 --- a/README.md +++ b/README.md @@ -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.22~ynh1 **Demo:** diff --git a/README_es.md b/README_es.md index be55229..84b4725 100644 --- a/README_es.md +++ b/README_es.md @@ -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.22~ynh1 **Demo:** diff --git a/README_eu.md b/README_eu.md index 18763ae..9df1ddb 100644 --- a/README_eu.md +++ b/README_eu.md @@ -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.22~ynh1 **Demoa:** diff --git a/README_fr.md b/README_fr.md index 1830161..6a86652 100644 --- a/README_fr.md +++ b/README_fr.md @@ -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.22~ynh1 **Démo :** diff --git a/README_gl.md b/README_gl.md index eaf9af8..7860523 100644 --- a/README_gl.md +++ b/README_gl.md @@ -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.22~ynh1 **Demo:** diff --git a/README_zh_Hans.md b/README_zh_Hans.md index 02824a4..3247869 100644 --- a/README_zh_Hans.md +++ b/README_zh_Hans.md @@ -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.22~ynh1 **演示:** From 623a123ad36d72ed6d08da37cb0c59b757f44c1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Fri, 28 Jun 2024 10:40:07 +0200 Subject: [PATCH 10/28] reorg _common.sh --- scripts/_common.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index eca3b21..e7573b8 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -37,6 +37,17 @@ fabmanager_build_ruby() { popd } +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 + 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" @@ -53,17 +64,6 @@ fabmanager_migrate_db() { popd } -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 - ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn cache clean --all - popd -} - #================================================= # EXPERIMENTAL HELPERS From 39a0b9bc2d5799788bb45bceccfccb322a237daf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Fri, 28 Jun 2024 10:40:32 +0200 Subject: [PATCH 11/28] build ruby with ynh_exec_as --- scripts/_common.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index e7573b8..e3f56d2 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -29,11 +29,11 @@ fi 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 + ynh_exec_warn_less ynh_exec_as "$app" $ynh_gem install "bundler:$bundler_version" + ynh_exec_warn_less ynh_exec_as "$app" bin/bundle config --global frozen 1 + ynh_exec_warn_less ynh_exec_as "$app" bin/bundle config set --local without 'development test doc' + ynh_exec_warn_less ynh_exec_as "$app" bin/bundle install + ynh_exec_warn_less ynh_exec_as "$app" bin/bundle binstubs --all popd } From 9bb3c531b19c0872eb5b883fa6733c73fc61d97c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Fri, 28 Jun 2024 10:40:46 +0200 Subject: [PATCH 12/28] use rails instead of rake --- scripts/_common.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index e3f56d2..d7af0ee 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -43,7 +43,7 @@ fabmanager_build_ui() { 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 + ynh_exec_warn_less ynh_exec_as "$app" env RAILS_ENV=production "$ynh_ruby_load_path" $ld_preload bin/bundle exec rails assets:precompile ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn cache clean --all popd } @@ -52,14 +52,14 @@ 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" + bin/bundle exec rails 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_exec_warn_less ynh_exec_as "$app" env RAILS_ENV=production "$ynh_ruby_load_path" $ld_preload bin/bundle exec rails db:migrate ynh_psql_execute_as_root --database="$db_name" --sql="ALTER USER $db_user WITH NOSUPERUSER;" popd } From 70808ce6569daf61e69a8c9fa41fcc624db810d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Fri, 28 Jun 2024 10:41:25 +0200 Subject: [PATCH 13/28] Install latest bundler --- scripts/_common.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index d7af0ee..e69bf70 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,6 @@ #================================================= ruby_version="3.2.2" -bundler_version=2.1.4 nodejs_version="18" # Workaround for Mastodon on Bullseye @@ -29,7 +28,7 @@ fi fabmanager_build_ruby() { pushd "$install_dir" ynh_use_ruby - ynh_exec_warn_less ynh_exec_as "$app" $ynh_gem install "bundler:$bundler_version" + ynh_exec_warn_less ynh_exec_as "$app" $ynh_gem install bundler ynh_exec_warn_less ynh_exec_as "$app" bin/bundle config --global frozen 1 ynh_exec_warn_less ynh_exec_as "$app" bin/bundle config set --local without 'development test doc' ynh_exec_warn_less ynh_exec_as "$app" bin/bundle install From c55597111fd70feeeb5d2921b732551215134bf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Fri, 28 Jun 2024 10:43:27 +0200 Subject: [PATCH 14/28] More straightforward bindle install --- scripts/_common.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index e69bf70..f1a2444 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -30,9 +30,7 @@ fabmanager_build_ruby() { ynh_use_ruby ynh_exec_warn_less ynh_exec_as "$app" $ynh_gem install bundler ynh_exec_warn_less ynh_exec_as "$app" bin/bundle config --global frozen 1 - ynh_exec_warn_less ynh_exec_as "$app" bin/bundle config set --local without 'development test doc' - ynh_exec_warn_less ynh_exec_as "$app" bin/bundle install - ynh_exec_warn_less ynh_exec_as "$app" bin/bundle binstubs --all + ynh_exec_warn_less ynh_exec_as "$app" bin/bundle install --binstubs --without 'development test doc' popd } From ea4e28b8e2054c260a2d194099f37e23927259d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Fri, 28 Jun 2024 11:10:11 +0200 Subject: [PATCH 15/28] Move from secrets.yml to .env --- conf/dot_env | 76 ++++++++++++++++++++++++++++++++++++++++++++++++ conf/secrets.yml | 66 ++++++++++++++++++++--------------------- scripts/install | 13 +++++---- 3 files changed, 117 insertions(+), 38 deletions(-) create mode 100644 conf/dot_env diff --git a/conf/dot_env b/conf/dot_env new file mode 100644 index 0000000..2f94fc1 --- /dev/null +++ b/conf/dot_env @@ -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 diff --git a/conf/secrets.yml b/conf/secrets.yml index 36e4da1..d3006f4 100644 --- a/conf/secrets.yml +++ b/conf/secrets.yml @@ -1,42 +1,42 @@ production: - secret_key_base: '__SECRET_KEY_BASE__' - default_host: '__DOMAIN__' - default_protocol: 'https' - delivery_method: 'smtp' - smtp_address: 'localhost' - smtp_port: 25 - smtp_user_name: '__APP__' - smtp_password: '__MAIL_PWD__' - time_zone: 'Paris' + # secret_key_base: '__SECRET_KEY_BASE__' + # default_host: '__DOMAIN__' + # default_protocol: 'https' + # delivery_method: 'smtp' + # smtp_address: 'localhost' + # smtp_port: 25 + # smtp_user_name: '__APP__' + # smtp_password: '__MAIL_PWD__' + # time_zone: 'Paris' smtp_authentication: 'none' - smtp_enable_starttls_auto: false - smtp_openssl_verify_mode: - smtp_tls: false + # smtp_enable_starttls_auto: false + # smtp_openssl_verify_mode: + # smtp_tls: false smtp_ca_file: smtp_ca_path: - week_starting_day: 'monday' - d3_date_format: '%y-%m-%d' - uib_date_format: 'dd/MM/yyyy' - excel_date_format: 'dd/mm/yyyy' - rails_locale: 'fr' - app_locale: 'fr' - moment_locale: 'fr' - summernote_locale: 'fr-FR' - angular_locale: 'fr-fr' - intl_locale: 'fr-FR' - intl_currency: 'EUR' - fullcalendar_locale: 'fr' + # week_starting_day: 'monday' + # d3_date_format: '%y-%m-%d' + # uib_date_format: 'dd/MM/yyyy' + # excel_date_format: 'dd/mm/yyyy' + # rails_locale: 'fr' + # app_locale: 'fr' + # moment_locale: 'fr' + # summernote_locale: 'fr-FR' + # angular_locale: 'fr-fr' + # intl_locale: 'fr-FR' + # intl_currency: 'EUR' + # fullcalendar_locale: 'fr' postgresql_language_analyzer: 'simple' - openlab_base_uri: 'https://openprojects.fab-manager.com' - openlab_ssl_verify: true + # openlab_base_uri: 'https://openprojects.fab-manager.com' + # openlab_ssl_verify: true openlab_ssl_verify_peer: true navinum_api_login: navinum_api_password: - elaticsearch_host: localhost - max_image_size: 10485760 - max_cao_size: 20971520 - max_import_size: 5242880 + # elaticsearch_host: localhost + # max_image_size: 10485760 + # max_cao_size: 20971520 + # max_import_size: 5242880 max_proof_of_identity_file_size: - disk_space_mb_alert: 1024 - adminsys_email: '__ADMIN_MAIL__' - allow_insecure_http: false + # disk_space_mb_alert: 1024 + # adminsys_email: '__ADMIN_MAIL__' + # allow_insecure_http: false diff --git a/scripts/install b/scripts/install index df39714..6265c14 100755 --- a/scripts/install +++ b/scripts/install @@ -55,9 +55,13 @@ 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="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,12 +73,11 @@ chown "$app:$app" "$install_dir/config/database.yml" ynh_script_progression --message="Building app..." --weight=7 fabmanager_build_ruby +fabmanager_build_ui fabmanager_migrate_db fabmanager_seed_db -fabmanager_build_ui - ynh_secure_remove --file="$install_dir/.cache" #================================================= From 9533751513ff00b7f04a47ce959ce6c933e4abdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Fri, 28 Jun 2024 11:15:23 +0200 Subject: [PATCH 16/28] bundler needs to be installed as root --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index f1a2444..f578a9a 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -28,7 +28,7 @@ fi fabmanager_build_ruby() { pushd "$install_dir" ynh_use_ruby - ynh_exec_warn_less ynh_exec_as "$app" $ynh_gem install bundler + ynh_exec_warn_less $ynh_gem install bundler ynh_exec_warn_less ynh_exec_as "$app" bin/bundle config --global frozen 1 ynh_exec_warn_less ynh_exec_as "$app" bin/bundle install --binstubs --without 'development test doc' popd From 3bbdac678a4247da3d691ce46dd1aad3f908c3ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Fri, 28 Jun 2024 11:25:49 +0200 Subject: [PATCH 17/28] Fix env to call ruby --- scripts/_common.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index f578a9a..8effd5b 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -25,12 +25,17 @@ fi # PERSONAL HELPERS #================================================= +env_ruby() { + ynh_exec_warn_less ynh_exec_as "$app" env RAILS_ENV=production "$ynh_ruby_load_path" "$@" +} + + fabmanager_build_ruby() { pushd "$install_dir" ynh_use_ruby ynh_exec_warn_less $ynh_gem install bundler - ynh_exec_warn_less ynh_exec_as "$app" bin/bundle config --global frozen 1 - ynh_exec_warn_less ynh_exec_as "$app" bin/bundle install --binstubs --without 'development test doc' + env_ruby bin/bundle config --global frozen 1 + env_ruby bin/bundle install --binstubs --without 'development test doc' popd } @@ -38,9 +43,9 @@ 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 rails assets:precompile + #env_ruby yarn install + #env_ruby bin/webpack + env_ruby bin/bundle exec rails assets:precompile ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn cache clean --all popd } @@ -48,15 +53,14 @@ fabmanager_build_ui() { 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 rails db:seed ADMIN_EMAIL="$admin_mail" ADMIN_PASSWORD="$password" + env_ruby bin/bundle exec rails 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 rails db:migrate + env_ruby bin/bundle exec rails db:migrate ynh_psql_execute_as_root --database="$db_name" --sql="ALTER USER $db_user WITH NOSUPERUSER;" popd } From b727dce7b187330916c06f5499ce2904050cc50d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Sat, 29 Jun 2024 22:39:53 +0200 Subject: [PATCH 18/28] Try to fix bundle install --- scripts/_common.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 8effd5b..1de3bc1 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -26,16 +26,22 @@ fi #================================================= env_ruby() { - ynh_exec_warn_less ynh_exec_as "$app" env RAILS_ENV=production "$ynh_ruby_load_path" "$@" + ynh_exec_as "$app" "$ynh_ruby_load_path" env RAILS_ENV=production "$@" } fabmanager_build_ruby() { pushd "$install_dir" ynh_use_ruby - ynh_exec_warn_less $ynh_gem install bundler + ynh_gem update --system --no-document + ynh_gem install bundler rake --no-document + env_ruby bin/bundle config --global frozen 1 - env_ruby bin/bundle install --binstubs --without 'development test doc' + 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 } From ca6fd6e61800ec59cabbee30aae418447a529faf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Sat, 29 Jun 2024 22:56:45 +0200 Subject: [PATCH 19/28] fix call to gem --- scripts/_common.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 1de3bc1..dfd6bf2 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -33,8 +33,8 @@ env_ruby() { fabmanager_build_ruby() { pushd "$install_dir" ynh_use_ruby - ynh_gem update --system --no-document - ynh_gem install bundler rake --no-document + $ynh_gem update --system --no-document + $ynh_gem install bundler rake --no-document env_ruby bin/bundle config --global frozen 1 env_ruby bin/bundle config set without 'development test doc' From a4e004ee677f53c9d260187679d957d802d6beb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Sun, 30 Jun 2024 00:22:49 +0200 Subject: [PATCH 20/28] try to fix v6 --- conf/secrets.yml | 66 +++++++++++++++++++++++----------------------- scripts/_common.sh | 10 +++---- 2 files changed, 37 insertions(+), 39 deletions(-) diff --git a/conf/secrets.yml b/conf/secrets.yml index d3006f4..36e4da1 100644 --- a/conf/secrets.yml +++ b/conf/secrets.yml @@ -1,42 +1,42 @@ production: - # secret_key_base: '__SECRET_KEY_BASE__' - # default_host: '__DOMAIN__' - # default_protocol: 'https' - # delivery_method: 'smtp' - # smtp_address: 'localhost' - # smtp_port: 25 - # smtp_user_name: '__APP__' - # smtp_password: '__MAIL_PWD__' - # time_zone: 'Paris' + secret_key_base: '__SECRET_KEY_BASE__' + default_host: '__DOMAIN__' + default_protocol: 'https' + delivery_method: 'smtp' + smtp_address: 'localhost' + smtp_port: 25 + smtp_user_name: '__APP__' + smtp_password: '__MAIL_PWD__' + time_zone: 'Paris' smtp_authentication: 'none' - # smtp_enable_starttls_auto: false - # smtp_openssl_verify_mode: - # smtp_tls: false + smtp_enable_starttls_auto: false + smtp_openssl_verify_mode: + smtp_tls: false smtp_ca_file: smtp_ca_path: - # week_starting_day: 'monday' - # d3_date_format: '%y-%m-%d' - # uib_date_format: 'dd/MM/yyyy' - # excel_date_format: 'dd/mm/yyyy' - # rails_locale: 'fr' - # app_locale: 'fr' - # moment_locale: 'fr' - # summernote_locale: 'fr-FR' - # angular_locale: 'fr-fr' - # intl_locale: 'fr-FR' - # intl_currency: 'EUR' - # fullcalendar_locale: 'fr' + week_starting_day: 'monday' + d3_date_format: '%y-%m-%d' + uib_date_format: 'dd/MM/yyyy' + excel_date_format: 'dd/mm/yyyy' + rails_locale: 'fr' + app_locale: 'fr' + moment_locale: 'fr' + summernote_locale: 'fr-FR' + angular_locale: 'fr-fr' + intl_locale: 'fr-FR' + intl_currency: 'EUR' + fullcalendar_locale: 'fr' postgresql_language_analyzer: 'simple' - # openlab_base_uri: 'https://openprojects.fab-manager.com' - # openlab_ssl_verify: true + openlab_base_uri: 'https://openprojects.fab-manager.com' + openlab_ssl_verify: true openlab_ssl_verify_peer: true navinum_api_login: navinum_api_password: - # elaticsearch_host: localhost - # max_image_size: 10485760 - # max_cao_size: 20971520 - # max_import_size: 5242880 + elaticsearch_host: localhost + max_image_size: 10485760 + max_cao_size: 20971520 + max_import_size: 5242880 max_proof_of_identity_file_size: - # disk_space_mb_alert: 1024 - # adminsys_email: '__ADMIN_MAIL__' - # allow_insecure_http: false + disk_space_mb_alert: 1024 + adminsys_email: '__ADMIN_MAIL__' + allow_insecure_http: false diff --git a/scripts/_common.sh b/scripts/_common.sh index dfd6bf2..c8c93ef 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -26,7 +26,7 @@ fi #================================================= env_ruby() { - ynh_exec_as "$app" "$ynh_ruby_load_path" env RAILS_ENV=production "$@" + ynh_exec_as "$app" "$ynh_ruby_load_path" env "$@" } @@ -49,9 +49,7 @@ fabmanager_build_ui() { pushd "$install_dir" ynh_use_nodejs ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn install - #env_ruby yarn install - #env_ruby bin/webpack - env_ruby bin/bundle exec rails assets:precompile + env_ruby bash -c "source '$install_dir/.env' ; 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 } @@ -59,14 +57,14 @@ fabmanager_build_ui() { 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" - env_ruby bin/bundle exec rails db:seed ADMIN_EMAIL="$admin_mail" ADMIN_PASSWORD="$password" + env_ruby bin/bundle exec rails db:seed RAILS_ENV=production 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;" - env_ruby bin/bundle exec rails db:migrate + env_ruby bin/bundle exec rails db:migrate RAILS_ENV=production ynh_psql_execute_as_root --database="$db_name" --sql="ALTER USER $db_user WITH NOSUPERUSER;" popd } From 976e95a6a0c94007ae810d39e2e0219a2abeae24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Sun, 30 Jun 2024 00:51:19 +0200 Subject: [PATCH 21/28] Found out what's wrong, fixed --- scripts/_common.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index c8c93ef..07f04b7 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -26,7 +26,7 @@ fi #================================================= env_ruby() { - ynh_exec_as "$app" "$ynh_ruby_load_path" env "$@" + ynh_exec_as "$app" "$ynh_ruby_load_path" "$@" } @@ -41,7 +41,6 @@ fabmanager_build_ruby() { env_ruby bin/bundle config set path 'vendor/bundle' env_ruby bin/bundle install env_ruby bin/bundle binstubs --all - popd } @@ -49,7 +48,10 @@ fabmanager_build_ui() { pushd "$install_dir" ynh_use_nodejs ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn install - env_ruby bash -c "source '$install_dir/.env' ; RAILS_ENV=production bin/bundle exec rake assets:precompile" + ( + set -a; source "$install_dir/.env"; set +a # Export all variables of .env + env_ruby 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 } @@ -57,14 +59,20 @@ fabmanager_build_ui() { 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" - env_ruby bin/bundle exec rails db:seed RAILS_ENV=production ADMIN_EMAIL="$admin_mail" ADMIN_PASSWORD="$password" + ( + set -a; source "$install_dir/.env"; set +a # Export all variables of .env + env_ruby 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 bin/bundle exec rails db:migrate RAILS_ENV=production + ( + set -a; source "$install_dir/.env"; set +a # Export all variables of .env + env_ruby 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 } From a9ccf70d4171fd72e6e2bbfc96d903fcd6d6587e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Sun, 30 Jun 2024 11:56:10 +0200 Subject: [PATCH 22/28] Actually need to source inside sudo --- scripts/_common.sh | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 07f04b7..cef5ff9 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -48,10 +48,7 @@ fabmanager_build_ui() { pushd "$install_dir" ynh_use_nodejs ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn install - ( - set -a; source "$install_dir/.env"; set +a # Export all variables of .env - env_ruby RAILS_ENV=production 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 } @@ -59,20 +56,14 @@ fabmanager_build_ui() { 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" - ( - set -a; source "$install_dir/.env"; set +a # Export all variables of .env - env_ruby RAILS_ENV=production ADMIN_EMAIL="$admin_mail" ADMIN_PASSWORD="$password" bin/bundle exec rails db:seed - ) + 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;" - ( - set -a; source "$install_dir/.env"; set +a # Export all variables of .env - env_ruby RAILS_ENV=production bin/bundle exec rails db:migrate - ) + 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 } From 39d6347a7da98070dd69e2233f0b56eeb0d08f60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Sun, 30 Jun 2024 13:58:53 +0200 Subject: [PATCH 23/28] Fix db creation: don't call migration but schema load and seed --- scripts/_common.sh | 1 + scripts/install | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index cef5ff9..64c866d 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -56,6 +56,7 @@ fabmanager_build_ui() { 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" + 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" 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 } diff --git a/scripts/install b/scripts/install index 6265c14..18acc77 100755 --- a/scripts/install +++ b/scripts/install @@ -75,8 +75,8 @@ ynh_script_progression --message="Building app..." --weight=7 fabmanager_build_ruby fabmanager_build_ui -fabmanager_migrate_db fabmanager_seed_db +# fabmanager_migrate_db ynh_secure_remove --file="$install_dir/.cache" From 496b9dccbf049d38f09e6de5a1ffe3ee793663c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Sun, 30 Jun 2024 14:37:55 +0200 Subject: [PATCH 24/28] Fix db install --- scripts/_common.sh | 3 +++ scripts/install | 11 ----------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 64c866d..dff43e5 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -56,7 +56,10 @@ fabmanager_build_ui() { 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 } diff --git a/scripts/install b/scripts/install index 18acc77..fe3ffbd 100755 --- a/scripts/install +++ b/scripts/install @@ -25,17 +25,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 #================================================= From 691425f5e8b55a9d2c2effae2f80bbd0a91cd1b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Sun, 30 Jun 2024 16:00:21 +0200 Subject: [PATCH 25/28] Check for password policy at the beginning of the app install --- scripts/_common.sh | 22 ++++++++++++++++++++++ scripts/install | 2 ++ 2 files changed, 24 insertions(+) diff --git a/scripts/_common.sh b/scripts/_common.sh index dff43e5..2dc6fb7 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -25,6 +25,28 @@ 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" "$@" } diff --git a/scripts/install b/scripts/install index fe3ffbd..a8e77ae 100755 --- a/scripts/install +++ b/scripts/install @@ -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 #================================================= From 00095b5b9bd587eb356ac931f96a87148bdb0a61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Sun, 30 Jun 2024 16:41:46 +0200 Subject: [PATCH 26/28] Fix services config : add environentfile --- conf/fab-manager-app.service | 2 ++ conf/fab-manager-worker.service | 2 ++ 2 files changed, 4 insertions(+) diff --git a/conf/fab-manager-app.service b/conf/fab-manager-app.service index 0df694a..d65defb 100644 --- a/conf/fab-manager-app.service +++ b/conf/fab-manager-app.service @@ -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" + 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 ExecReload=/bin/kill -SIGUSR1 $MAINPID diff --git a/conf/fab-manager-worker.service b/conf/fab-manager-worker.service index 8254fc8..5760b90 100644 --- a/conf/fab-manager-worker.service +++ b/conf/fab-manager-worker.service @@ -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 From 283ba539ef16ba30071bdd994ead701abe96c456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Sun, 30 Jun 2024 17:25:45 +0200 Subject: [PATCH 27/28] Fix service puma call --- conf/fab-manager-app.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/fab-manager-app.service b/conf/fab-manager-app.service index d65defb..f1bbf6d 100644 --- a/conf/fab-manager-app.service +++ b/conf/fab-manager-app.service @@ -12,7 +12,7 @@ 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 service -u puma -p __PORT__ -b 127.0.0.1 ExecReload=/bin/kill -SIGUSR1 $MAINPID TimeoutSec=15 Restart=always From c435c453843bbd46b19b7cc4fd374e12f731baa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Sun, 30 Jun 2024 17:54:32 +0200 Subject: [PATCH 28/28] Fix service puma call --- conf/fab-manager-app.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/fab-manager-app.service b/conf/fab-manager-app.service index f1bbf6d..1c319d7 100644 --- a/conf/fab-manager-app.service +++ b/conf/fab-manager-app.service @@ -12,7 +12,7 @@ EnvironmentFile=__INSTALL_DIR__/.env Environment="RAILS_ENV=production" ExecStartPre=-rm -f __INSTALL_DIR__/tmp/pids/server.pid -ExecStart=__INSTALL_DIR__/bin/bundle exec rails service -u 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