1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/cinny_ynh.git synced 2024-09-03 18:16:13 +02:00
This commit is contained in:
Salamandar 2024-08-09 12:22:31 +00:00 committed by GitHub
commit 561821cfb7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 101 additions and 42 deletions

View file

@ -2,12 +2,12 @@
location __PATH__/ {
# Path to source
alias __INSTALL_DIR__/;
alias __INSTALL_DIR__/www/;
try_files $uri /index.html;
try_files $uri __PATH__/index.html;
location ~ ^.*/olm.wasm$ {
try_files $uri /olm.wasm;
location ~ ^__PATH__/.*/olm.wasm$ {
try_files $uri __PATH__/olm.wasm;
}
# From upstream, FIXME: not needed?

View file

@ -63,10 +63,9 @@ ram.runtime = "50M"
[resources.sources]
[resources.sources.main]
url = "https://github.com/cinnyapp/cinny/releases/download/v4.1.0/cinny-v4.1.0.tar.gz"
sha256 = "64bce650b1d5ee281e215f732fa40e40e2d38ebf8c2a8ed87ca0ae9ebe5ed788"
url = "https://github.com/ajbura/cinny/archive/refs/tags/v4.1.0.tar.gz"
sha256 = "468e7f769b68d81b8681647a84c5783f4683f1b75bcadf9eca99575f5f1de01b"
autoupdate.strategy = "latest_github_release"
autoupdate.asset = "cinny-v.*.tar.gz$"
[resources.system_user]

View file

@ -4,10 +4,39 @@
# COMMON VARIABLES
#=================================================
nodejs_version=20
#=================================================
# PERSONAL HELPERS
#=================================================
_patch_build_config() {
sourcedir=$1
# Required for sub-path installation
sed -i \
"s|base: '.*'|base: '$path'|" \
"$1/build.config.ts"
}
_npm_build_install() {
sourcedir=$1
targetdir=$2
ynh_use_nodejs
pushd "$sourcedir" || ynh_die "Could not pushd $sourcedir"
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" \
"$ynh_npm" ci
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" \
"$ynh_npm" --max-old-space-size=4096 run build
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" \
"$ynh_npm" cache clean --force
popd || ynh_die "Could not popd"
ynh_secure_remove --file="$targetdir"
mv "$sourcedir/dist" "$targetdir"
}
#=================================================
# EXPERIMENTAL HELPERS
#=================================================

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -9,8 +7,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
@ -18,6 +14,22 @@ ynh_script_progression --message="Updating NGINX web server configuration..." --
ynh_change_url_nginx_config
#=================================================
# REBUILD CINNY
#=================================================
ynh_script_progression --message="Rebuilding $app..." --weight=1
cp "$install_dir/www/config.json" "$install_dir/config.json"
_patch_build_config "$install_dir/source"
_npm_build_install "$install_dir/source" "$install_dir/www"
mv "$install_dir/config.json" "$install_dir/www/config.json"
# Fix any permissions in the install dir
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -9,24 +7,32 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing NodeJS..." --weight=5
# Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir"
ynh_setup_source --dest_dir="$install_dir/source"
chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
#=================================================
# NGINX CONFIGURATION
# BUILD APP
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
ynh_script_progression --message="Building $app..." --weight=5
# Create a dedicated NGINX config
ynh_add_nginx_config
_patch_build_config "$install_dir/source"
_npm_build_install "$install_dir/source" "$install_dir/www"
#=================================================
# CINNY CONFIGURATION
@ -34,12 +40,20 @@ ynh_add_nginx_config
ynh_script_progression --message="Configuring Cinny..." --weight=1
# Copy over the Cinny configuration file
ynh_add_config --template="../conf/cinny.json" --destination="$install_dir/config.json"
ynh_add_config --template="cinny.json" --destination="$install_dir/www/config.json"
# Fix any permissions in the install dir
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -10,21 +8,14 @@ source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# REMOVE NGINX CONFIGURATION
# REMOVE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..." --weight=1
# Remove the log files
ynh_remove_nodejs
#=================================================
# END OF SCRIPT

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -11,7 +9,13 @@ source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD RESTORATION STEPS
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling NodeJS..." --weight=5
# Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
@ -27,10 +31,8 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
ynh_restore_file --origin_path="$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
chown -R "$app:www-data" "$install_dir"
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -9,17 +7,33 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Updating NodeJS..." --weight=5
# Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Upgrading source files..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep="config.json"
ynh_setup_source --dest_dir="$install_dir/source" --full_replace=1 --keep="config.json"
chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
#=================================================
# BUILD APP
#=================================================
ynh_script_progression --message="Rebuilding $app..." --weight=5
_patch_build_config "$install_dir/source"
_npm_build_install "$install_dir/source" "$install_dir/www"
#=================================================
# NGINX CONFIGURATION
#=================================================