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

Merge pull request #36 from YunoHost-Apps/testing

Testing
This commit is contained in:
Thomas 2024-06-01 22:23:04 +02:00 committed by GitHub
commit 21cf6982d1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 276 additions and 230 deletions

View file

@ -1,6 +1,7 @@
# All available README files by language # All available README files by language
- [Read the README in English](README.md) - [Read the README in English](README.md)
- [Lea el README en español](README_es.md)
- [Irakurri README euskaraz](README_eu.md) - [Irakurri README euskaraz](README_eu.md)
- [Lire le README en français](README_fr.md) - [Lire le README en français](README_fr.md)
- [Le o README en galego](README_gl.md) - [Le o README en galego](README_gl.md)

View file

@ -19,7 +19,7 @@ It shall NOT be edited by hand.
Overleaf is an open-source online real-time collaborative LaTeX editor. Overleaf is an open-source online real-time collaborative LaTeX editor.
**Shipped version:** 2024.04.09~ynh1 **Shipped version:** 2024.05.31~ynh1
## Screenshots ## Screenshots

48
README_es.md Normal file
View file

@ -0,0 +1,48 @@
<!--
Este archivo README esta generado automaticamente<https://github.com/YunoHost/apps/tree/master/tools/readme_generator>
No se debe editar a mano.
-->
# Overleaf para Yunohost
[![Nivel de integración](https://dash.yunohost.org/integration/overleaf.svg)](https://dash.yunohost.org/appci/app/overleaf) ![Estado funcional](https://ci-apps.yunohost.org/ci/badges/overleaf.status.svg) ![Estado En Mantención](https://ci-apps.yunohost.org/ci/badges/overleaf.maintain.svg)
[![Instalar Overleaf con Yunhost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=overleaf)
*[Leer este README en otros idiomas.](./ALL_README.md)*
> *Este paquete le permite instalarOverleaf rapidamente y simplement en un servidor YunoHost.*
> *Si no tiene YunoHost, visita [the guide](https://yunohost.org/install) para aprender como instalarla.*
## Descripción general
Overleaf is an open-source online real-time collaborative LaTeX editor.
**Versión actual:** 2024.05.31~ynh1
## Capturas
![Captura de Overleaf](./doc/screenshots/screenshot.png)
## Documentaciones y recursos
- Sitio web oficial: <https://www.overleaf.com>
- Documentación usuario oficial: <https://www.overleaf.com/learn>
- Repositorio del código fuente oficial de la aplicación : <https://github.com/overleaf/overleaf>
- Catálogo YunoHost: <https://apps.yunohost.org/app/overleaf>
- Reportar un error: <https://github.com/YunoHost-Apps/overleaf_ynh/issues>
## Información para desarrolladores
Por favor enviar sus correcciones a la [`branch testing`](https://github.com/YunoHost-Apps/overleaf_ynh/tree/testing
Para probar la rama `testing`, sigue asÍ:
```bash
sudo yunohost app install https://github.com/YunoHost-Apps/overleaf_ynh/tree/testing --debug
o
sudo yunohost app upgrade overleaf -u https://github.com/YunoHost-Apps/overleaf_ynh/tree/testing --debug
```
**Mas informaciones sobre el empaquetado de aplicaciones:** <https://yunohost.org/packaging_apps>

View file

@ -19,7 +19,7 @@ EZ editatu eskuz.
Overleaf is an open-source online real-time collaborative LaTeX editor. Overleaf is an open-source online real-time collaborative LaTeX editor.
**Paketatutako bertsioa:** 2024.04.09~ynh1 **Paketatutako bertsioa:** 2024.05.31~ynh1
## Pantaila-argazkiak ## Pantaila-argazkiak

View file

@ -19,7 +19,7 @@ Il NE doit PAS être modifié à la main.
Overleaf est un éditeur LaTeX collaboratif en ligne et en temps réel open source. Overleaf est un éditeur LaTeX collaboratif en ligne et en temps réel open source.
**Version incluse:** 2024.04.09~ynh1 **Version incluse:** 2024.05.31~ynh1
## Captures décran ## Captures décran

View file

@ -19,7 +19,7 @@ NON debe editarse manualmente.
Overleaf is an open-source online real-time collaborative LaTeX editor. Overleaf is an open-source online real-time collaborative LaTeX editor.
**Versión proporcionada:** 2024.04.09~ynh1 **Versión proporcionada:** 2024.05.31~ynh1
## Capturas de pantalla ## Capturas de pantalla

View file

@ -3,7 +3,7 @@
请勿手动编辑。 请勿手动编辑。
--> -->
# YunoHost 的 Overleaf # YunoHost 的 Overleaf
[![集成程度](https://dash.yunohost.org/integration/overleaf.svg)](https://dash.yunohost.org/appci/app/overleaf) ![工作状态](https://ci-apps.yunohost.org/ci/badges/overleaf.status.svg) ![维护状态](https://ci-apps.yunohost.org/ci/badges/overleaf.maintain.svg) [![集成程度](https://dash.yunohost.org/integration/overleaf.svg)](https://dash.yunohost.org/appci/app/overleaf) ![工作状态](https://ci-apps.yunohost.org/ci/badges/overleaf.status.svg) ![维护状态](https://ci-apps.yunohost.org/ci/badges/overleaf.maintain.svg)
@ -19,7 +19,7 @@
Overleaf is an open-source online real-time collaborative LaTeX editor. Overleaf is an open-source online real-time collaborative LaTeX editor.
**分发版本:** 2024.04.09~ynh1 **分发版本:** 2024.05.31~ynh1
## 截图 ## 截图

View file

@ -7,7 +7,7 @@ name = "Overleaf"
description.en = "Online real-time collaborative LaTeX editor" description.en = "Online real-time collaborative LaTeX editor"
description.fr = "Éditeur LaTeX collaboratif en ligne et en temps réel" description.fr = "Éditeur LaTeX collaboratif en ligne et en temps réel"
version = "2024.04.09~ynh1" version = "2024.05.31~ynh1"
maintainers = [] maintainers = []
@ -51,8 +51,8 @@ ram.runtime = "3G"
[resources] [resources]
[resources.sources] [resources.sources]
[resources.sources.main] [resources.sources.main]
url = "https://github.com/overleaf/overleaf/archive/568044ee48a20bdb930f9f140f17227d19cb1219.tar.gz" url = "https://github.com/overleaf/overleaf/archive/f89ee54fdc96c9cef942d8963ed0949bce77a5d3.tar.gz"
sha256 = "61e2602c76f8c8a635656d99db6725c802261e383411d71095cf9710149567f6" sha256 = "8b98259048bd10790adff8e364f9916c84c45209db8ec0f745481a0cd2d7b367"
autoupdate.strategy = "latest_github_commit" autoupdate.strategy = "latest_github_commit"
[resources.system_user] [resources.system_user]

View file

@ -1,21 +1,18 @@
#!/bin/bash
#=================================================
# COMMON VARIABLES # COMMON VARIABLES
#================================================= #=================================================
nodejs_version=18.20.2 nodejs_version="18.20.2"
YNH_DEFAULT_MONGO_VERSION=6.0
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS
#================================================= #=================================================
#================================================= #=================================================
# EXPERIMENTAL HELPERS # FUTURE OFFICIAL HELPERS
#================================================= #=================================================
readonly YNH_DEFAULT_MONGO_VERSION=5.0 # Declare the actual MongoDB version to use: 4.4; 5.0; 6.0
# Declare the actual MongoDB version to use: 4.4 ; 5.0 ; 6.0
# A packager willing to use another version of MongoDB can override the variable into its _common.sh. # A packager willing to use another version of MongoDB can override the variable into its _common.sh.
YNH_MONGO_VERSION=${YNH_MONGO_VERSION:-$YNH_DEFAULT_MONGO_VERSION} YNH_MONGO_VERSION=${YNH_MONGO_VERSION:-$YNH_DEFAULT_MONGO_VERSION}
@ -25,100 +22,100 @@ YNH_MONGO_VERSION=${YNH_MONGO_VERSION:-$YNH_DEFAULT_MONGO_VERSION}
# example: ynh_mongo_exec --command="db.getMongo().getDBNames().indexOf(\"wekan\")" # example: ynh_mongo_exec --command="db.getMongo().getDBNames().indexOf(\"wekan\")"
# #
# usage: ynh_mongo_exec [--user=user] [--password=password] [--authenticationdatabase=authenticationdatabase] [--database=database] [--host=host] [--port=port] --command="command" [--eval] # usage: ynh_mongo_exec [--user=user] [--password=password] [--authenticationdatabase=authenticationdatabase] [--database=database] [--host=host] [--port=port] --command="command" [--eval]
# | arg: -u, --user= - The user name to connect as # | arg: -u, --user= - The user name to connect as
# | arg: -p, --password= - The user password # | arg: -p, --password= - The user password
# | arg: -d, --authenticationdatabase= - The authenticationdatabase to connect to # | arg: -d, --authenticationdatabase= - The authenticationdatabase to connect to
# | arg: -d, --database= - The database to connect to # | arg: -d, --database= - The database to connect to
# | arg: -h, --host= - The host to connect to # | arg: -h, --host= - The host to connect to
# | arg: -P, --port= - The port to connect to # | arg: -P, --port= - The port to connect to
# | arg: -c, --command= - The command to evaluate # | arg: -c, --command= - The command to evaluate
# | arg: -e, --eval - Evaluate instead of execute the command. # | arg: -e, --eval - Evaluate instead of execute the command.
# #
# #
ynh_mongo_exec() { ynh_mongo_exec() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=upadhPce local legacy_args=upadhPce
local -A args_array=( [u]=user= [p]=password= [a]=authenticationdatabase= [d]=database= [h]=host= [P]=port= [c]=command= [e]=eval ) local -A args_array=( [u]=user= [p]=password= [a]=authenticationdatabase= [d]=database= [h]=host= [P]=port= [c]=command= [e]=eval )
local user local user
local password local password
local authenticationdatabase local authenticationdatabase
local database local database
local host local host
local port local port
local command local command
local eval local eval
# Manage arguments with getopts # Manage arguments with getopts
ynh_handle_getopts_args "$@" ynh_handle_getopts_args "$@"
user="${user:-}" user="${user:-}"
password="${password:-}" password="${password:-}"
authenticationdatabase="${authenticationdatabase:-}" authenticationdatabase="${authenticationdatabase:-}"
database="${database:-}" database="${database:-}"
host="${host:-}" host="${host:-}"
port="${port:-}" port="${port:-}"
eval=${eval:-0} eval=${eval:-0}
# If user is provided # If user is provided
if [ -n "$user" ] if [ -n "$user" ]
then then
user="--username=$user" user="--username=$user"
# If password is provided # If password is provided
if [ -n "$password" ] if [ -n "$password" ]
then then
password="--password=$password" password="--password=$password"
fi fi
# If authenticationdatabase is provided # If authenticationdatabase is provided
if [ -n "$authenticationdatabase" ] if [ -n "$authenticationdatabase" ]
then then
authenticationdatabase="--authenticationDatabase=$authenticationdatabase" authenticationdatabase="--authenticationDatabase=$authenticationdatabase"
else else
authenticationdatabase="--authenticationDatabase=admin" authenticationdatabase="--authenticationDatabase=admin"
fi fi
else else
password="" password=""
authenticationdatabase="" authenticationdatabase=""
fi fi
# If host is provided # If host is provided
if [ -n "$host" ] if [ -n "$host" ]
then then
host="--host=$host" host="--host=$host"
fi fi
# If port is provided # If port is provided
if [ -n "$port" ] if [ -n "$port" ]
then then
port="--port=$port" port="--port=$port"
fi fi
# If eval is not provided # If eval is not provided
if [ $eval -eq 0 ] if [ $eval -eq 0 ]
then then
# If database is provided # If database is provided
if [ -n "$database" ] if [ -n "$database" ]
then then
database="use $database" database="use $database"
else else
database="" database=""
fi fi
mongo --quiet $user $password $authenticationdatabase $host $port <<EOF mongosh --quiet --username $user --password $password --authenticationDatabase $authenticationdatabase --host $host --port $port <<EOF
$database $database
${command} ${command}
quit() quit()
EOF EOF
else else
# If database is provided # If database is provided
if [ -n "$database" ] if [ -n "$database" ]
then then
database="$database" database="$database"
else else
database="" database=""
fi fi
mongo --quiet $database $user $password $authenticationdatabase $host $port --eval="$command" mongosh --quiet $database --username $user --password $password --authenticationDatabase $authenticationdatabase --host $host --port $port --eval="$command"
fi fi
} }
# Drop a database # Drop a database
@ -129,18 +126,18 @@ EOF
# consider using ynh_mongo_remove_db instead. # consider using ynh_mongo_remove_db instead.
# #
# usage: ynh_mongo_drop_db --database=database # usage: ynh_mongo_drop_db --database=database
# | arg: -d, --database= - The database name to drop # | arg: -d, --database= - The database name to drop
# #
# #
ynh_mongo_drop_db() { ynh_mongo_drop_db() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=d local legacy_args=d
local -A args_array=( [d]=database= ) local -A args_array=( [d]=database= )
local database local database
# Manage arguments with getopts # Manage arguments with getopts
ynh_handle_getopts_args "$@" ynh_handle_getopts_args "$@"
ynh_mongo_exec --database="$database" --command='db.runCommand({dropDatabase: 1})' ynh_mongo_exec --database="$database" --command='db.runCommand({dropDatabase: 1})'
} }
# Dump a database # Dump a database
@ -148,19 +145,19 @@ ynh_mongo_drop_db() {
# example: ynh_mongo_dump_db --database=wekan > ./dump.bson # example: ynh_mongo_dump_db --database=wekan > ./dump.bson
# #
# usage: ynh_mongo_dump_db --database=database # usage: ynh_mongo_dump_db --database=database
# | arg: -d, --database= - The database name to dump # | arg: -d, --database= - The database name to dump
# | ret: the mongodump output # | ret: the mongodump output
# #
# #
ynh_mongo_dump_db() { ynh_mongo_dump_db() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=d local legacy_args=d
local -A args_array=( [d]=database= ) local -A args_array=( [d]=database= )
local database local database
# Manage arguments with getopts # Manage arguments with getopts
ynh_handle_getopts_args "$@" ynh_handle_getopts_args "$@"
mongodump --quiet --db="$database" --archive mongodump --quiet --db="$database" --archive
} }
# Create a user # Create a user
@ -168,49 +165,49 @@ ynh_mongo_dump_db() {
# [internal] # [internal]
# #
# usage: ynh_mongo_create_user --db_user=user --db_pwd=pwd --db_name=name # usage: ynh_mongo_create_user --db_user=user --db_pwd=pwd --db_name=name
# | arg: -u, --db_user= - The user name to create # | arg: -u, --db_user= - The user name to create
# | arg: -p, --db_pwd= - The password to identify user by # | arg: -p, --db_pwd= - The password to identify user by
# | arg: -n, --db_name= - Name of the database to grant privilegies # | arg: -n, --db_name= - Name of the database to grant privilegies
# #
# #
ynh_mongo_create_user() { ynh_mongo_create_user() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=unp local legacy_args=unp
local -A args_array=( [u]=db_user= [n]=db_name= [p]=db_pwd= ) local -A args_array=( [u]=db_user= [n]=db_name= [p]=db_pwd= )
local db_user local db_user
local db_name local db_name
local db_pwd local db_pwd
# Manage arguments with getopts # Manage arguments with getopts
ynh_handle_getopts_args "$@" ynh_handle_getopts_args "$@"
# Create the user and set the user as admin of the db # Create the user and set the user as admin of the db
ynh_mongo_exec --database="$db_name" --command='db.createUser( { user: "'${db_user}'", pwd: "'${db_pwd}'", roles: [ { role: "readWrite", db: "'${db_name}'" } ] } );' ynh_mongo_exec --database="$db_name" --command='db.createUser( { user: "'${db_user}'", pwd: "'${db_pwd}'", roles: [ { role: "readWrite", db: "'${db_name}'" } ] } );'
# Add clustermonitoring rights # Add clustermonitoring rights
ynh_mongo_exec --database="$db_name" --command='db.grantRolesToUser("'${db_user}'",[{ role: "clusterMonitor", db: "admin" }]);' ynh_mongo_exec --database="$db_name" --command='db.grantRolesToUser("'${db_user}'",[{ role: "clusterMonitor", db: "admin" }]);'
} }
# Check if a mongo database exists # Check if a mongo database exists
# #
# usage: ynh_mongo_database_exists --database=database # usage: ynh_mongo_database_exists --database=database
# | arg: -d, --database= - The database for which to check existence # | arg: -d, --database= - The database for which to check existence
# | exit: Return 1 if the database doesn't exist, 0 otherwise # | exit: Return 1 if the database doesn't exist, 0 otherwise
# #
# #
ynh_mongo_database_exists() { ynh_mongo_database_exists() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=d local legacy_args=d
local -A args_array=([d]=database=) local -A args_array=([d]=database=)
local database local database
# Manage arguments with getopts # Manage arguments with getopts
ynh_handle_getopts_args "$@" ynh_handle_getopts_args "$@"
if [ $(ynh_mongo_exec --command='db.getMongo().getDBNames().indexOf("'${database}'")' --eval) -lt 0 ] if [ $(ynh_mongo_exec --command='db.getMongo().getDBNames().indexOf("'${database}'")' --eval) -lt 0 ]
then then
return 1 return 1
else else
return 0 return 0
fi fi
} }
# Restore a database # Restore a database
@ -218,18 +215,18 @@ ynh_mongo_database_exists() {
# example: ynh_mongo_restore_db --database=wekan < ./dump.bson # example: ynh_mongo_restore_db --database=wekan < ./dump.bson
# #
# usage: ynh_mongo_restore_db --database=database # usage: ynh_mongo_restore_db --database=database
# | arg: -d, --database= - The database name to restore # | arg: -d, --database= - The database name to restore
# #
# #
ynh_mongo_restore_db() { ynh_mongo_restore_db() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=d local legacy_args=d
local -A args_array=( [d]=database= ) local -A args_array=( [d]=database= )
local database local database
# Manage arguments with getopts # Manage arguments with getopts
ynh_handle_getopts_args "$@" ynh_handle_getopts_args "$@"
mongorestore --quiet --db="$database" --archive mongorestore --quiet --db="$database" --archive
} }
# Drop a user # Drop a user
@ -237,98 +234,98 @@ ynh_mongo_restore_db() {
# [internal] # [internal]
# #
# usage: ynh_mongo_drop_user --db_user=user --db_name=name # usage: ynh_mongo_drop_user --db_user=user --db_name=name
# | arg: -u, --db_user= - The user to drop # | arg: -u, --db_user= - The user to drop
# | arg: -n, --db_name= - Name of the database # | arg: -n, --db_name= - Name of the database
# #
# #
ynh_mongo_drop_user() { ynh_mongo_drop_user() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=un local legacy_args=un
local -A args_array=( [u]=db_user= [n]=db_name= ) local -A args_array=( [u]=db_user= [n]=db_name= )
local db_user local db_user
local db_name local db_name
# Manage arguments with getopts # Manage arguments with getopts
ynh_handle_getopts_args "$@" ynh_handle_getopts_args "$@"
ynh_mongo_exec --database="$db_name" --command='db.dropUser("'$db_user'", {w: "majority", wtimeout: 5000})' ynh_mongo_exec --database="$db_name" --command='db.dropUser("'$db_user'", {w: "majority", wtimeout: 5000})'
} }
# Create a database, an user and its password. Then store the password in the app's config # Create a database, an user and its password. Then store the password in the app's config
# #
# usage: ynh_mongo_setup_db --db_user=user --db_name=name [--db_pwd=pwd] # usage: ynh_mongo_setup_db --db_user=user --db_name=name [--db_pwd=pwd]
# | arg: -u, --db_user= - Owner of the database # | arg: -u, --db_user= - Owner of the database
# | arg: -n, --db_name= - Name of the database # | arg: -n, --db_name= - Name of the database
# | arg: -p, --db_pwd= - Password of the database. If not provided, a password will be generated # | arg: -p, --db_pwd= - Password of the database. If not provided, a password will be generated
# #
# After executing this helper, the password of the created database will be available in $db_pwd # After executing this helper, the password of the created database will be available in $db_pwd
# It will also be stored as "mongopwd" into the app settings. # It will also be stored as "mongopwd" into the app settings.
# #
# #
ynh_mongo_setup_db() { ynh_mongo_setup_db() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=unp local legacy_args=unp
local -A args_array=( [u]=db_user= [n]=db_name= [p]=db_pwd= ) local -A args_array=( [u]=db_user= [n]=db_name= [p]=db_pwd= )
local db_user local db_user
local db_name local db_name
db_pwd="" db_pwd=""
# Manage arguments with getopts # Manage arguments with getopts
ynh_handle_getopts_args "$@" ynh_handle_getopts_args "$@"
local new_db_pwd=$(ynh_string_random) # Generate a random password local new_db_pwd=$(ynh_string_random) # Generate a random password
# If $db_pwd is not provided, use new_db_pwd instead for db_pwd # If $db_pwd is not provided, use new_db_pwd instead for db_pwd
db_pwd="${db_pwd:-$new_db_pwd}" db_pwd="${db_pwd:-$new_db_pwd}"
# Create the user and grant access to the database # Create the user and grant access to the database
ynh_mongo_create_user --db_user="$db_user" --db_pwd="$db_pwd" --db_name="$db_name" ynh_mongo_create_user --db_user="$db_user" --db_pwd="$db_pwd" --db_name="$db_name"
# Store the password in the app's config # Store the password in the app's config
ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
} }
# Remove a database if it exists, and the associated user # Remove a database if it exists, and the associated user
# #
# usage: ynh_mongo_remove_db --db_user=user --db_name=name # usage: ynh_mongo_remove_db --db_user=user --db_name=name
# | arg: -u, --db_user= - Owner of the database # | arg: -u, --db_user= - Owner of the database
# | arg: -n, --db_name= - Name of the database # | arg: -n, --db_name= - Name of the database
# #
# #
ynh_mongo_remove_db() { ynh_mongo_remove_db() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=un local legacy_args=un
local -A args_array=( [u]=db_user= [n]=db_name= ) local -A args_array=( [u]=db_user= [n]=db_name= )
local db_user local db_user
local db_name local db_name
# Manage arguments with getopts # Manage arguments with getopts
ynh_handle_getopts_args "$@" ynh_handle_getopts_args "$@"
if ynh_mongo_database_exists --database=$db_name; then # Check if the database exists if ynh_mongo_database_exists --database=$db_name; then # Check if the database exists
ynh_mongo_drop_db --database=$db_name # Remove the database ynh_mongo_drop_db --database=$db_name # Remove the database
else else
ynh_print_warn --message="Database $db_name not found" ynh_print_warn --message="Database $db_name not found"
fi fi
# Remove mongo user if it exists # Remove mongo user if it exists
ynh_mongo_drop_user --db_user=$db_user --db_name=$db_name ynh_mongo_drop_user --db_user=$db_user --db_name=$db_name
} }
# Install MongoDB and integrate MongoDB service in YunoHost # Install MongoDB and integrate MongoDB service in YunoHost
# #
# usage: ynh_install_mongo [--mongo_version=mongo_version] # usage: ynh_install_mongo [--mongo_version=mongo_version]
# | arg: -m, --mongo_version= - Version of MongoDB to install # | arg: -m, --mongo_version= - Version of MongoDB to install
# #
# #
ynh_install_mongo() { ynh_install_mongo() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=m local legacy_args=m
local -A args_array=([m]=mongo_version=) local -A args_array=([m]=mongo_version=)
local mongo_version local mongo_version
# Manage arguments with getopts # Manage arguments with getopts
ynh_handle_getopts_args "$@" ynh_handle_getopts_args "$@"
mongo_version="${mongo_version:-$YNH_MONGO_VERSION}" mongo_version="${mongo_version:-$YNH_MONGO_VERSION}"
ynh_print_info --message="Installing MongoDB Community Edition..." debian=$(lsb_release --codename --short)
local mongo_debian_release=bullseye #$(ynh_get_debian_release)
ynh_print_info --message="Installing MongoDB Community Edition..."
if [[ $(cat /proc/cpuinfo) != *"avx"* && "$mongo_version" != "4.4" ]]; then if [[ $(cat /proc/cpuinfo) != *"avx"* && "$mongo_version" != "4.4" ]]; then
ynh_print_warn --message="Installing Mongo 4.4 as $mongo_version is not compatible with your CPU (see https://docs.mongodb.com/manual/administration/production-notes/#x86_64)." ynh_print_warn --message="Installing Mongo 4.4 as $mongo_version is not compatible with your CPU (see https://docs.mongodb.com/manual/administration/production-notes/#x86_64)."
mongo_version="4.4" mongo_version="4.4"
@ -337,21 +334,22 @@ ynh_install_mongo() {
ynh_print_warn --message="Switched to Buster install as Mongo 4.4 is not compatible with $mongo_debian_release." ynh_print_warn --message="Switched to Buster install as Mongo 4.4 is not compatible with $mongo_debian_release."
mongo_debian_release=buster mongo_debian_release=buster
fi fi
ynh_install_extra_app_dependencies \
--repo="deb http://repo.mongodb.org/apt/debian $debian/mongodb-org/$mongo_version main" \
--package="mongodb-org mongodb-org-server mongodb-org-tools mongodb-mongosh" \
--key="https://www.mongodb.org/static/pgp/server-$mongo_version.asc"
mongodb_servicename=mongod
ynh_install_extra_app_dependencies --repo="deb http://repo.mongodb.org/apt/debian $mongo_debian_release/mongodb-org/$mongo_version main" --package="mongodb-org-server mongodb-org-shell mongodb-database-tools" --key="https://www.mongodb.org/static/pgp/server-$mongo_version.asc" # Make sure MongoDB is started and enabled
mongodb_servicename=mongod systemctl enable $mongodb_servicename --quiet
systemctl daemon-reload --quiet
ynh_systemd_action --service_name=$mongodb_servicename --action=restart --line_match="aiting for connections" --log_path="/var/log/mongodb/$mongodb_servicename.log"
# Make sure MongoDB is started and enabled # Integrate MongoDB service in YunoHost
systemctl enable $mongodb_servicename --quiet yunohost service add $mongodb_servicename --description="MongoDB daemon" --log="/var/log/mongodb/$mongodb_servicename.log"
systemctl daemon-reload --quiet
ynh_systemd_action --service_name=$mongodb_servicename --action=restart --line_match="aiting for connections" --log_path="/var/log/mongodb/$mongodb_servicename.log" # Store mongo_version into the config of this app
ynh_app_setting_set --app=$app --key=mongo_version --value=$mongo_version
# Integrate MongoDB service in YunoHost
yunohost service add $mongodb_servicename --description="MongoDB daemon" --log="/var/log/mongodb/$mongodb_servicename.log"
# Store mongo_version into the config of this app
ynh_app_setting_set --app=$app --key=mongo_version --value=$mongo_version
} }
# Remove MongoDB # Remove MongoDB
@ -362,18 +360,14 @@ ynh_install_mongo() {
# #
# #
ynh_remove_mongo() { ynh_remove_mongo() {
# Only remove the mongodb service if it is not installed. # Only remove the mongodb service if it is not installed.
if ! ynh_package_is_installed --package="mongodb*" if ! ynh_package_is_installed --package="mongodb*"
then then
ynh_print_info --message="Removing MongoDB service..." ynh_print_info --message="Removing MongoDB service..."
mongodb_servicename=mongod mongodb_servicename=mongod
# Remove the mongodb service # Remove the mongodb service
yunohost service remove $mongodb_servicename yunohost service remove $mongodb_servicename
ynh_secure_remove --file="/var/lib/mongodb" ynh_secure_remove --file="/var/lib/mongodb"
ynh_secure_remove --file="/var/log/mongodb" ynh_secure_remove --file="/var/log/mongodb"
fi fi
} }
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================

View file

@ -132,9 +132,11 @@ cp "$install_dir/build/server-ce/config/custom-environment-variables.json" "$ins
ynh_secure_remove --file="$install_dir/build" ynh_secure_remove --file="$install_dir/build"
ynh_script_progression --message="Building app..." ynh_script_progression --message="Building app... This may take a LOT of time depending of your CPU" --weight=25
pushd "$install_dir/live" pushd "$install_dir/live"
ynh_use_nodejs ynh_use_nodejs
ynh_exec_warn_less npm cache clean --force
ynh_exec_warn_less npm install
ynh_exec_warn_less npm ci ynh_exec_warn_less npm ci
popd popd

View file

@ -153,7 +153,8 @@ cp "$install_dir/build/server-ce/config/custom-environment-variables.json" "$ins
ynh_script_progression --message="Building app... This may take a LOT of time depending of your CPU" --weight=25 ynh_script_progression --message="Building app... This may take a LOT of time depending of your CPU" --weight=25
pushd "$install_dir/live" pushd "$install_dir/live"
ynh_use_nodejs ynh_use_nodejs
ynh_exec_warn_less npm install ynh_exec_warn_less npm cache clean --force
ynh_exec_warn_less npm install
ynh_exec_warn_less npm ci ynh_exec_warn_less npm ci
popd popd

View file

@ -2,4 +2,4 @@ test_format = 1.0
[default] [default]
test_upgrade_from.c5e7ec1.name = "Overleaf 4.x" test_upgrade_from.405228e.name = "2024-04-09"