From b5e262762eabd33f1341ed6b07e3326df73a285d Mon Sep 17 00:00:00 2001 From: Fabian Wilkens Date: Mon, 11 Jul 2022 20:17:12 +0200 Subject: [PATCH] Fix: modify ynh package for new upstream app source --- conf/app.src | 4 +-- conf/env.sample | 30 +++++------------------ conf/nginx.conf | 4 +-- conf/systemd.service | 4 +-- doc/DISCLAIMER.md | 8 +++--- manifest.json | 4 +-- scripts/_common.sh | 10 +------- scripts/install | 19 +++----------- scripts/upgrade | 18 +++----------- sources/patches/app-00-add-path-url.patch | 6 ++--- 10 files changed, 28 insertions(+), 79 deletions(-) diff --git a/conf/app.src b/conf/app.src index 5687965..abd6a8e 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/standardnotes/app/archive/refs/tags/3.20.2.tar.gz -SOURCE_SUM=6EE98FA8CEDCC7743419ED528E0A5B5AF5253373895AEC3E87EFFCA7D150122B +SOURCE_URL=https://github.com/standardnotes/app/archive/refs/tags/@standardnotes/web@3.39.1.tar.gz +SOURCE_SUM=1dc84e151c20f5a31cf8b6f9c1248b14d2f72800f58557ddb8fe8ee54d360c58 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/env.sample b/conf/env.sample index da5fdc0..a9bb6b5 100644 --- a/conf/env.sample +++ b/conf/env.sample @@ -1,33 +1,15 @@ RAILS_ENV=production PORT=__PORT__ -WEB_CONCURRENCY=0 -RAILS_LOG_TO_STDOUT=true -# Log Level options: "INFO" | "DEBUG" | "INFO" | "WARN" | "ERROR" | "FATAL" -RAILS_LOG_LEVEL=INFO - -RAILS_SERVE_STATIC_FILES=true -SECRET_KEY_BASE=__SECRET_KEY_BASE__ - -APP_HOST=http://__DOMAIN____PATH__/ -PURCHASE_URL=https://standardnotes.com/purchase -PLANS_URL=https://standardnotes.com/plans -DASHBOARD_URL=http://standardnotes.com/dashboard DEFAULT_SYNC_SERVER=https://__SNSERVER_DOMAIN__/ -WEBSOCKET_URL=wss://sockets-dev.standardnotes.com -ENABLE_UNFINISHED_FEATURES=false +# Subscription related endpoints +DASHBOARD_URL=http://standardnotes.com/dashboard +PLANS_URL=https://standardnotes.com/plans +PURCHASE_URL=https://standardnotes.com/purchase -# NewRelic (Optional) -NEW_RELIC_ENABLED=false -NEW_RELIC_THREAD_PROFILER_ENABLED=false -NEW_RELIC_LICENSE_KEY= -NEW_RELIC_APP_NAME=Web -NEW_RELIC_BROWSER_MONITORING_AUTO_INSTRUMENT=false - -DEV_ACCOUNT_EMAIL= -DEV_ACCOUNT_PASSWORD= -DEV_ACCOUNT_SERVER= +# Used by Rails internals and not Standard Notes related +SECRET_KEY_BASE=__SECRET_KEY_BASE__ # Sub-URI RAILS_RELATIVE_URL_ROOT=__PATH__/ diff --git a/conf/nginx.conf b/conf/nginx.conf index 52614d4..426082e 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,10 +1,10 @@ location __PATH__/ { # Path to source - alias __FINALPATH__/live/public ; + alias __FINALPATH__/live/packages/web-server/public ; # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file - client_max_body_size 25M; + client_max_body_size 50M; proxy_pass http://127.0.0.1:__PORT____PATH__/; proxy_http_version 1.1; diff --git a/conf/systemd.service b/conf/systemd.service index 711412c..8a571ea 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,8 +7,8 @@ Type=simple User=__APP__ Group=__APP__ EnvironmentFile=__FINALPATH__/live/.env -WorkingDirectory=__FINALPATH__/live/ -ExecStart=__RBENV_INSTALL_DIR__/versions/__APP__/bin/bundle exec puma -C config/puma.rb -p __PORT__ -e production +WorkingDirectory=__FINALPATH__/live/packages/web-server/ +ExecStart=__RBENV_INSTALL_DIR__/versions/__APP__/bin/bundle exec rails s -b 0.0.0.0 -p __PORT__ -e production StandardOutput=append:/var/log/__APP__/snweb.log StandardError=inherit Restart=always diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md index 22efad9..2c669cc 100644 --- a/doc/DISCLAIMER.md +++ b/doc/DISCLAIMER.md @@ -1,10 +1,10 @@ * No single-sign on or LDAP integration * The app requires up 1500MB of RAM to install -* The app requires at least 80MB of RAM to work properly. -* The app requires around 1000MB of disk. +* The app requires at least 100MB of RAM to work properly. +* The app requires around 3500MB of disk. * A dedicated domain is requierd if you want to use extensions. - * notes.your-domain.tld/ -> Extension Manager is working - * your-domain.tld/notes/ -> Extension Manager is not working + * notes.your-domain.tld/ -> Extensions are working + * your-domain.tld/notes/ -> Extensions are not working * The config-file is stored under "/opt/yunohost/$app/live/.env" diff --git a/manifest.json b/manifest.json index 038cbaf..0ef3c17 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "End-to-end encrypted note-taking app", "fr": "Application de prise de notes chiffrées" }, - "version": "3.20.2~ynh1", + "version": "3.39.1~ynh1", "url": "https://github.com/standardnotes/web", "upstream": { "license": "AGPL-3.0-or-later", @@ -58,7 +58,7 @@ "en": "Choose the default Standard Notes Syncing Server", "de": "Wähle den Standard Notes Syncing Server" }, - "default": "sync.standardnotes.org" + "default": "api.standardnotes.org" } ] } diff --git a/scripts/_common.sh b/scripts/_common.sh index 376887d..c47cfa8 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,19 +6,11 @@ # dependencies used by the app pkg_dependencies="\ - zlib1g-dev \ - libssl-dev \ - libjemalloc-dev \ - python2-minimal \ - git \ " -RUBY_VERSION="2.7.3" +RUBY_VERSION="2.7.4" NODEJS_VERSION="16" -SOURCE="https://github.com/standardnotes/web" -COMMIT="4d581feb0ac862e5face27be3fd52ac39f565d23" - node_max_old_space_size=2048 #================================================= diff --git a/scripts/install b/scripts/install index 2d2bf59..fc76ddc 100644 --- a/scripts/install +++ b/scripts/install @@ -96,14 +96,6 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app: "$final_path" -# Set permissions to app files -mkdir -p "$final_path/live/log" -chown -R $app: "$final_path/live/log" -mkdir -p "$final_path/live/public" -chown -R $app: "$final_path/live/public" -mkdir -p "$final_path/live/tmp" -chown -R $app: "$final_path/live/tmp" - #================================================= # NGINX CONFIGURATION #================================================= @@ -146,13 +138,9 @@ chown -R $app: "$final_path" pushd "$final_path/live" ynh_use_nodejs - ynh_exec_as $app $ynh_ruby_load_path bin/bundle config set --local path 'vendor/bundle' - ynh_exec_as $app $ynh_ruby_load_path bin/bundle config set with 'development' - ynh_exec_warn_less ynh_exec_as $app $ynh_ruby_load_path bin/bundle update -j$(getconf _NPROCESSORS_ONLN) --quiet - ynh_exec_warn_less ynh_exec_as $app $ynh_ruby_load_path bin/bundle install -j$(getconf _NPROCESSORS_ONLN) --quiet - ynh_exec_warn_less ynh_exec_as $app env NODE_OPTIONS="--max-old-space-size=$node_max_old_space_size" PATH=$ynh_node_load_PATH yarn install --pure-lockfile - ynh_exec_warn_less ynh_exec_as $app env NODE_OPTIONS="--max-old-space-size=$node_max_old_space_size" PATH=$ynh_node_load_PATH yarn bundle - ynh_exec_warn_less ynh_exec_as $app $ynh_ruby_load_path bin/bundle exec rails assets:precompile --quiet + ynh_exec_warn_less ynh_exec_as $app env NODE_OPTIONS="--max-old-space-size=$node_max_old_space_size" PATH=$ynh_node_load_PATH yarn install + ynh_exec_warn_less ynh_exec_as $app env NODE_OPTIONS="--max-old-space-size=$node_max_old_space_size" PATH=$ynh_node_load_PATH yarn build:web-server + ynh_exec_warn_less ynh_exec_as $app env NODE_OPTIONS="--max-old-space-size=$node_max_old_space_size" PATH=$ynh_node_load_PATH yarn build:web popd #================================================= @@ -174,7 +162,6 @@ mkdir -p "/var/log/$app" chown -R $app: "/var/log/$app" # Use logrotate to manage application logfile(s) -ynh_use_logrotate --logfile="$final_path/live/log/production.log" ynh_use_logrotate --logfile="/var/log/$app/$app.log" #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 3ddf75b..b2165b6 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -107,13 +107,6 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app: "$final_path" -mkdir -p "$final_path/live/log" -chown -R $app: "$final_path/live/log" -mkdir -p "$final_path/live/public" -chown -R $app: "$final_path/live/public" -mkdir -p "$final_path/live/tmp" -chown -R $app: "$final_path/live/tmp" - #================================================= # NGINX CONFIGURATION #================================================= @@ -165,13 +158,9 @@ then pushd "$final_path/live" ynh_use_nodejs - ynh_exec_as $app $ynh_ruby_load_path bin/bundle config set --local path 'vendor/bundle' - ynh_exec_as $app $ynh_ruby_load_path bin/bundle config set with 'development' - ynh_exec_warn_less ynh_exec_as $app $ynh_ruby_load_path bin/bundle update -j$(getconf _NPROCESSORS_ONLN) --quiet - ynh_exec_warn_less ynh_exec_as $app $ynh_ruby_load_path bin/bundle install -j$(getconf _NPROCESSORS_ONLN) --quiet - ynh_exec_warn_less ynh_exec_as $app env NODE_OPTIONS="--max-old-space-size=$node_max_old_space_size" PATH=$ynh_node_load_PATH yarn install --pure-lockfile - ynh_exec_warn_less ynh_exec_as $app env NODE_OPTIONS="--max-old-space-size=$node_max_old_space_size" PATH=$ynh_node_load_PATH yarn bundle - ynh_exec_warn_less ynh_exec_as $app $ynh_ruby_load_path bin/bundle exec rails assets:precompile --quiet + ynh_exec_warn_less ynh_exec_as $app env NODE_OPTIONS="--max-old-space-size=$node_max_old_space_size" PATH=$ynh_node_load_PATH yarn install + ynh_exec_warn_less ynh_exec_as $app env NODE_OPTIONS="--max-old-space-size=$node_max_old_space_size" PATH=$ynh_node_load_PATH yarn build:web-server + ynh_exec_warn_less ynh_exec_as $app env NODE_OPTIONS="--max-old-space-size=$node_max_old_space_size" PATH=$ynh_node_load_PATH yarn build:web popd fi @@ -194,7 +183,6 @@ mkdir -p "/var/log/$app" chown -R $app: "/var/log/$app" # Use logrotate to manage application logfile(s) -ynh_use_logrotate --logfile="$final_path/live/log/production.log" ynh_use_logrotate --logfile="/var/log/$app/$app.log" #================================================= diff --git a/sources/patches/app-00-add-path-url.patch b/sources/patches/app-00-add-path-url.patch index 92d073a..d9bab2f 100644 --- a/sources/patches/app-00-add-path-url.patch +++ b/sources/patches/app-00-add-path-url.patch @@ -1,7 +1,7 @@ -diff --git a/config.ru b/config.ru +diff --git a/packages/web-server/config.ru b/packages/web-server/config.ru index bd83b25..6b1bb50 100644 ---- a/config.ru -+++ b/config.ru +--- a/packages/web-server/config.ru ++++ b/packages/web-server/config.ru @@ -1,4 +1,6 @@ # This file is used by Rack-based servers to start the application.