mirror of
https://github.com/YunoHost-Apps/invoiceninja_ynh.git
synced 2024-09-03 19:26:22 +02:00
first working state
This commit is contained in:
parent
53c6aed1bc
commit
b23f0a7a27
9 changed files with 99 additions and 274 deletions
69
README.md
69
README.md
|
@ -1,24 +1,16 @@
|
||||||
# Usage of this package (REMOVE THIS SECTION BEFORE RELEASE)
|
# Invoice Ninja for YunoHost
|
||||||
- Edit `conf/nginx.conf` file to match application prerequisites.
|
|
||||||
- Edit the `install`, `upgrade`, `remove`, `backup`, and `restore` scripts.
|
|
||||||
- Using the [script helpers documentation.](https://yunohost.org/#/packaging_apps_helpers)
|
|
||||||
- Add a `LICENSE` file for the package.
|
|
||||||
- Edit `README.md` and README_fr.md.
|
|
||||||
|
|
||||||
# Example app for YunoHost
|
[![Integration level](https://dash.yunohost.org/integration/invoiceninja.svg)](https://dash.yunohost.org/appci/app/invoiceninja)
|
||||||
|
[![Install invoiceninja with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=invoiceninja)
|
||||||
|
|
||||||
[![Integration level](https://dash.yunohost.org/integration/REPLACEBYYOURAPP.svg)](https://dash.yunohost.org/appci/app/REPLACEBYYOURAPP)
|
> *This package allow you to install invoiceninja quickly and simply on a YunoHost server.
|
||||||
[![Install REPLACEBYYOURAPP with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=REPLACEBYYOURAPP)
|
|
||||||
|
|
||||||
*[Lire ce readme en français.](./README_fr.md)*
|
|
||||||
|
|
||||||
> *This package allow you to install REPLACEBYYOURAPP quickly and simply on a YunoHost server.
|
|
||||||
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
|
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
Quick description of this app.
|
|
||||||
|
|
||||||
**Shipped version:** 1.0
|
Invoice Ninja is the #1 open-source platform to create & email invoices, track payments and expenses, and time billable tasks & projects for clients.
|
||||||
|
|
||||||
|
**Shipped version:** v4.5.18
|
||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
|
|
||||||
|
@ -26,58 +18,45 @@ Quick description of this app.
|
||||||
|
|
||||||
## Demo
|
## Demo
|
||||||
|
|
||||||
* [Official demo](Link to a demo site for this app)
|
* [Official demo](https://app.invoiceninja.com/dashboard)
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
How to configure this app: by an admin panel, a plain file with SSH, or any other way.
|
Configuration happens in the application itself.
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
* Official documentation: Link to the official documentation of this app
|
* Official documentation: https://docs.invoiceninja.com/index.html
|
||||||
* YunoHost documentation: If specific documentation is needed, feel free to contribute.
|
|
||||||
|
|
||||||
## YunoHost specific features
|
## YunoHost specific features
|
||||||
|
|
||||||
#### Multi-users support
|
#### Multi-users support
|
||||||
|
|
||||||
Are LDAP and HTTP auth supported?
|
* There is no official LDAP support
|
||||||
Can the app be used by multiple users?
|
* The first user gets created after installing Invoice Ninja
|
||||||
|
* Other users can be created from inside the application
|
||||||
|
|
||||||
#### Supported architectures
|
#### Supported architectures
|
||||||
|
|
||||||
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/REPLACEBYYOURAPP%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/REPLACEBYYOURAPP/)
|
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/invoiceninja%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/invoiceninja/)
|
||||||
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/REPLACEBYYOURAPP%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/REPLACEBYYOURAPP/)
|
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/invoiceninja%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/invoiceninja/)
|
||||||
|
|
||||||
## Limitations
|
## Limitations
|
||||||
|
|
||||||
* Any known limitations.
|
* Any known limitations.
|
||||||
|
|
||||||
## Additional information
|
|
||||||
|
|
||||||
* Other information you would add about this application
|
|
||||||
|
|
||||||
**More information on the documentation page:**
|
|
||||||
https://yunohost.org/packaging_apps
|
|
||||||
|
|
||||||
## Links
|
## Links
|
||||||
|
|
||||||
* Report a bug: https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/issues
|
* Report a bug: https://github.com/YunoHost-Apps/invoiceninja_ynh/issues
|
||||||
* App website: Link to the official website of this app
|
* App website: https://www.invoiceninja.org/
|
||||||
* Upstream app repository: Link to the official repository of the upstream app
|
* Upstream app repository: https://github.com/invoiceninja/invoiceninja
|
||||||
* YunoHost website: https://yunohost.org/
|
* YunoHost website: https://yunohost.org/
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
Developers info
|
## TODOs
|
||||||
----------------
|
|
||||||
|
|
||||||
**Only if you want to use a testing branch for coding, instead of merging directly into master.**
|
* Completely configure the env
|
||||||
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/tree/testing).
|
* Mail settings
|
||||||
|
* Cronjobs
|
||||||
To try the testing branch, please proceed like that.
|
* Create initial user?
|
||||||
```
|
* Test upgrade
|
||||||
sudo yunohost app install https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/tree/testing --debug
|
|
||||||
or
|
|
||||||
sudo yunohost app upgrade REPLACEBYYOURAPP -u https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/tree/testing --debug
|
|
||||||
```
|
|
||||||
|
|
|
@ -1,21 +1,17 @@
|
||||||
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
|
||||||
location __PATH__/ {
|
location __PATH__/ {
|
||||||
|
|
||||||
# Path to source
|
# Path to source
|
||||||
alias __FINALPATH__/ ;
|
alias __FINALPATH__/public/ ;
|
||||||
|
try_files $uri $uri/ @__NAME__;
|
||||||
|
|
||||||
|
|
||||||
# Force usage of https
|
# Force usage of https
|
||||||
if ($scheme = http) {
|
if ($scheme = http) {
|
||||||
rewrite ^ https://$server_name$request_uri? permanent;
|
rewrite ^ https://$server_name$request_uri? permanent;
|
||||||
}
|
}
|
||||||
|
|
||||||
### Example PHP configuration (remove it if not used)
|
|
||||||
index index.php;
|
index index.php;
|
||||||
|
|
||||||
# Common parameter to increase upload size limit in conjunction with dedicated php-fpm file
|
|
||||||
#client_max_body_size 50M;
|
|
||||||
|
|
||||||
try_files $uri $uri/ index.php;
|
|
||||||
location ~ [^/]\.php(/|$) {
|
location ~ [^/]\.php(/|$) {
|
||||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||||
fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock;
|
fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock;
|
||||||
|
@ -26,8 +22,11 @@ location __PATH__/ {
|
||||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||||
fastcgi_param SCRIPT_FILENAME $request_filename;
|
fastcgi_param SCRIPT_FILENAME $request_filename;
|
||||||
}
|
}
|
||||||
### End of PHP configuration part
|
|
||||||
|
|
||||||
# Include SSOWAT user panel.
|
# Include SSOWAT user panel.
|
||||||
include conf.d/yunohost_panel.conf.inc;
|
include conf.d/yunohost_panel.conf.inc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
location @invoiceninja {
|
||||||
|
rewrite ^(.+)$ /index.php?/$1 last;
|
||||||
|
}
|
||||||
|
|
|
@ -3,16 +3,15 @@
|
||||||
"id": "invoiceninja",
|
"id": "invoiceninja",
|
||||||
"packaging_format": 1,
|
"packaging_format": 1,
|
||||||
"description": {
|
"description": {
|
||||||
"en": "Explain in *a few (10~15) words* the purpose of the app or what it actually does (it is meant to give a rough idea to users browsing a catalog of 100+ apps)",
|
"en": "Invoice Ninja is the #1 open-source platform to create & email invoices, track payments and expenses, and time billable tasks & projects for clients."
|
||||||
"fr": "Expliquez en *quelques* (10~15) mots l'utilité de l'app ou ce qu'elle fait (l'objectif est de donner une idée grossière pour des utilisateurs qui naviguent dans un catalogue de 100+ apps)"
|
|
||||||
},
|
},
|
||||||
"version": "1.0~ynh1",
|
"version": "1.0~ynh1",
|
||||||
"url": "https://example.com",
|
"url": "https://invoiceninja.org",
|
||||||
"license": "free",
|
"license": "Attribution Assurance License",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
"name": "John doe",
|
"name": "Sebastian Gumprich",
|
||||||
"email": "john.doe@example.com",
|
"email": "yunohost AT gumpri DOT ch",
|
||||||
"url": "http://example.com"
|
"url": "https://github.com/YunoHost-Apps/invoiceninja_ynh/"
|
||||||
},
|
},
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 3.5"
|
"yunohost": ">= 3.5"
|
||||||
|
@ -41,8 +40,8 @@
|
||||||
"en": "Choose a path for ynhexample",
|
"en": "Choose a path for ynhexample",
|
||||||
"fr": "Choisissez un chemin pour ynhexample"
|
"fr": "Choisissez un chemin pour ynhexample"
|
||||||
},
|
},
|
||||||
"example": "/example",
|
"example": "/invoiceninja",
|
||||||
"default": "/example"
|
"default": "/invoiceninja"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "admin",
|
"name": "admin",
|
||||||
|
@ -58,7 +57,7 @@
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Is it a public application?",
|
"en": "Is it a public application?",
|
||||||
"fr": "Est-ce une application publique ?"
|
"fr": "Est-ce une application publique?"
|
||||||
},
|
},
|
||||||
"default": true
|
"default": true
|
||||||
},
|
},
|
||||||
|
@ -70,20 +69,7 @@
|
||||||
"fr": "Choisissez la langue de l'application"
|
"fr": "Choisissez la langue de l'application"
|
||||||
},
|
},
|
||||||
"choices": ["fr", "en"],
|
"choices": ["fr", "en"],
|
||||||
"default": "fr"
|
"default": "en"
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "password",
|
|
||||||
"type": "password",
|
|
||||||
"ask": {
|
|
||||||
"en": "Set the administrator password",
|
|
||||||
"fr": "Définissez le mot de passe administrateur"
|
|
||||||
},
|
|
||||||
"help": {
|
|
||||||
"en": "Use the help field to add an information for the admin about this question.",
|
|
||||||
"fr": "Utilisez le champ aide pour ajouter une information à l'intention de l'administrateur à propos de cette question."
|
|
||||||
},
|
|
||||||
"example": "Choose a password"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,6 @@
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# dependencies used by the app
|
|
||||||
pkg_dependencies="deb1 deb2"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
117
scripts/install
117
scripts/install
|
@ -29,7 +29,6 @@ path_url=$YNH_APP_ARG_PATH
|
||||||
admin=$YNH_APP_ARG_ADMIN
|
admin=$YNH_APP_ARG_ADMIN
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
language=$YNH_APP_ARG_LANGUAGE
|
language=$YNH_APP_ARG_LANGUAGE
|
||||||
password=$YNH_APP_ARG_PASSWORD
|
|
||||||
|
|
||||||
### If it's a multi-instance app, meaning it can be installed several times independently
|
### If it's 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 id of the app as stated in the manifest is available as $YNH_APP_ID
|
||||||
|
@ -78,40 +77,6 @@ ynh_app_setting_set --app=$app --key=language --value=$language
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
# FIND AND OPEN A PORT
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring firewall..." --time --weight=1
|
|
||||||
|
|
||||||
### Use these lines if you have to open a port for the application
|
|
||||||
### `ynh_find_port` will find the first available port starting from the given port.
|
|
||||||
### If you're not using these lines:
|
|
||||||
### - Remove the section "CLOSE A PORT" in the remove script
|
|
||||||
|
|
||||||
# Find an available port
|
|
||||||
port=$(ynh_find_port --port=8095)
|
|
||||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
|
||||||
|
|
||||||
# Optional: Expose this port publicly
|
|
||||||
# (N.B. : you only need to do this if the app actually needs to expose the port publicly.
|
|
||||||
# If you do this and the app doesn't actually need you are CREATING SECURITY HOLES IN THE SERVER !)
|
|
||||||
|
|
||||||
# Open the port
|
|
||||||
# ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# INSTALL DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Installing dependencies..." --time --weight=1
|
|
||||||
|
|
||||||
### `ynh_install_app_dependencies` allows you to add any "apt" dependencies to the package.
|
|
||||||
### Those deb packages will be installed as dependencies of this package.
|
|
||||||
### If you're not using this helper:
|
|
||||||
### - Remove the section "REMOVE DEPENDENCIES" in the remove script
|
|
||||||
### - Remove the variable "pkg_dependencies" in _common.sh
|
|
||||||
### - As well as the section "REINSTALL DEPENDENCIES" in the restore script
|
|
||||||
### - And the section "UPGRADE DEPENDENCIES" in the upgrade script
|
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE A MYSQL DATABASE
|
# CREATE A MYSQL DATABASE
|
||||||
|
@ -188,25 +153,6 @@ ynh_add_fpm_config
|
||||||
# ...
|
# ...
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SETUP SYSTEMD
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring a systemd service..." --time --weight=1
|
|
||||||
|
|
||||||
### `ynh_systemd_config` is used to configure a systemd script for an app.
|
|
||||||
### It can be used for apps that use sysvinit (with adaptation) or systemd.
|
|
||||||
### Have a look at the app to be sure this app needs a systemd script.
|
|
||||||
### `ynh_systemd_config` will use the file conf/systemd.service
|
|
||||||
### If you're not using these lines:
|
|
||||||
### - You can remove those files in conf/.
|
|
||||||
### - Remove the section "BACKUP SYSTEMD" in the backup script
|
|
||||||
### - Remove also the section "STOP AND REMOVE SERVICE" in the remove script
|
|
||||||
### - As well as the section "RESTORE SYSTEMD" in the restore script
|
|
||||||
### - And the section "SETUP SYSTEMD" in the upgrade script
|
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
|
||||||
ynh_add_systemd_config
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP APPLICATION WITH CURL
|
# SETUP APPLICATION WITH CURL
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -245,18 +191,15 @@ fi
|
||||||
### `ynh_replace_string` is used to replace a string in a file.
|
### `ynh_replace_string` is used to replace a string in a file.
|
||||||
### (It's compatible with sed regular expressions syntax)
|
### (It's compatible with sed regular expressions syntax)
|
||||||
|
|
||||||
ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$final_path/CONFIG_FILE"
|
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/.env"
|
||||||
|
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$final_path/.env"
|
||||||
|
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/.env"
|
||||||
|
ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$final_path/.env"
|
||||||
|
ynh_replace_string --match_string="__DB_PASS__" --replace_string="$db_pwd" --target_file="$final_path/.env"
|
||||||
|
|
||||||
#=================================================
|
ynh_replace_string --match_string="__APP_KEY__" --replace_string="$(ynh_string_random --length=32)" --target_file="$final_path/.env"
|
||||||
# STORE THE CONFIG FILE CHECKSUM
|
ynh_replace_string --match_string="__PHANTOMJS_KEY__" --replace_string="$(ynh_string_random --length=32)" --target_file="$final_path/.env"
|
||||||
#=================================================
|
|
||||||
|
|
||||||
### `ynh_store_file_checksum` is used to store the checksum of a file.
|
|
||||||
### That way, during the upgrade script, by using `ynh_backup_if_checksum_is_different`,
|
|
||||||
### you can make a backup of this file before modifying it again if the admin had modified it.
|
|
||||||
|
|
||||||
# Calculate and store the config file checksum into the app settings
|
|
||||||
ynh_store_file_checksum --file="$final_path/CONFIG_FILE"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
@ -271,6 +214,10 @@ ynh_store_file_checksum --file="$final_path/CONFIG_FILE"
|
||||||
# Set permissions to app files
|
# Set permissions to app files
|
||||||
chown -R root: $final_path
|
chown -R root: $final_path
|
||||||
|
|
||||||
|
chmod -R 755 $final_path/storage
|
||||||
|
chown -R $app $final_path/storage $final_path/bootstrap $final_path/public/logo $final_path/.env
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -287,51 +234,13 @@ ynh_script_progression --message="Configuring log rotation..." --time --weight=1
|
||||||
# Use logrotate to manage application logfile(s)
|
# Use logrotate to manage application logfile(s)
|
||||||
ynh_use_logrotate
|
ynh_use_logrotate
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
### `yunohost service add` integrates a service in YunoHost. It then gets
|
|
||||||
### displayed in the admin interface and through the others `yunohost service` commands.
|
|
||||||
### (N.B. : this line only makes sense if the app adds a service to the system!)
|
|
||||||
### If you're not using these lines:
|
|
||||||
### - You can remove these files in conf/.
|
|
||||||
### - Remove the section "REMOVE SERVICE FROM ADMIN PANEL" in the remove script
|
|
||||||
### - As well as the section "ADVERTISE SERVICE IN ADMIN PANEL" in the restore script
|
|
||||||
|
|
||||||
yunohost service add $app --description "A short description of the app" --log "/var/log/$app/$app.log"
|
|
||||||
|
|
||||||
### With YunoHost 3.8 you will then be able to:
|
|
||||||
### - specify a list of ports that needs to be publicly exposed (c.f. --needs_exposed_ports)
|
|
||||||
### which will then be checked by YunoHost's diagnosis system
|
|
||||||
### - specify a custom command to check the status of the service (c.f. --test_status)
|
|
||||||
### though it's only needed for weird cases where 'systemctl status' doesn't do a good job
|
|
||||||
### - specify a custom command to check / validate the configuration of the service (c.f. --test_conf)
|
|
||||||
### for example, the command to check the configuration of nginx is "nginx -t"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# START SYSTEMD SERVICE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Starting a systemd service..." --time --weight=1
|
|
||||||
|
|
||||||
### `ynh_systemd_action` is used to start a systemd service for an app.
|
|
||||||
### Only needed if you have configure a systemd service
|
|
||||||
### If you're not using these lines:
|
|
||||||
### - Remove the section "STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the backup script
|
|
||||||
### - As well as the section "START SYSTEMD SERVICE" in the restore script
|
|
||||||
### - As well as the section"STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the upgrade script
|
|
||||||
### - And the section "STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the change_url script
|
|
||||||
|
|
||||||
# Start a systemd service
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP FAIL2BAN
|
# SETUP FAIL2BAN
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring fail2ban..." --time --weight=1
|
#ynh_script_progression --message="Configuring fail2ban..." --time --weight=1
|
||||||
|
|
||||||
# Create a dedicated fail2ban config
|
# Create a dedicated fail2ban config
|
||||||
ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
|
#ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
|
|
|
@ -35,14 +35,6 @@ then
|
||||||
yunohost service remove $app
|
yunohost service remove $app
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STOP AND REMOVE SERVICE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Stopping and removing the systemd service..." --time --weight=1
|
|
||||||
|
|
||||||
# Remove the dedicated systemd config
|
|
||||||
ynh_remove_systemd_config
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE THE MYSQL DATABASE
|
# REMOVE THE MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -51,14 +43,6 @@ ynh_script_progression --message="Removing the MySQL database..." --time --weigh
|
||||||
# Remove a database if it exists, along with the associated user
|
# Remove a database if it exists, along with the associated user
|
||||||
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing dependencies..." --time --weight=1
|
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
|
||||||
ynh_remove_app_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE APP MAIN DIR
|
# REMOVE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -75,14 +59,6 @@ ynh_script_progression --message="Removing nginx web server configuration..." --
|
||||||
# Remove the dedicated nginx config
|
# Remove the dedicated nginx config
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE PHP-FPM CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing php-fpm configuration..." --time --weight=1
|
|
||||||
|
|
||||||
# Remove the dedicated php-fpm config
|
|
||||||
ynh_remove_fpm_config
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE LOGROTATE CONFIGURATION
|
# REMOVE LOGROTATE CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -91,23 +67,13 @@ ynh_script_progression --message="Removing logrotate configuration..." --time --
|
||||||
# Remove the app-specific logrotate config
|
# Remove the app-specific logrotate config
|
||||||
ynh_remove_logrotate
|
ynh_remove_logrotate
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CLOSE A PORT
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
if yunohost firewall list | grep -q "\- $port$"
|
|
||||||
then
|
|
||||||
ynh_script_progression --message="Closing port $port..."
|
|
||||||
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE FAIL2BAN CONFIGURATION
|
# REMOVE FAIL2BAN CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing fail2ban configuration..." --time --weight=1
|
#ynh_script_progression --message="Removing fail2ban configuration..." --time --weight=1
|
||||||
|
|
||||||
# Remove the dedicated fail2ban config
|
# Remove the dedicated fail2ban config
|
||||||
ynh_remove_fail2ban_config
|
#ynh_remove_fail2ban_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC REMOVE
|
# SPECIFIC REMOVE
|
||||||
|
@ -118,12 +84,6 @@ ynh_remove_fail2ban_config
|
||||||
# Remove a cron file
|
# Remove a cron file
|
||||||
ynh_secure_remove --file="/etc/cron.d/$app"
|
ynh_secure_remove --file="/etc/cron.d/$app"
|
||||||
|
|
||||||
# Remove a directory securely
|
|
||||||
ynh_secure_remove --file="/etc/$app/"
|
|
||||||
|
|
||||||
# Remove the log files
|
|
||||||
ynh_secure_remove --file="/var/log/$app/"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -92,12 +92,6 @@ ynh_systemd_action --action=restart --service_name=fail2ban
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC RESTORATION
|
# SPECIFIC RESTORATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# REINSTALL DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1
|
|
||||||
|
|
||||||
# Define and install dependencies
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE MYSQL DATABASE
|
# RESTORE THE MYSQL DATABASE
|
||||||
|
|
|
@ -88,15 +88,6 @@ ynh_abort_if_errors
|
||||||
# safely remove this line
|
# safely remove this line
|
||||||
path_url=$(ynh_normalize_url_path --path_url=$path_url)
|
path_url=$(ynh_normalize_url_path --path_url=$path_url)
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD UPGRADE STEPS
|
|
||||||
#=================================================
|
|
||||||
# STOP SYSTEMD SERVICE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Stopping a systemd service..." --time --weight=1
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -117,13 +108,6 @@ ynh_script_progression --message="Upgrading nginx web server configuration..." -
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# UPGRADE DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Upgrading dependencies..." --time --weight=1
|
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -143,18 +127,22 @@ ynh_add_fpm_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC UPGRADE
|
# SPECIFIC UPGRADE
|
||||||
#=================================================
|
#=================================================
|
||||||
# ...
|
# Upgrade database via artisan
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading the database..." --time --weight=1
|
||||||
|
|
||||||
#=================================================
|
# Put the application into maintenance mode
|
||||||
# STORE THE CONFIG FILE CHECKSUM
|
$final_path/artisan down --no-interaction --verbose
|
||||||
#=================================================
|
|
||||||
|
# Run the database migrations
|
||||||
|
$final_path/artisan migrate --force --no-interaction --verbose
|
||||||
|
|
||||||
|
# Optimize the framework for better performance
|
||||||
|
$final_path/artisan optimize --force --no-interaction --verbose
|
||||||
|
|
||||||
|
# Bring the application out of maintenance mode
|
||||||
|
$final_path/artisan up --no-interaction --verbose
|
||||||
|
|
||||||
### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
|
||||||
### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it.
|
|
||||||
ynh_backup_if_checksum_is_different --file="$final_path/CONFIG_FILE"
|
|
||||||
# Recalculate and store the checksum of the file for the next upgrade.
|
|
||||||
ynh_store_file_checksum --file="$final_path/CONFIG_FILE"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
|
@ -164,14 +152,6 @@ ynh_script_progression --message="Upgrading logrotate configuration..." --time -
|
||||||
# Use logrotate to manage app-specific logfile(s)
|
# Use logrotate to manage app-specific logfile(s)
|
||||||
ynh_use_logrotate --non-append
|
ynh_use_logrotate --non-append
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SETUP SYSTEMD
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Upgrading systemd configuration..." --time --weight=1
|
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
|
||||||
ynh_add_systemd_config
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -189,6 +169,9 @@ ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failreg
|
||||||
# Set permissions on app files
|
# Set permissions on app files
|
||||||
chown -R root: $final_path
|
chown -R root: $final_path
|
||||||
|
|
||||||
|
chmod -R 755 $final_path/storage
|
||||||
|
chown -R $app $final_path/storage $final_path/bootstrap $final_path/public/logo
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -201,13 +184,6 @@ then
|
||||||
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
|
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# START SYSTEMD SERVICE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Starting a systemd service..." --time --weight=1
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
25
sources/extra_files/app/.env
Normal file
25
sources/extra_files/app/.env
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
APP_ENV=production
|
||||||
|
APP_DEBUG=false
|
||||||
|
APP_LOCALE=en
|
||||||
|
APP_URL=https://__DOMAIN____PATH__/index.php
|
||||||
|
APP_KEY=__APP_KEY__
|
||||||
|
APP_CIPHER=AES-256-CBC
|
||||||
|
REQUIRE_HTTPS=true
|
||||||
|
DB_TYPE=mysql
|
||||||
|
DB_HOST=localhost
|
||||||
|
DB_DATABASE=__DB_NAME__
|
||||||
|
DB_USERNAME=__DB_USER__
|
||||||
|
DB_PASSWORD=__DB_PASS__
|
||||||
|
MAIL_DRIVER=smtp
|
||||||
|
MAIL_PORT=587
|
||||||
|
MAIL_ENCRYPTION=tls
|
||||||
|
MAIL_HOST=
|
||||||
|
MAIL_USERNAME=
|
||||||
|
MAIL_FROM_NAME=Invoiceninja
|
||||||
|
MAIL_FROM_ADDRESS=invoiceninja@gumpri.ch
|
||||||
|
MAIL_PASSWORD=
|
||||||
|
PHANTOMJS_CLOUD_KEY=a-demo-key-with-low-quota-per-ip-address
|
||||||
|
PHANTOMJS_SECRET=__PHANTOMJS_KEY__
|
||||||
|
MAILGUN_DOMAIN=
|
||||||
|
MAILGUN_SECRET=
|
||||||
|
PRECONFIGURED_INSTALL=true
|
Loading…
Reference in a new issue