1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/nocodb_ynh.git synced 2024-09-03 19:56:01 +02:00

Rely on upstream built binaries

This commit is contained in:
tituspijean 2023-01-28 19:24:20 +01:00
parent b833fa7094
commit 0287b80c3a
No known key found for this signature in database
GPG key ID: EF3B0D7CC0A94720
5 changed files with 37 additions and 5 deletions

4
conf/amd64.src Normal file
View file

@ -0,0 +1,4 @@
SOURCE_URL=https://github.com/nocodb/nocodb/releases/download/0.104.2/Noco-linux-x64
SOURCE_SUM=7506A5936B53CCFBB60FDEF80C5D90A87013B24C57CD4C477C57AF37E74654DD
SOURCE_SUM_PRG=sha256sum
SOURCE_FILENAME=nocodb

4
conf/arm64.src Normal file
View file

@ -0,0 +1,4 @@
SOURCE_URL=https://github.com/nocodb/nocodb/releases/download/0.104.2/Noco-linux-arm64
SOURCE_SUM=3B7EEF61DA6E69E2F8B99ED13DDC11DAA2B6E30552D6C877C2D0824E028D7361
SOURCE_SUM_PRG=sha256sum
SOURCE_FILENAME=nocodb

View file

@ -9,7 +9,7 @@ Group=__APP__
WorkingDirectory=__FINALPATH__/
Environment="__YNH_NODE_LOAD_PATH__"
EnvironmentFile=__FINALPATH__/.env
ExecStart=__YNH_NODE__ index.js
ExecStart=__NOCODB_STARTCOMMAND__
StandardOutput=append:/var/log/__APP__/__APP__.log
StandardError=inherit

View file

@ -36,10 +36,12 @@ jwt_secret=$(ynh_string_random --length=20)
#=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=1
# Stop if architecture is 32-bit ARM
# Stop if architecture is 32-bit ARM, else point to the ARM64 or AMD64 binaries, else to the source code to be downloaded
case $YNH_ARCH in
arm|armhf) ynh_die --message="Sorry, your architecture $YNH_ARCH is not supported by NocoDB. Aborting.";;
*) ;;
arm64) src="arm64";;
amd64) src="amd64";;
*) src="app";;
esac
final_path=/opt/yunohost/$app
@ -100,7 +102,7 @@ ynh_script_progression --message="Setting up source files..." --weight=1
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
ynh_setup_source --source_id="$src" --dest_dir="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
@ -148,6 +150,13 @@ chown $app:$app "$final_path/.env"
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1
if [ $YNH_ARCH = "arm64" || $YNH_ARCH = "amd64" ];
nocodb_startcommand="nocodb"
else
nocodb_startcommand="$ynh_node index.js"
fi
ynh_app_setting_set --app=$app --key=nocodb_startcommand --value=$nocodb_startcommand
# Create a dedicated systemd config
ynh_add_systemd_config

View file

@ -22,6 +22,14 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
port=$(ynh_app_setting_get --app=$app --key=port)
# Stop if architecture is 32-bit ARM, else point to the ARM64 or AMD64 binaries, else to the source code to be downloaded
case $YNH_ARCH in
arm|armhf) ynh_die --message="Sorry, your architecture $YNH_ARCH is not supported by NocoDB. Aborting.";;
arm64) src="arm64";;
amd64) src="amd64";;
*) src="app";;
esac
#=================================================
# CHECK VERSION
#=================================================
@ -75,7 +83,7 @@ then
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="$final_path" --keep=".env"
ynh_setup_source --source="$src" --dest_dir="$final_path" --keep=".env"
fi
chmod 750 "$final_path"
@ -126,6 +134,13 @@ popd
#=================================================
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
if [ $YNH_ARCH = "arm64" || $YNH_ARCH = "amd64" ];
nocodb_startcommand="nocodb"
else
nocodb_startcommand="$ynh_node index.js"
fi
ynh_app_setting_set --app=$app --key=nocodb_startcommand --value=$nocodb_startcommand
# Create a dedicated systemd config
ynh_add_systemd_config