Merge pull request #9 from YunoHost-Apps/packagingv2

Packagingv2, copied from elasticsearch8
This commit is contained in:
Salamandar 2024-05-15 23:08:12 +02:00 committed by GitHub
commit 08af55fb11
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 116 additions and 400 deletions

View file

@ -23,14 +23,6 @@ To learn more about Elasticsearchs features and capabilities, see the [produc
**Shipped version:** 7.17.8~ynh6 **Shipped version:** 7.17.8~ynh6
**Demo:** <https://www.elastic.co/demos> **Demo:** <https://www.elastic.co/demos>
## Disclaimers / important information
### Limitations
- **Not totally free**: Licensed under SSPL, see for more information: <https://en.wikipedia.org/wiki/Server_Side_Public_License>
- Currently the security is disabled
- Therefore, the package is configured to remain not public for now (i.e. not accessible through the web, the apps depending on it should be installed on the same server)
- Not scalable for now
## :red_circle: Antifeatures ## :red_circle: Antifeatures
- **Not totally free upstream**: The packaged app is under an overall free license, but with clauses that may restrict its use. - **Not totally free upstream**: The packaged app is under an overall free license, but with clauses that may restrict its use.

View file

@ -23,14 +23,6 @@ To learn more about Elasticsearchs features and capabilities, see the [produc
**Versión actual:** 7.17.8~ynh6 **Versión actual:** 7.17.8~ynh6
**Demo:** <https://www.elastic.co/demos> **Demo:** <https://www.elastic.co/demos>
## informaciones importantes
### Limitations
- **Not totally free**: Licensed under SSPL, see for more information: <https://en.wikipedia.org/wiki/Server_Side_Public_License>
- Currently the security is disabled
- Therefore, the package is configured to remain not public for now (i.e. not accessible through the web, the apps depending on it should be installed on the same server)
- Not scalable for now
## :red_circle: funcionalidades no deseadas ## :red_circle: funcionalidades no deseadas
- **Not totally free upstream**: The packaged app is under an overall free license, but with clauses that may restrict its use. - **Not totally free upstream**: The packaged app is under an overall free license, but with clauses that may restrict its use.

View file

@ -23,14 +23,6 @@ To learn more about Elasticsearchs features and capabilities, see the [produc
**Paketatutako bertsioa:** 7.17.8~ynh6 **Paketatutako bertsioa:** 7.17.8~ynh6
**Demoa:** <https://www.elastic.co/demos> **Demoa:** <https://www.elastic.co/demos>
## Ezespena / informazio garrantzitsua
### Limitations
- **Not totally free**: Licensed under SSPL, see for more information: <https://en.wikipedia.org/wiki/Server_Side_Public_License>
- Currently the security is disabled
- Therefore, the package is configured to remain not public for now (i.e. not accessible through the web, the apps depending on it should be installed on the same server)
- Not scalable for now
## :red_circle: Ezaugarri zalantzagarriak ## :red_circle: Ezaugarri zalantzagarriak
- **Jatorrizkoa ez da erabat librea**: Aplikazioak lizentzia librea du orokorrean, baina bere erabilera mugatzen duten klausulekin. - **Jatorrizkoa ez da erabat librea**: Aplikazioak lizentzia librea du orokorrean, baina bere erabilera mugatzen duten klausulekin.

View file

@ -16,21 +16,12 @@ Il NE doit PAS être modifié à la main.
## Vue densemble ## Vue densemble
Elasticsearch is the distributed, RESTful search and analytics engine at the heart of the [Elastic Stack](https://www.elastic.co/products). You can use Elasticsearch to store, search, and manage data for logs, metrics, search backend, application monitoring, Endpoint security. Elasticsearch est le moteur de recherche et d'analyse distribué et RESTful au cœur de la [Elastic Stack](https://www.elastic.co/products). Vous pouvez utiliser Elasticsearch pour stocker, rechercher et gérer des données pour les journaux, les métriques, le backend de recherche, la surveillance des applications et la sécurité des points de terminaison.
To learn more about Elasticsearchs features and capabilities, see the [product page](https://www.elastic.co/products/elasticsearch). Pour en savoir plus sur les fonctionnalités et capacités d'Elasticsearch, consultez la [page produit](https://www.elastic.co/products/elasticsearch).
**Version incluse:** 7.17.8~ynh6 **Version incluse:** 7.17.8~ynh6
**Démo:** <https://www.elastic.co/demos> **Démo:** <https://www.elastic.co/demos>
## Avertissements / informations importantes
### Limitations
- **Not totally free**: Licensed under SSPL, see for more information: <https://en.wikipedia.org/wiki/Server_Side_Public_License>
- Currently the security is disabled
- Therefore, the package is configured to remain not public for now (i.e. not accessible through the web, the apps depending on it should be installed on the same server)
- Not scalable for now
## :red_circle: Anti-fonctionnalités ## :red_circle: Anti-fonctionnalités
- **Application sous licence libre restreinte **: L'application packagée est sous une licence globalement libre, mais avec des clauses qui pourraient restreindre son utilisation. - **Application sous licence libre restreinte **: L'application packagée est sous une licence globalement libre, mais avec des clauses qui pourraient restreindre son utilisation.

View file

@ -23,14 +23,6 @@ To learn more about Elasticsearchs features and capabilities, see the [produc
**Versión proporcionada:** 7.17.8~ynh6 **Versión proporcionada:** 7.17.8~ynh6
**Demo:** <https://www.elastic.co/demos> **Demo:** <https://www.elastic.co/demos>
## Avisos / información importante
### Limitations
- **Not totally free**: Licensed under SSPL, see for more information: <https://en.wikipedia.org/wiki/Server_Side_Public_License>
- Currently the security is disabled
- Therefore, the package is configured to remain not public for now (i.e. not accessible through the web, the apps depending on it should be installed on the same server)
- Not scalable for now
## :red_circle: Debes considerar ## :red_circle: Debes considerar
- **Not totally free upstream**: The packaged app is under an overall free license, but with clauses that may restrict its use. - **Not totally free upstream**: The packaged app is under an overall free license, but with clauses that may restrict its use.

View file

@ -3,15 +3,15 @@ N.B.: Questo README è stato automaticamente generato da <https://github.com/Yun
NON DEVE essere modificato manualmente. NON DEVE essere modificato manualmente.
--> -->
# ElasticSearch 7 per YunoHost # ElasticSearch 8 per YunoHost
[![Livello di integrazione](https://dash.yunohost.org/integration/elasticsearch7.svg)](https://dash.yunohost.org/appci/app/elasticsearch7) ![Stato di funzionamento](https://ci-apps.yunohost.org/ci/badges/elasticsearch7.status.svg) ![Stato di manutenzione](https://ci-apps.yunohost.org/ci/badges/elasticsearch7.maintain.svg) [![Livello di integrazione](https://dash.yunohost.org/integration/elasticsearch8.svg)](https://dash.yunohost.org/appci/app/elasticsearch8) ![Stato di funzionamento](https://ci-apps.yunohost.org/ci/badges/elasticsearch8.status.svg) ![Stato di manutenzione](https://ci-apps.yunohost.org/ci/badges/elasticsearch8.maintain.svg)
[![Installa ElasticSearch 7 con YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=elasticsearch7) [![Installa ElasticSearch 8 con YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=elasticsearch8)
*[Leggi questo README in altre lingue.](./ALL_README.md)* *[Leggi questo README in altre lingue.](./ALL_README.md)*
> *Questo pacchetto ti permette di installare ElasticSearch 7 su un server YunoHost in modo semplice e veloce.* > *Questo pacchetto ti permette di installare ElasticSearch 8 su un server YunoHost in modo semplice e veloce.*
> *Se non hai YunoHost, consulta [la guida](https://yunohost.org/install) per imparare a installarlo.* > *Se non hai YunoHost, consulta [la guida](https://yunohost.org/install) per imparare a installarlo.*
## Panoramica ## Panoramica
@ -20,17 +20,9 @@ Elasticsearch is the distributed, RESTful search and analytics engine at the hea
To learn more about Elasticsearchs features and capabilities, see the [product page](https://www.elastic.co/products/elasticsearch). To learn more about Elasticsearchs features and capabilities, see the [product page](https://www.elastic.co/products/elasticsearch).
**Versione pubblicata:** 7.17.8~ynh6 **Versione pubblicata:** 8.11.1~ynh3
**Prova:** <https://www.elastic.co/demos> **Prova:** <https://www.elastic.co/demos>
## Attenzione/informazioni importanti
### Limitations
- **Not totally free**: Licensed under SSPL, see for more information: <https://en.wikipedia.org/wiki/Server_Side_Public_License>
- Currently the security is disabled
- Therefore, the package is configured to remain not public for now (i.e. not accessible through the web, the apps depending on it should be installed on the same server)
- Not scalable for now
## :red_circle: Anti-funzionalità ## :red_circle: Anti-funzionalità
- **Applicazione con licenza parzialmente libera**: Questapplicazione è protetta da licenza generalmente libera, ma con delle clausole che potrebbero limitare il suo utilizzo. - **Applicazione con licenza parzialmente libera**: Questapplicazione è protetta da licenza generalmente libera, ma con delle clausole che potrebbero limitare il suo utilizzo.
@ -38,21 +30,21 @@ To learn more about Elasticsearchs features and capabilities, see the [produc
## Documentazione e risorse ## Documentazione e risorse
- Sito web ufficiale dellapp: <https://elastic.co> - Sito web ufficiale dellapp: <https://elastic.co>
- Documentazione ufficiale per gli amministratori: <https://www.elastic.co/guide/en/elasticsearch/reference/7.17/elasticsearch-intro.html> - Documentazione ufficiale per gli amministratori: <https://www.elastic.co/guide/en/elasticsearch/reference/8.11/elasticsearch-intro.html>
- Repository upstream del codice dellapp: <https://github.com/elastic/elasticsearch> - Repository upstream del codice dellapp: <https://github.com/elastic/elasticsearch>
- Store di YunoHost: <https://apps.yunohost.org/app/elasticsearch7> - Store di YunoHost: <https://apps.yunohost.org/app/elasticsearch8>
- Segnala un problema: <https://github.com/YunoHost-Apps/elasticsearch7_ynh/issues> - Segnala un problema: <https://github.com/YunoHost-Apps/elasticsearch8_ynh/issues>
## Informazioni per sviluppatori ## Informazioni per sviluppatori
Si prega di inviare la tua pull request alla [branch di `testing`](https://github.com/YunoHost-Apps/elasticsearch7_ynh/tree/testing). Si prega di inviare la tua pull request alla [branch di `testing`](https://github.com/YunoHost-Apps/elasticsearch8_ynh/tree/testing).
Per provare la branch di `testing`, si prega di procedere in questo modo: Per provare la branch di `testing`, si prega di procedere in questo modo:
```bash ```bash
sudo yunohost app install https://github.com/YunoHost-Apps/elasticsearch7_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/elasticsearch8_ynh/tree/testing --debug
o o
sudo yunohost app upgrade elasticsearch7 -u https://github.com/YunoHost-Apps/elasticsearch7_ynh/tree/testing --debug sudo yunohost app upgrade elasticsearch8 -u https://github.com/YunoHost-Apps/elasticsearch8_ynh/tree/testing --debug
``` ```
**Maggiori informazioni riguardo il pacchetto di questapp:** <https://yunohost.org/packaging_apps> **Maggiori informazioni riguardo il pacchetto di questapp:** <https://yunohost.org/packaging_apps>

View file

@ -23,14 +23,6 @@ To learn more about Elasticsearchs features and capabilities, see the [produc
**分发版本:** 7.17.8~ynh6 **分发版本:** 7.17.8~ynh6
**演示:** <https://www.elastic.co/demos> **演示:** <https://www.elastic.co/demos>
## 免责声明 / 重要信息
### Limitations
- **Not totally free**: Licensed under SSPL, see for more information: <https://en.wikipedia.org/wiki/Server_Side_Public_License>
- Currently the security is disabled
- Therefore, the package is configured to remain not public for now (i.e. not accessible through the web, the apps depending on it should be installed on the same server)
- Not scalable for now
## :red_circle: 负面特征 ## :red_circle: 负面特征
- **Not totally free upstream**: The packaged app is under an overall free license, but with clauses that may restrict its use. - **Not totally free upstream**: The packaged app is under an overall free license, but with clauses that may restrict its use.

View file

@ -1,22 +0,0 @@
# See here for more information
# https://github.com/YunoHost/package_check#syntax-check_process-file
# Move this file from check_process.default to check_process when you have filled it.
;; Test complet
; Manifest
; Checks
pkg_linter=1
setup_sub_dir=0
setup_root=0
setup_nourl=1
setup_private=0
setup_public=0
upgrade=1
backup_restore=1
multi_instance=1
port_already_use=1
change_url=0
;;; Options
Email=
Notification=none

View file

@ -1,6 +0,0 @@
SOURCE_URL=https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.17.8-linux-x86_64.tar.gz
SOURCE_SUM=1c40ba4e0912da1432cb85c0d246f68e14a7da249feea91752c8eaeb28adf0ac
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -1,6 +0,0 @@
SOURCE_URL=https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.17.8-linux-aarch64.tar.gz
SOURCE_SUM=47d6532a16e02b92208a0d71289a6fb021542c925ed868e49237032bc3ab5c6a
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -11,7 +11,7 @@ http.port: __PORT__
# #
# Path to directory where to store the data (separate multiple locations by comma): # Path to directory where to store the data (separate multiple locations by comma):
# #
path.data: __DATADIR__ path.data: __DATA_DIR__
# #
# Unless you have already configured a cluster, you should set # Unless you have already configured a cluster, you should set

View file

@ -1,5 +1,5 @@
[Unit] [Unit]
Description=ElasticSearch - Distributed and RESTful search engine Description=ElasticSearch: Distributed and RESTful search engine
Documentation=https://elastic.co Documentation=https://elastic.co
After=network.target After=network.target
@ -8,12 +8,12 @@ Type=simple
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
RuntimeDirectory=__APP__ RuntimeDirectory=__APP__
Environment="ES_JAVA_HOME=__FINALPATH__/jdk" Environment="ES_JAVA_HOME=__INSTALL_DIR__/jdk"
Environment="ES_PATH_CONF=__FINALPATH__/config" Environment="ES_PATH_CONF=__INSTALL_DIR__/config"
Environment="PID_DIR=/run/__APP__" Environment="PID_DIR=/run/__APP__"
Environment="ES_SD_NOTIFY=true" Environment="ES_SD_NOTIFY=true"
WorkingDirectory=__FINALPATH__/ WorkingDirectory=__INSTALL_DIR__/
ExecStart=__FINALPATH__/bin/elasticsearch -p ${PID_DIR}/__APP__.pid --quiet ExecStart=__INSTALL_DIR__/bin/elasticsearch -p ${PID_DIR}/__APP__.pid --quiet
StandardOutput=append:/var/log/__APP__/__APP__.log StandardOutput=append:/var/log/__APP__/__APP__.log
StandardError=inherit StandardError=inherit

2
doc/DESCRIPTION_fr.md Normal file
View file

@ -0,0 +1,2 @@
Elasticsearch est le moteur de recherche et d'analyse distribué et RESTful au cœur de la [Elastic Stack](https://www.elastic.co/products). Vous pouvez utiliser Elasticsearch pour stocker, rechercher et gérer des données pour les journaux, les métriques, le backend de recherche, la surveillance des applications et la sécurité des points de terminaison.
Pour en savoir plus sur les fonctionnalités et capacités d'Elasticsearch, consultez la [page produit](https://www.elastic.co/products/elasticsearch).

57
manifest.toml Normal file
View file

@ -0,0 +1,57 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
packaging_format = 2
id = "elasticsearch7"
name = "ElasticSearch 7"
description.en = "Distributed and RESTful search engine"
description.fr = "Moteur de recherche RESTful"
version = "7.17.8~ynh7"
maintainers = ["fflorent"]
[upstream]
license = "SSPL-1.0"
website = "https://elastic.co"
demo = "https://www.elastic.co/demos"
admindoc = "https://www.elastic.co/guide/en/elasticsearch/reference/7.17/elasticsearch-intro.html"
code = "https://github.com/elastic/elasticsearch"
[integration]
yunohost = ">= 11.2"
architectures = ["amd64", "arm64"]
multi_instance = true
ldap = "not_relevant"
sso = "not_relevant"
disk = "50M"
ram.build = "50M"
ram.runtime = "50M"
[install]
[resources]
[resources.sources.main]
arm64.url = "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.17.8-linux-aarch64.tar.gz"
arm64.sha256 = "47d6532a16e02b92208a0d71289a6fb021542c925ed868e49237032bc3ab5c6a"
amd64.url = "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.17.8-linux-x86_64.tar.gz"
amd64.sha256 = "1c40ba4e0912da1432cb85c0d246f68e14a7da249feea91752c8eaeb28adf0ac"
# This is only for notification purposes! Generated PRs will be invalid.
autoupdate.strategy = "latest_github_release"
autoupdate.asset.amd64 = "tarball"
autoupdate.asset.arm64 = "tarball"
[resources.system_user]
[resources.install_dir]
[resources.data_dir]
[resources.permissions]
[resources.ports]
main.default = 9200

View file

@ -10,27 +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 () {
### Remove this function if there's nothing to clean before calling the remove script.
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)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#================================================= #=================================================
# DECLARE DATA AND CONF FILES TO BACKUP # DECLARE DATA AND CONF FILES TO BACKUP
#================================================= #=================================================
@ -40,13 +19,13 @@ 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 DATA DIR # BACKUP THE DATA DIR
#================================================= #=================================================
ynh_backup --src_path="$datadir" --is_big ynh_backup --src_path="$data_dir" --is_big
#================================================= #=================================================
# SPECIFIC BACKUP # SPECIFIC BACKUP

View file

@ -9,95 +9,37 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=1
final_path=/opt/yunohost/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
#=================================================
# 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=9200)
ynh_app_setting_set --app=$app --key=port --value=$port
#================================================= #=================================================
# DEFAULT VALUES FOR CONFIGURATION # DEFAULT VALUES FOR CONFIGURATION
#================================================= #=================================================
xms=256m xms=256m
ynh_app_setting_set --app=$app --key=xms --value=$xms
xmx=1g xmx=1g
ynh_app_setting_set --app=$app --key=xms --value=$xms
ynh_app_setting_set --app=$app --key=xmx --value=$xmx ynh_app_setting_set --app=$app --key=xmx --value=$xmx
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." --weight=15 ynh_script_progression --message="Setting up source files..." --weight=15
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" --source_id="$YNH_ARCH" ynh_setup_source --dest_dir="$install_dir"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:$app "$final_path"
#=================================================
# CREATE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Creating a data directory..." --weight=1
datadir=/home/yunohost.app/$app
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
mkdir -p $datadir
chmod 750 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir"
chmod -R o-rwx "$install_dir"
chown -R $app:$app "$install_dir"
#================================================= #=================================================
# ADD CONFIGURATIONS # ADD CONFIGURATIONS
#================================================= #=================================================
ynh_script_progression --message="Adding the configuration files..." --weight=1 ynh_script_progression --message="Adding the configuration files..." --weight=1
ynh_add_config --template="elasticsearch.yml" --destination="$final_path/config/elasticsearch.yml" ynh_add_config --template="elasticsearch.yml" --destination="$install_dir/config/elasticsearch.yml"
ynh_add_config --template="jvm.options" --destination="$final_path/config/jvm.options.d/yunohost.options" ynh_add_config --template="jvm.options" --destination="$install_dir/config/jvm.options.d/yunohost.options"
chmod 400 "$final_path/config/elasticsearch.yml" "$final_path/config/jvm.options.d/yunohost.options"
chown $app:$app "$final_path/config/elasticsearch.yml" "$final_path/config/jvm.options.d/yunohost.options"
chmod 400 "$install_dir/config/elasticsearch.yml" "$install_dir/config/jvm.options.d/yunohost.options"
chown $app:$app "$install_dir/config/elasticsearch.yml" "$install_dir/config/jvm.options.d/yunohost.options"
#================================================= #=================================================
# INCREASE MAX_MAP_COUNT # INCREASE MAX_MAP_COUNT
@ -112,7 +54,6 @@ then
sysctl -p /etc/sysctl.d/90-max_map_count-elasticsearch.conf sysctl -p /etc/sysctl.d/90-max_map_count-elasticsearch.conf
fi fi
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================
@ -121,23 +62,10 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=1
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config ynh_add_systemd_config
#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=1
# Use logrotate to manage application logfile(s) # Use logrotate to manage application logfile(s)
ynh_use_logrotate ynh_use_logrotate
#================================================= yunohost service add $app --description="Distributed and RESTful search engine" --log="/var/log/$app/$app.log"
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="ElasticSearch - Distributed and RESTful search engine" --log="/var/log/$app/$app.log"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE

View file

@ -9,17 +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
port=$(ynh_app_setting_get --app=$app --key=port)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
#================================================= #=================================================
@ -33,68 +22,12 @@ then
yunohost service remove $app yunohost service remove $app
fi fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
# Remove the dedicated systemd config # Remove the dedicated systemd config
ynh_remove_systemd_config ynh_remove_systemd_config
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
# Remove the app-specific logrotate config # Remove the app-specific logrotate config
ynh_remove_logrotate ynh_remove_logrotate
#=================================================
# 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 DATA DIR
#=================================================
# Remove the data directory if --purge option is used
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
then
ynh_script_progression --message="Removing app data directory..." --weight=1
ynh_secure_remove --file="$datadir"
fi
#=================================================
# CLOSE A PORT
#=================================================
if yunohost firewall list | grep -q "\- $port$"
then
ynh_script_progression --message="Closing port $port..." --weight=1
ynh_exec_warn_less yunohost firewall disallow TCP $port
fi
#=================================================
# 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
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..."
if [ -e "/etc/sysctl.d/90-max_map_count-elasticsearch.conf" ]; then if [ -e "/etc/sysctl.d/90-max_map_count-elasticsearch.conf" ]; then
ynh_secure_remove --file="/etc/sysctl.d/90-max_map_count-elasticsearch.conf" ynh_secure_remove --file="/etc/sysctl.d/90-max_map_count-elasticsearch.conf"
# Reload the kernel configuration. # Reload the kernel configuration.

View file

@ -10,76 +10,31 @@
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 () {
#### Remove this function if there's nothing to clean before calling the remove script.
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
port=$(ynh_find_port --port=9200)
#=================================================
# 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
#=================================================
# 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 "$install_dir"
chmod -R o-rwx "$final_path" chown -R $app:www-data "$install_dir"
chown -R $app:www-data "$final_path"
#================================================= #=================================================
# RESTORE THE DATA DIRECTORY # RESTORE THE DATA DIRECTORY
#================================================= #=================================================
ynh_script_progression --message="Restoring the data directory..." --weight=1 ynh_script_progression --message="Restoring the data directory..." --weight=1
ynh_restore_file --origin_path="$datadir" --not_mandatory ynh_restore_file --origin_path="$data_dir" --not_mandatory
mkdir -p $datadir chown -R $app:www-data "$data_dir"
chmod 750 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir"
#================================================= #=================================================
# SPECIFIC RESTORATION # SPECIFIC RESTORATION
#================================================= #=================================================
# RESTORE VARIOUS FILES # RESTORE VARIOUS FILES
#================================================= #=================================================
ynh_script_progression --message="Restoring various files..." ynh_script_progression --message="Restoring various files..." --weight=1
ynh_restore_file --origin_path="/etc/sysctl.d/90-max_map_count-elasticsearch.conf" ynh_restore_file --origin_path="/etc/sysctl.d/90-max_map_count-elasticsearch.conf"
if ! [ "${container:-}" = "lxc" ] # lxc doesn't allow sysctl to play with kernel options. if ! [ "${container:-}" = "lxc" ] # lxc doesn't allow sysctl to play with kernel options.
@ -95,19 +50,9 @@ ynh_script_progression --message="Restoring the systemd configuration..." --weig
ynh_restore_file --origin_path="/etc/systemd/system/$app.service" ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet systemctl enable $app.service --quiet
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
ynh_restore_file --origin_path="/etc/logrotate.d/$app" ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#================================================= yunohost service add $app --description="Distributed and RESTful search engine" --log="/var/log/$app/$app.log"
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="ElasticSearch - Distributed and RESTful search engine" --log="/var/log/$app/$app.log"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE

View file

@ -9,39 +9,12 @@
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
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
port=$(ynh_app_setting_get --app=$app --key=port)
xms=$(ynh_app_setting_get --app=$app --key=xms)
xmx=$(ynh_app_setting_get --app=$app --key=xmx)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
#================================================= #=================================================
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
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 () {
# 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
#================================================= #=================================================
@ -56,14 +29,6 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
#================================================= #=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
#=================================================
# 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
#================================================= #=================================================
@ -73,23 +38,24 @@ then
ynh_script_progression --message="Upgrading source files..." --weight=20 ynh_script_progression --message="Upgrading source files..." --weight=20
# 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" --source_id="$YNH_ARCH" --keep="config/elasticsearch.yml config/jvm.options.d/yunohost.conf" # The keep option prevents this warning:
# "File .... has been manually modified since the installation or last upgrade."
ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep="config/elasticsearch.yml"
fi fi
chmod 750 "$final_path" chmod -R o-rwx "$install_dir"
chmod -R o-rwx "$final_path" chown -R $app:$app "$install_dir"
chown -R $app:$app "$final_path"
#================================================= #=================================================
# UPDATE A CONFIG FILE # UPDATE A CONFIG FILE
#================================================= #=================================================
ynh_script_progression --message="Updating a configuration file..." --weight=1 ynh_script_progression --message="Updating a configuration file..." --weight=1
ynh_add_config --template="elasticsearch.yml" --destination="$final_path/config/elasticsearch.yml" ynh_add_config --template="elasticsearch.yml" --destination="$install_dir/config/elasticsearch.yml"
ynh_add_config --template="jvm.options" --destination="$final_path/config/jvm.options.d/yunohost.options" ynh_add_config --template="jvm.options" --destination="$install_dir/config/jvm.options.d/yunohost.options"
chmod 400 "$final_path/config/elasticsearch.yml" "$final_path/config/jvm.options.d/yunohost.options" chmod 400 "$install_dir/config/elasticsearch.yml" "$install_dir/config/jvm.options.d/yunohost.options"
chown $app:$app "$final_path/config/elasticsearch.yml" "$final_path/config/jvm.options.d/yunohost.options" chown $app:$app "$install_dir/config/elasticsearch.yml" "$install_dir/config/jvm.options.d/yunohost.options"
#================================================= #=================================================
# INCREASE MAX_MAP_COUNT # INCREASE MAX_MAP_COUNT
@ -112,22 +78,10 @@ ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config ynh_add_systemd_config
#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
# Use logrotate to manage app-specific logfile(s) # Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append ynh_use_logrotate --non-append
#================================================= yunohost service add $app --description="Distributed and RESTful search engine" --log="/var/log/$app/$app.log"
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="ElasticSearch - Distributed and RESTful search engine" --log="/var/log/$app/$app.log"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE

9
tests.toml Normal file
View file

@ -0,0 +1,9 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json
test_format = 1.0
[default]
# ------------
# Tests to run
# ------------