1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/calckey_ynh.git synced 2024-09-03 18:16:18 +02:00

Merge branch 'YunoHost-Apps:testing' into testing

This commit is contained in:
oufmilo 2023-03-15 09:29:25 +01:00 committed by GitHub
commit a1cb2c9255
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 109 additions and 415 deletions

View file

@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Fetch the source code - name: Fetch the source code
uses: actions/checkout@v2 uses: actions/checkout@v3
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
- name: Run the updater script - name: Run the updater script
@ -33,7 +33,7 @@ jobs:
- 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@v4
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update to version ${{ env.VERSION }} commit-message: Update to version ${{ env.VERSION }}

View file

@ -6,6 +6,7 @@ It shall NOT be edited by hand.
# Calckey for YunoHost # Calckey for YunoHost
[![Integration level](https://dash.yunohost.org/integration/calckey.svg)](https://dash.yunohost.org/appci/app/calckey) ![Working status](https://ci-apps.yunohost.org/ci/badges/calckey.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/calckey.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/calckey.svg)](https://dash.yunohost.org/appci/app/calckey) ![Working status](https://ci-apps.yunohost.org/ci/badges/calckey.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/calckey.maintain.svg)
[![Install Calckey with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=calckey) [![Install Calckey with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=calckey)
*[Lire ce readme en français.](./README_fr.md)* *[Lire ce readme en français.](./README_fr.md)*
@ -32,30 +33,6 @@ A greatly enhanced fork of Misskey with better UI/UX, security, features, and mo
![Screenshot of Calckey](./doc/screenshots/screenshot-calckey.png) ![Screenshot of Calckey](./doc/screenshots/screenshot-calckey.png)
## Disclaimers / important information
### Important points to read before installing
- *Calckey* requires a dedicated root domain, e.g. `Calckey.domain.tld`
- Due to Cypress dependency, *Calckey* only works on 64-bit CPU machines.
- *Calckey* can take quite some time to install (more then 30 minutes). So take out some time and grab yourself a coffee.
- If installing from command line, using `screen` is recommended to avoid disconnection. See below.
- After installation, first page can take time to load and may show timeout error. Give it time to make itself ready for you. Refresh the page after 2 or 3 minutes.
- The first account created will be an admin user and will have all the admin rights.
Using screen in case of disconnects
```
sudo apt-get install screen
screen
sudo yunohost app install https://github.com/YunoHost-Apps/Calckey_ynh.git
```
Recover after disconnect:
```
screen -d
screen -r
```
## Documentation and resources ## Documentation and resources
* Official app website: <https://i.calckey.cloud/> * Official app website: <https://i.calckey.cloud/>

View file

@ -6,6 +6,7 @@ It shall NOT be edited by hand.
# Calckey pour YunoHost # Calckey pour YunoHost
[![Niveau dintégration](https://dash.yunohost.org/integration/calckey.svg)](https://dash.yunohost.org/appci/app/calckey) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/calckey.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/calckey.maintain.svg) [![Niveau dintégration](https://dash.yunohost.org/integration/calckey.svg)](https://dash.yunohost.org/appci/app/calckey) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/calckey.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/calckey.maintain.svg)
[![Installer Calckey avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=calckey) [![Installer Calckey avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=calckey)
*[Read this readme in english.](./README.md)* *[Read this readme in english.](./README.md)*
@ -30,30 +31,6 @@ Un fork grandement amélioré de Misskey avec une meilleure UI/UX, sécurité, f
![Capture décran de Calckey](./doc/screenshots/screenshot-calckey.png) ![Capture décran de Calckey](./doc/screenshots/screenshot-calckey.png)
## Avertissements / informations importantes
### Points importants à lire avant l'installation
- *Calckey* nécessite un domaine racine dédié, par ex. `Calckey.domain.tld`
- En raison de la dépendance de Cypress, *Calckey* ne fonctionne que sur les machines à processeur 64 bits.
- *Calckey* peut prendre un certain temps à installer (plus de 30 minutes). Alors prenez un peu de temps et prenez un café.
- Si l'installation à partir de la ligne de commande, l'utilisation de l'écran est réenregistrée pour éviter la déconnexion. Voir ci-dessous.
- Après l'installation, la première page peut prendre du temps à charger et peut afficher une erreur de délai d'attente. Donnez-lui le temps de se préparer pour vous. Actualiser la page après 2-3 minutes.
- Le premier compte créé sera un utilisateur administrateur et disposera de tous les droits d'administrateur.
Utiliser *screen* en cas de déconnexion
```
sudo apt-get install screen
screen
sudo yunohost app install https://github.com/YunoHost-Apps/Calckey_ynh.git
```
Récupérer après déconnexion :
```
screen -d
screen -r
```
## Documentations et ressources ## Documentations et ressources
* Site officiel de lapp : <https://i.calckey.cloud/> * Site officiel de lapp : <https://i.calckey.cloud/>

View file

@ -1,25 +0,0 @@
;; Test complet
; Manifest
domain="domain.tld"
is_public=1
; Checks
pkg_linter=1
setup_sub_dir=0
setup_root=1
setup_nourl=0
setup_private=1
setup_public=1
upgrade=1
# v13.0.5
upgrade=1 from_commit=89f4f52e3cb3c9daf8eff43aab67bcda475da410
backup_restore=1
multi_instance=0
change_url=0
;;; Options
Email=
Notification=none
;;; Upgrade options
; commit=CommitHash
name=Name and date of the commit.
manifest_arg=domain=DOMAIN&path=PATH&is_public=1&language=fr&admin=USER&password=pass&port=666&

View file

@ -1,6 +1,7 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ { location __PATH__/ {
proxy_pass http://127.0.0.1:__PORT__; proxy_pass http://127.0.0.1:__PORT__;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;

View file

@ -6,7 +6,7 @@ After=network.target
Type=simple Type=simple
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
WorkingDirectory=__FINALPATH__/ WorkingDirectory=__INSTALL_DIR__/
Environment="__YNH_NODE_LOAD_PATH__" Environment="__YNH_NODE_LOAD_PATH__"
Environment="NODE_ENV=production" Environment="NODE_ENV=production"
ExecStart=__YNH_NPM__ start ExecStart=__YNH_NPM__ start

View file

@ -1,21 +0,0 @@
### Important points to read before installing
- *Calckey* requires a dedicated root domain, e.g. `Calckey.domain.tld`
- Due to Cypress dependency, *Calckey* only works on 64-bit CPU machines.
- *Calckey* can take quite some time to install (more then 30 minutes). So take out some time and grab yourself a coffee.
- If installing from command line, using `screen` is recommended to avoid disconnection. See below.
- After installation, first page can take time to load and may show timeout error. Give it time to make itself ready for you. Refresh the page after 2 or 3 minutes.
- The first account created will be an admin user and will have all the admin rights.
Using screen in case of disconnects
```
sudo apt-get install screen
screen
sudo yunohost app install https://github.com/YunoHost-Apps/Calckey_ynh.git
```
Recover after disconnect:
```
screen -d
screen -r
```

View file

@ -1,21 +0,0 @@
### Points importants à lire avant l'installation
- *Calckey* nécessite un domaine racine dédié, par ex. `Calckey.domain.tld`
- En raison de la dépendance de Cypress, *Calckey* ne fonctionne que sur les machines à processeur 64 bits.
- *Calckey* peut prendre un certain temps à installer (plus de 30 minutes). Alors prenez un peu de temps et prenez un café.
- Si l'installation à partir de la ligne de commande, l'utilisation de l'écran est réenregistrée pour éviter la déconnexion. Voir ci-dessous.
- Après l'installation, la première page peut prendre du temps à charger et peut afficher une erreur de délai d'attente. Donnez-lui le temps de se préparer pour vous. Actualiser la page après 2-3 minutes.
- Le premier compte créé sera un utilisateur administrateur et disposera de tous les droits d'administrateur.
Utiliser *screen* en cas de déconnexion
```
sudo apt-get install screen
screen
sudo yunohost app install https://github.com/YunoHost-Apps/Calckey_ynh.git
```
Récupérer après déconnexion :
```
screen -d
screen -r
```

View file

@ -1,46 +0,0 @@
{
"name": "Calckey",
"id": "calckey",
"packaging_format": 1,
"description": {
"en": "Fork of Misskey with better UI/UX, security, features",
"fr": "Un fork de Misskey avec une meilleure interface utilisateur, la sécurité, les fonctionnalités"
},
"version": "13.1.2~ynh1",
"url": "https://i.calckey.cloud/",
"upstream": {
"license": "AGPL-3.0",
"website": "https://i.calckey.cloud/",
"demo": "https://i.calckey.cloud/",
"code": "https://codeberg.org/calckey/calckey"
},
"license": "AGPL-3.0",
"maintainer": {
"name": "oufmilo"
},
"requirements": {
"yunohost": ">= 11.0.0"
},
"multi_instance": false,
"services": [
"nginx"
],
"arguments": {
"install": [
{
"name": "domain",
"type": "domain"
},
{
"name": "is_public",
"type": "boolean",
"help": {
"en": "If enabled, Calckey will be accessible by people who do not have an account. This can be changed later via the webadmin.",
"fr": "Si cette case est cochée, Calckey sera accessible aux personnes nayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin."
},
"default": true
}
]
}
}

55
manifest.toml Normal file
View file

@ -0,0 +1,55 @@
packaging_format = 2
id = "calckey"
name = "Calckey"
description.en = "Fork of Misskey with better UI/UX, security, features"
description.fr = "Un fork de Misskey avec une meilleure interface utilisateur, la sécurité, les fonctionnalités"
version = "13.1.2~ynh1"
maintainers = ["oufmilo"]
[upstream]
license = "AGPL-3.0"
website = "https://i.calckey.cloud/"
demo = "https://i.calckey.cloud/"
code = "https://codeberg.org/calckey/calckey"
[integration]
yunohost = ">= 11.0.0"
architectures = "all"
multi_instance = false
ldap = "not_relevant"
sso = "not_relevant"
disk = "50M"
ram.build = "50M"
ram.runtime = "50M"
[install]
[install.domain]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "domain"
full_domain = true
[install.init_main_permission]
help.en = "If enabled, Calckey will be accessible by people who do not have an account. This can be changed later via the webadmin."
help.fr = "Si cette case est cochée, Calckey sera accessible aux personnes nayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin."
type = "group"
default = "visitors"
[resources]
[resources.system_user]
[resources.install_dir]
[resources.permissions]
main.url = "/"
[resources.ports]
main.default = 3020
[resources.apt]
packages = "ffmpeg, postgresql, build-essential"
[resources.database]
type = "postgresql"

View file

@ -10,26 +10,6 @@
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#================================================= #=================================================
# DECLARE DATA AND CONF FILES TO BACKUP # DECLARE DATA AND CONF FILES TO BACKUP
@ -40,7 +20,7 @@ ynh_print_info --message="Declaring files to be backed up..."
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_backup --src_path="$final_path" ynh_backup --src_path="$install_dir"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION

View file

@ -9,61 +9,15 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#================================================= #=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST # RETRIEVE ARGUMENTS FROM THE MANIFEST
#================================================= #=================================================
domain=$YNH_APP_ARG_DOMAIN
path_url="/"
is_public=$YNH_APP_ARG_IS_PUBLIC
app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=1
# Check machine architecture (in particular, we don't support ARM and 32bit machines)
if [ $YNH_ARCH != "amd64" ] && [ $YNH_ARCH != "aarch64" ] && [ $YNH_ARCH != "arm64" ]
then
ynh_die --message="Sorry, but this app can only be installed on a 64 bits machine :("
fi
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
# Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#================================================= #=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_script_progression --message="Finding an available port..." --weight=1
# Find an available port
port=$(ynh_find_port --port=3020)
ynh_app_setting_set --app=$app --key=port --value=$port
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
@ -72,39 +26,15 @@ ynh_script_progression --message="Installing dependencies... This might take som
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=2
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# CREATE A POSTGRESQL DATABASE
#=================================================
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2
db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." --weight=3 ynh_script_progression --message="Setting up source files..." --weight=3
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
ynh_setup_source --dest_dir="$final_path" ynh_setup_source --dest_dir="$install_dir"
chmod 750 "$final_path" chown -R $app:www-data "$install_dir"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
@ -123,14 +53,20 @@ ynh_script_progression --message="Adding a configuration file..." --weight=1
redis_db=$(ynh_redis_get_free_db) redis_db=$(ynh_redis_get_free_db)
ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db" ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db"
ynh_add_config --template="../conf/default.yml" --destination="$final_path/.config/default.yml" ynh_add_config --template="../conf/default.yml" --destination="$install_dir/.config/default.yml"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
chmod 400 "$install_dir/.config/default.yml"
chown $app:$app "$install_dir/.config/default.yml"
#================================================= #=================================================
# BUILD APP # BUILD APP
#================================================= #=================================================
ynh_script_progression --message="Building app... This will take some time." --weight=15 ynh_script_progression --message="Building app... This will take some time." --weight=15
pushd "$final_path" pushd "$install_dir"
ynh_use_nodejs ynh_use_nodejs
corepack enable corepack enable
corepack prepare pnpm@latest --activate corepack prepare pnpm@latest --activate
@ -171,23 +107,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
# Start a systemd service # Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="All workers started" ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="All workers started"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary
if [ $is_public -eq 1 ]
then
ynh_permission_update --permission="main" --add="visitors"
fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -9,19 +9,6 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
port=$(ynh_app_setting_get --app=$app --key=port)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
@ -52,14 +39,6 @@ ynh_script_progression --message="Removing logrotate configuration..." --weight=
# Remove the app-specific logrotate config # Remove the app-specific logrotate config
ynh_remove_logrotate ynh_remove_logrotate
#=================================================
# REMOVE THE POSTGRESQL DATABASE
#=================================================
ynh_script_progression --message="Removing the PostgreSQL database..." --weight=1
# Remove a database if it exists, along with the associated user
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
#================================================= #=================================================
# REMOVE THE REDIS DATABASE # REMOVE THE REDIS DATABASE
#================================================= #=================================================
@ -67,14 +46,6 @@ ynh_script_progression --message="Removing the redis database..." --weight=1
ynh_redis_remove_db "$redis_db" ynh_redis_remove_db "$redis_db"
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing app main directory..." --weight=1
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION
#================================================= #=================================================
@ -90,7 +61,6 @@ ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies # Remove metapackage and its dependencies
ynh_remove_nodejs ynh_remove_nodejs
ynh_remove_app_dependencies
#================================================= #=================================================
# SPECIFIC REMOVE # SPECIFIC REMOVE
@ -104,12 +74,6 @@ ynh_secure_remove --file="/var/log/$app"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
# Delete a system user
ynh_system_user_delete --username=$app
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -10,58 +10,16 @@
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
#================================================= #=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1 ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_restore_file --origin_path="$final_path" ynh_restore_file --origin_path="$install_dir"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#================================================= #=================================================
# SPECIFIC RESTORATION # SPECIFIC RESTORATION
@ -72,7 +30,6 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=5
# Define and install dependencies # Define and install dependencies
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# REINSTALL PNPM # REINSTALL PNPM
@ -80,7 +37,7 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
ynh_script_progression --message="Reinstalling pnpm..." --weight=1 ynh_script_progression --message="Reinstalling pnpm..." --weight=1
# Define and install pnpm # Define and install pnpm
pushd "$final_path" pushd "$install_dir"
ynh_use_nodejs ynh_use_nodejs
corepack enable corepack enable
corepack prepare pnpm@latest --activate corepack prepare pnpm@latest --activate
@ -100,10 +57,16 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1 ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1
ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set permissions to app files
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# RESTORE SYSTEMD # RESTORE SYSTEMD
#================================================= #=================================================

View file

@ -9,19 +9,6 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
port=$(ynh_app_setting_get --app=$app --key=port)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -52,16 +39,6 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line
#================================================= #=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
ynh_clean_check_starting
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
#================================================= #=================================================
@ -75,28 +52,12 @@ if [ -z "$db_name" ]; then
ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name
fi fi
# If final_path doesn't exist, create it # If install_dir doesn't exist, create it
if [ -z "$final_path" ]; then if [ -z "$install_dir" ]; then
final_path=/var/www/$app install_dir=/var/www/$app
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
fi fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
@ -106,12 +67,12 @@ then
ynh_script_progression --message="Upgrading source files..." ynh_script_progression --message="Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" --keep=".config/default.yml" ynh_setup_source --dest_dir="$install_dir" --keep=".config/default.yml"
fi fi
chmod 750 "$final_path" chmod 750 "$install_dir"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$final_path" chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# UPGRADE DEPENDENCIES # UPGRADE DEPENDENCIES
@ -119,11 +80,10 @@ chown -R $app:www-data "$final_path"
ynh_script_progression --message="Upgrading dependencies..." --weight=5 ynh_script_progression --message="Upgrading dependencies..." --weight=5
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
# REMOVE YARN (upgrade from 13.0.x to 13.1.x) # REMOVE YARN (upgrade from 13.0.x to 13.1.x)
ynh_script_progression --message="Removing old version dependency..." ynh_script_progression --message="Removing old version dependency..."
ynh_secure_remove --file="$final_path/.yarn" ynh_secure_remove --file="$install_dir/.yarn"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
@ -138,7 +98,7 @@ ynh_add_nginx_config
#================================================= #=================================================
ynh_script_progression --message="Building app..." ynh_script_progression --message="Building app..."
pushd "$final_path" pushd "$install_dir"
corepack enable corepack enable
corepack prepare pnpm@latest --activate corepack prepare pnpm@latest --activate
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH pnpm clean-all ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH pnpm clean-all
@ -179,12 +139,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="All workers started" ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="All workers started"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

17
tests.toml Normal file
View file

@ -0,0 +1,17 @@
test_format = 1.0
[default]
# ------------
# Tests to run
# ------------
# -------------------------------
# Default args to use for install
# -------------------------------
exclude = ["change_url"]
# -------------------------------
# Commits to test upgrade from
# -------------------------------
test_upgrade_from.89f4f52.name = "Upgrade from 13.0.5"