mirror of
https://github.com/YunoHost-Apps/beehive_ynh.git
synced 2024-09-03 18:06:24 +02:00
commit
b3cc33f2a6
15 changed files with 154 additions and 341 deletions
|
@ -1,13 +1,8 @@
|
||||||
# See here for more information
|
|
||||||
# https://github.com/YunoHost/package_check#syntax-check_process-file
|
|
||||||
|
|
||||||
# Move this file from check_process.default to check_process when you have filled it.
|
|
||||||
|
|
||||||
;; Test complet
|
;; Test complet
|
||||||
; Manifest
|
; Manifest
|
||||||
domain="domain.tld" (DOMAIN)
|
domain="domain.tld"
|
||||||
admin="john" (USER)
|
admin="john"
|
||||||
port="8181" (PORT)
|
port="8181"
|
||||||
; Checks
|
; Checks
|
||||||
pkg_linter=1
|
pkg_linter=1
|
||||||
setup_sub_dir=0
|
setup_sub_dir=0
|
||||||
|
@ -19,7 +14,6 @@
|
||||||
#upgrade=1 from_commit=CommitHash
|
#upgrade=1 from_commit=CommitHash
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=1
|
multi_instance=1
|
||||||
port_already_use=0
|
|
||||||
change_url=0
|
change_url=0
|
||||||
;;; Options
|
;;; Options
|
||||||
Email=
|
Email=
|
||||||
|
|
7
conf/amd64.src
Normal file
7
conf/amd64.src
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
SOURCE_URL=https://github.com/muesli/beehive/releases/download/v0.4.0/beehive_0.4.0_Linux_x86_64.tar.gz
|
||||||
|
SOURCE_SUM=f1959bc2f7c19d4ec8eaabc7b78492836afcc3bcd75d034854e66607efa9efab
|
||||||
|
SOURCE_SUM_PRG=sha256sum
|
||||||
|
SOURCE_FORMAT=tar.gz
|
||||||
|
SOURCE_IN_SUBDIR=false
|
||||||
|
SOURCE_FILENAME=
|
||||||
|
SOURCE_EXTRACT=true
|
21
conf/beehive.conf
Normal file
21
conf/beehive.conf
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
"Bees":[
|
||||||
|
{
|
||||||
|
"Name":"ircbee_freenode",
|
||||||
|
"Class":"ircbee",
|
||||||
|
"Description":"ircbee connected to freenode, channel #beehive",
|
||||||
|
"Options":[
|
||||||
|
{
|
||||||
|
"Name":"server",
|
||||||
|
"Value":"irc.freenode.net"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"nick",
|
||||||
|
"Value":"beehive"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"channels",
|
||||||
|
"Value":["#beehive"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
|
@ -1,17 +1,19 @@
|
||||||
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
location / {
|
||||||
location __PATH__/ {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
proxy_pass http://localhost:__PORT__;
|
proxy_pass https://127.0.0.1:__PORT__;
|
||||||
|
proxy_redirect off;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Host $server_name;
|
||||||
|
|
||||||
### End of PHP configuration part
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
# Include SSOWAT user panel.
|
proxy_set_header Connection "upgrade";
|
||||||
include conf.d/yunohost_panel.conf.inc;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,12 +7,13 @@ Type=simple
|
||||||
User=__APP__
|
User=__APP__
|
||||||
Group=__APP__
|
Group=__APP__
|
||||||
WorkingDirectory=__FINALPATH__/
|
WorkingDirectory=__FINALPATH__/
|
||||||
ExecStart=__FINALPATH__/beehive -bind 127.0.0.1:__PORT__ -canonicalurl https://__DOMAIN__ -config __FINALPATH__/__APP__.conf
|
ExecStart=__FINALPATH__/beehive --config __FINALPATH__/beehive.conf
|
||||||
|
#-bind "127.0.0.1:__PORT__" -canonicalurl "https://__DOMAIN__"
|
||||||
Restart=always
|
Restart=always
|
||||||
StandardOutput=/var/log/__APP__/__APP__.log
|
StandardOutput=/var/log/__APP__/__APP__.log
|
||||||
StandardError=/var/log/__APP__/__APP__.log
|
StandardError=/var/log/__APP__/__APP__.log
|
||||||
SyslogIdentifier=__APP__
|
SyslogIdentifier=__APP__
|
||||||
Environment=GOPATH=/usr/local/go/bin
|
WatchdogSec=30s
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
|
@ -1,55 +0,0 @@
|
||||||
---
|
|
||||||
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 beehive 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 beehive
|
|
||||||
```
|
|
||||||
- *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.*
|
|
|
@ -5,14 +5,14 @@
|
||||||
"description": {
|
"description": {
|
||||||
"en": "A flexible event/agent & automation system "
|
"en": "A flexible event/agent & automation system "
|
||||||
},
|
},
|
||||||
"version": "28.01.2021~ynh1",
|
"version": "0.4.0~ynh1",
|
||||||
"url": "https://github.com/muesli/beehive",
|
"url": "https://github.com/muesli/beehive",
|
||||||
"license": "AGPL-1.0-or-later",
|
"license": "AGPL-1.0-or-later",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
"name": "Anmol Sharma"
|
"name": "Anmol Sharma"
|
||||||
},
|
},
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 4.1.3"
|
"yunohost": ">= 4.2.4"
|
||||||
},
|
},
|
||||||
"multi_instance": true,
|
"multi_instance": true,
|
||||||
"services": [
|
"services": [
|
||||||
|
@ -23,17 +23,11 @@
|
||||||
{
|
{
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"type": "domain",
|
"type": "domain",
|
||||||
"ask": {
|
|
||||||
"en": "Choose a domain name for Beehive"
|
|
||||||
},
|
|
||||||
"example": "example.com"
|
"example": "example.com"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "admin",
|
"name": "admin",
|
||||||
"type": "user",
|
"type": "user",
|
||||||
"ask": {
|
|
||||||
"en": "Choose an admin user"
|
|
||||||
},
|
|
||||||
"example": "johndoe"
|
"example": "johndoe"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
## Problem
|
|
||||||
- *Description of why you made this PR*
|
|
||||||
|
|
||||||
## Solution
|
|
||||||
- *And how do you fix that problem*
|
|
|
@ -3,53 +3,33 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES
|
||||||
#=================================================
|
#=================================================
|
||||||
GO_VERSION=1.16
|
|
||||||
# dependencies used by the app
|
|
||||||
pkg_dependencies="wget"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# Check the architecture
|
||||||
|
#
|
||||||
|
# example: architecture=$(ynh_detect_arch)
|
||||||
|
#
|
||||||
|
# usage: ynh_detect_arch
|
||||||
|
#
|
||||||
|
# Requires YunoHost version 2.2.4 or higher.
|
||||||
|
|
||||||
|
ynh_detect_arch(){
|
||||||
|
local architecture
|
||||||
if [ -n "$(uname -m | grep arm64)" ] || [ -n "$(uname -m | grep aarch64)" ]; then
|
if [ -n "$(uname -m | grep arm64)" ] || [ -n "$(uname -m | grep aarch64)" ]; then
|
||||||
architecture="arm64"
|
architecture="arm64"
|
||||||
elif [ -n "$(uname -m | grep 64)" ]; then
|
elif [ -n "$(uname -m | grep 64)" ]; then
|
||||||
architecture="amd64"
|
architecture="amd64"
|
||||||
|
elif [ -n "$(uname -m | grep 86)" ]; then
|
||||||
|
architecture="386"
|
||||||
|
elif [ -n "$(uname -m | grep armv7)" ]; then
|
||||||
|
architecture="arm7"
|
||||||
|
elif [ -n "$(uname -m | grep armv6)" ]; then
|
||||||
|
architecture="arm6"
|
||||||
else
|
else
|
||||||
ynh_die "Unable to detect your achitecture, please open a bug describing \
|
architecture="unknown"
|
||||||
your hardware and the result of the command \"uname -m\"." 1
|
|
||||||
fi
|
fi
|
||||||
|
echo $architecture
|
||||||
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 /; then
|
|
||||||
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")"
|
|
||||||
}
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# EXPERIMENTAL HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# FUTURE OFFICIAL HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Declaring files to be backed up..."
|
ynh_print_info --message="Declaring files to be backed up..."
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -105,16 +105,6 @@ then
|
||||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC MODIFICATIONS
|
|
||||||
#=================================================
|
|
||||||
# ...
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALISATION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -27,18 +27,16 @@ ynh_abort_if_errors
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url="/"
|
path_url="/"
|
||||||
admin=$YNH_APP_ARG_ADMIN
|
admin=$YNH_APP_ARG_ADMIN
|
||||||
|
architecture=$(ynh_detect_arch)
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
||||||
|
|
||||||
### If the app uses NGINX as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app".
|
final_path=/var/www/$app
|
||||||
### If the app provides an internal web server (or uses another application server such as uWSGI), the final path should be "/opt/yunohost/$app"
|
|
||||||
final_path=/opt/yunohost/$app
|
|
||||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||||
|
|
||||||
# Register (book) web path
|
# Register (book) web path
|
||||||
|
@ -64,76 +62,41 @@ ynh_script_progression --message="Finding an available port..." --weight=1
|
||||||
port=$(ynh_find_port --port=8181)
|
port=$(ynh_find_port --port=8181)
|
||||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# INSTALL DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Installing dependencies..." --weight=1
|
|
||||||
|
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
# Install Go
|
|
||||||
tmpdir="$(ynh_smart_mktemp)"
|
|
||||||
pushd "$tmpdir"
|
|
||||||
wget https://golang.org/dl/go$GO_VERSION.linux-$architecture.tar.gz
|
|
||||||
ynh_secure_remove /usr/local/go
|
|
||||||
tar -C /usr/local -xzf go$GO_VERSION.linux-$architecture.tar.gz
|
|
||||||
popd
|
|
||||||
ynh_secure_remove "$tmpdir"
|
|
||||||
export PATH=$PATH:/usr/local/go/bin
|
|
||||||
export GOPATH=/usr/local/go/bin
|
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Setting up source files..." --weight=1
|
|
||||||
|
|
||||||
### `ynh_setup_source` is used to install an app from a zip or tar.gz file,
|
|
||||||
### downloaded from an upstream source, like a git repository.
|
|
||||||
### `ynh_setup_source` use the file conf/app.src
|
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
|
||||||
|
|
||||||
git clone --recursive https://github.com/muesli/beehive.git "$final_path"
|
|
||||||
pushd "$final_path"
|
|
||||||
make
|
|
||||||
popd
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
|
||||||
|
|
||||||
### `ynh_add_nginx_config` will use the file conf/nginx.conf
|
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
|
||||||
ynh_add_nginx_config
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring system user..." --weight=1
|
ynh_script_progression --message="Configuring system user..." --weight=1
|
||||||
|
|
||||||
# Create a system user
|
# Create a system user
|
||||||
ynh_system_user_create --username=$app
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Setting up source files..." --weight=1
|
||||||
|
|
||||||
|
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" --source_id="$architecture"
|
||||||
|
|
||||||
|
chmod 750 "$final_path"
|
||||||
|
chmod -R o-rwx "$final_path"
|
||||||
|
chown -R $app:www-data "$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||||
|
|
||||||
|
# Create a dedicated NGINX config
|
||||||
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_add_systemd_config --service="$app" --template="systemd.service" --others_var="port domain"
|
ynh_add_systemd_config
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
|
||||||
# SECURE FILES AND DIRECTORIES
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
chown -R $app: $final_path
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
|
@ -147,7 +110,6 @@ ynh_use_logrotate
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||||
|
|
||||||
|
|
||||||
yunohost service add $app --description="$app service" --log="/var/log/$app/$app.log"
|
yunohost service add $app --description="$app service" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -155,20 +117,15 @@ yunohost service add $app --description="$app service" --log="/var/log/$app/$app
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring permissions..." --weight=1
|
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||||
|
|
||||||
|
|
||||||
# Only the admin can access the admin panel of the app (if the app has an admin panel)
|
# Only the admin can access the admin panel of the app (if the app has an admin panel)
|
||||||
ynh_permission_update --permission "main" --remove all_users --add $admin
|
ynh_permission_update --permission "main" --remove="all_users" --add="$admin"
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
|
|
|
@ -41,15 +41,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
|
||||||
# Remove the dedicated systemd config
|
# Remove the dedicated systemd config
|
||||||
ynh_remove_systemd_config
|
ynh_remove_systemd_config
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing dependencies..." --weight=1
|
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
|
||||||
ynh_remove_app_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE APP MAIN DIR
|
# REMOVE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -66,8 +57,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 LOGROTATE CONFIGURATION
|
# REMOVE LOGROTATE CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -76,25 +65,6 @@ ynh_script_progression --message="Removing logrotate configuration..." --weight
|
||||||
# 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..." --weight=1
|
|
||||||
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC REMOVE
|
|
||||||
#=================================================
|
|
||||||
# REMOVE VARIOUS FILES
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Remove the log files
|
|
||||||
ynh_secure_remove --file="/var/log/$app/"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -102,7 +72,6 @@ ynh_secure_remove --file="/var/log/$app/"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
||||||
|
|
||||||
# Delete a system user
|
|
||||||
ynh_system_user_delete --username=$app
|
ynh_system_user_delete --username=$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -50,6 +50,14 @@ test ! -d $final_path \
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RECREATE THE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
||||||
|
|
||||||
|
# Create the dedicated user (if not existing)
|
||||||
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -57,30 +65,9 @@ ynh_script_progression --message="Restoring the app main directory..." --weight
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$final_path"
|
ynh_restore_file --origin_path="$final_path"
|
||||||
|
|
||||||
#=================================================
|
chmod 750 "$final_path"
|
||||||
# RECREATE THE DEDICATED USER
|
chmod -R o-rwx "$final_path"
|
||||||
#=================================================
|
chown -R $app:www-data "$final_path"
|
||||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
|
||||||
|
|
||||||
# Create the dedicated user (if not existing)
|
|
||||||
ynh_system_user_create --username=$app
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE USER RIGHTS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Restore permissions on app files
|
|
||||||
chown -R $app: $final_path
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC RESTORATION
|
|
||||||
#=================================================
|
|
||||||
# REINSTALL DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
|
|
||||||
|
|
||||||
# Define and install dependencies
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE SYSTEMD
|
# RESTORE SYSTEMD
|
||||||
|
|
|
@ -26,7 +26,6 @@ port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
upgrade_type=$(ynh_check_app_version_changed)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -52,6 +51,14 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CREATE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
||||||
|
|
||||||
|
# Create a dedicated user (if not existing)
|
||||||
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -61,14 +68,13 @@ then
|
||||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
export PATH=$PATH:/usr/local/go/bin
|
ynh_setup_source --dest_dir="$final_path"
|
||||||
export GOPATH=/usr/local/go/bin
|
|
||||||
pushd "$final_path"
|
|
||||||
git pull
|
|
||||||
make
|
|
||||||
popd
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
chmod 750 "$final_path"
|
||||||
|
chmod -R o-rwx "$final_path"
|
||||||
|
chown -R $app:www-data "$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -77,45 +83,13 @@ 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..." --weight=1
|
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
|
||||||
|
|
||||||
# Create a dedicated user (if not existing)
|
|
||||||
ynh_system_user_create --username=$app
|
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC UPGRADE
|
|
||||||
#=================================================
|
|
||||||
# ...
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
|
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
ynh_add_systemd_config --service="$app" --template="systemd.service" --others_var="port domain"
|
ynh_add_systemd_config
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
|
||||||
# SECURE FILES AND DIRECTORIES
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Set permissions on app files
|
|
||||||
chown -R $app: $final_path
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
|
@ -144,10 +118,8 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring permissions..." --weight=1
|
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||||
|
|
||||||
|
|
||||||
# Only the admin can access the admin panel of the app (if the app has an admin panel)
|
# Only the admin can access the admin panel of the app (if the app has an admin panel)
|
||||||
ynh_permission_update --permission "main" --remove all_users --add $admin
|
ynh_permission_update --permission="main" --remove=all_users --add=$admin
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
|
|
Loading…
Reference in a new issue