mirror of
https://github.com/YunoHost-Apps/cockpit_ynh.git
synced 2024-09-03 18:16:26 +02:00
Small fixes
This commit is contained in:
parent
43fa808425
commit
0cc20fb19c
5 changed files with 55 additions and 209 deletions
|
@ -8,8 +8,6 @@
|
||||||
domain="domain.tld" (DOMAIN)
|
domain="domain.tld" (DOMAIN)
|
||||||
path="/" (PATH)
|
path="/" (PATH)
|
||||||
is_public=1 (PUBLIC|public=1|private=0)
|
is_public=1 (PUBLIC|public=1|private=0)
|
||||||
# password="pass"
|
|
||||||
# nextclouddomain="domain.tld"
|
|
||||||
port="9980" (PORT)
|
port="9980" (PORT)
|
||||||
; Checks
|
; Checks
|
||||||
pkg_linter=1
|
pkg_linter=1
|
||||||
|
@ -25,18 +23,7 @@
|
||||||
port_already_use=0
|
port_already_use=0
|
||||||
change_url=0
|
change_url=0
|
||||||
;;; Levels
|
;;; Levels
|
||||||
Level 1=auto
|
|
||||||
Level 2=auto
|
|
||||||
Level 3=auto
|
|
||||||
# Level 4:
|
|
||||||
Level 4=1 (This app supports the Nextcloud LDAP auth)
|
|
||||||
# Level 5:
|
|
||||||
Level 5=auto
|
Level 5=auto
|
||||||
Level 6=auto
|
|
||||||
Level 7=auto
|
|
||||||
Level 8=0
|
|
||||||
Level 9=0
|
|
||||||
Level 10=0
|
|
||||||
;;; Options
|
;;; Options
|
||||||
Email=
|
Email=
|
||||||
Notification=none
|
Notification=none
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
location __PATH__/ {
|
proxy_pass http://127.0.0.1:__PORT__;
|
||||||
proxy_pass http://127.0.0.1:__PORT__;
|
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_buffering off;
|
proxy_buffering off;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Forwarded-For $remote_addr;
|
proxy_set_header X-Forwarded-For $remote_addr;
|
||||||
|
|
||||||
# needed for websocket
|
# needed for websocket
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_set_header Connection "upgrade";
|
proxy_set_header Connection "upgrade";
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"en": "Cockpit package for YunoHost.",
|
"en": "Cockpit package for YunoHost.",
|
||||||
"fr": "Cockpit pour YunoHost."
|
"fr": "Cockpit pour YunoHost."
|
||||||
},
|
},
|
||||||
"version": "187",
|
"version": "232~ynh1",
|
||||||
"url": "https://cockpit-project.org/",
|
"url": "https://cockpit-project.org/",
|
||||||
"license": "free",
|
"license": "free",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
|
@ -14,12 +14,12 @@
|
||||||
"email": "liberodark@gmail.com"
|
"email": "liberodark@gmail.com"
|
||||||
},
|
},
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 2.7.2"
|
"yunohost": ">= 4.0.0"
|
||||||
},
|
},
|
||||||
"multi_instance": false,
|
"multi_instance": false,
|
||||||
"services": [
|
"services": [
|
||||||
"nginx",
|
"nginx",
|
||||||
"php5-fpm",
|
"php7.0-fpm",
|
||||||
"mysql"
|
"mysql"
|
||||||
],
|
],
|
||||||
"arguments": {
|
"arguments": {
|
||||||
|
@ -32,7 +32,6 @@
|
||||||
},
|
},
|
||||||
"example": "example.com"
|
"example": "example.com"
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name": "path",
|
"name": "path",
|
||||||
"type": "path",
|
"type": "path",
|
||||||
|
@ -43,15 +42,14 @@
|
||||||
"example": "/cockpit",
|
"example": "/cockpit",
|
||||||
"default": "/cockpit"
|
"default": "/cockpit"
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name": "is_public",
|
"name": "is_public",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Is it a public site ?",
|
"en": "Is it a public site?",
|
||||||
"fr": "Est-ce un site public ?"
|
"fr": "Est-ce un site public ?"
|
||||||
},
|
},
|
||||||
"default": "true"
|
"default": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,112 +1,22 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# =============================================================================
|
#=================================================
|
||||||
# YUNOHOST 2.7 FORTHCOMING HELPERS
|
# COMMON VARIABLES
|
||||||
# =============================================================================
|
#=================================================
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
YNH_PHP_VERSION="7.3"
|
||||||
#
|
|
||||||
# usage: ynh_add_nginx_config
|
|
||||||
ynh_add_nginx_config () {
|
|
||||||
finalnginxconf="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
||||||
ynh_backup_if_checksum_is_different "$finalnginxconf"
|
|
||||||
sudo cp ../conf/nginx.conf "$finalnginxconf"
|
|
||||||
|
|
||||||
# To avoid a break by set -u, use a void substitution ${var:-}. If the variable is not set, it's simply set with an empty variable.
|
# dependencies used by the app
|
||||||
# Substitute in a nginx config file only if the variable is not empty
|
pkg_dependencies="cockpit"
|
||||||
if test -n "${path_url:-}"; then
|
|
||||||
ynh_replace_string "__PATH__" "$path_url" "$finalnginxconf"
|
|
||||||
fi
|
|
||||||
if test -n "${domain:-}"; then
|
|
||||||
ynh_replace_string "__DOMAIN__" "$domain" "$finalnginxconf"
|
|
||||||
fi
|
|
||||||
if test -n "${port:-}"; then
|
|
||||||
ynh_replace_string "__PORT__" "$port" "$finalnginxconf"
|
|
||||||
fi
|
|
||||||
if test -n "${app:-}"; then
|
|
||||||
ynh_replace_string "__NAME__" "$app" "$finalnginxconf"
|
|
||||||
fi
|
|
||||||
if test -n "${final_path:-}"; then
|
|
||||||
ynh_replace_string "__FINALPATH__" "$final_path" "$finalnginxconf"
|
|
||||||
fi
|
|
||||||
ynh_store_file_checksum "$finalnginxconf"
|
|
||||||
|
|
||||||
sudo systemctl reload nginx
|
#=================================================
|
||||||
}
|
# PERSONAL HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# Remove the dedicated nginx config
|
#=================================================
|
||||||
#
|
# EXPERIMENTAL HELPERS
|
||||||
# usage: ynh_remove_nginx_config
|
#=================================================
|
||||||
ynh_remove_nginx_config () {
|
|
||||||
ynh_secure_remove "/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
||||||
sudo systemctl reload nginx
|
|
||||||
}
|
|
||||||
|
|
||||||
# Create a dedicated php-fpm config
|
#=================================================
|
||||||
#
|
# FUTURE OFFICIAL HELPERS
|
||||||
# usage: ynh_add_fpm_config
|
#=================================================
|
||||||
ynh_add_fpm_config () {
|
|
||||||
finalphpconf="/etc/php5/fpm/pool.d/$app.conf"
|
|
||||||
ynh_backup_if_checksum_is_different "$finalphpconf"
|
|
||||||
sudo cp ../conf/php-fpm.conf "$finalphpconf"
|
|
||||||
ynh_replace_string "__NAMETOCHANGE__" "$app" "$finalphpconf"
|
|
||||||
ynh_replace_string "__FINALPATH__" "$final_path" "$finalphpconf"
|
|
||||||
ynh_replace_string "__USER__" "$app" "$finalphpconf"
|
|
||||||
sudo chown root: "$finalphpconf"
|
|
||||||
ynh_store_file_checksum "$finalphpconf"
|
|
||||||
|
|
||||||
if [ -e "../conf/php-fpm.ini" ]
|
|
||||||
then
|
|
||||||
finalphpini="/etc/php5/fpm/conf.d/20-$app.ini"
|
|
||||||
ynh_backup_if_checksum_is_different "$finalphpini"
|
|
||||||
sudo cp ../conf/php-fpm.ini "$finalphpini"
|
|
||||||
sudo chown root: "$finalphpini"
|
|
||||||
ynh_store_file_checksum "$finalphpini"
|
|
||||||
fi
|
|
||||||
|
|
||||||
sudo systemctl reload php5-fpm
|
|
||||||
}
|
|
||||||
|
|
||||||
# Remove the dedicated php-fpm config
|
|
||||||
#
|
|
||||||
# usage: ynh_remove_fpm_config
|
|
||||||
ynh_remove_fpm_config () {
|
|
||||||
ynh_secure_remove "/etc/php5/fpm/pool.d/$app.conf"
|
|
||||||
ynh_secure_remove "/etc/php5/fpm/conf.d/20-$app.ini" 2>&1
|
|
||||||
sudo systemctl reload php5-fpm
|
|
||||||
}
|
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
|
||||||
#
|
|
||||||
# usage: ynh_add_systemd_config
|
|
||||||
ynh_add_systemd_config () {
|
|
||||||
finalsystemdconf="/etc/systemd/system/$app.service"
|
|
||||||
ynh_backup_if_checksum_is_different "$finalsystemdconf"
|
|
||||||
sudo cp ../conf/systemd.service "$finalsystemdconf"
|
|
||||||
|
|
||||||
# To avoid a break by set -u, use a void substitution ${var:-}. If the variable is not set, it's simply set with an empty variable.
|
|
||||||
# Substitute in a nginx config file only if the variable is not empty
|
|
||||||
if test -n "${final_path:-}"; then
|
|
||||||
ynh_replace_string "__FINALPATH__" "$final_path" "$finalsystemdconf"
|
|
||||||
fi
|
|
||||||
if test -n "${app:-}"; then
|
|
||||||
ynh_replace_string "__APP__" "$app" "$finalsystemdconf"
|
|
||||||
fi
|
|
||||||
ynh_store_file_checksum "$finalsystemdconf"
|
|
||||||
|
|
||||||
sudo chown root: "$finalsystemdconf"
|
|
||||||
sudo systemctl enable $app
|
|
||||||
sudo systemctl daemon-reload
|
|
||||||
}
|
|
||||||
|
|
||||||
# Remove the dedicated systemd config
|
|
||||||
#
|
|
||||||
# usage: ynh_remove_systemd_config
|
|
||||||
ynh_remove_systemd_config () {
|
|
||||||
finalsystemdconf="/etc/systemd/system/$app.service"
|
|
||||||
if [ -e "$finalsystemdconf" ]; then
|
|
||||||
sudo systemctl stop $app
|
|
||||||
sudo systemctl disable $app
|
|
||||||
ynh_secure_remove "$finalsystemdconf"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
113
scripts/install
113
scripts/install
|
@ -29,24 +29,13 @@ domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url=$YNH_APP_ARG_PATH
|
path_url=$YNH_APP_ARG_PATH
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
|
|
||||||
### 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 instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...)
|
|
||||||
### The app instance name is available as $YNH_APP_INSTANCE_NAME
|
|
||||||
### - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample
|
|
||||||
### - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2
|
|
||||||
### - ynhexample__{N} for the subsequent installations, with N=3,4, ...
|
|
||||||
### The app instance name is probably what interests you most, since this is
|
|
||||||
### guaranteed to be unique. This is a good unique identifier to define installation path,
|
|
||||||
### db names, ...
|
|
||||||
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
|
||||||
|
|
||||||
### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/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=/var/www/$app
|
final_path=/var/www/$app
|
||||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||||
|
|
||||||
|
@ -61,92 +50,38 @@ ynh_webpath_register $app $domain $path_url
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Storing installation settings..." --weight=2
|
||||||
|
|
||||||
ynh_app_setting_set $app domain $domain
|
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||||
ynh_app_setting_set $app path $path_url
|
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||||
ynh_app_setting_set $app is_public $is_public
|
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
|
||||||
|
|
||||||
#==============================================
|
|
||||||
# INSTALL DEPS
|
|
||||||
#==============================================
|
|
||||||
|
|
||||||
## Install the backports repo for debian
|
|
||||||
echo 'deb http://deb.debian.org/debian stretch-backports main' > \
|
|
||||||
/etc/apt/sources.list.d/$app.list
|
|
||||||
|
|
||||||
ynh_package_update
|
|
||||||
ynh_install_app_dependencies cockpit
|
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# STANDARD MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
# FIND AND OPEN A PORT
|
# FIND AND OPEN A PORT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring firewall..." --weight=2
|
||||||
|
|
||||||
### Use these lines if you have to open a port for the application
|
# Find an available port
|
||||||
### `ynh_find_port` will find the first available port starting from the given port.
|
port=$(ynh_find_port --port=9090)
|
||||||
### If you're not using these lines:
|
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||||
### - Remove the section "CLOSE A PORT" in the remove script
|
|
||||||
|
|
||||||
# Find a free port
|
|
||||||
port=$(ynh_find_port 9090)
|
|
||||||
# Open this port
|
|
||||||
#yunohost firewall allow --no-upnp TCP $port 2>&1
|
|
||||||
ynh_app_setting_set $app port $port
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Installing dependencies..." --weight=20
|
||||||
|
|
||||||
#ynh_app_setting_set $app final_path $final_path
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
|
||||||
#ynh_setup_source "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Create a system user
|
|
||||||
#ynh_system_user_create $app
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# MODIFY A CONFIG FILE
|
|
||||||
#=================================================
|
|
||||||
#cp -a ../conf/onlyoffice-documentserver.conf /etc/onlyoffice/documentserver/nginx/onlyoffice-documentserver.conf
|
|
||||||
#ynh_replace_string "__NEXTCLOUDDOMAIN__" "$nextcloud_domain" "/etc/loolwsd/loolwsd.xml"
|
|
||||||
#ynh_replace_string "__PASSWORD__" "$password" "/etc/loolwsd/loolwsd.xml"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STORE THE CONFIG FILE CHECKSUM
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
### `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 "/etc/onlyoffice/documentserver/nginx/onlyoffice-documentserver.conf"
|
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
|
||||||
# SECURE FILES AND DIRECTORIES
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
### For security reason, any app should set the permissions to root: before anything else.
|
|
||||||
### Then, if write authorization is needed, any access should be given only to directories
|
|
||||||
### that really need such authorization.
|
|
||||||
|
|
||||||
# Set permissions to app files
|
|
||||||
#chown -R root: /etc/loolwsd
|
|
||||||
rm /etc/apt/sources.list.d/$app.list
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -158,5 +93,19 @@ if [ $is_public -eq 1 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Reload services
|
# Reload services
|
||||||
|
systemctl start cockpit
|
||||||
systemctl enable --now cockpit
|
systemctl enable --now cockpit
|
||||||
systemctl reload nginx
|
|
||||||
|
#=================================================
|
||||||
|
# RELOAD NGINX
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Reloading NGINX web server..." --weight=2
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Installation of HedgeDoc completed" --last
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue