mirror of
https://github.com/YunoHost-Apps/dont-code_ynh.git
synced 2024-09-03 18:26:34 +02:00
Merge branch 'main' into testing
This commit is contained in:
commit
c48b78bdb8
17 changed files with 265 additions and 50 deletions
|
@ -1,7 +1,6 @@
|
||||||
# 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)
|
||||||
- [Lee 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)
|
||||||
|
|
|
@ -31,7 +31,6 @@ This Yunohost app installs the server part (services + mongo database) needed to
|
||||||
- Projects and all user's data are backuped up as part of the Yunohost backup process
|
- Projects and all user's data are backuped up as part of the Yunohost backup process
|
||||||
- As well any documents or images uploaded by users will be backed up
|
- As well any documents or images uploaded by users will be backed up
|
||||||
|
|
||||||
|
|
||||||
**Version incluse :** 0.3.1~ynh1
|
**Version incluse :** 0.3.1~ynh1
|
||||||
|
|
||||||
**Démo :** <https://dont-code.net/apps.html>
|
**Démo :** <https://dont-code.net/apps.html>
|
||||||
|
|
65
README_it.md
Normal file
65
README_it.md
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
<!--
|
||||||
|
N.B.: Questo README è stato automaticamente generato da <https://github.com/YunoHost/apps/tree/master/tools/readme_generator>
|
||||||
|
NON DEVE essere modificato manualmente.
|
||||||
|
-->
|
||||||
|
|
||||||
|
# Dont-code Services per YunoHost
|
||||||
|
|
||||||
|
[![Livello di integrazione](https://dash.yunohost.org/integration/dont-code.svg)](https://dash.yunohost.org/appci/app/dont-code) ![Stato di funzionamento](https://ci-apps.yunohost.org/ci/badges/dont-code.status.svg) ![Stato di manutenzione](https://ci-apps.yunohost.org/ci/badges/dont-code.maintain.svg)
|
||||||
|
|
||||||
|
[![Installa Dont-code Services con YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=dont-code)
|
||||||
|
|
||||||
|
*[Leggi questo README in altre lingue.](./ALL_README.md)*
|
||||||
|
|
||||||
|
> *Questo pacchetto ti permette di installare Dont-code Services su un server YunoHost in modo semplice e veloce.*
|
||||||
|
> *Se non hai YunoHost, consulta [la guida](https://yunohost.org/install) per imparare a installarlo.*
|
||||||
|
|
||||||
|
## Panoramica
|
||||||
|
|
||||||
|
Dont-code is a low-code / no-code platform letting user create their own applications based on complete feature sets developed by IT.
|
||||||
|
You can find more information here: https://dont-code.net
|
||||||
|
|
||||||
|
This Yunohost app installs the server part (services + mongo database) needed to run the dont-code applications.
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
- Thanks to the Powerful [Builders](https://dont-code.net/ide-ui) and [Previewers](https://dont-code.net/ide-ui), a user can directly design its application and immediately see the result
|
||||||
|
- One only needs to describe its application by filling sentences prepared by the platform.
|
||||||
|
- By default it provides support for images, currency, text, numbers, countries, links.
|
||||||
|
- Multiple plugins allow you to list, edit, make reports, call services, save to database, save in browser, and so on...
|
||||||
|
- Plugins can be developed by any IT team
|
||||||
|
- Projects and all user's data are backuped up as part of the Yunohost backup process
|
||||||
|
- As well any documents or images uploaded by users will be backed up
|
||||||
|
|
||||||
|
|
||||||
|
**Versione pubblicata:** 0.2.10~ynh7
|
||||||
|
|
||||||
|
**Prova:** <https://dont-code.net/apps.html>
|
||||||
|
|
||||||
|
## Screenshot
|
||||||
|
|
||||||
|
![Screenshot di Dont-code Services](./doc/screenshots/previewer.gif)
|
||||||
|
![Screenshot di Dont-code Services](./doc/screenshots/ide.gif)
|
||||||
|
|
||||||
|
## Documentazione e risorse
|
||||||
|
|
||||||
|
- Sito web ufficiale dell’app: <https://dont-code.net>
|
||||||
|
- Documentazione ufficiale per gli utenti: <https://dont-code.net/news.html>
|
||||||
|
- Documentazione ufficiale per gli amministratori: <https://dont-code.net/developers.html>
|
||||||
|
- Repository upstream del codice dell’app: <https://github.com/dont-code>
|
||||||
|
- Store di YunoHost: <https://apps.yunohost.org/app/dont-code>
|
||||||
|
- Segnala un problema: <https://github.com/YunoHost-Apps/dont-code_ynh/issues>
|
||||||
|
|
||||||
|
## Informazioni per sviluppatori
|
||||||
|
|
||||||
|
Si prega di inviare la tua pull request alla [branch di `testing`](https://github.com/YunoHost-Apps/dont-code_ynh/tree/testing).
|
||||||
|
|
||||||
|
Per provare la branch di `testing`, si prega di procedere in questo modo:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo yunohost app install https://github.com/YunoHost-Apps/dont-code_ynh/tree/testing --debug
|
||||||
|
o
|
||||||
|
sudo yunohost app upgrade dont-code -u https://github.com/YunoHost-Apps/dont-code_ynh/tree/testing --debug
|
||||||
|
```
|
||||||
|
|
||||||
|
**Maggiori informazioni riguardo il pacchetto di quest’app:** <https://yunohost.org/packaging_apps>
|
11
conf/.env
11
conf/.env
|
@ -1,9 +1,8 @@
|
||||||
quarkus_http_host=127.0.0.1
|
quarkus_http_host=127.0.0.1
|
||||||
|
quarkus_http_cors=false
|
||||||
quarkus_mongodb_projects_connection_string=mongodb://localhost:27017
|
quarkus_mongodb_projects_connection_string=mongodb://__DB_USER__:__DB_PWD__@localhost:27017/?authSource=dontCode__TENANT__Projects
|
||||||
projects_database_name=dontCodeProjects
|
projects_database_name=dontCode__TENANT__Projects
|
||||||
|
quarkus_mongodb_data_connection_string=mongodb://__DB_USER__:__DB_PWD__@localhost:27017/?authSource=dontCode__TENANT__Data
|
||||||
quarkus_mongodb_data_connection_string=mongodb://localhost:27017
|
data_database_name=dontCode__TENANT__Data
|
||||||
data_database_name=dontCodeData
|
|
||||||
document_directory=__DOCUMENT_DIR__
|
document_directory=__DOCUMENT_DIR__
|
||||||
document_external_url=__DOCUMENT_URL__
|
document_external_url=__DOCUMENT_URL__
|
||||||
|
|
|
@ -2,6 +2,14 @@
|
||||||
|
|
||||||
location __PATH__/ {
|
location __PATH__/ {
|
||||||
|
|
||||||
|
# CORS support
|
||||||
|
more_set_headers 'Access-Control-Allow-Origin: *';
|
||||||
|
|
||||||
|
# Handling preflight requests
|
||||||
|
if ($request_method = OPTIONS) {
|
||||||
|
more_set_headers 'Access-Control-Allow-Methods: *' 'Access-Control-Allow-Headers: *';
|
||||||
|
}
|
||||||
|
|
||||||
# Path to source
|
# Path to source
|
||||||
alias __DATA_DIR__/;
|
alias __DATA_DIR__/;
|
||||||
|
|
||||||
|
@ -50,11 +58,4 @@ location __PATH__/ {
|
||||||
client_max_body_size 15M;
|
client_max_body_size 15M;
|
||||||
}
|
}
|
||||||
|
|
||||||
location __PATH__/demo_project {
|
|
||||||
proxy_pass http://localhost:__PORT_PROJECT__/project;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header DbName "dontCodeDemoProjects";
|
|
||||||
proxy_read_timeout 86400s;
|
|
||||||
proxy_send_timeout 86400s;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
57
conf/repository-next.json
Normal file
57
conf/repository-next.json
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://dont-code.net/schemas/v1/repository-schema.json",
|
||||||
|
"name": "Next Repository __TENANT__",
|
||||||
|
"description": "Repository provided by Dont-code offering next versions of all plugins",
|
||||||
|
"ideWebSocketUrl": "ws://__DOMAIN____PATH__/ide",
|
||||||
|
"webSocketUrl": "ws://__DOMAIN____PATH__/preview",
|
||||||
|
"storeApiUrl": "https://__DOMAIN____PATH__/data",
|
||||||
|
"projectApiUrl": "https://__DOMAIN____PATH__/project",
|
||||||
|
"documentApiUrl": "https://__DOMAIN____PATH__/documents",
|
||||||
|
"plugins": [
|
||||||
|
{
|
||||||
|
"id": "Basic",
|
||||||
|
"display-name": "Basic plugin for editing entities",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"info": {
|
||||||
|
"remote-entry":"https://run.dont-code.net/plugins/next/remoteEntry.mjs"
|
||||||
|
},
|
||||||
|
"config": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "Fields",
|
||||||
|
"display-name": "Additional editors for entity properties",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"info": {
|
||||||
|
"remote-entry":"https://run.dont-code.net/plugins/next/remoteEntry.mjs"
|
||||||
|
},
|
||||||
|
"config": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "Rest",
|
||||||
|
"display-name": "Plugins to support datasources from Rest API",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"info": {
|
||||||
|
"remote-entry":"https://run.dont-code.net/plugin-rest/next/remoteEntry.mjs"
|
||||||
|
},
|
||||||
|
"config": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "Report",
|
||||||
|
"display-name": "Plugins to generate and display reports",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"info": {
|
||||||
|
"remote-entry":"https://run.dont-code.net/plugin-report/next/remoteEntry.mjs"
|
||||||
|
},
|
||||||
|
"config": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "Commerce",
|
||||||
|
"display-name": "Plugins to get prices from shops",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"info": {
|
||||||
|
"remote-entry":"https://run.dont-code.net/plugin-commerce/next/remoteEntry.mjs"
|
||||||
|
},
|
||||||
|
"config": {}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
57
conf/repository-stable.json
Normal file
57
conf/repository-stable.json
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://dont-code.net/schemas/v1/repository-schema.json",
|
||||||
|
"name": "Stable Repository __TENANT__",
|
||||||
|
"description": "Repository provided by Dont-code using stable versions of plugins",
|
||||||
|
"ideWebSocketUrl": "ws://__DOMAIN____PATH__/ide",
|
||||||
|
"webSocketUrl": "ws://__DOMAIN____PATH__/preview",
|
||||||
|
"storeApiUrl": "https://__DOMAIN____PATH__/data",
|
||||||
|
"projectApiUrl": "https://__DOMAIN____PATH__/project",
|
||||||
|
"documentApiUrl": "https://__DOMAIN____PATH__/documents",
|
||||||
|
"plugins": [
|
||||||
|
{
|
||||||
|
"id": "Basic",
|
||||||
|
"display-name": "Basic plugin for editing entities",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"info": {
|
||||||
|
"remote-entry":"https://run.dont-code.net/plugins/latest/remoteEntry.mjs"
|
||||||
|
},
|
||||||
|
"config": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "Fields",
|
||||||
|
"display-name": "Additional editors for entity properties",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"info": {
|
||||||
|
"remote-entry":"https://run.dont-code.net/plugins/latest/remoteEntry.mjs"
|
||||||
|
},
|
||||||
|
"config": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "Rest",
|
||||||
|
"display-name": "Plugins to support datasources from Rest API",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"info": {
|
||||||
|
"remote-entry":"https://run.dont-code.net/plugin-rest/latest/remoteEntry.mjs"
|
||||||
|
},
|
||||||
|
"config": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "Report",
|
||||||
|
"display-name": "Plugins to generate and display reports",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"info": {
|
||||||
|
"remote-entry":"https://run.dont-code.net/plugin-report/latest/remoteEntry.mjs"
|
||||||
|
},
|
||||||
|
"config": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "Commerce",
|
||||||
|
"display-name": "Plugins to get prices from shops",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"info": {
|
||||||
|
"remote-entry":"https://run.dont-code.net/plugin-commerce/latest/remoteEntry.mjs"
|
||||||
|
},
|
||||||
|
"config": {}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -22,7 +22,7 @@ code = "https://github.com/dont-code"
|
||||||
[integration]
|
[integration]
|
||||||
yunohost = ">= 11.0.0"
|
yunohost = ">= 11.0.0"
|
||||||
architectures = "all"
|
architectures = "all"
|
||||||
multi_instance = false
|
multi_instance = true
|
||||||
ldap = false
|
ldap = false
|
||||||
sso = false
|
sso = false
|
||||||
disk = "50M"
|
disk = "50M"
|
||||||
|
@ -39,6 +39,12 @@ ram.runtime = "400M"
|
||||||
type = "path"
|
type = "path"
|
||||||
default = "/dont-code"
|
default = "/dont-code"
|
||||||
|
|
||||||
|
[install.tenant]
|
||||||
|
ask.en = "The name of the tenant these services will support. This configures database name to use. Can be empty if non necessary."
|
||||||
|
ask.fr = "Le nom du tenant associé a ces services. Permet de configurer une base de donnée séparée. Peut-être vide si non nécessaire."
|
||||||
|
type = "string"
|
||||||
|
optional = true
|
||||||
|
|
||||||
[install.public_key]
|
[install.public_key]
|
||||||
ask.en = "SSH Public key to allow service updates as part of delivery process, leave empty to disable."
|
ask.en = "SSH Public key to allow service updates as part of delivery process, leave empty to disable."
|
||||||
ask.fr = "Clef publique SSH permettant la mise à jour des services via une deploiement automatique, inactif si non renseigné."
|
ask.fr = "Clef publique SSH permettant la mise à jour des services via une deploiement automatique, inactif si non renseigné."
|
||||||
|
|
|
@ -10,7 +10,7 @@ mongo_version=6.0
|
||||||
SERVICES_LIST=(ide preview project data)
|
SERVICES_LIST=(ide preview project data)
|
||||||
|
|
||||||
# List of Mongo databases to manage
|
# List of Mongo databases to manage
|
||||||
MONGO_DB_LIST=(dontCodeProjects dontCodeDemoProjects dontCodeData dontCodeTestProjects)
|
MONGO_DB_LIST=(Projects Data)
|
||||||
|
|
||||||
# The list of port in the same order than the list of services
|
# The list of port in the same order than the list of services
|
||||||
PORT_LIST=("$port_ide" "$port_preview" "$port_project" "$port_data")
|
PORT_LIST=("$port_ide" "$port_preview" "$port_project" "$port_data")
|
||||||
|
|
|
@ -63,11 +63,11 @@ fi
|
||||||
ynh_print_info --message="Backing up the Mongo databases..."
|
ynh_print_info --message="Backing up the Mongo databases..."
|
||||||
|
|
||||||
for db_name in "${MONGO_DB_LIST[@]}"; do
|
for db_name in "${MONGO_DB_LIST[@]}"; do
|
||||||
ynh_mongo_dump_db --database=$db_name > ./dump-${db_name}.bson
|
ynh_mongo_dump_db --database="dontCode$tenant$db_name" > ./dump-dontCode${tenant}${db_name}.bson
|
||||||
done
|
done
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
ynh_print_info --message="Backup script completed for $app with tenant $tenant. (YunoHost will then actually copy those files to the archive)."
|
||||||
|
|
|
@ -41,6 +41,10 @@ ynh_backup_if_checksum_is_different --file="$install_dir/.env"
|
||||||
ynh_replace_string --match_string="$document_url" --replace_string="$new_document_url" --target_file="$install_dir/.env"
|
ynh_replace_string --match_string="$document_url" --replace_string="$new_document_url" --target_file="$install_dir/.env"
|
||||||
ynh_store_file_checksum --file="$install_dir/.env"
|
ynh_store_file_checksum --file="$install_dir/.env"
|
||||||
|
|
||||||
|
# Update the repository pages
|
||||||
|
ynh_add_config --template="repository-next.json" --destination="$data_dir/repository-next.json"
|
||||||
|
ynh_add_config --template="repository-stable.json" --destination="$data_dir/repository-stable.json"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALISATION
|
# GENERIC FINALISATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -35,9 +35,14 @@ ynh_app_setting_set --app="$app" --key=document_dir --value="$document_dir"
|
||||||
document_url=$(append_uri "https://${domain}${path}" "docs")
|
document_url=$(append_uri "https://${domain}${path}" "docs")
|
||||||
ynh_app_setting_set --app="$app" --key=document_url --value="$document_url"
|
ynh_app_setting_set --app="$app" --key=document_url --value="$document_url"
|
||||||
|
|
||||||
# Add the status page
|
# Add the status pageindex
|
||||||
ynh_add_config --template="index.html" --destination="$data_dir/index.html"
|
ynh_add_config --template="index.html" --destination="$data_dir/index.html"
|
||||||
|
|
||||||
|
# Add the repository pages
|
||||||
|
ynh_add_config --template="repository-next.json" --destination="$data_dir/repository-next.json"
|
||||||
|
ynh_add_config --template="repository-stable.json" --destination="$data_dir/repository-stable.json"
|
||||||
|
|
||||||
|
|
||||||
chmod -R o-rwx "$data_dir"
|
chmod -R o-rwx "$data_dir"
|
||||||
chown -R $app:www-data "$data_dir"
|
chown -R $app:www-data "$data_dir"
|
||||||
|
|
||||||
|
@ -46,6 +51,13 @@ chown -R $app:www-data "$data_dir"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||||
|
|
||||||
|
# The .env needs db_user and db_password
|
||||||
|
new_db_pwd=$(ynh_string_random) # Generate a random password
|
||||||
|
db_pwd="${db_pwd:-$new_db_pwd}"
|
||||||
|
|
||||||
|
db_user=$(ynh_sanitize_dbid --db_name="${app}")
|
||||||
|
ynh_app_setting_set --app="$app" --key=db_user --value="$db_user"
|
||||||
|
|
||||||
ynh_add_config --template=".env" --destination="$install_dir/.env"
|
ynh_add_config --template=".env" --destination="$install_dir/.env"
|
||||||
|
|
||||||
chmod 400 "$install_dir/.env"
|
chmod 400 "$install_dir/.env"
|
||||||
|
@ -82,12 +94,9 @@ ynh_install_mongo --mongo_version=$mongo_version
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Creating the Mongo databases..." --weight=1
|
ynh_script_progression --message="Creating the Mongo databases..." --weight=1
|
||||||
|
|
||||||
db_user=$(ynh_sanitize_dbid --db_name="${app}")
|
for db_name in "${MONGO_DB_LIST[@]}"; do
|
||||||
ynh_app_setting_set --app="$app" --key=db_user --value="$db_user"
|
ynh_mongo_setup_db --db_user="$db_user" --db_pwd="$db_pwd" --db_name="dontCode$tenant${db_name}"
|
||||||
|
done
|
||||||
# We should probably enable databases to the user, but for now, we connect through admin
|
|
||||||
# No need to create other databases: Mongo creates them on the fly
|
|
||||||
ynh_mongo_setup_db --db_user="$db_user" --db_name="${MONGO_DB_LIST[0]}"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SYSTEM CONFIGURATION
|
# SYSTEM CONFIGURATION
|
||||||
|
|
|
@ -36,7 +36,7 @@ ynh_remove_logrotate
|
||||||
|
|
||||||
# Remove a database if it exists, along with the associated user
|
# Remove a database if it exists, along with the associated user
|
||||||
for db_name in "${MONGO_DB_LIST[@]}"; do
|
for db_name in "${MONGO_DB_LIST[@]}"; do
|
||||||
ynh_mongo_remove_db --db_user=$db_user --db_name=$db_name
|
ynh_mongo_remove_db --db_user=$db_user --db_name="dontCode$tenant$db_name"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Remove mongo itself if not used anymore
|
# Remove mongo itself if not used anymore
|
||||||
|
|
|
@ -64,10 +64,9 @@ ynh_install_mongo --mongo_version=$mongo_version
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the Mongo databases..." --weight=1
|
ynh_script_progression --message="Restoring the Mongo databases..." --weight=1
|
||||||
|
|
||||||
ynh_mongo_setup_db --db_user=$db_user --db_name=${MONGO_DB_LIST[0]} --db_pwd=$db_pwd
|
|
||||||
|
|
||||||
for db_name in "${MONGO_DB_LIST[@]}"; do
|
for db_name in "${MONGO_DB_LIST[@]}"; do
|
||||||
ynh_mongo_restore_db --database="$db_name" < "./dump-${db_name}.bson"
|
ynh_mongo_setup_db --db_user="$db_user" --db_pwd="$db_pwd" --db_name="dontCode$tenant${db_name}"
|
||||||
|
ynh_mongo_restore_db --database="dontCode$tenant$db_name" < "./dump-dontCode${tenant}${db_name}.bson"
|
||||||
done
|
done
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -34,6 +34,16 @@ if [ -z "${public_key+x}" ]; then
|
||||||
ynh_app_setting_set --app="$app" --key=public_key --value="$public_key"
|
ynh_app_setting_set --app="$app" --key=public_key --value="$public_key"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Set default tenant to empty if needed
|
||||||
|
if [ -z "${tenant+x}" ]; then
|
||||||
|
tenant=""
|
||||||
|
ynh_app_setting_set --app="$app" --key=tenant --value="$tenant"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# The .env needs db_password
|
||||||
|
new_db_pwd=$(ynh_string_random) # Generate a random password
|
||||||
|
db_pwd="${db_pwd:-$new_db_pwd}"
|
||||||
|
|
||||||
if [[ -n "${document_path:-}" ]]; then
|
if [[ -n "${document_path:-}" ]]; then
|
||||||
# Renamed setting key
|
# Renamed setting key
|
||||||
document_dir="$document_path"
|
document_dir="$document_path"
|
||||||
|
@ -66,7 +76,7 @@ if [[ -n "${html_path:-}" ]]; then
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Regenerate the .env file if the document_url was incorrectly set before
|
# Recalculate the document_url if it was incorrectly set before
|
||||||
correct_document_url=$(append_uri "https://${domain}${path}" "docs")
|
correct_document_url=$(append_uri "https://${domain}${path}" "docs")
|
||||||
if [ "$correct_document_url" != "$document_url" ]; then
|
if [ "$correct_document_url" != "$document_url" ]; then
|
||||||
ynh_script_progression --message="Updading url for documents" --weight=1
|
ynh_script_progression --message="Updading url for documents" --weight=1
|
||||||
|
@ -74,13 +84,6 @@ if [ "$correct_document_url" != "$document_url" ]; then
|
||||||
document_url=$correct_document_url
|
document_url=$correct_document_url
|
||||||
ynh_app_setting_set --app=$app --key=document_url --value=$document_url
|
ynh_app_setting_set --app=$app --key=document_url --value=$document_url
|
||||||
|
|
||||||
ynh_add_config --template=".env" --destination="$install_dir/.env"
|
|
||||||
|
|
||||||
# FIXME: this should be handled by the core in the future
|
|
||||||
# You may need to use chmod 600 instead of 400,
|
|
||||||
# for example if the app is expected to be able to modify its own config
|
|
||||||
chmod 400 "$install_dir/.env"
|
|
||||||
chown $app:$app "$install_dir/.env"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -92,6 +95,16 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]; then
|
||||||
|
|
||||||
# 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="$install_dir" --full_replace=1 --keep ".env .ssh/authorized_keys restart_services.sh"
|
ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep ".env .ssh/authorized_keys restart_services.sh"
|
||||||
|
|
||||||
|
# Always update .env
|
||||||
|
ynh_add_config --template=".env" --destination="$install_dir/.env"
|
||||||
|
|
||||||
|
# FIXME: this should be handled by the core in the future
|
||||||
|
# You may need to use chmod 600 instead of 400,
|
||||||
|
# for example if the app is expected to be able to modify its own config
|
||||||
|
chmod 400 "$install_dir/.env"
|
||||||
|
chown $app:$app "$install_dir/.env"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chmod -R o-rwx "$install_dir"
|
chmod -R o-rwx "$install_dir"
|
||||||
|
@ -104,6 +117,10 @@ ynh_script_progression --message="Configuring document storage..." --weight=1
|
||||||
|
|
||||||
ynh_add_config --template="index.html" --destination="$data_dir/index.html"
|
ynh_add_config --template="index.html" --destination="$data_dir/index.html"
|
||||||
|
|
||||||
|
# Add the repository pages
|
||||||
|
ynh_add_config --template="repository-next.json" --destination="$data_dir/repository-next.json"
|
||||||
|
ynh_add_config --template="repository-stable.json" --destination="$data_dir/repository-stable.json"
|
||||||
|
|
||||||
chmod -R o-rwx "$data_dir"
|
chmod -R o-rwx "$data_dir"
|
||||||
chown -R "$app:www-data" "$data_dir"
|
chown -R "$app:www-data" "$data_dir"
|
||||||
|
|
||||||
|
@ -124,6 +141,11 @@ ynh_script_progression --message="Upgrading MongoDB..." --weight=1
|
||||||
# Install the required version of Mongo
|
# Install the required version of Mongo
|
||||||
ynh_install_mongo --mongo_version=$mongo_version
|
ynh_install_mongo --mongo_version=$mongo_version
|
||||||
|
|
||||||
|
# We are now assigning the user to the database, so update the user's rights
|
||||||
|
for db_name in "${MONGO_DB_LIST[@]}"; do
|
||||||
|
ynh_mongo_setup_db --db_user="$db_user" --db_pwd="$db_pwd" --db_name="dontCode$tenant${db_name}"
|
||||||
|
done
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REAPPLY SYSTEM CONFIGURATIONS
|
# REAPPLY SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
readonly YNH_DEFAULT_MONGO_VERSION=4.4
|
readonly YNH_DEFAULT_MONGO_VERSION=6.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 ; 7.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}
|
||||||
|
|
||||||
|
@ -316,17 +316,13 @@ ynh_install_mongo() {
|
||||||
local mongo_debian_release=$(ynh_get_debian_release)
|
local mongo_debian_release=$(ynh_get_debian_release)
|
||||||
|
|
||||||
if [[ $(cat /proc/cpuinfo) != *"avx"* && "$mongo_version" != "4.4" ]]; then
|
if [[ $(cat /proc/cpuinfo) != *"avx"* && "$mongo_version" != "4.4" ]]; then
|
||||||
#Sadly mongo 4.4 is the only version not requiring avx instruction set, so we will install it
|
#Sadly mongo 4.4 is the only version not requiring avx instruction set, so we will install it
|
||||||
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"
|
||||||
fi
|
fi
|
||||||
if [[ "$mongo_version" == "4.4" && "$mongo_debian_release" != "buster" ]]; then
|
|
||||||
ynh_print_warn --message="Switched to buster install as Mongo 4.4 is not compatible with $mongo_debian_release."
|
|
||||||
mongo_debian_release=buster
|
|
||||||
fi
|
|
||||||
|
|
||||||
ynh_install_extra_app_dependencies --repo="deb http://repo.mongodb.org/apt/debian $mongo_debian_release/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"
|
ynh_install_extra_app_dependencies --repo="deb http://repo.mongodb.org/apt/debian $mongo_debian_release/mongodb-org/$mongo_version main" --package="mongodb-org" --key="https://www.mongodb.org/static/pgp/server-$mongo_version.asc"
|
||||||
mongodb_servicename=mongod
|
mongodb_servicename=mongod
|
||||||
|
|
||||||
# Make sure MongoDB is started and enabled
|
# Make sure MongoDB is started and enabled
|
||||||
systemctl enable $mongodb_servicename --quiet
|
systemctl enable $mongodb_servicename --quiet
|
||||||
|
|
|
@ -5,10 +5,12 @@ test_format = 1.0
|
||||||
[default]
|
[default]
|
||||||
|
|
||||||
args.public_key = ""
|
args.public_key = ""
|
||||||
|
args.tenant = "Test"
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
# Commits to test upgrade from
|
# Commits to test upgrade from
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
|
|
||||||
test_upgrade_from.7852cc4bf44ff20ee51fe35f3f53dc105e0f6d79.name= "2023-01-07 - Added Ssh support for dev."
|
test_upgrade_from.7852cc4bf44ff20ee51fe35f3f53dc105e0f6d79.name= "2023-01-07 - Added Ssh support for dev."
|
||||||
test_upgrade_from.e89eebdac9f59202202d07972e274ebe6fc7c51c.name= "Before Manifest v2."
|
test_upgrade_from.e89eebdac9f59202202d07972e274ebe6fc7c51c.name= "Before Manifest v2."
|
||||||
|
test_upgrade_from.13b9ba1eb3ccad38329ee2c7dadad00c18fe5e83.name= "Before switching to multi_instance."
|
||||||
|
|
Loading…
Reference in a new issue