diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..2729a6b --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,55 @@ +--- +name: Bug report +about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently. + +--- + +**How to post a meaningful bug report** +1. *Read this whole template first.* +2. *Determine if you are on the right place:* + - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!* + - *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.* + - *When in doubt, post here and we will figure it out together.* +3. *Delete the italic comments as you write over them below, and remove this guide.* +--- + +### Describe the bug + +*A clear and concise description of what the bug is.* + +### Context + +- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...* +- YunoHost version: x.x.x +- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...* +- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes* + - If yes, please explain: +- Using, or trying to install package version/branch: +- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`* + +### Steps to reproduce + +- *If you performed a command from the CLI, the command itself is enough. For example:* + ```sh + sudo yunohost app install the_app + ``` +- *If you used the webadmin, please perform the equivalent command from the CLI first.* +- *If the error occurs in your browser, explain what you did:* + 1. *Go to '...'* + 2. *Click on '...'* + 3. *Scroll down to '...'* + 4. *See error* + +### Expected behavior + +*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.* + +### Logs + +*When an operation fails, YunoHost provides a simple way to share the logs.* +- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.* +- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.* + +*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)* + +*If applicable and useful, add screenshots to help explain your problem.* diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..ef70e18 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,16 @@ +## Problem + +- *Description of why you made this PR* + +## Solution + +- *And how do you fix that problem* + +## PR Status + +- [ ] Code finished and ready to be reviewed/tested +- [ ] The fix/enhancement were manually tested (if applicable) + +## Automatic tests + +Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization) diff --git a/README.md b/README.md index b597609..ee726f7 100644 --- a/README.md +++ b/README.md @@ -10,12 +10,12 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to ## Overview Friendica is a software to create a distributed social network. It is part of the federation of servers that are running with Friendica, Diaspora and Hubzilla which are compatible to each other. -**Version:** 2021.01 +**Version:** 2021.04 Current snapshot in *sources*: -* https://github.com/friendica/friendica: 2021.01 -* https://github.com/friendica/friendica-addons: 2021.01 +* https://github.com/friendica/friendica: 2021.04 +* https://github.com/friendica/friendica-addons: 2021.04 **Warning:** It's advised to use Barracuda as MySQL DB file format for your Friendica database. diff --git a/check_process b/check_process index 4b72b27..d073319 100644 --- a/check_process +++ b/check_process @@ -10,10 +10,11 @@ setup_private=0 setup_public=1 upgrade=1 - backup_restore=1 + upgrade=1 from_commit=b3642c110f0e927ba36ee32e738a81e6afce958f7ackup_restore=1 + backup_restore=1 multi_instance=1 port_already_use=0 change_url=0 ;;; Options - Email=anmol@datamol.org + Email="" Notification=change diff --git a/conf/addons.src b/conf/addons.src deleted file mode 100644 index a0c78eb..0000000 --- a/conf/addons.src +++ /dev/null @@ -1,6 +0,0 @@ -SOURCE_URL=https://files.friendi.ca/friendica-addons-2021.01.tar.gz -SOURCE_SUM=13d1a31373ec3e47913386241f5bee7524c18ddb77258cbf7b410450ec2cd601 -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= diff --git a/conf/app.src b/conf/app.src deleted file mode 100644 index 5a0600c..0000000 --- a/conf/app.src +++ /dev/null @@ -1,6 +0,0 @@ -SOURCE_URL=https://files.friendi.ca/friendica-full-2021.01.tar.gz -SOURCE_SUM=b6f6ac81a0dd8e4bd32848ab2b6a54c35baf104d77abb589751fbd4f26edbcd7 -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=2 -SOURCE_FILENAME= diff --git a/manifest.json b/manifest.json index 34d1ea5..c7147f1 100644 --- a/manifest.json +++ b/manifest.json @@ -1,52 +1,52 @@ { - "name": "Friendica", - "id": "friendica", - "packaging_format": 1, - "description": { - "en": "Social Communication Server", - "fr": "Serveur de Communication Social" - }, - "url": "http://friendi.ca", - "license": "AGPL-3.0-only", - "version": "2021.01~ynh2", - "maintainer": { - "name": "Anmol Sharma", - "email": "anmol@datamol.org" - }, - "requirements": { - "yunohost": ">= 4.1.0" - }, - "previous_maintainers": { - "name": "aymhce", - "email": "aymhce@gmail.com" - }, - "multi_instance": true, - "services": [ - "nginx", - "php7.3-fpm", - "mysql" + "name": "Friendica", + "id": "friendica", + "packaging_format": 1, + "description": { + "en": "Social Communication Server", + "fr": "Serveur de Communication Social" + }, + "url": "http://friendi.ca", + "license": "AGPL-3.0-only", + "version": "2021.04~ynh2", + "maintainer": { + "name": "Anmol Sharma", + "email": "" + }, + "requirements": { + "yunohost": ">= 4.1.0" + }, + "previous_maintainers": { + "name": "aymhce", + "email": "aymhce@gmail.com" + }, + "multi_instance": true, + "services": [ + "nginx", + "php7.3-fpm", + "mysql" ], "arguments": { - "install" : [ - { - "name": "domain", - "type": "domain", - "ask": { - "en": "Choose a domain for Friendica. Friendica must be installed on the ROOT domain, so be careful!", - "fr": "Choisissez un domaine pour Friendica.Friendica doit etre installe a la racine, soyez prudent" - }, - "example": "domain.org" - }, - { - "name": "admin", - "type": "user", - "ask": { - "en": "Choose the Friendica administrator (must be an existing YunoHost user)", - "fr": "Choisissez l'administrateur pour Friendica (l'utilisateur YunoHost doit exister)" - }, - "example": "homer" - } + "install" : [ + { + "name": "domain", + "type": "domain", + "ask": { + "en": "Choose a domain for Friendica. Friendica must be installed on the ROOT domain, so be careful!", + "fr": "Choisissez un domaine pour Friendica.Friendica doit etre installe a la racine, soyez prudent" + }, + "example": "domain.org" + }, + { + "name": "admin", + "type": "user", + "ask": { + "en": "Choose the Friendica administrator (must be an existing YunoHost user)", + "fr": "Choisissez l'administrateur pour Friendica (l'utilisateur YunoHost doit exister)" + }, + "example": "homer" + } - ] + ] } } diff --git a/pull_request_template.md b/pull_request_template.md deleted file mode 100644 index 6c28fc5..0000000 --- a/pull_request_template.md +++ /dev/null @@ -1,16 +0,0 @@ -## Problem -- *Description of why you made this PR* - -## Solution -- *And how do you fix that problem* - -## PR Status -- [ ] Code finished. -- [ ] Tested with Package_check. -- [ ] Fix or enhancement tested. -- [ ] Upgrade from last version tested. -- [ ] Can be reviewed and tested. - -## Package_check results ---- -* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"* diff --git a/scripts/_common.sh b/scripts/_common.sh index 0446752..b8749f1 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -8,3 +8,36 @@ YNH_PHP_VERSION="7.3" extra_php_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-gd" + +#================================================= +# EXPERIMENTAL HELPERS +#================================================= + +ynh_smart_mktemp () { + local min_size="${1:-300}" + # Transform the minimum size from megabytes to kilobytes + min_size=$(( $min_size * 1024 )) + + # Check if there's enough free space in a directory + is_there_enough_space () { + local free_space=$(df --output=avail "$1" | sed 1d) + test $free_space -ge $min_size + } + + if is_there_enough_space /tmp; then + local tmpdir=/tmp + elif is_there_enough_space /var; then + local tmpdir=/var + elif is_there_enough_space /; then1 + local tmpdir=/ + elif is_there_enough_space /home; then + local tmpdir=/home + else + ynh_die "Insufficient free space to continue..." + fi + + echo "$(mktemp --directory --tmpdir="$tmpdir")" +} +#================================================= +# FUTURE OFFICIAL HELPERS +#================================================= diff --git a/scripts/install b/scripts/install index 696b753..463903b 100644 --- a/scripts/install +++ b/scripts/install @@ -73,14 +73,14 @@ ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name ynh_script_progression --message="Setting up source files..." 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" +# 1- Clone stable repo +git clone https://github.com/friendica/friendica.git -b stable "$final_path" +# Copy .htaccess-dist to ..htaccess cp -f "$final_path/.htaccess-dist" "$final_path/.htaccess" -# 2 - Addons -mkdir $final_path/addon -ynh_setup_source --dest_dir="$final_path/addon" --source_id="addons" +# 2 - Clone addons repo +git clone https://github.com/friendica/friendica-addons.git -b stable "$final_path/addon" #================================================= # NGINX CONFIGURATION @@ -119,7 +119,7 @@ ynh_system_user_create --username=$app #================================================= ynh_script_progression --message="Configuring php-fpm..." -# Create a dedicated php-fpm config +# Create a dedicated php-fpm configy ynh_add_fpm_config --package="$extra_php_dependencies" phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) @@ -142,7 +142,7 @@ ynh_store_file_checksum --file="$final_path/config/local.config.php" # Run composer pushd "$final_path" - php$phpversion bin/composer.phar install + php$phpversion bin/composer.phar install 2>/dev/null bin/console config system addon ldapauth popd ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" <<< "INSERT INTO addon (id, name, version, installed, hidden, timestamp, plugin_admin) VALUES (NULL, 'ldapauth', '', '1', '0', UNIX_TIMESTAMP(), '0');" diff --git a/scripts/upgrade b/scripts/upgrade index 7affa29..83e7989 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -94,15 +94,51 @@ fi if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Upgrading source files..." - # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" +# Check if the repo can be updated with git + if [ `cd $final_path && git rev-parse --is-inside-work-tree` ]; + then + # Update through git + pushd "$final_path" + git fetch + git checkout stable + git pull + popd + pushd "$final_path/addon" + git fetch + git checkout stable + git pull + popd +# If git is not present upgrade through manual method +else + + # Create a temporary directory and backup smarty3 folder + tmpdir="$(ynh_smart_mktemp 6000)" + ynh_script_progression --message="Upgrading source files..." + cp -a "$final_path/view/smarty3" "$tmpdir/view/smarty3" + + # Remove the app directory securely + ynh_secure_remove "$final_path" + + # 1- Clone stable repo + $git clone https://github.com/friendica/friendica.git -b stable "$final_path" + + # Remove the addon directory securely + ynh_secure_remove "$final_path/addon" + + # 2 - Clone addons repo + git clone https://github.com/friendica/friendica-addons.git -b stable "$final_path/addon" + + # Restore the smarty3 folder + cp -a "$tmpdir/view/smarty3" "${final_path}" + ynh_secure_remove "$tmpdir" + + fi fi # Copy config file for correct place config="$final_path/config/local.config.php" -cp -f "/var/www/$app/config/local-sample.config.php" $config +cp -a "/var/www/$app/config/local-sample.config.php" $config # Replace strings in config file ynh_replace_string --match_string="your.mysqlhost.com" --replace_string="localhost" --target_file="$config" @@ -110,11 +146,10 @@ ynh_replace_string --match_string="mysqlusername" --replace_string="$db_nam ynh_replace_string --match_string="mysqldatabasename" --replace_string="$db_name" --target_file="$config" ynh_replace_string --match_string="mysqlpassword" --replace_string="$db_pwd" --target_file= "$config" ynh_replace_string --match_string="'admin_email' => ''," --replace_string="'admin_email' => '$admin_mail'," --target_file="$config" -ynh_replace_string --match_string="OPEN" --replace_string="CLOSED" --target_file="$config" +#ynh_replace_string --match_string="OPEN" --replace_string="CLOSED" --target_file="$config" -#Copy Addons -ynh_secure_remove "$final_path/addon" -ynh_setup_source --dest_dir="$final_path/addon" --source_id="addons" +# ldap addon config +cp -f "../conf/addon.config.php" "$final_path/config/." # 3 - some extra folders chmod -R 775 $final_path/view/smarty3 @@ -161,7 +196,7 @@ cp "../conf/poller-cron" "/etc/cron.d/$app" # Run composer pushd "$final_path" - php$phpversion bin/console dbstructure update + php$phpversion bin/console dbstructure update 2> /dev/null bin/console config system addon ldapauth popd diff --git a/tags b/tags new file mode 100644 index 0000000..2e420e2 --- /dev/null +++ b/tags @@ -0,0 +1,87 @@ +!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ +!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ +!_TAG_OUTPUT_FILESEP slash /slash or backslash/ +!_TAG_OUTPUT_MODE u-ctags /u-ctags or e-ctags/ +!_TAG_PATTERN_LENGTH_LIMIT 96 /0 for no limit/ +!_TAG_PROGRAM_AUTHOR Universal Ctags Team // +!_TAG_PROGRAM_NAME Universal Ctags /Derived from Exuberant Ctags/ +!_TAG_PROGRAM_URL https://ctags.io/ /official site/ +!_TAG_PROGRAM_VERSION 0.0.0 // +0 manifest.json /^ {$/;" o array:arguments.install +0 manifest.json /^ "nginx",$/;" s array:services +1 manifest.json /^ {$/;" o array:arguments.install +1 manifest.json /^ "php7.3-fpm",$/;" s array:services +2 manifest.json /^ "mysql"$/;" s array:services +Developers info README.md /^## Developers info$/;" s chapter:Friendica for YunoHost +Friendica README.md /^## Friendica$/;" s chapter:Friendica for YunoHost +Friendica for YunoHost README.md /^# Friendica for YunoHost$/;" c +Install Friendica README.md /^### Install Friendica$/;" S section:Friendica for YunoHost""Installation +Installation README.md /^## Installation$/;" s chapter:Friendica for YunoHost +Links README.md /^## Links$/;" s chapter:Friendica for YunoHost +Overview README.md /^## Overview$/;" s chapter:Friendica for YunoHost +PR Status pull_request_template.md /^## PR Status$/;" s +Package_check results pull_request_template.md /^## Package_check results$/;" s +Problem pull_request_template.md /^## Problem$/;" s +Register a new domain and add it to YunoHost README.md /^### Register a new domain and add it to YunoHost$/;" S section:Friendica for YunoHost""Installation +Solution pull_request_template.md /^## Solution$/;" s +Supported architectures README.md /^#### Supported architectures$/;" t section:Friendica for YunoHost""User with ldap admin rights +This app claims following features: README.md /^## This app claims following features:$/;" s chapter:Friendica for YunoHost +User with ldap admin rights README.md /^## User with ldap admin rights$/;" s chapter:Friendica for YunoHost +__NAMETOCHANGE__ conf/php-fpm.conf /^[__NAMETOCHANGE__]$/;" s +arguments manifest.json /^ "arguments": {$/;" o +ask manifest.json /^ "ask": {$/;" o object:arguments.install.0 +ask manifest.json /^ "ask": {$/;" o object:arguments.install.1 +chdir conf/php-fpm.conf /^chdir = __FINALPATH__$/;" k section:__NAMETOCHANGE__ +db_data conf/htconfig.php /^ $db_data = getenv('MYSQL_DATABASE');$/;" v +db_data conf/htconfig.php /^$db_data = 'mysqldatabasename';$/;" v +db_host conf/htconfig.php /^ $db_host = getenv('MYSQL_HOST') . ':' . getenv('MYSQL_PORT');$/;" v +db_host conf/htconfig.php /^$db_host = 'your.mysqlhost.com';$/;" v +db_pass conf/htconfig.php /^ $db_pass = getenv('MYSQL_PASSWORD');$/;" v +db_pass conf/htconfig.php /^$db_pass = 'mysqlpassword';$/;" v +db_user conf/htconfig.php /^ $db_user = getenv('MYSQL_USER');$/;" v +db_user conf/htconfig.php /^ $db_user = getenv('MYSQL_USERNAME');$/;" v +db_user conf/htconfig.php /^$db_user = 'mysqlusername';$/;" v +default_timezone conf/htconfig.php /^$default_timezone = 'America\/Los_Angeles';$/;" v +description manifest.json /^ "description": {$/;" o +email manifest.json /^ "email": ""$/;" s object:maintainer +email manifest.json /^ "email": "aymhce@gmail.com"$/;" s object:previous_maintainers +en manifest.json /^ "en": "Choose a domain for Friendica. Friendica must be installed on the ROOT domain/;" s object:arguments.install.0.ask +en manifest.json /^ "en": "Choose the Friendica administrator (must be an existing YunoHost user)",$/;" s object:arguments.install.1.ask +en manifest.json /^ "en": "Social Communication Server",$/;" s object:description +example manifest.json /^ "example": "domain.org"$/;" s object:arguments.install.0 +example manifest.json /^ "example": "homer"$/;" s object:arguments.install.1 +fr manifest.json /^ "fr": "Choisissez l'administrateur pour Friendica (l'utilisateur YunoHost doit exist/;" s object:arguments.install.1.ask +fr manifest.json /^ "fr": "Choisissez un domaine pour Friendica.Friendica doit etre installe a la racine/;" s object:arguments.install.0.ask +fr manifest.json /^ "fr": "Serveur de Communication Social"$/;" s object:description +group conf/php-fpm.conf /^group = __USER__$/;" k section:__NAMETOCHANGE__ +group conf/php-fpm.conf /^listen.group = www-data$/;" k section:__NAMETOCHANGE__ +id manifest.json /^ "id": "friendica",$/;" s +install manifest.json /^ "install" : [$/;" a object:arguments +is_there_enough_space scripts/_common.sh /^ is_there_enough_space () {$/;" f +license manifest.json /^ "license": "AGPL-3.0-only",$/;" s +listen conf/php-fpm.conf /^listen = \/var\/run\/php\/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock$/;" k section:__NAMETOCHANGE__ +maintainer manifest.json /^ "maintainer": {$/;" o +max_children conf/php-fpm.conf /^pm.max_children = 5$/;" k section:__NAMETOCHANGE__ +max_spare_servers conf/php-fpm.conf /^pm.max_spare_servers = 3$/;" k section:__NAMETOCHANGE__ +min_spare_servers conf/php-fpm.conf /^pm.min_spare_servers = 1$/;" k section:__NAMETOCHANGE__ +multi_instance manifest.json /^ "multi_instance": true,$/;" b +name manifest.json /^ "name": "admin",$/;" s object:arguments.install.1 +name manifest.json /^ "name": "domain",$/;" s object:arguments.install.0 +name manifest.json /^ "name": "Anmol Sharma",$/;" s object:maintainer +name manifest.json /^ "name": "aymhce",$/;" s object:previous_maintainers +name manifest.json /^ "name": "Friendica",$/;" s +owner conf/php-fpm.conf /^listen.owner = www-data$/;" k section:__NAMETOCHANGE__ +packaging_format manifest.json /^ "packaging_format": 1,$/;" n +pm conf/php-fpm.conf /^pm = dynamic$/;" k section:__NAMETOCHANGE__ +previous_maintainers manifest.json /^ "previous_maintainers": {$/;" o +request_terminate_timeout conf/php-fpm.conf /^request_terminate_timeout = 1d$/;" k section:__NAMETOCHANGE__ +requirements manifest.json /^ "requirements": {$/;" o +services manifest.json /^ "services": [$/;" a +start_servers conf/php-fpm.conf /^pm.start_servers = 2$/;" k section:__NAMETOCHANGE__ +type manifest.json /^ "type": "domain",$/;" s object:arguments.install.0 +type manifest.json /^ "type": "user",$/;" s object:arguments.install.1 +url manifest.json /^ "url": "http:\/\/friendi.ca",$/;" s +user conf/php-fpm.conf /^user = __USER__$/;" k section:__NAMETOCHANGE__ +version manifest.json /^ "version": "2021.04~ynh2",$/;" s +ynh_smart_mktemp scripts/_common.sh /^ynh_smart_mktemp () {$/;" f +yunohost manifest.json /^ "yunohost": ">= 4.1.0"$/;" s object:requirements