mirror of
https://github.com/YunoHost-Apps/mosquitto_ynh.git
synced 2024-09-03 19:45:54 +02:00
Add nginx settings
This commit is contained in:
parent
766b098597
commit
95f610b66c
9 changed files with 92 additions and 3 deletions
11
.project
Normal file
11
.project
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>mosquitto_ynh</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
|
@ -1,4 +1,37 @@
|
||||||
listener __PORT__
|
log_timestamp_format %Y-%m-%dT%H:%M:%S
|
||||||
|
|
||||||
|
################### Direct IP ###############################################
|
||||||
|
#To use mosquitto with direct IP call and no websocket protocol, uncomment those lines and comment
|
||||||
|
# those for websocket protocol
|
||||||
|
#You will need to open the firewall port with command "sudo yunohost firewall allow TCP __PORT__ --no-upnp"
|
||||||
|
|
||||||
|
#listener __PORT__
|
||||||
|
|
||||||
|
###################SSL CONNECTION###########################################
|
||||||
|
#To use mosquitto with direct IP and SSL connection, uncomment those lines
|
||||||
|
#You will need to open the firewall port with command "sudo yunohost firewall allow TCP __SSL_PORT__ --no-upnp"
|
||||||
|
|
||||||
|
#listener __PORT_SSL__
|
||||||
|
#certfile /etc/yunohost/certs/__DOMAIN__/crt.pem
|
||||||
|
#cafile /etc/yunohost/certs/__DOMAIN__/crt.pem
|
||||||
|
#keyfile /etc/yunohost/certs/__DOMAIN__/key.pem
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
|
#############################WEBSOCKET AND URL################################
|
||||||
|
#To use mosquitto with websocket protocol and a direct URL call, uncomment those lines and comment
|
||||||
|
#those for direct IP
|
||||||
|
|
||||||
|
listener __PORT__ 127.0.0.1
|
||||||
|
listener __PORT__ ::1
|
||||||
|
|
||||||
|
listener __PORT_WEBSOCKET__
|
||||||
|
protocol websockets
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
allow_anonymous false
|
allow_anonymous false
|
||||||
password_file /etc/mosquitto/passwd
|
password_file /etc/mosquitto/passwd
|
||||||
|
|
10
conf/nginx.conf
Normal file
10
conf/nginx.conf
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
location / {
|
||||||
|
|
||||||
|
#Settings for mqtt server from outside
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_pass http://127.0.0.1:__PORT__;
|
||||||
|
proxy_read_timeout 90;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
}
|
|
@ -7,7 +7,7 @@ name = "Mosquitto"
|
||||||
description.en = "Interconnect your objects and applications with an open source MQTT broker"
|
description.en = "Interconnect your objects and applications with an open source MQTT broker"
|
||||||
description.fr = "Interconnecter vos objets et vos applications grâce à un serveur MQTT open source"
|
description.fr = "Interconnecter vos objets et vos applications grâce à un serveur MQTT open source"
|
||||||
|
|
||||||
version = "2.0.14~ynh2"
|
version = "2.0.14~ynh3"
|
||||||
|
|
||||||
maintainers = ["Grena"]
|
maintainers = ["Grena"]
|
||||||
|
|
||||||
|
@ -30,6 +30,17 @@ ram.build = "100M"
|
||||||
ram.runtime = "10M"
|
ram.runtime = "10M"
|
||||||
|
|
||||||
[install]
|
[install]
|
||||||
|
[install.domain]
|
||||||
|
type = "domain"
|
||||||
|
|
||||||
|
[install.path]
|
||||||
|
type = "path"
|
||||||
|
default = "/example"
|
||||||
|
|
||||||
|
[install.init_main_permission]
|
||||||
|
type = "group"
|
||||||
|
default = "visitors"
|
||||||
|
|
||||||
[install.username]
|
[install.username]
|
||||||
ask.en = "Set the username for client authentication"
|
ask.en = "Set the username for client authentication"
|
||||||
ask.fr = "Définissez le nom d'utilisateur pour l'authentification du client"
|
ask.fr = "Définissez le nom d'utilisateur pour l'authentification du client"
|
||||||
|
@ -52,6 +63,9 @@ ram.runtime = "10M"
|
||||||
[resources.ports]
|
[resources.ports]
|
||||||
main.default = 1883
|
main.default = 1883
|
||||||
main.exposed = "TCP"
|
main.exposed = "TCP"
|
||||||
|
websocket.default = 8883
|
||||||
|
ssl.default = 8884
|
||||||
|
|
||||||
|
|
||||||
[resources.apt]
|
[resources.apt]
|
||||||
packages = "mosquitto"
|
packages = "mosquitto"
|
||||||
|
@ -59,4 +73,4 @@ ram.runtime = "10M"
|
||||||
[resources.apt.extras.mosquitto]
|
[resources.apt.extras.mosquitto]
|
||||||
repo = "deb https://repo.mosquitto.org/debian bullseye main"
|
repo = "deb https://repo.mosquitto.org/debian bullseye main"
|
||||||
key = "http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key"
|
key = "http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key"
|
||||||
packages = ["mosquitto"]
|
packages = ["mosquitto", "mosquitto-clients"]
|
||||||
|
|
|
@ -15,6 +15,12 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Declaring files to be backed up..."
|
ynh_print_info --message="Declaring files to be backed up..."
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC BACKUP
|
# SPECIFIC BACKUP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -37,6 +37,9 @@ chown -R "mosquitto" "/etc/mosquitto"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
||||||
|
|
||||||
|
# Create a dedicated NGINX config using the conf/nginx.conf template
|
||||||
|
ynh_add_nginx_config
|
||||||
|
|
||||||
# Use logrotate to manage application logfile(s)
|
# Use logrotate to manage application logfile(s)
|
||||||
ynh_use_logrotate
|
ynh_use_logrotate
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,8 @@ ynh_systemd_action --service_name="$app" --action="stop"
|
||||||
pkill -u "$app" || true
|
pkill -u "$app" || true
|
||||||
ynh_remove_systemd_config
|
ynh_remove_systemd_config
|
||||||
|
|
||||||
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
# Remove the app-specific logrotate config
|
# Remove the app-specific logrotate config
|
||||||
ynh_remove_logrotate
|
ynh_remove_logrotate
|
||||||
|
|
||||||
|
@ -44,6 +46,7 @@ ynh_secure_remove --file="/etc/mosquitto/passwd"
|
||||||
# Remove the config file
|
# Remove the config file
|
||||||
ynh_secure_remove --file="/etc/mosquitto/conf.d/default.conf"
|
ynh_secure_remove --file="/etc/mosquitto/conf.d/default.conf"
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -15,6 +15,8 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||||
|
|
||||||
yunohost service add "$app" --description="Allows MQTT clients to send/receive data" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port"
|
yunohost service add "$app" --description="Allows MQTT clients to send/receive data" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port"
|
||||||
|
|
|
@ -30,6 +30,10 @@ if [ -z "${userpass:-}" ]; then
|
||||||
ynh_app_setting_delete --app="$app" --key="password"
|
ynh_app_setting_delete --app="$app" --key="password"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "${domain:-}" ]; then
|
||||||
|
ynh_die --message="This new version requires a domain, please remove and reinstall."
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC UPGRADE
|
# SPECIFIC UPGRADE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -52,6 +56,9 @@ chown -R "mosquitto" "/etc/mosquitto"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
||||||
|
|
||||||
|
# Create a dedicated NGINX config using the conf/nginx.conf template
|
||||||
|
ynh_add_nginx_config
|
||||||
|
|
||||||
# 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
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue