mirror of
https://github.com/YunoHost-Apps/abantecart_ynh.git
synced 2024-09-03 18:06:16 +02:00
commit
bb56b8ce37
15 changed files with 302 additions and 206 deletions
41
.github/workflows/updater.sh
vendored
41
.github/workflows/updater.sh
vendored
|
@ -9,9 +9,6 @@
|
|||
# Since each app is different, maintainers can adapt its contents so as to perform
|
||||
# automatic actions when a new upstream release is detected.
|
||||
|
||||
# Remove this exit command when you are ready to run this Action
|
||||
exit 1
|
||||
|
||||
#=================================================
|
||||
# FETCHING LATEST RELEASE AND ITS ASSETS
|
||||
#=================================================
|
||||
|
@ -21,7 +18,7 @@ current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
|
|||
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
|
||||
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
|
||||
version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1)
|
||||
assets=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").assets[].browser_download_url ] | join(" ") | @sh' | tr -d "'"))
|
||||
assets="https://github.com/abantecart/abantecart-src/archive/refs/tags/$version.tar.gz"
|
||||
|
||||
# Later down the script, we assume the version has only digits and dots
|
||||
# Sometimes the release name starts with a "v", so let's filter it out.
|
||||
|
@ -34,6 +31,7 @@ fi
|
|||
echo "Current version: $current_version"
|
||||
echo "Latest release from upstream: $version"
|
||||
echo "VERSION=$version" >> $GITHUB_ENV
|
||||
echo "REPO=$repo" >> $GITHUB_ENV
|
||||
# For the time being, let's assume the script will fail
|
||||
echo "PROCEED=false" >> $GITHUB_ENV
|
||||
|
||||
|
@ -47,38 +45,16 @@ elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.
|
|||
exit 0
|
||||
fi
|
||||
|
||||
# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.)
|
||||
echo "${#assets[@]} available asset(s)"
|
||||
|
||||
#=================================================
|
||||
# UPDATE SOURCE FILES
|
||||
#=================================================
|
||||
|
||||
# Here we use the $assets variable to get the resources published in the upstream release.
|
||||
# Here is an example for Grav, it has to be adapted in accordance with how the upstream releases look like.
|
||||
|
||||
# Let's loop over the array of assets URLs
|
||||
for asset_url in ${assets[@]}; do
|
||||
# Let's download source tarball
|
||||
asset_url=$assets
|
||||
|
||||
echo "Handling asset at $asset_url"
|
||||
|
||||
# Assign the asset to a source file in conf/ directory
|
||||
# Here we base the source file name upon a unique keyword in the assets url (admin vs. update)
|
||||
# Leave $src empty to ignore the asset
|
||||
case $asset_url in
|
||||
*"admin"*)
|
||||
src="app"
|
||||
;;
|
||||
*"update"*)
|
||||
src="app-upgrade"
|
||||
;;
|
||||
*)
|
||||
src=""
|
||||
;;
|
||||
esac
|
||||
|
||||
# If $src is not empty, let's process the asset
|
||||
if [ ! -z "$src" ]; then
|
||||
src="app"
|
||||
|
||||
# Create the temporary directory
|
||||
tempdir="$(mktemp -d)"
|
||||
|
@ -106,15 +82,10 @@ SOURCE_SUM_PRG=sha256sum
|
|||
SOURCE_FORMAT=$extension
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=
|
||||
SOURCE_EXTRACT=true
|
||||
EOT
|
||||
echo "... conf/$src.src updated"
|
||||
|
||||
else
|
||||
echo "... asset ignored"
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPDATE STEPS
|
||||
#=================================================
|
||||
|
|
49
.github/workflows/updater.yml
vendored
Normal file
49
.github/workflows/updater.yml
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected.
|
||||
# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization.
|
||||
# This file should be enough by itself, but feel free to tune it to your needs.
|
||||
# It calls updater.sh, which is where you should put the app-specific update steps.
|
||||
name: Check for new upstream releases
|
||||
on:
|
||||
# Allow to manually trigger the workflow
|
||||
workflow_dispatch:
|
||||
# Run it every day at 6:00 UTC
|
||||
schedule:
|
||||
- cron: '0 6 * * *'
|
||||
jobs:
|
||||
updater:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Fetch the source code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Run the updater script
|
||||
id: run_updater
|
||||
run: |
|
||||
# Setting up Git user
|
||||
git config --global user.name 'yunohost-bot'
|
||||
git config --global user.email 'yunohost-bot@users.noreply.github.com'
|
||||
# Run the updater script
|
||||
/bin/bash .github/workflows/updater.sh
|
||||
- name: Commit changes
|
||||
id: commit
|
||||
if: ${{ env.PROCEED == 'true' }}
|
||||
run: |
|
||||
git commit -am "Upgrade to v$VERSION"
|
||||
- name: Create Pull Request
|
||||
id: cpr
|
||||
if: ${{ env.PROCEED == 'true' }}
|
||||
uses: peter-evans/create-pull-request@v3
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
commit-message: Update to version ${{ env.VERSION }}
|
||||
committer: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
|
||||
author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
|
||||
signoff: false
|
||||
base: testing
|
||||
branch: ci-auto-update-v${{ env.VERSION }}
|
||||
delete-branch: true
|
||||
title: 'Upgrade to version ${{ env.VERSION }}'
|
||||
body: |
|
||||
Upgrade to v${{ env.VERSION }}
|
||||
draft: false
|
24
README.md
24
README.md
|
@ -5,7 +5,7 @@ It shall NOT be edited by hand.
|
|||
|
||||
# Abantecart for YunoHost
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/abantecart)  
|
||||
[](https://dash.yunohost.org/appci/app/abantecart)  
|
||||
[](https://install-app.yunohost.org/?app=abantecart)
|
||||
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
|
@ -20,35 +20,39 @@ AbanteCart is a free open source ecommerce platform to power online retail. Aban
|
|||
|
||||
**Shipped version:** 1.3.2~ynh1
|
||||
|
||||
|
||||
**Demo:** https://www.abantecart.com/shopping-cart-demo
|
||||
|
||||
## Screenshots
|
||||
|
||||

|
||||

|
||||
|
||||
## Disclaimers / important information
|
||||
|
||||
### Important points to read before installing
|
||||
|
||||
- Do not upgrade manually within the app, upgrade with Yunohost instead!
|
||||
- Admin interface will be available at https://domain.tld/?s=admin
|
||||
|
||||
## Documentation and resources
|
||||
|
||||
* Official app website: https://www.abantecart.com/
|
||||
* Official user documentation: https://abantecart.atlassian.net/wiki/spaces/AD/overview?homepageId=3506313
|
||||
* Official admin documentation: https://docs.abantecart.com/
|
||||
* Upstream app code repository: https://github.com/abantecart/abantecart-src
|
||||
* YunoHost documentation for this app: https://yunohost.org/app_abantecart
|
||||
* Report a bug: https://github.com/YunoHost-Apps/abantecart_ynh/issues
|
||||
* Official app website: <https://www.abantecart.com/>
|
||||
* Official user documentation: <https://abantecart.atlassian.net/wiki/spaces/AD/overview?homepageId=3506313>
|
||||
* Official admin documentation: <https://docs.abantecart.com/>
|
||||
* Upstream app code repository: <https://github.com/abantecart/abantecart-src>
|
||||
* YunoHost documentation for this app: <https://yunohost.org/app_abantecart>
|
||||
* Report a bug: <https://github.com/YunoHost-Apps/abantecart_ynh/issues>
|
||||
|
||||
## Developer info
|
||||
|
||||
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/abantecart_ynh/tree/testing).
|
||||
|
||||
To try the testing branch, please proceed like that.
|
||||
```
|
||||
|
||||
``` bash
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/abantecart_ynh/tree/testing --debug
|
||||
or
|
||||
sudo yunohost app upgrade abantecart -u https://github.com/YunoHost-Apps/abantecart_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**More info regarding app packaging:** https://yunohost.org/packaging_apps
|
||||
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>
|
||||
|
|
32
README_fr.md
32
README_fr.md
|
@ -1,10 +1,14 @@
|
|||
<!--
|
||||
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
|
||||
It shall NOT be edited by hand.
|
||||
-->
|
||||
|
||||
# Abantecart pour YunoHost
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/abantecart)  
|
||||
[](https://dash.yunohost.org/appci/app/abantecart)  
|
||||
[](https://install-app.yunohost.org/?app=abantecart)
|
||||
|
||||
*[Read this readme in english.](./README.md)*
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
|
||||
> *Ce package vous permet d'installer Abantecart rapidement et simplement sur un serveur YunoHost.
|
||||
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
|
||||
|
@ -14,37 +18,41 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
|
|||
AbanteCart is a free open source ecommerce platform to power online retail. AbanteCart is a ready to run web application as well as reliable foundation to build custom eCommerce solutions. AbanteCart ecommerce platform is designed to fit a wide variety of online businesses and applications, as well as can be configured or customized to perform very specific business requirements. Chosen by many shop owners launching their business online for the first time, AbanteCart is also picked by developers looking for a user-friendly interface and powerful features set.
|
||||
|
||||
|
||||
**Version incluse :** 1.3.2~ynh1
|
||||
**Version incluse :** 1.3.2~ynh1
|
||||
|
||||
|
||||
**Démo :** https://www.abantecart.com/shopping-cart-demo
|
||||
|
||||
## Captures d'écran
|
||||
|
||||

|
||||

|
||||
|
||||
## Avertissements / informations importantes
|
||||
|
||||
### Important points to read before installing
|
||||
|
||||
- Do not upgrade manually within the app, upgrade with Yunohost instead!
|
||||
- Admin interface will be available at https://domain.tld/?s=admin
|
||||
|
||||
## Documentations et ressources
|
||||
|
||||
* Site officiel de l'app : https://www.abantecart.com/
|
||||
* Documentation officielle utilisateur : https://abantecart.atlassian.net/wiki/spaces/AD/overview?homepageId=3506313
|
||||
* Documentation officielle de l'admin : https://docs.abantecart.com/
|
||||
* Dépôt de code officiel de l'app : https://github.com/abantecart/abantecart-src
|
||||
* Documentation YunoHost pour cette app : https://yunohost.org/app_abantecart
|
||||
* Signaler un bug : https://github.com/YunoHost-Apps/abantecart_ynh/issues
|
||||
* Site officiel de l'app : <https://www.abantecart.com/>
|
||||
* Documentation officielle utilisateur : <https://abantecart.atlassian.net/wiki/spaces/AD/overview?homepageId=3506313>
|
||||
* Documentation officielle de l'admin : <https://docs.abantecart.com/>
|
||||
* Dépôt de code officiel de l'app : <https://github.com/abantecart/abantecart-src>
|
||||
* Documentation YunoHost pour cette app : <https://yunohost.org/app_abantecart>
|
||||
* Signaler un bug : <https://github.com/YunoHost-Apps/abantecart_ynh/issues>
|
||||
|
||||
## Informations pour les développeurs
|
||||
|
||||
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/abantecart_ynh/tree/testing).
|
||||
|
||||
Pour essayer la branche testing, procédez comme suit.
|
||||
```
|
||||
|
||||
``` bash
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/abantecart_ynh/tree/testing --debug
|
||||
ou
|
||||
sudo yunohost app upgrade abantecart -u https://github.com/YunoHost-Apps/abantecart_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps
|
||||
**Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
;; Test complet
|
||||
; Manifest
|
||||
domain="domain.tld"
|
||||
is_public=1
|
||||
admin="john"
|
||||
password="1Strong-Password"
|
||||
is_public=1
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=0
|
||||
|
@ -13,8 +13,11 @@
|
|||
setup_public=1
|
||||
upgrade=1
|
||||
upgrade=1 from_commit=acdb6cfdf31a2f02baf5bbcbb5cc0cdaf0a3ac69
|
||||
# 1.3.2~ynh1
|
||||
upgrade=1 from_commit=4586e00bbf6ae98f49135623b282446613a9cb25
|
||||
backup_restore=1
|
||||
multi_instance=0
|
||||
port_already_use=0
|
||||
change_url=0
|
||||
;;; Options
|
||||
Email=
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
SOURCE_URL=https://github.com/abantecart/abantecart-src/archive/refs/tags/1.3.2.zip
|
||||
SOURCE_SUM=631fd1032e5a32e3041c56e78048d611bcf28ef07bae1ac75bb467190f18f014
|
||||
SOURCE_URL=https://github.com/abantecart/abantecart-src/archive/refs/tags/1.3.2.tar.gz
|
||||
SOURCE_SUM=58ed9007054e5f74826d8ac5d3358d893c612af34e04877107c9baf81f6d529f
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=zip
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=
|
||||
SOURCE_EXTRACT=true
|
||||
|
|
|
@ -15,11 +15,13 @@ location __PATH__/ {
|
|||
rewrite ^(.+)$ __PATH__/index.php?q=$1 last;
|
||||
}
|
||||
|
||||
client_max_body_size 30m;
|
||||
# Common parameter to increase upload size limit in conjunction with dedicated php-fpm file
|
||||
client_max_body_size 50M;
|
||||
|
||||
location ~ [^/]\.php(/|$) {
|
||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
|
||||
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
fastcgi_param REMOTE_USER $remote_user;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
### Important points to read before installing
|
||||
|
||||
- Do not upgrade manually within the app, upgrade with Yunohost instead!
|
||||
- Admin interface will be available at https://domain.tld/?s=admin
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"id": "abantecart",
|
||||
"name": "Abantecart",
|
||||
"id": "abantecart",
|
||||
"packaging_format": 1,
|
||||
"description": {
|
||||
"en": "Open source ecommerce platform to power online retail",
|
||||
|
@ -14,7 +14,8 @@
|
|||
"demo": "https://www.abantecart.com/shopping-cart-demo",
|
||||
"admindoc": "https://docs.abantecart.com/",
|
||||
"userdoc": "https://abantecart.atlassian.net/wiki/spaces/AD/overview?homepageId=3506313",
|
||||
"code": "https://github.com/abantecart/abantecart-src"
|
||||
"code": "https://github.com/abantecart/abantecart-src",
|
||||
"cpe": "cpe:2.3:a:abantecart:abantecart"
|
||||
},
|
||||
"license": "OSL-3.0",
|
||||
"maintainer": {
|
||||
|
@ -31,27 +32,24 @@
|
|||
"mysql"
|
||||
],
|
||||
"arguments": {
|
||||
"install" : [
|
||||
"install": [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain"
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "admin",
|
||||
"type": "user",
|
||||
"help": {
|
||||
"en": "Access admin page via https://<domain.tld>/<admin>/"
|
||||
}
|
||||
"type": "user"
|
||||
},
|
||||
{
|
||||
"name": "password",
|
||||
"type": "password",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -4,7 +4,10 @@
|
|||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
YNH_PHP_VERSION="7.3"
|
||||
php_dependencies="php$YNH_DEFAULT_PHP_VERSION-iconv php$YNH_DEFAULT_PHP_VERSION-mbstring php$YNH_DEFAULT_PHP_VERSION-mysqli php$YNH_DEFAULT_PHP_VERSION-mysql php$YNH_DEFAULT_PHP_VERSION-zip php$YNH_DEFAULT_PHP_VERSION-soap"
|
||||
|
||||
# dependencies used by the app (must be on a single line)
|
||||
pkg_dependencies="curl wget git libwebp-dev libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev libpng-dev libxpm-dev libonig-dev libzip-dev mariadb-server mc net-tools libxml2-dev $php_dependencies"
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -13,6 +14,9 @@ source /usr/share/yunohost/helpers
|
|||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
true
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
|
|
108
scripts/install
108
scripts/install
|
@ -13,6 +13,9 @@ source /usr/share/yunohost/helpers
|
|||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
true
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
|
@ -22,13 +25,13 @@ ynh_abort_if_errors
|
|||
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url="/"
|
||||
password=$YNH_APP_ARG_PASSWORD
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
admin=$YNH_APP_ARG_ADMIN
|
||||
phpversion=$YNH_PHP_VERSION
|
||||
email=$(ynh_user_get_info --username=$admin --key=mail)
|
||||
password=$YNH_APP_ARG_PASSWORD
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
email=$(ynh_user_get_info --username=$admin --key=mail)
|
||||
src_version=$(ynh_app_upstream_version)
|
||||
|
||||
#=================================================
|
||||
|
@ -45,7 +48,7 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
|||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Storing installation settings..."
|
||||
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=path --value=$path_url
|
||||
|
@ -53,26 +56,23 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
|||
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||
ynh_app_setting_set --app=$app --key=src_version --value=$src_version
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=1
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..." --weight=1
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..." --weight=3
|
||||
|
||||
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/git_src"
|
||||
|
||||
ln -s $final_path/git_src/public_html $final_path/www
|
||||
|
||||
#=================================================
|
||||
# CREATE A MYSQL DATABASE
|
||||
#=================================================
|
||||
|
@ -84,40 +84,21 @@ ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
|||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# CREATE A MYSQL DATABASE
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring a MySQL database..." --weight=2
|
||||
ynh_script_progression --message="Setting up source files..." --weight=3
|
||||
|
||||
cat $final_path/www/install/cli_install.php
|
||||
php_installer=$final_path/www/install/cli_install.php
|
||||
php $php_installer install \
|
||||
--db_host=localhost \
|
||||
--db_user=$db_name \
|
||||
--db_password=$db_pwd \
|
||||
--db_name=$db_name \
|
||||
--db_driver=amysqli \
|
||||
--db_prefix=ac_ \
|
||||
--username=$admin \
|
||||
--admin_path=$admin \
|
||||
--password=$password \
|
||||
--email=$email \
|
||||
--http_server=https://$domain
|
||||
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/git_src"
|
||||
ln -s $final_path/git_src/public_html $final_path/www
|
||||
|
||||
ynh_secure_remove $final_path/www/install
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
find $final_path/www -type d -exec chmod 755 {} \;
|
||||
find $final_path/www -type f -exec chmod 644 {} \;
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -132,24 +113,63 @@ else
|
|||
fi
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config --usage=$usage --footprint=low
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
# INSTALL APP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing app..." --weight=2
|
||||
|
||||
php$phpversion $final_path/www/install/cli_install.php install \
|
||||
--db_host=localhost \
|
||||
--db_user=$db_name \
|
||||
--db_password=$db_pwd \
|
||||
--db_name=$db_name \
|
||||
--db_driver=amysqli \
|
||||
--db_prefix=ac_ \
|
||||
--username=$admin \
|
||||
--admin_path=admin \
|
||||
--password=$password \
|
||||
--email=$email \
|
||||
--http_server=https://$domain
|
||||
|
||||
ynh_secure_remove $final_path/www/install
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
find $final_path/www -type d -exec chmod 755 {} \;
|
||||
find $final_path/www -type f -exec chmod 644 {} \;
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring permissions..."
|
||||
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||
|
||||
# Make app public if necessary
|
||||
if [ $is_public -eq 1 ]
|
||||
then
|
||||
# Everyone can access the app.
|
||||
# The "main" permission is automatically created before the install script.
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
|
|
@ -39,6 +39,14 @@ ynh_script_progression --message="Removing app main directory..." --weight=1
|
|||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="$final_path"
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=2
|
||||
|
||||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -47,19 +55,12 @@ ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=2
|
|||
# Remove the dedicated PHP-FPM config
|
||||
ynh_remove_fpm_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=2
|
||||
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the dedicated system user..."
|
||||
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
||||
|
||||
# Delete a system user
|
||||
ynh_system_user_delete --username=$app
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -13,13 +14,16 @@ source /usr/share/yunohost/helpers
|
|||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
true
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading settings..." --weight=2
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=2
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -39,32 +43,17 @@ fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
|
|||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..." --weight=2
|
||||
|
||||
test ! -d $final_path || ynh_die --message="There is already a directory: $final_path "
|
||||
test ! -d $final_path \
|
||||
|| ynh_die --message="There is already a directory: $final_path "
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Restoring the MySQL database..." --weight=1
|
||||
|
||||
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
|
||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=2
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
if [ -n "$password" ]
|
||||
|
@ -86,22 +75,49 @@ chown -R $app:www-data "$final_path"
|
|||
find $final_path/www -type d -exec chmod 755 {} \;
|
||||
find $final_path/www -type f -exec chmod 644 {} \;
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
|
||||
|
||||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring PHP-FPM configuration..." --weight=2
|
||||
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=2
|
||||
|
||||
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
|
||||
# Recreate a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the MySQL database..." --weight=1
|
||||
|
||||
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
|
||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# RELOAD NGINX AND PHP-FPM
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..."
|
||||
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
|
|
@ -22,8 +22,7 @@ admin=$(ynh_app_setting_get --app=$app --key=admin)
|
|||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
src_version=$(ynh_app_setting_get --app=$app --key=src_version)
|
||||
|
||||
phpversion=$YNH_PHP_VERSION
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
|
||||
fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
|
||||
|
@ -31,6 +30,7 @@ fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
|
|||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Checking version..." --weight=1
|
||||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
|
@ -48,6 +48,8 @@ ynh_clean_setup () {
|
|||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
|
@ -102,7 +104,33 @@ find $final_path/www -type f -exec chmod 644 {} \;
|
|||
ln -s $final_path/git_src/public_html $final_path/www
|
||||
|
||||
#=================================================
|
||||
# MYSQL CONFIGURATION
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
|
||||
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
# UPGRADE MYSQL CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading MySQL configuration..." --weight=1
|
||||
|
||||
|
@ -118,21 +146,7 @@ updated_src_version=$(ynh_app_upstream_version)
|
|||
ynh_app_setting_set --app=$app --key=src_version --value=$updated_src_version
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
|
||||
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
|
||||
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue