From d86c2522b977c6de044466c9b9c37609a340d23d Mon Sep 17 00:00:00 2001 From: Garwinch Date: Sun, 4 Dec 2016 18:16:03 +0100 Subject: [PATCH 01/11] firts files set design from https://github.com/YunoHost-Apps/my_webapp_ynh --- manifest.json | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/manifest.json b/manifest.json index 513d033..8db5cc9 100644 --- a/manifest.json +++ b/manifest.json @@ -1,17 +1,17 @@ { - "name": "YunoHost example app", - "id": "ynhexample", + "name": "cagette_app", + "id": "cagette", "packaging_format": 1, "description": { - "en": "Example package for YunoHost application.", - "fr": "Exemple de package d’application pour YunoHost." + "en": "Package for Cagette;net application in YunoHost.", + "fr": "Package pour l’application Cagette.net pour YunoHost." }, - "url": "https://example.com", - "license": "free", + "url": "http://www.cagette.net", + "license": "CC Attribution-Share Alike 4.0 International", "maintainer": { - "name": "John doe", - "email": "john.doe@example.com", - "url": "http://example.com" + "name": "Forissier Gaspard", + "email": "gaspard@garwinch.ddns.net", + "url": "https://garwinch.ddns.net" }, "requirements": { "yunohost": ">> 2.4.0" @@ -28,20 +28,16 @@ "name": "domain", "type": "domain", "ask": { - "en": "Choose a domain name for ynhexample", - "fr": "Choisissez un nom de domaine pour ynhexample" + "en": "Choose a domain name for cagette_app", + "fr": "Choisissez un nom de domaine pour cagette_app" }, "example": "example.com" }, { "name": "path", "type": "path", - "ask": { - "en": "Choose a path for ynhexample", - "fr": "Choisissez un chemin pour ynhexample" - }, - "example": "/example", - "default": "/example" + + "default": "/" }, { "name": "admin", From 499e2811a2519fd7be45a11d1dfcadf2b762e2ed Mon Sep 17 00:00:00 2001 From: Garwinch Date: Sun, 4 Dec 2016 18:17:41 +0100 Subject: [PATCH 02/11] first set disign from https://github.com/YunoHost-Apps/my_webapp_ynh --- conf/nginx.conf | 67 ++++++++++++++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 26 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 8c76342..1bd6854 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,33 +1,48 @@ -location YNH_WWW_PATH { +location / { + alias /var/www/cagette_app/www/; - # Path to source - alias YNH_WWW_ALIAS ; + # Default indexes and catch-all + index index.html index.php; + try_files $uri $uri/ /index.php?$args; - # Example PHP configuration (remove if not used) - index index.php; + # Prevent useless logs + location = /favicon.ico { + log_not_found off; + access_log off; + } + location = /robots.txt { + allow all; + log_not_found off; + access_log off; + } - # Common parameter to increase upload size limit in conjuction with dedicated php-fpm file - #client_max_body_size 50M; + # Deny access to hidden files and directories + location ~ ^/(.+/|)\.(?!well-known\/) { + deny all; + } - try_files $uri $uri/ index.php; - location ~ [^/]\.php(/|$) { - fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php5-fpm.sock; - - # Filename to be changed if dedicated php-fpm process is required - # This is to be used INSTEAD of line above - # Don't forget to adjust scripts install/upgrade/remove/backup accordingly - # - #fastcgi_pass unix:/var/run/php5-fpm-YNH_WWW_APP.sock; + # Execute and serve PHP files + location ~ [^/]\.php(/|$) { + fastcgi_split_path_info ^(.+?\.php)(/.*)$; + fastcgi_pass unix:/var/run/php5-fpm-my_webapp__2.sock; + fastcgi_index index.php; + include fastcgi_params; + fastcgi_param REMOTE_USER $remote_user; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param SCRIPT_FILENAME $request_filename; + } - fastcgi_index index.php; - include fastcgi_params; - fastcgi_param REMOTE_USER $remote_user; - fastcgi_param PATH_INFO $fastcgi_path_info; - fastcgi_param SCRIPT_FILENAME $request_filename; - } - # PHP configuration end + # Include SSOWAT user panel. + include conf.d/yunohost_panel.conf.inc; + + location ~ \.(png|gif|jpg|ico|swf|css|js|dat)$ { + } + + location / { + rewrite (.*)/css/[a-z0-9]+/(.*) /css/$2 break; + rewrite (.*)/js/[a-z0-9]+/(.*) /js/$2 break; + rewrite ^(.*)$ /index.php; + } - # Include SSOWAT user panel. - include conf.d/yunohost_panel.conf.inc; } + From 3be1f1c8f48cf789e8336091cbb530a4817304cd Mon Sep 17 00:00:00 2001 From: Garwinch Date: Sun, 4 Dec 2016 18:18:23 +0100 Subject: [PATCH 03/11] first set disign from https://github.com/YunoHost-Apps/my_webapp_ynh --- scripts/backup | 44 +++++++------- scripts/install | 153 ++++++++++++++++++++++++++---------------------- scripts/remove | 50 +++++++++------- scripts/restore | 97 +++++++++++++++++++----------- scripts/upgrade | 78 ++++++++++++------------ 5 files changed, 231 insertions(+), 191 deletions(-) diff --git a/scripts/backup b/scripts/backup index af8ccd9..63f13fb 100755 --- a/scripts/backup +++ b/scripts/backup @@ -3,31 +3,29 @@ # Exit on command errors and treat unset variables as an error set -eu -# See comments in install script +# Get multi-instances specific variables app=$YNH_APP_INSTANCE_NAME -# Source YunoHost helpers -source /usr/share/yunohost/helpers +# Source app helpers +. /usr/share/yunohost/helpers -# Backup sources & data -# Note: the last argument is where to save this path, see the restore script. -ynh_backup "/var/www/${app}" "sources" - -### MySQL (remove if not used) ### -# If a MySQL database is used: -# # Dump the database -# dbname=$app -# dbuser=$app -# dbpass=$(ynh_app_setting_get "$app" mysqlpwd) -# mysqldump -u "$dbuser" -p"$dbpass" --no-create-db "$dbname" > ./dump.sql -### MySQL end ### - -# Copy NGINX configuration +# Retrieve app settings domain=$(ynh_app_setting_get "$app" domain) -ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf" +path=$(ynh_app_setting_get "$app" path) +with_mysql=$(ynh_app_setting_get "$app" with_mysql) -### PHP (remove if not used) ### -# If a dedicated php-fpm process is used: -# # Copy PHP-FPM pool configuration -# ynh_backup "/etc/php5/fpm/pool.d/${app}.conf" "php-fpm.conf" -### PHP end ### +# Copy the app files +DESTDIR="/var/www/${app}" +ynh_backup "$DESTDIR" "sources" 1 + +# Copy the conf files +ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "conf/nginx.conf" +ynh_backup "/etc/php5/fpm/pool.d/${app}.conf" "conf/php-fpm.conf" + +# Dump the database +if [[ $with_mysql -eq 1 ]]; then + dbname=$app + dbuser=$app + dbpass=$(ynh_app_setting_get "$app" mysqlpwd) + mysqldump -u "$dbuser" -p"$dbpass" --no-create-db "$dbname" > ./dump.sql +fi diff --git a/scripts/install b/scripts/install index f1b2bf4..5f60c90 100755 --- a/scripts/install +++ b/scripts/install @@ -3,90 +3,103 @@ # Exit on command errors and treat unset variables as an error set -eu -# This is a multi-instance app, meaning it can be installed several times independently -# The id of the app as stated in the manifest is available as $YNH_APP_ID -# The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...) -# The app instance name is available as $YNH_APP_INSTANCE_NAME -# - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample -# - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2 -# - ynhexample__{N} for the subsequent installations, with N=3,4, ... -# The app instance name is probably what you are interested the most, since this is -# guaranteed to be unique. This is a good unique identifier to define installation path, -# db names, ... +# Get instances specific variables app=$YNH_APP_INSTANCE_NAME + # Retrieve arguments -domain=$YNH_APP_ARG_DOMAIN -path=$YNH_APP_ARG_PATH -admin=$YNH_APP_ARG_ADMIN -is_public=$YNH_APP_ARG_IS_PUBLIC -language=$YNH_APP_ARG_LANGUAGE +domain=$1 +path=${2%/} +password=$3 +is_public=$4 +with_mysql=$5 -# Source YunoHost helpers -source /usr/share/yunohost/helpers - -# Save app settings -ynh_app_setting_set "$app" admin "$admin" -ynh_app_setting_set "$app" is_public "$is_public" -ynh_app_setting_set "$app" language "$language" +# Source app helpers +. /usr/share/yunohost/helpers # Check domain/path availability sudo yunohost app checkurl "${domain}${path}" -a "$app" \ - || ynh_die "Path not available: ${domain}${path}" + || exit 1 -# Copy source files -src_path=/var/www/$app -sudo mkdir -p $src_path -sudo cp -a ../sources/. $src_path +# Check password strength +[[ ${#password} -gt 5 ]] || ynh_die \ +"The password is too weak, it must be longer than 5 characters" -# Set permissions to app files -# you may need to make some file and/or directory writeable by www-data (nginx user) -sudo chown -R root: $src_path +# Check destination directory +DESTDIR="/var/www/${app}" +[[ -d "$DESTDIR" ]] && ynh_die \ +"The destination directory '${DESTDIR}' already exists.\ + You should safely delete it before installing this app." -### MySQL (can be removed if not used) ### -# If your app use a MySQL database you can use these lines to bootstrap -# a database, an associated user and save the password in app settings. -# -# # Generate MySQL password and create database -# dbuser=$app -# dbname=$app -# dbpass=$(ynh_string_random 12) -# ynh_app_setting_set "$app" mysqlpwd "$dbpass" -# ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass" -# -# # Load initial SQL into the new database -# ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" \ -# < "../sources/sql/mysql.init.sql" -### MySQL end ### +# Save app settings +user="webapp${app_nb}" +ynh_app_setting_set "$app" is_public "$is_public" +ynh_app_setting_set "$app" with_mysql "$with_mysql" +ynh_app_setting_set "$app" password "$password" +ynh_app_setting_set "$app" user "$user" -# Modify Nginx configuration file and copy it to Nginx conf directory -nginx_conf=../conf/nginx.conf -sed -i "s@YNH_WWW_PATH@$path@g" $nginx_conf -sed -i "s@YNH_WWW_ALIAS@$src_path/@g" $nginx_conf -# If a dedicated php-fpm process is used: -# Don't forget to modify ../conf/nginx.conf accordingly or your app will not work! -# sed -i "s@YNH_WWW_APP@$app@g" $nginx_conf -sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf +# Create the user account +sudo useradd -c "${app} user account" \ + -d "$DESTDIR" -M -g www-data "$user" \ + || ynh_die "Unable to create user account" +sudo chpasswd <<< "${user}:${password}" -### PHP (can be removed if not used) ### -# If a dedicated php-fpm process is used: -# Don't forget to modify ../conf/php-fpm.conf accordingly or your app will not work! -# -# # Modify PHP-FPM pool configuration and copy it to the pool directory -# sed -i "s@YNH_WWW_APP@$app@g" ../conf/php-fpm.conf -# sed -i "s@YNH_WWW_ALIAS@$src_path/@g" ../conf/php-fpm.conf -# finalphpconf=/etc/php5/fpm/pool.d/$app.conf -# sudo cp ../conf/php-fpm.conf $finalphpconf -# sudo chown root: $finalphpconf -# sudo chmod 644 $finalphpconf -# sudo service php5-fpm reload -### PHP end ### +# Harden SSH connection for the user +echo "##-> ${app} +# Hardening user connection +Match User ${user} + ChrootDirectory %h + ForceCommand internal-sftp + AllowTcpForwarding no + PermitTunnel no + X11Forwarding no +##<- ${app}" | sudo tee -a /etc/ssh/sshd_config >/dev/null -# If app is public, add url to SSOWat conf as skipped_uris -if [[ $is_public -eq 1 ]]; then - # unprotected_uris allows SSO credentials to be passed anyway. - ynh_app_setting_set "$app" unprotected_uris "/" +# Specify the user and the domain in the home page +sed -i "s@{DOMAIN}@${domain}@g" ../sources/www/index.html +sed -i "s@{USER}@${user}@g" ../sources/www/index.html + +# Initialize database as needed +if [[ $with_mysql -eq 1 ]]; then + dbname=$app + dbuser=$app + dbpass=$(ynh_string_random) + ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass" + + # Store the database access + echo -e "# MySQL Database +name: ${dbname}\nuser: ${dbuser}\npass: ${dbpass}" > ../sources/db_access.txt + ynh_app_setting_set "$app" mysqlpwd "$dbpass" fi +# Copy files to the right place and set permissions +sudo cp -r ../sources "$DESTDIR" +sudo chown -hR "${user}:" "$DESTDIR" + +# Home directory of the user need to be owned by root to allow +# SFTP connections +sudo chown root: "$DESTDIR" + +# Set SSOwat rules +[[ $is_public -eq 1 ]] \ + && ynh_app_setting_set "$app" skipped_uris "/" + +# Copy and set nginx configuration +nginx_conf="/etc/nginx/conf.d/${domain}.d/${app}.conf" +sed -i "s@{PATH}@${path}@g" ../conf/nginx.conf +sed -i "s@{LOCATION}@${path:-/}@g" ../conf/nginx.conf +sed -i "s@{DESTDIR}@${DESTDIR}@g" ../conf/nginx.conf +sed -i "s@{POOLNAME}@${app}@g" ../conf/nginx.conf +sudo cp ../conf/nginx.conf "$nginx_conf" + +# Copy and set php-fpm configuration +phpfpm_conf="/etc/php5/fpm/pool.d/${app}.conf" +sed -i "s@{USER}@${user}@g" ../conf/php-fpm.conf +sed -i "s@{POOLNAME}@${app}@g" ../conf/php-fpm.conf +sed -i "s@{DESTDIR}@${DESTDIR}@g" ../conf/php-fpm.conf +sudo cp ../conf/php-fpm.conf "$phpfpm_conf" + # Reload services +sudo service php5-fpm reload sudo service nginx reload +sudo service sshd reload diff --git a/scripts/remove b/scripts/remove index 59ef331..021afa4 100755 --- a/scripts/remove +++ b/scripts/remove @@ -1,34 +1,40 @@ #!/bin/bash -# See comments in install script +# Get multi-instances specific variables app=$YNH_APP_INSTANCE_NAME +app_nb=$YNH_APP_INSTANCE_NUMBER -# Source YunoHost helpers -source /usr/share/yunohost/helpers +# Source app helpers +. /usr/share/yunohost/helpers # Retrieve app settings domain=$(ynh_app_setting_get "$app" domain) +with_mysql=$(ynh_app_setting_get "$app" with_mysql) +user=$(ynh_app_setting_get "$app" user) -# Remove sources -sudo rm -rf /var/www/$app +# Drop MySQL database and user as needed +if [[ $with_mysql -eq 1 ]]; then + dbname=$app + dbuser=$app + dbpass=$(ynh_app_setting_get "$app" mysqlpwd) + ynh_mysql_drop_db $dbname || true + ynh_mysql_drop_user $dbuser || true +fi -# Remove nginx configuration file -sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf +# Delete app directory and configurations +sudo rm -rf "/var/www/${app}" +sudo rm -f "/etc/php5/fpm/pool.d/${app}.conf" +[[ -n $domain ]] && sudo rm -f "/etc/nginx/conf.d/${domain}.d/${app}.conf" -### PHP (remove if not used) ### -# If a dedicated php-fpm process is used: -# sudo rm -f /etc/php5/fpm/pool.d/$app.conf -# sudo service php5-fpm reload -### PHP end ### +# Remove custom SSH configuration +sudo sed -i "/##-> ${app}/,/##<- ${app}/d" /etc/ssh/sshd_config -### MySQL (remove if not used) ### -# If a MySQL database is used: -# # Drop MySQL database and user -# dbname=$app -# dbuser=$app -# ynh_mysql_drop_db "$dbname" || true -# ynh_mysql_drop_user "$dbuser" || true -### MySQL end ### +# Reload services +sudo service php5-fpm restart || true +sudo service nginx reload || true +sudo service sshd reload -# Reload nginx service -sudo service nginx reload +# Remove the user account +id "$user" >/dev/null 2>&1 \ + && sudo deluser --quiet --force "$user" >/dev/null \ + || true diff --git a/scripts/restore b/scripts/restore index a83fa6d..eb5a6d6 100755 --- a/scripts/restore +++ b/scripts/restore @@ -1,52 +1,81 @@ #!/bin/bash -# Note: each files and directories you've saved using the ynh_backup helper -# will be located in the current directory, regarding the last argument. +set -e -# Exit on command errors and treat unset variables as an error -set -eu - -# See comments in install script +# Get multi-instances specific variables app=$YNH_APP_INSTANCE_NAME -# Source YunoHost helpers -source /usr/share/yunohost/helpers +# Source app helpers +. /usr/share/yunohost/helpers # Retrieve old app settings domain=$(ynh_app_setting_get "$app" domain) path=$(ynh_app_setting_get "$app" path) +with_mysql=$(ynh_app_setting_get "$app" with_mysql) +password=$(ynh_app_setting_get "$app" password) +user=$(ynh_app_setting_get "$app" user) # Check domain/path availability sudo yunohost app checkurl "${domain}${path}" -a "$app" \ - || ynh_die "Path not available: ${domain}${path}" + || exit 1 -# Restore sources & data -src_path="/var/www/${app}" -sudo cp -a ./sources "$src_path" +# Check destination directory +DESTDIR="/var/www/$app" +[[ -d $DESTDIR ]] && ynh_die \ +"The destination directory '$DESTDIR' already exists.\ + You should safely delete it before restoring this app." -# Restore permissions to app files -# you may need to make some file and/or directory writeable by www-data (nginx user) -sudo chown -R root: "$src_path" +# Check configuration files +nginx_conf="/etc/nginx/conf.d/${domain}.d/${app}.conf" +[[ -f $nginx_conf ]] && ynh_die \ +"The NGINX configuration already exists at '${nginx_conf}'. + You should safely delete it before restoring this app." +phpfpm_conf="/etc/php5/fpm/pool.d/${app}.conf" +[[ -f $phpfpm_conf ]] && ynh_die \ +"The PHP FPM configuration already exists at '${phpfpm_conf}'. + You should safely delete it before restoring this app." -### MySQL (remove if not used) ### -# If a MySQL database is used: -# # Create and restore the database -# dbname=$app -# dbuser=$app -# dbpass=$(ynh_app_setting_get "$app" mysqlpwd) -# ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass" -# ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < ./dump.sql -### MySQL end ### +# Create the user account +sudo useradd -c "${app} user account" \ + -d "$DESTDIR" -M -g www-data "$user" \ + || ynh_die "Unable to create user account" +sudo chpasswd <<< "${user}:${password}" -# Restore NGINX configuration -sudo cp -a ./nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf" +# Harden SSH connection for the user +echo "##-> ${app} +# Hardening user connection +Match User ${user} + ChrootDirectory %h + ForceCommand internal-sftp + AllowTcpForwarding no + PermitTunnel no + X11Forwarding no +##<- ${app}" | sudo tee -a /etc/ssh/sshd_config >/dev/null -### PHP (remove if not used) ### -# If a dedicated php-fpm process is used: -# # Copy PHP-FPM pool configuration and reload the service -# sudo cp -a ./php-fpm.conf "/etc/php5/fpm/pool.d/${app}.conf" -# sudo service php5-fpm reload -### PHP end ### +# Restore the app files +sudo cp -a ./sources "$DESTDIR" +sudo chown -hR "${user}:" "$DESTDIR" -# Restart webserver -sudo service nginx reload +# Home directory of the user need to be owned by root to allow +# SFTP connections +sudo chown root: "$DESTDIR" + +# Create and restore the database as needed +if [[ $with_mysql -eq 1 ]]; then + dbname=$app + dbuser=$app + dbpass=$(ynh_app_setting_get "$app" mysqlpwd) + ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass" + [[ -f ./dump.sql ]] \ + && ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < ./dump.sql \ + || echo "No MySQL dump has been found" >&2 +fi + +# Restore configuration files +sudo cp -a ./conf/nginx.conf "$nginx_conf" +sudo cp -a ./conf/php-fpm.conf "$phpfpm_conf" + +# Reload services +sudo service php5-fpm reload || true +sudo service nginx reload || true +sudo service sshd reload diff --git a/scripts/upgrade b/scripts/upgrade index 1decc77..6181f54 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,59 +1,53 @@ #!/bin/bash -# Exit on command errors and treat unset variables as an error set -eu -# See comments in install script +# Get multi-instances specific variables app=$YNH_APP_INSTANCE_NAME -# Source YunoHost helpers -source /usr/share/yunohost/helpers +# Source app helpers +. /usr/share/yunohost/helpers # Retrieve app settings domain=$(ynh_app_setting_get "$app" domain) path=$(ynh_app_setting_get "$app" path) -admin=$(ynh_app_setting_get "$app" admin) -is_public=$(ynh_app_setting_get "$app" is_public) -language=$(ynh_app_setting_get "$app" language) - -# Remove trailing "/" for next commands path=${path%/} +is_public=$(ynh_app_setting_get "$app" is_public) +with_mysql=$(ynh_app_setting_get "$app" with_mysql) +password=$(ynh_app_setting_get "$app" password) +user=$(ynh_app_setting_get "$app" user) -# Copy source files -src_path=/var/www/$app -sudo mkdir -p $src_path -sudo cp -a ../sources/. $src_path +([[ -n "$with_mysql" ]] && [[ -n "$password" ]] && [[ -n "$user" ]]) \ + || ynh_die "The app changed and can not be automatically upgraded. \ +You will have to manually upgrade it following those instructions: \ +https://github.com/garwinch/Yuno_app_cagette#upgrade" -# Set permissions to app files -# you may need to make some file and/or directory writeable by www-data (nginx user) -sudo chown -R root: $src_path +# Check destination directory +DESTDIR="/var/www/$app" +[[ ! -d $DESTDIR ]] && ynh_die \ +"The destination directory '$DESTDIR' does not exist.\ + The app is not correctly installed, you should remove it first." -# Modify Nginx configuration file and copy it to Nginx conf directory -nginx_conf=../conf/nginx.conf -sed -i "s@YNH_WWW_PATH@$path@g" $nginx_conf -sed -i "s@YNH_WWW_ALIAS@$src_path/@g" $nginx_conf -# If a dedicated php-fpm process is used: -# -# sed -i "s@YNH_WWW_APP@$app@g" $nginx_conf -sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf +# Harden SSH connection for the user +sudo sed -i "/##-> ${app}/,/##<- ${app}/d" /etc/ssh/sshd_config +echo "##-> ${app} +# Hardening user connection +Match User ${user} + ChrootDirectory %h + ForceCommand internal-sftp + AllowTcpForwarding no + PermitTunnel no + X11Forwarding no +##<- ${app}" | sudo tee -a /etc/ssh/sshd_config >/dev/null -### PHP (remove if not used) ### -# If a dedicated php-fpm process is used: -# # Modify PHP-FPM pool configuration and copy it to the pool directory -# sed -i "s@YNH_WWW_APP@$app@g" ../conf/php-fpm.conf -# sed -i "s@YNH_WWW_ALIAS@$src_path/@g" ../conf/php-fpm.conf -# finalphpconf=/etc/php5/fpm/pool.d/$app.conf -# sudo cp ../conf/php-fpm.conf $finalphpconf -# sudo chown root: $finalphpconf -# sudo chmod 644 $finalphpconf -# sudo service php5-fpm restart -### PHP end ### +# Fix permissions +sudo chown -hR "${user}:" "$DESTDIR" -# If app is public, add url to SSOWat conf as skipped_uris -if [[ $is_public -eq 1 ]]; then - # See install script - ynh_app_setting_set "$app" unprotected_uris "/" -fi +# Home directory of the user need to be owned by root to allow +# SFTP connections +sudo chown root: "$DESTDIR" + +# Set SSOwat rules +[[ $is_public -eq 1 ]] \ + && ynh_app_setting_set "$app" skipped_uris "/" -# Reload nginx service -sudo service nginx reload From 5339dff640d3089d93ab4ecaf4215a4b72d2dcb5 Mon Sep 17 00:00:00 2001 From: Garwinch Date: Sun, 4 Dec 2016 18:27:17 +0100 Subject: [PATCH 06/11] Add files via upload --- README.md | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 6d6cb13..a83f2bb 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,5 @@ -# YunoHost example app +# Cagette app -## Usage -- Add application source files into `sources` subfolder. -- Edit `conf/nginx.conf` file to match application prerequisites. -- Edit manifest with application specific information. -- Edit the install, upgrade, remove, backup, restore scripts. -- Add a LICENSE file for the package. +##Premiers pas -**More information on the documentation page:** -https://yunohost.org/packaging_apps +- cette app est à létat de test, il s'agit des prmiers fichiers adapté pour la plupart de https://github.com/YunoHost-Apps/my_webapp_ynh et de https://github.com/YunoHost/example_ynh From 175b99034306830449d261019457fb2f22630569 Mon Sep 17 00:00:00 2001 From: Garwinch Date: Sun, 4 Dec 2016 18:28:08 +0100 Subject: [PATCH 07/11] Add files via upload --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a83f2bb..e08f98f 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,4 @@ ##Premiers pas -- cette app est à létat de test, il s'agit des prmiers fichiers adapté pour la plupart de https://github.com/YunoHost-Apps/my_webapp_ynh et de https://github.com/YunoHost/example_ynh +- cette app est à l'état de test, il s'agit des premiers fichiers adaptés pour la plupart de https://github.com/YunoHost-Apps/my_webapp_ynh et de https://github.com/YunoHost/example_ynh From 8c5bef609623feccc3a433f53f576862464f3cee Mon Sep 17 00:00:00 2001 From: Garwinch Date: Sun, 4 Dec 2016 18:30:59 +0100 Subject: [PATCH 08/11] Add files via upload --- sources/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/README.md b/sources/README.md index bd2bfad..7dbb103 100644 --- a/sources/README.md +++ b/sources/README.md @@ -1,3 +1,3 @@ -Place the sources of the webapp in this folder. +The sources of the webapp are based on -This file can be removed. +https://github.com/bablukid/cagette From c2847b4588285b4b146006a9251ff6942e50207b Mon Sep 17 00:00:00 2001 From: Garwinch Date: Sun, 4 Dec 2016 18:53:39 +0100 Subject: [PATCH 09/11] Create vendor__view.mtt.php --- sources/cagette-php/lang/fr/tmp/vendor__view.mtt.php | 1 + 1 file changed, 1 insertion(+) create mode 100644 sources/cagette-php/lang/fr/tmp/vendor__view.mtt.php diff --git a/sources/cagette-php/lang/fr/tmp/vendor__view.mtt.php b/sources/cagette-php/lang/fr/tmp/vendor__view.mtt.php new file mode 100644 index 0000000..05834ff --- /dev/null +++ b/sources/cagette-php/lang/fr/tmp/vendor__view.mtt.php @@ -0,0 +1 @@ +test files From 6ebe6a8db3b105d8258b163e91063c02928c7306 Mon Sep 17 00:00:00 2001 From: Garwinch Date: Sun, 4 Dec 2016 18:54:29 +0100 Subject: [PATCH 10/11] Add files via upload --- sources/config.xml.dist | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 sources/config.xml.dist diff --git a/sources/config.xml.dist b/sources/config.xml.dist new file mode 100644 index 0000000..00a9552 --- /dev/null +++ b/sources/config.xml.dist @@ -0,0 +1,28 @@ + \ No newline at end of file From 5d4c205bf912cbdc2cd4c1aa805eff7ba351c0ee Mon Sep 17 00:00:00 2001 From: Garwinch Date: Mon, 5 Dec 2016 11:50:10 +0100 Subject: [PATCH 11/11] Update manifest.json --- manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 8db5cc9..3e05944 100644 --- a/manifest.json +++ b/manifest.json @@ -3,11 +3,11 @@ "id": "cagette", "packaging_format": 1, "description": { - "en": "Package for Cagette;net application in YunoHost.", + "en": "Package for Cagette.net application in YunoHost.", "fr": "Package pour l’application Cagette.net pour YunoHost." }, "url": "http://www.cagette.net", - "license": "CC Attribution-Share Alike 4.0 International", + "license": "free", "maintainer": { "name": "Forissier Gaspard", "email": "gaspard@garwinch.ddns.net",