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

Resolved merge conflict

This commit is contained in:
squeak 2021-05-24 00:50:32 +02:00
commit 880d9fd7e6
10 changed files with 69 additions and 73 deletions

View file

@ -1,7 +1,5 @@
# FacilMap for YunoHost # FacilMap for YunoHost
⚠️ This package is not ready, and still in development, only install at your own risks and **NOT** in a production server.
[![Integration level](https://dash.yunohost.org/integration/facilmap.svg)](https://dash.yunohost.org/appci/app/facilmap) ![](https://ci-apps.yunohost.org/ci/badges/facilmap.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/facilmap.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/facilmap.svg)](https://dash.yunohost.org/appci/app/facilmap) ![](https://ci-apps.yunohost.org/ci/badges/facilmap.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/facilmap.maintain.svg)
[![Install facilmap with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=facilmap) [![Install facilmap with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=facilmap)
@ -15,7 +13,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
[FacilMap](https://github.com/FacilMap/facilmap) is a privacy-friendly, open-source versatile online map that combines different services based on OpenStreetMap and makes it easy to find places, plan routes and create custom maps full of markers, lines and routes, allowing live collaboration. Think of it like [Etherpad](https://etherpad.org/), just for maps. [FacilMap](https://github.com/FacilMap/facilmap) is a privacy-friendly, open-source versatile online map that combines different services based on OpenStreetMap and makes it easy to find places, plan routes and create custom maps full of markers, lines and routes, allowing live collaboration. Think of it like [Etherpad](https://etherpad.org/), just for maps.
**Shipped version:** 3.0.1 **Shipped version:** 3.1.0
## Screenshots ## Screenshots

View file

@ -1,7 +1,5 @@
# FacilMap pour YunoHost # FacilMap pour YunoHost
⚠️ Ce paquet n'est pas encore prêt et encore en développement, utilisez le à vos risques et périls, et **NON** dans un serveur en production.
[![Niveau d'intégration](https://dash.yunohost.org/integration/facilmap.svg)](https://dash.yunohost.org/appci/app/facilmap) ![](https://ci-apps.yunohost.org/ci/badges/facilmap.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/facilmap.maintain.svg) [![Niveau d'intégration](https://dash.yunohost.org/integration/facilmap.svg)](https://dash.yunohost.org/appci/app/facilmap) ![](https://ci-apps.yunohost.org/ci/badges/facilmap.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/facilmap.maintain.svg)
[![Installer facilmap avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=facilmap) [![Installer facilmap avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=facilmap)
@ -15,7 +13,7 @@ Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install
[FacilMap](https://github.com/FacilMap/facilmap) est une carte interactive polyvalente, libre et respectueuse de la vie privée qui regroupe des nombreux services basés sur les données libres de OpenStreetMap. FacilMap permet de naviguer, chercher et dessiner facilement des trajets, créer des cartes collaboratives qui peuvent être éditées par plusieurs personnes simultanément, similairement à ce qu'[Etherpad](http://etherpad.org/) propose pour l'édition collaborative de texte. [FacilMap](https://github.com/FacilMap/facilmap) est une carte interactive polyvalente, libre et respectueuse de la vie privée qui regroupe des nombreux services basés sur les données libres de OpenStreetMap. FacilMap permet de naviguer, chercher et dessiner facilement des trajets, créer des cartes collaboratives qui peuvent être éditées par plusieurs personnes simultanément, similairement à ce qu'[Etherpad](http://etherpad.org/) propose pour l'édition collaborative de texte.
**Version incluse :** 3.0.1 **Version incluse :** 3.1.0
## Captures d'écran ## Captures d'écran

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://github.com/FacilMap/facilmap/archive/refs/tags/v3.0.1.tar.gz
SOURCE_SUM=0cc1a92dc7be0e8dca605ebeaf3874f0f34fea8f6b830ebbe299a3c0deac291d
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
SOURCE_EXTRACT=true

View file

@ -16,7 +16,7 @@ DB_PASSWORD=__DB_PWD__
# OpenRouteService is used for calculating routes with advanced settings # OpenRouteService is used for calculating routes with advanced settings
# Get a token on https://go.openrouteservice.org/ # Get a token on https://go.openrouteservice.org/
OSR_TOKEN=__OSR_TOKEN__ ORS_TOKEN=__ORS_TOKEN__
# MapBox is used for calculating routes with simple settings # MapBox is used for calculating routes with simple settings
# Get an API key on https://www.mapbox.com/signup/ # Get an API key on https://www.mapbox.com/signup/

View file

@ -5,11 +5,12 @@ After=network.target
[Service] [Service]
Type=simple Type=simple
Environment=NODE_ENV=production Environment=NODE_ENV=production
Environment=DOTENV_CONFIG_PATH=__FINALPATH__/etc/facilmap.env
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
Environment="__YNH_NODE_LOAD_PATH__" Environment="__YNH_NODE_LOAD_PATH__"
ExecStart=/bin/sh -c ' yarn server' ExecStart=__FINALPATH__/bin/facilmap-server
WorkingDirectory=__FINALPATH__/server/ WorkingDirectory=__FINALPATH__
StandardOutput=syslog StandardOutput=syslog
StandardError=syslog StandardError=syslog
SyslogIdentifier=__APP__ SyslogIdentifier=__APP__

View file

@ -6,7 +6,7 @@
"en": "Collaborative maps and routing with a straightforward interface", "en": "Collaborative maps and routing with a straightforward interface",
"fr": "Carte collaborative avec une interface simple et pratique" "fr": "Carte collaborative avec une interface simple et pratique"
}, },
"version": "3.0.1~ynh1", "version": "3.1.0~ynh1",
"url": "https://github.com/FacilMap/facilmap", "url": "https://github.com/FacilMap/facilmap",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"maintainer": { "maintainer": {
@ -49,7 +49,7 @@
} }
}, },
{ {
"name": "osr_token", "name": "ors_token",
"type": "string", "type": "string",
"help": { "help": {
"en": "OpenRouteService is used for calculating routes with advanced settings. You can get a token on https://go.openrouteservice.org/", "en": "OpenRouteService is used for calculating routes with advanced settings. You can get a token on https://go.openrouteservice.org/",
@ -84,7 +84,7 @@
}, },
{ {
"name": "maxmind_license_key", "name": "maxmind_license_key",
"type": "password", "type": "string",
"help": { "help": {
"en": "License key associated to the maxmind user id you specified.", "en": "License key associated to the maxmind user id you specified.",
"fr": "La clé de license associée à l'utilisateur maxmind que vous avez spécifié." "fr": "La clé de license associée à l'utilisateur maxmind que vous avez spécifié."

View file

@ -8,11 +8,41 @@
pkg_dependencies="" pkg_dependencies=""
nodejs_version=14 nodejs_version=14
facilmap_version=3.1.0
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS
#================================================= #=================================================
facilmap_add_config() {
mkdir -p "$final_path/etc"
ynh_add_config --template="../conf/config.env" --destination="$final_path/etc/facilmap.env"
}
facilmap_set_permissions() {
chown -R root:root $final_path
mkdir -p "$final_path/lib/node_modules/facilmap-server/cache"
chown -R facilmap:facilmap "$final_path/lib/node_modules/facilmap-server/cache"
}
facilmap_install_app() {
chown -R "$app":"$app" $final_path
pushd "$final_path"
ynh_exec_as "$app" "$ynh_node_load_PATH" "$ynh_npm" install --prefix "$final_path" -g facilmap-server@"$facilmap_version"
popd
}
facilmap_create_user() {
ynh_system_user_create --username=$app --home_dir="$final_path"
mkdir -p "$final_path"
}
facilmap_create_db() {
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
echo "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci" | ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name
}
#================================================= #=================================================
# EXPERIMENTAL HELPERS # EXPERIMENTAL HELPERS
#================================================= #=================================================

View file

@ -31,7 +31,7 @@ is_public=$YNH_APP_ARG_IS_PUBLIC
user_agent="$YNH_APP_ARG_USER_AGENT" user_agent="$YNH_APP_ARG_USER_AGENT"
# APIS TOKENS # APIS TOKENS
osr_token="$YNH_APP_ARG_OSR_TOKEN" ors_token="$YNH_APP_ARG_ORS_TOKEN"
mapbox_token="$YNH_APP_ARG_MAPBOX_TOKEN" mapbox_token="$YNH_APP_ARG_MAPBOX_TOKEN"
mapzen_token="$YNH_APP_ARG_MAPZEN_TOKEN" mapzen_token="$YNH_APP_ARG_MAPZEN_TOKEN"
maxmind_user_id="$YNH_APP_ARG_MAXMIND_USER_ID" maxmind_user_id="$YNH_APP_ARG_MAXMIND_USER_ID"
@ -58,7 +58,7 @@ ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=user_agent --value=$user_agent ynh_app_setting_set --app=$app --key=user_agent --value=$user_agent
ynh_app_setting_set --app=$app --key=osr_token --value=$osr_token ynh_app_setting_set --app=$app --key=ors_token --value=$ors_token
ynh_app_setting_set --app=$app --key=mapbox_token --value=$mapbox_token ynh_app_setting_set --app=$app --key=mapbox_token --value=$mapbox_token
ynh_app_setting_set --app=$app --key=mapzen_token --value=$mapzen_token ynh_app_setting_set --app=$app --key=mapzen_token --value=$mapzen_token
ynh_app_setting_set --app=$app --key=maxmind_user_id --value=$maxmind_user_id ynh_app_setting_set --app=$app --key=maxmind_user_id --value=$maxmind_user_id
@ -97,9 +97,6 @@ ynh_script_progression --message="Installing NodeJS..." --weight=30
ynh_install_nodejs --nodejs_version=$nodejs_version ynh_install_nodejs --nodejs_version=$nodejs_version
# Install Yarn
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
#================================================= #=================================================
# CREATE A MYSQL DATABASE # CREATE A MYSQL DATABASE
#================================================= #=================================================
@ -107,21 +104,19 @@ ynh_script_progression --message="Creating a MySQL database..." --weight=2
db_name=$(ynh_sanitize_dbid --db_name=$app) db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name db_user=$db_name
db_pwd= # Will be set by facilmap_create_db
ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name facilmap_create_db
echo "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci" | ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." --weight=100 #ynh_script_progression --message="Setting up source files..." --weight=100
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
# Remove docs, they are not needed and take a lot of space # Download, check integrity, uncompress and patch the source from app.src
rm -rf "$final_path/docs" #ynh_setup_source --dest_dir="$final_path"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
@ -137,7 +132,7 @@ ynh_add_nginx_config
ynh_script_progression --message="Configuring system user..." --weight=1 ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user # Create a system user
ynh_system_user_create --username=$app --home_dir="/home/$app" facilmap_create_user
#================================================= #=================================================
# SPECIFIC SETUP # SPECIFIC SETUP
@ -146,13 +141,7 @@ ynh_system_user_create --username=$app --home_dir="/home/$app"
#================================================= #=================================================
ynh_script_progression --message="Building node dependencies..." --time --weight=1 ynh_script_progression --message="Building node dependencies..." --time --weight=1
chown -R "$app":"$app" $final_path facilmap_install_app
pushd "$final_path"
ynh_use_nodejs
sudo -u $app env $ynh_node_load_PATH yarn install
sudo -u $app env $ynh_node_load_PATH yarn build
popd
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
@ -166,7 +155,7 @@ ynh_add_systemd_config --others_var="ynh_node_load_PATH"
# ADD A CONFIGURATION # ADD A CONFIGURATION
#================================================= #=================================================
ynh_add_config --template="../conf/config.env" --destination="$final_path/config.env" facilmap_add_config
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
@ -174,8 +163,8 @@ ynh_add_config --template="../conf/config.env" --destination="$final_path/config
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES
#================================================= #=================================================
# Make only server/cache subdirectory accessible to facilmap to write # Set permissions on app files
chown -R root:root $final_path && chown -R $app:$app $final_path/server/cache facilmap_set_permissions
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE

View file

@ -65,14 +65,16 @@ ynh_restore_file --origin_path="$final_path"
ynh_script_progression --message="Recreating the dedicated system user..." --time --weight=1 ynh_script_progression --message="Recreating the dedicated system user..." --time --weight=1
# Create the dedicated user (if not existing) # Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="/home/$app" ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# RESTORE USER RIGHTS # RESTORE USER RIGHTS
#================================================= #=================================================
# Restore permissions on app files # Restore permissions on app files
chown -R root:root $final_path && chown -R $app:$app $final_path/server/cache chown -R root:root $final_path
mkdir -p "$final_path/lib/node_modules/facilmap-server/cache"
chown -R facilmap:facilmap "$final_path/lib/node_modules/facilmap-server/cache"
#================================================= #=================================================
# SPECIFIC RESTORATION # SPECIFIC RESTORATION
@ -91,17 +93,14 @@ ynh_script_progression --message="Installing NodeJS..." --time --weight=15
ynh_install_nodejs --nodejs_version=$nodejs_version ynh_install_nodejs --nodejs_version=$nodejs_version
# Reinstall Yarn
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
#================================================= #=================================================
# RESTORE THE MYSQL DATABASE # RESTORE THE MYSQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Restoring the MySQL database..." --time --weight=1 ynh_script_progression --message="Restoring the MySQL database..." --time --weight=1
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
echo "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci" | ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name facilmap_create_db
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#================================================= #=================================================

View file

@ -26,7 +26,7 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
# APIS TOKENS AND USER AGENT (USEFUL TO RESTORE CONFIG FILE) # APIS TOKENS AND USER AGENT (USEFUL TO RESTORE CONFIG FILE)
user_agent=$(ynh_app_setting_get --app=$app --key=user_agent) user_agent=$(ynh_app_setting_get --app=$app --key=user_agent)
osr_token=$(ynh_app_setting_get --app=$app --key=osr_token) ors_token=$(ynh_app_setting_get --app=$app --key=ors_token)
mapbox_token=$(ynh_app_setting_get --app=$app --key=mapbox_token) mapbox_token=$(ynh_app_setting_get --app=$app --key=mapbox_token)
mapzen_token=$(ynh_app_setting_get --app=$app --key=mapzen_token) mapzen_token=$(ynh_app_setting_get --app=$app --key=mapzen_token)
maxmind_user_id=$(ynh_app_setting_get --app=$app --key=maxmind_user_id) maxmind_user_id=$(ynh_app_setting_get --app=$app --key=maxmind_user_id)
@ -65,16 +65,13 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ] #if [ "$upgrade_type" == "UPGRADE_APP" ]
then #then
ynh_script_progression --message="Upgrading source files..." --time --weight=1 # ynh_script_progression --message="Upgrading source files..." --time --weight=1
#
# Download, check integrity, uncompress and patch the source from app.src # # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" # ynh_setup_source --dest_dir="$final_path"
#fi
# Remove docs, they are not needed and take a lot of space
rm -rf "$final_path/docs"
fi
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
@ -98,16 +95,13 @@ ynh_script_progression --message="Installing NodeJS..." --weight=15
ynh_install_nodejs --nodejs_version=$nodejs_version ynh_install_nodejs --nodejs_version=$nodejs_version
# Install Yarn
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --time --weight=1 ynh_script_progression --message="Making sure dedicated system user exists..." --time --weight=1
# Create a dedicated user (if not existing) # Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="/home/$app/" facilmap_create_user
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
@ -116,13 +110,7 @@ ynh_system_user_create --username=$app --home_dir="/home/$app/"
#================================================= #=================================================
ynh_script_progression --message="Building node dependencies..." --weight=90 ynh_script_progression --message="Building node dependencies..." --weight=90
chown -R "$app":"$app" $final_path facilmap_install_app
pushd "$final_path"
ynh_use_nodejs
sudo -u $app env $ynh_node_load_PATH yarn install
sudo -u $app env $ynh_node_load_PATH yarn build
popd
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
@ -136,7 +124,7 @@ ynh_add_systemd_config --others_var="ynh_node_load_PATH"
# UPDATE A CONFIG FILE # UPDATE A CONFIG FILE
#================================================= #=================================================
ynh_add_config --template="../conf/config.env" --destination="$final_path/config.env" facilmap_add_config
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
@ -145,7 +133,7 @@ ynh_add_config --template="../conf/config.env" --destination="$final_path/config
#================================================= #=================================================
# Set permissions on app files # Set permissions on app files
chown -R root:root $final_path && chown -R $app:$app $final_path/server/cache facilmap_set_permissions
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE