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

Merge pull request #43 from YunoHost-Apps/testing

3.39.1~ynh1
This commit is contained in:
Fabian Wilkens 2022-07-15 04:44:00 +02:00 committed by GitHub
commit 4941f89800
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 112 additions and 153 deletions

View file

@ -18,10 +18,19 @@ current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
current_ynh_version=$(cat manifest.json | jq -j '.version|split("~ynh")[1]') current_ynh_version=$(cat manifest.json | jq -j '.version|split("~ynh")[1]')
current_commit=$(cat scripts/_common.sh | awk -F= '/^COMMIT/ { print $2 }') current_commit=$(cat scripts/_common.sh | awk -F= '/^COMMIT/ { print $2 }')
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]') repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
tag_version=$(curl --silent "https://api.github.com/repos/$repo/tags" | jq -r '.[] | .name' | sort -V | tail -1)
version=$(curl --silent "https://raw.githubusercontent.com/$repo/$tag_version/package.json" | jq -j '.version') page=0
assets="https://github.com/$repo/archive/refs/tags/$tag_version.tar.gz" tag_version=""
commit=$(curl --silent "https://api.github.com/repos/$repo/tags" | jq -r '[ .[] | select(.name=="'$tag_version'").commit.sha ] | join(" ") | @sh' | tr -d "'") while [ -z $tag_version ]
do
let page++
tag_version=$(curl --silent "https://api.github.com/repos/$repo/tags?per_page=100&page=$page" | jq -r '.[] | .name' | grep -v "alpha" | grep "@standardnotes/web@" | sort -V | tail -1)
done
version=$(curl --silent "https://raw.githubusercontent.com/$repo/$tag_version/packages/web/package.json" | jq -j '.version')
asset="https://github.com/$repo/archive/refs/tags/$tag_version.tar.gz"
commit=$(curl --silent "https://api.github.com/repos/$repo/tags?per_page=100&page=$page" | jq -r '[ .[] | select(.name=="'$tag_version'").commit.sha ] | join(" ") | @sh' | tr -d "'")
# Later down the script, we assume the version has only digits and dots # Later down the script, we assume the version has only digits and dots
# Sometimes the release name starts with a "v", so let's filter it out. # Sometimes the release name starts with a "v", so let's filter it out.
@ -57,8 +66,34 @@ fi
# UPDATE SOURCE FILES # UPDATE SOURCE FILES
#================================================= #=================================================
filename="scripts/_common.sh" # Create the temporary directory
sed -i 's/COMMIT=".*"$/COMMIT="'$commit'"/g' $filename tempdir="$(mktemp -d)"
# Download sources and calculate checksum
filename=${asset##*/}
curl --silent -4 -L $asset -o "$tempdir/$filename"
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
# Delete temporary directory
rm -rf $tempdir
# Get extension
if [[ $filename == *.tar.gz ]]; then
extension=tar.gz
else
extension=${filename##*.}
fi
# Rewrite source file
cat <<EOT > conf/app.src
SOURCE_URL=$asset
SOURCE_SUM=$checksum
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=$extension
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
EOT
echo "... conf/app.src updated"
#================================================= #=================================================
# SPECIFIC UPDATE STEPS # SPECIFIC UPDATE STEPS
@ -85,5 +120,3 @@ echo "$(jq -s --indent 4 ".[] | .version = \"$new_version\"" manifest.json)" > m
# The Action will proceed only if the PROCEED environment variable is set to true # The Action will proceed only if the PROCEED environment variable is set to true
echo "PROCEED=true" >> $GITHUB_ENV echo "PROCEED=true" >> $GITHUB_ENV
exit 0 exit 0

View file

@ -6,9 +6,9 @@ name: Check for new upstream releases
on: on:
# Allow to manually trigger the workflow # Allow to manually trigger the workflow
workflow_dispatch: workflow_dispatch:
# Run it every day at 6:00 UTC # Run it every monday at 6:00 UTC
schedule: schedule:
- cron: '0 6 * * *' - cron: '0 6 * * 1'
jobs: jobs:
updater: updater:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -29,22 +29,21 @@ jobs:
id: commit id: commit
if: ${{ env.PROCEED == 'true' }} if: ${{ env.PROCEED == 'true' }}
run: | run: |
git commit -am "Upgrade to version $VERSION - tag $TAG_VERSION" git commit -am "Upgrade to version $VERSION"
- name: Create Pull Request - name: Create Pull Request
id: cpr id: cpr
if: ${{ env.PROCEED == 'true' }} if: ${{ env.PROCEED == 'true' }}
uses: peter-evans/create-pull-request@v3 uses: peter-evans/create-pull-request@v3
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'Update: Update to version ${{ env.VERSION }} - tag ${{ env.TAG_VERSION }}' commit-message: 'Update: Update to version ${{ env.VERSION }}'
committer: 'yunohost-bot <yunohost-bot@users.noreply.github.com>' committer: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>' author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
signoff: false signoff: false
base: testing base: testing
branch: ci-auto-update-v${{ env.VERSION }}-tag${{ env.TAG_VERSION }} branch: ci-auto-update-v${{ env.VERSION }}
delete-branch: true delete-branch: true
title: 'Upgrade to version ${{ env.VERSION }} - tag ${{ env.TAG_VERSION }}' title: 'Upgrade to version ${{ env.VERSION }}'
body: | body: |
Upgrade to version ${{ env.VERSION }} Upgrade to version ${{ env.VERSION }}
Upgrade to tag ${{ env.TAG_VERSION }}
draft: false draft: false

View file

@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
End-to-end encrypted note-taking app End-to-end encrypted note-taking app
**Shipped version:** 3.20.2~ynh1 **Shipped version:** 3.39.1~ynh1
**Demo:** https://standardnotes.org/demo **Demo:** https://standardnotes.org/demo
@ -29,12 +29,12 @@ End-to-end encrypted note-taking app
* No single-sign on or LDAP integration * No single-sign on or LDAP integration
* The app requires up 1500MB of RAM to install * The app requires up 1500MB of RAM to install
* The app requires at least 80MB of RAM to work properly. * The app requires at least 100MB of RAM to work properly.
* The app requires around 1000MB of disk. * The app requires around 3500MB of disk.
* A dedicated domain is requierd if you want to use extensions. * A dedicated domain is requierd if you want to use extensions.
* notes.your-domain.tld/ -> Extension Manager is working * notes.your-domain.tld/ -> Extensions are working
* your-domain.tld/notes/ -> Extension Manager is not working * your-domain.tld/notes/ -> Extensions are not working
* The config-file is stored under "/opt/yunohost/$app/live/.env" * The config-file is stored under "/opt/yunohost/$app/live/.env"
@ -43,7 +43,7 @@ End-to-end encrypted note-taking app
* Official app website: <https://standardnotes.org/> * Official app website: <https://standardnotes.org/>
* Official user documentation: <https://standardnotes.org/help> * Official user documentation: <https://standardnotes.org/help>
* Official admin documentation: <https://docs.standardnotes.org/> * Official admin documentation: <https://docs.standardnotes.org/>
* Upstream app code repository: <https://github.com/standardnotes/web> * Upstream app code repository: <https://github.com/standardnotes/app>
* YunoHost documentation for this app: <https://yunohost.org/app_snweb> * YunoHost documentation for this app: <https://yunohost.org/app_snweb>
* Report a bug: <https://github.com/YunoHost-Apps/snweb_ynh/issues> * Report a bug: <https://github.com/YunoHost-Apps/snweb_ynh/issues>

View file

@ -17,7 +17,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
Application de prise de notes chiffrées Application de prise de notes chiffrées
**Version incluse :** 3.20.2~ynh1 **Version incluse :** 3.39.1~ynh1
**Démo :** https://standardnotes.org/demo **Démo :** https://standardnotes.org/demo
@ -29,12 +29,12 @@ Application de prise de notes chiffrées
* No single-sign on or LDAP integration * No single-sign on or LDAP integration
* The app requires up 1500MB of RAM to install * The app requires up 1500MB of RAM to install
* The app requires at least 80MB of RAM to work properly. * The app requires at least 100MB of RAM to work properly.
* The app requires around 1000MB of disk. * The app requires around 3500MB of disk.
* A dedicated domain is requierd if you want to use extensions. * A dedicated domain is requierd if you want to use extensions.
* notes.your-domain.tld/ -> Extension Manager is working * notes.your-domain.tld/ -> Extensions are working
* your-domain.tld/notes/ -> Extension Manager is not working * your-domain.tld/notes/ -> Extensions are not working
* The config-file is stored under "/opt/yunohost/$app/live/.env" * The config-file is stored under "/opt/yunohost/$app/live/.env"
@ -43,7 +43,7 @@ Application de prise de notes chiffrées
* Site officiel de l'app : <https://standardnotes.org/> * Site officiel de l'app : <https://standardnotes.org/>
* Documentation officielle utilisateur : <https://standardnotes.org/help> * Documentation officielle utilisateur : <https://standardnotes.org/help>
* Documentation officielle de l'admin : <https://docs.standardnotes.org/> * Documentation officielle de l'admin : <https://docs.standardnotes.org/>
* Dépôt de code officiel de l'app : <https://github.com/standardnotes/web> * Dépôt de code officiel de l'app : <https://github.com/standardnotes/app>
* Documentation YunoHost pour cette app : <https://yunohost.org/app_snweb> * Documentation YunoHost pour cette app : <https://yunohost.org/app_snweb>
* Signaler un bug : <https://github.com/YunoHost-Apps/snweb_ynh/issues> * Signaler un bug : <https://github.com/YunoHost-Apps/snweb_ynh/issues>

View file

@ -11,8 +11,8 @@
setup_private=1 setup_private=1
setup_public=1 setup_public=1
upgrade=1 upgrade=1
# 3.14.0~ynh1 # 3.20.2~ynh1
upgrade=1 from_commit=6b533ef25d4454a09c4a6e5b135b4873a4cdbcb8 # upgrade=1 from_commit=294a7b88cd8dbf396b6f90ecc164cedcb0516e57
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
port_already_use=0 port_already_use=0
@ -21,6 +21,6 @@
Email= Email=
Notification=none Notification=none
;;; Upgrade options ;;; Upgrade options
; commit=6b533ef25d4454a09c4a6e5b135b4873a4cdbcb8 ; commit=294a7b88cd8dbf396b6f90ecc164cedcb0516e57
name=3.14.0~ynh1 name=3.20.2~ynh1
manifest_arg=domain=DOMAIN&is_public=1 manifest_arg=domain=DOMAIN&is_public=1

7
conf/app.src Normal file
View file

@ -0,0 +1,7 @@
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
SOURCE_FILENAME=
SOURCE_EXTRACT=true

View file

@ -1,33 +1,15 @@
RAILS_ENV=production RAILS_ENV=production
PORT=__PORT__ 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__/ 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) # Used by Rails internals and not Standard Notes related
NEW_RELIC_ENABLED=false SECRET_KEY_BASE=__SECRET_KEY_BASE__
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=
# Sub-URI # Sub-URI
RAILS_RELATIVE_URL_ROOT=__PATH__/ RAILS_RELATIVE_URL_ROOT=__PATH__/

View file

@ -1,10 +1,10 @@
location __PATH__/ { location __PATH__/ {
# Path to source # 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 # 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_pass http://127.0.0.1:__PORT____PATH__/;
proxy_http_version 1.1; proxy_http_version 1.1;

View file

@ -7,8 +7,8 @@ Type=simple
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
EnvironmentFile=__FINALPATH__/live/.env EnvironmentFile=__FINALPATH__/live/.env
WorkingDirectory=__FINALPATH__/live/ WorkingDirectory=__FINALPATH__/live/packages/web-server/
ExecStart=__RBENV_INSTALL_DIR__/versions/__APP__/bin/bundle exec puma -C config/puma.rb -p __PORT__ -e production 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 StandardOutput=append:/var/log/__APP__/snweb.log
StandardError=inherit StandardError=inherit
Restart=always Restart=always

View file

@ -1,10 +1,10 @@
* No single-sign on or LDAP integration * No single-sign on or LDAP integration
* The app requires up 1500MB of RAM to install * The app requires up 1500MB of RAM to install
* The app requires at least 80MB of RAM to work properly. * The app requires at least 100MB of RAM to work properly.
* The app requires around 1000MB of disk. * The app requires around 3500MB of disk.
* A dedicated domain is requierd if you want to use extensions. * A dedicated domain is requierd if you want to use extensions.
* notes.your-domain.tld/ -> Extension Manager is working * notes.your-domain.tld/ -> Extensions are working
* your-domain.tld/notes/ -> Extension Manager is not working * your-domain.tld/notes/ -> Extensions are not working
* The config-file is stored under "/opt/yunohost/$app/live/.env" * The config-file is stored under "/opt/yunohost/$app/live/.env"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 602 KiB

After

Width:  |  Height:  |  Size: 149 KiB

View file

@ -6,7 +6,7 @@
"en": "End-to-end encrypted note-taking app", "en": "End-to-end encrypted note-taking app",
"fr": "Application de prise de notes chiffrées" "fr": "Application de prise de notes chiffrées"
}, },
"version": "3.20.2~ynh1", "version": "3.39.1~ynh1",
"url": "https://github.com/standardnotes/web", "url": "https://github.com/standardnotes/web",
"upstream": { "upstream": {
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
@ -14,7 +14,7 @@
"demo": "https://standardnotes.org/demo", "demo": "https://standardnotes.org/demo",
"admindoc": "https://docs.standardnotes.org/", "admindoc": "https://docs.standardnotes.org/",
"userdoc": "https://standardnotes.org/help", "userdoc": "https://standardnotes.org/help",
"code": "https://github.com/standardnotes/web" "code": "https://github.com/standardnotes/app"
}, },
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"maintainer": { "maintainer": {
@ -58,7 +58,7 @@
"en": "Choose the default Standard Notes Syncing Server", "en": "Choose the default Standard Notes Syncing Server",
"de": "Wähle den Standard Notes Syncing Server" "de": "Wähle den Standard Notes Syncing Server"
}, },
"default": "sync.standardnotes.org" "default": "api.standardnotes.org"
} }
] ]
} }

View file

@ -6,19 +6,11 @@
# dependencies used by the app # dependencies used by the app
pkg_dependencies="\ pkg_dependencies="\
zlib1g-dev \
libssl-dev \
libjemalloc-dev \
python2-minimal \
git \
" "
RUBY_VERSION="2.7.3" RUBY_VERSION="2.7.4"
NODEJS_VERSION="16" NODEJS_VERSION="16"
SOURCE="https://github.com/standardnotes/web"
COMMIT="4d581feb0ac862e5face27be3fd52ac39f565d23"
node_max_old_space_size=2048 node_max_old_space_size=2048
#================================================= #=================================================

View file

@ -70,7 +70,7 @@ ynh_app_setting_set --app=$app --key=port --value=$port
#================================================= #=================================================
ynh_script_progression --message="Installing dependencies..." --weight=30 ynh_script_progression --message="Installing dependencies..." --weight=30
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies $build_pkg_dependencies
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
ynh_install_ruby --ruby_version=$RUBY_VERSION ynh_install_ruby --ruby_version=$RUBY_VERSION
@ -90,33 +90,12 @@ ynh_script_progression --message="Setting up source files..." --weight=16
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
mkdir -p "$final_path/live" ynh_setup_source --dest_dir="$final_path/live"
git clone $SOURCE "$final_path/live" --quiet
pushd "$final_path/live"
git checkout $COMMIT --quiet
git submodule update --init --recursive --quiet
popd
# Apply Patch
if [ -f "$YNH_CWD/../sources/patches/app-00-add-path-url.patch" ]
then
pushd "$final_path/live"
patch --strip=1 < "$YNH_CWD/../sources/patches/app-00-add-path-url.patch"
popd
fi
chmod 750 "$final_path" chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"
chown -R $app: "$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 # NGINX CONFIGURATION
#================================================= #=================================================
@ -159,13 +138,9 @@ chown -R $app: "$final_path"
pushd "$final_path/live" pushd "$final_path/live"
ynh_use_nodejs ynh_use_nodejs
ynh_exec_as $app $ynh_ruby_load_path bin/bundle config set --local path 'vendor/bundle' 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_as $app $ynh_ruby_load_path bin/bundle config set with 'development' 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 $ynh_ruby_load_path bin/bundle update -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 build:web
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
popd popd
#================================================= #=================================================
@ -187,7 +162,6 @@ mkdir -p "/var/log/$app"
chown -R $app: "/var/log/$app" chown -R $app: "/var/log/$app"
# Use logrotate to manage application logfile(s) # 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" ynh_use_logrotate --logfile="/var/log/$app/$app.log"
#================================================= #=================================================

View file

@ -68,14 +68,6 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"
chown -R $app: "$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"
#================================================= #=================================================
# SPECIFIC RESTORATION # SPECIFIC RESTORATION
#================================================= #=================================================
@ -84,7 +76,7 @@ chown -R $app: "$final_path/live/tmp"
ynh_script_progression --message="Reinstalling dependencies... ( This may take a while... )" --weight=100 #294 ynh_script_progression --message="Reinstalling dependencies... ( This may take a while... )" --weight=100 #294
# Define and install dependencies # Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies $build_pkg_dependencies
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
ynh_install_ruby --ruby_version=$RUBY_VERSION ynh_install_ruby --ruby_version=$RUBY_VERSION

View file

@ -98,22 +98,8 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
ynh_script_progression --message="Upgrading source files..." --weight=17 ynh_script_progression --message="Upgrading source files..." --weight=17
# Remove destination directory # Download, check integrity, uncompress and patch the source from app.src
ynh_secure_remove --file=$final_path ynh_setup_source --dest_dir="$final_path/live"
# Download
mkdir -p "$final_path"
git clone $SOURCE "$final_path/live" --quiet
pushd "$final_path/live"
git checkout $COMMIT --quiet
git submodule update --init --recursive --quiet
popd
# Apply Patch
if [ -f "$YNH_CWD/../sources/patches/app-00-add-path-url.patch" ]
then
pushd "$final_path/live"
patch --strip=1 < "$YNH_CWD/../sources/patches/app-00-add-path-url.patch"
popd
fi
fi fi
# Set permissions to app files # Set permissions to app files
@ -121,13 +107,6 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"
chown -R $app: "$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 # NGINX CONFIGURATION
#================================================= #=================================================
@ -141,7 +120,7 @@ ynh_add_nginx_config
#================================================= #=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=37 ynh_script_progression --message="Upgrading dependencies..." --weight=37
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies $build_pkg_dependencies
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
ynh_install_ruby --ruby_version=$RUBY_VERSION ynh_install_ruby --ruby_version=$RUBY_VERSION
@ -179,13 +158,9 @@ then
pushd "$final_path/live" pushd "$final_path/live"
ynh_use_nodejs ynh_use_nodejs
ynh_exec_as $app $ynh_ruby_load_path bin/bundle config set --local path 'vendor/bundle' 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_as $app $ynh_ruby_load_path bin/bundle config set with 'development' 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 $ynh_ruby_load_path bin/bundle update -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 build:web
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
popd popd
fi fi
@ -208,7 +183,6 @@ mkdir -p "/var/log/$app"
chown -R $app: "/var/log/$app" chown -R $app: "/var/log/$app"
# Use logrotate to manage application logfile(s) # 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" ynh_use_logrotate --logfile="/var/log/$app/$app.log"
#================================================= #=================================================

View file

@ -12,6 +12,12 @@ rbenv_install_dir="/opt/rbenv"
ruby_version_path="$rbenv_install_dir/versions" ruby_version_path="$rbenv_install_dir/versions"
# RBENV_ROOT is the directory of rbenv, it needs to be loaded as a environment variable. # RBENV_ROOT is the directory of rbenv, it needs to be loaded as a environment variable.
export RBENV_ROOT="$rbenv_install_dir" export RBENV_ROOT="$rbenv_install_dir"
export rbenv_root="$rbenv_install_dir"
ruby_dependencies=""
build_ruby_dependencies="libjemalloc-dev curl build-essential libreadline-dev zlib1g-dev libsqlite3-dev libssl-dev libxml2-dev libxslt-dev autoconf automake bison libtool"
pkg_dependencies="$pkg_dependencies $ruby_dependencies"
build_pkg_dependencies="$build_pkg_dependencies $build_ruby_dependencies"
# Load the version of Ruby for an app, and set variables. # Load the version of Ruby for an app, and set variables.
# #
@ -36,9 +42,9 @@ export RBENV_ROOT="$rbenv_install_dir"
# Finally, to start a Ruby service with the correct version, 2 solutions # Finally, to start a Ruby service with the correct version, 2 solutions
# Either the app is dependent of Ruby or gem, but does not called it directly. # Either the app is dependent of Ruby or gem, but does not called it directly.
# In such situation, you need to load PATH # In such situation, you need to load PATH
# `Environment="__YNH_RUBY_LOAD_ENV_PATH__"` # `Environment="__YNH_RUBY_LOAD_PATH__"`
# `ExecStart=__FINALPATH__/my_app` # `ExecStart=__FINALPATH__/my_app`
# You will replace __YNH_RUBY_LOAD_ENV_PATH__ with $ynh_ruby_load_path # You will replace __YNH_RUBY_LOAD_PATH__ with $ynh_ruby_load_path
# #
# Or Ruby start the app directly, then you don't need to load the PATH variable # Or Ruby start the app directly, then you don't need to load the PATH variable
# `ExecStart=__YNH_RUBY__ my_app run` # `ExecStart=__YNH_RUBY__ my_app run`

View file

@ -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 index bd83b25..6b1bb50 100644
--- a/config.ru --- a/packages/web-server/config.ru
+++ b/config.ru +++ b/packages/web-server/config.ru
@@ -1,4 +1,6 @@ @@ -1,4 +1,6 @@
# This file is used by Rack-based servers to start the application. # This file is used by Rack-based servers to start the application.