Commit 0c6fc658 authored by HgO's avatar HgO

Merge branch 'unstable' into 'stable'

Release Neutrinet v0.3.0~ynh5

See merge request Neutrinet/neutrinet_ynh!27
parents 9db7799f 403d2c27
......@@ -2,9 +2,33 @@
The neutrinet application is for Neutrinet members that have an Internet Cube configured and does 2 things:
* It renews the vpn-certificates
* Adds a webpage with genral information about Neutrinet
* It adds a webpage with general information about Neutrinet
# Installation
## From the web interface
First make sure you have the neutrinet apps list
1. Go to the admin interface on your cube
2. Click *Tools*
3. In the *Advanced* section, click *Applications lists*
4. Check in the Applications lists section if you have *neutrinet*
If you don't have it, under *Custom applications list*, fill in the form with:
1. Name: *neutrinet*
2. URL: *https://neutrinet.be/apps.json*
Then, click on the *Add* button.
Now, we can install the Neutrinet application:
1. Go to the admin interface
2. Click *Applications*
3. Click *Install* button
4. Select *All apps* on the right
5. Search for *neutrinet*
6. Click *Install*
7. Fill in the form (or just keep the defaults) and click *Install* just like you would install any app from the web interface
## From the CLI
First check if you have a list, probably named *neutrinet*, with *https://neutrinet.be/apps.json* as url.
......@@ -47,12 +71,12 @@ sudo ./renew_cert_cron.sh -v
## Contributing
* Bugs, feature requests and other issues can be logged on the issue tracker at https://git.domainepublic.net/Neutrinet/neutrinet_ynh/issues
* Merge requests should be submitted at https://git.domainepublic.net/Neutrinet/neutrinet_ynh
* Merge requests should be done to the `develop` branch
* Merge requests should be done to the `unstable` branch
## Publish a new version of the app
* Edit the [manifest](manifest.json) file to bump the version
* Edit the [upgrade](scripts/upgrade) script with the needed upgrades for previous installations
* Test the updated version both for new installs and upgrades and make sure the other scripts ([backup](scripts/backup), [remove](scripts/remove) and [upgrade](scripts/upgrade)) also still work
* In the [apps.json](https://neutrinet.be/apps.json) file you must update the `revision` with the current `sha` on the `master` branch of the package and update the `lastUpdate` field. If you added things to the manifest file, you should add these changes ass well
* In the [apps.json](https://neutrinet.be/apps.json) file you must update the `revision` with the current `sha` on the `stable` branch of the package and update the `lastUpdate` field. If you added things to the manifest file, you should add these changes ass well
location PATHTOCHANGE {
rewrite ^PATHTOCHANGE$ PATHTOCHANGE/ permanent;
location PATHTOCHANGE/ {
return 302 PATHTOCHANGE/fr;
}
location PATHTOCHANGE/nl {
alias ALIASTOCHANGE;
index index_nl.html;
}
location PATHTOCHANGE/fr {
alias ALIASTOCHANGE;
index index.html;
index index_fr.html;
}
......@@ -5,7 +5,7 @@
"en": "Auto renewal for the Neutrinet vpn-certificates",
"fr": "Renouvellement automatique des certificats vpn Neutrinet"
},
"version": "0.3.0~ynh4",
"version": "0.3.0~ynh5",
"license": "GPL-3+",
"maintainer": {
"name": "ilja",
......@@ -13,7 +13,7 @@
"url": "https://gitlab.com/Spctrl"
},
"requirements": {
"yunohost": ">= 3.2.0"
"yunohost": ">= 3.5.0"
},
"multi_instance": "false",
"services": [
......
......@@ -26,6 +26,7 @@ path_url=$(ynh_app_setting_get $app path_url)
app_user=$(ynh_app_setting_get $app app_user)
www_path=$(ynh_app_setting_get $app www_path)
opt_path=$(ynh_app_setting_get $app opt_path)
nginx_path=/etc/nginx/conf.d/$domain.d/$app.conf
#=================================================
# STANDARD BACKUP STEPS
......@@ -33,10 +34,10 @@ opt_path=$(ynh_app_setting_get $app opt_path)
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_print_info "Backing up..."
ynh_script_progression "Backing up..."
ynh_backup "$www_path"
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup "$nginx_path"
ynh_backup "$opt_path"
ynh_backup "/etc/cron.daily/$app-renew-cert"
......
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
source _common.sh
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
app=$YNH_APP_INSTANCE_NAME
old_domain=$YNH_APP_OLD_DOMAIN
old_path_url=$YNH_APP_OLD_PATH
www_path=$(ynh_app_setting_get $app www_path)
domain=$YNH_APP_NEW_DOMAIN
path_url=$YNH_APP_NEW_PATH
nginx_path=/etc/nginx/conf.d/$domain.d/$app.conf
#==================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#==================================================
# Normalize the url path syntax
path_url=$(ynh_normalize_url_path $path_url)
# Trim trailing slashes
path_url=$(sed 's@*/$@@' <<< $path_url)
#=================================================
# STORE SETTINGS
#=================================================
ynh_app_setting_set $app domain $domain
ynh_app_setting_set $app path_url $path_url
#=================================================
# CHANGE URL IN NGINX CONFIG
#=================================================
ynh_script_progression "Updating nginx configuration..."
cp ../conf/nginx.conf "$nginx_path"
if [[ $path_url == "/" ]]; then
sed -i "/^rewrite/d" "$nginx_path"
path_url=""
fi
sed -i "s@PATHTOCHANGE@$path_url@g" "$nginx_path"
sed -i "s@ALIASTOCHANGE@$www_path@g" "$nginx_path"
if [[ $old_domain != $domain ]]; then
rm -f /etc/nginx/conf.d/$old_domain.d/$app.conf
fi
ynh_script_progression "Reloading nginx web server..."
nginx -tq
ynh_systemd_action nginx reload
......@@ -23,6 +23,7 @@ domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH_URL
app=$YNH_APP_INSTANCE_NAME
app_user=$app
nginx_path=/etc/nginx/conf.d/$domain.d/$app.conf
#==================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
......@@ -70,7 +71,7 @@ ynh_app_setting_set $app opt_path $opt_path
# INSTALL DEPENDENCIES
#=================================================
ynh_print_info "Installing dependencies…"
ynh_script_progression "Installing dependencies…"
ynh_install_app_dependencies git python3-openssl python3-requests
......@@ -78,7 +79,7 @@ ynh_install_app_dependencies git python3-openssl python3-requests
# CREATE DEDICATED USER
#=================================================
ynh_print_info "Creating app's user…"
ynh_script_progression "Creating app's user…"
mkdir -p $www_path
ynh_system_user_create $app_user $www_path
......@@ -87,18 +88,23 @@ ynh_system_user_create $app_user $www_path
# INSTALL STATIC FILE
#=================================================
ynh_print_info "Installing static site…"
ynh_script_progression "Installing static site…"
cp -a ../sources/. $www_path
chown -R $app_user: $www_path
sed -i "s@PATHTOCHANGE@$path_url@g" ../conf/nginx.conf
sed -i "s@ALIASTOCHANGE@$www_path@g" ../conf/nginx.conf
cp ../conf/nginx.conf "$nginx_path"
cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
if [[ $path_url == "/" ]]; then
sed -i "/^rewrite/d" "$nginx_path"
path_url=""
fi
sed -i "s@PATHTOCHANGE@$path_url@g" "$nginx_path"
sed -i "s@ALIASTOCHANGE@$www_path@g" "$nginx_path"
nginx -tq
service nginx reload
ynh_systemd_action nginx reload
#=================================================
# INSTALL RENEW CERT
......@@ -109,7 +115,7 @@ renew_cert_version=$(jq .version ../manifest.json -r -e | cut -d '~' -f 1)
renew_cert_path="$opt_path/renew_cert"
renew_cert_cron_script="renew_cert_cron.sh"
ynh_print_info "Installing automatic VPN certificate renewal…"
ynh_script_progression "Installing automatic VPN certificate renewal…"
git clone $renew_cert_repo $renew_cert_path
git -C $renew_cert_path checkout $renew_cert_version
......@@ -118,7 +124,7 @@ git -C $renew_cert_path checkout $renew_cert_version
# This wrapper will be used as a daily cron task
cp $renew_cert_cron_script $renew_cert_path/$renew_cert_cron_script
ynh_print_info "Setting up permissions"
ynh_script_progression "Setting up permissions"
chown -R $app_user: $opt_path
chmod 0755 $renew_cert_path/$renew_cert_cron_script
......@@ -128,7 +134,7 @@ chown root: $renew_cert_path/$renew_cert_cron_script
# SETTING UP CRONTAB
#=================================================
ynh_print_info "Setting up cron job for certificate renewal…"
ynh_script_progression "Setting up cron job for certificate renewal…"
cat <<EOF > /etc/cron.daily/$app-renew-cert
#!/bin/bash
......@@ -143,6 +149,6 @@ chmod 0755 /etc/cron.daily/$app-renew-cert
# FINALIZATION
#=================================================
ynh_print_info "Checking certificates…"
ynh_script_progression "Checking certificates…"
/etc/cron.daily/$app-renew-cert
......@@ -20,20 +20,21 @@ path_url=$(ynh_app_setting_get $app path_url)
app_user=$(ynh_app_setting_get $app app_user)
www_path=$(ynh_app_setting_get $app www_path)
opt_path=$(ynh_app_setting_get $app opt_path)
nginx_path=/etc/nginx/conf.d/$domain.d/$app.conf
#=================================================
# STANDARD REMOVE
#=================================================
ynh_print_info "Removing static site..."
ynh_script_progression "Removing static site..."
rm -rf $www_path
rm -f /etc/nginx/conf.d/$domain.d/$app.conf
rm -f "$nginx_path"
nginx -t > /dev/null
service nginx reload
nginx -tq
ynh_systemd_action nginx reload
ynh_print_info "Removing automatic vpn certificate renewal..."
ynh_script_progression "Removing automatic vpn certificate renewal..."
rm -rf $opt_path
rm -rf /etc/cron.daily/$app-renew-cert
......@@ -42,7 +43,7 @@ rm -rf /etc/cron.daily/$app-renew-cert
# REMOVE DEPENDENCIES
#=================================================
ynh_print_info "Removing dependencies..."
ynh_script_progression "Removing dependencies..."
ynh_remove_app_dependencies
......@@ -50,6 +51,6 @@ ynh_remove_app_dependencies
# REMOVE DEDICATED USER
#=================================================
ynh_print_info "Removing system user..."
ynh_script_progression "Removing system user..."
ynh_system_user_delete $app_user
......@@ -26,12 +26,13 @@ path_url=$(ynh_app_setting_get $app path_url)
app_user=$(ynh_app_setting_get $app app_user)
www_path=$(ynh_app_setting_get $app www_path)
opt_path=$(ynh_app_setting_get $app opt_path)
nginx_path=/etc/nginx/conf.d/$domain.d/$app.conf
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_print_info "Checking for conflicts…"
ynh_script_progression "Checking for conflicts…"
[[ ! -e $www_path ]] || ynh_die "The path $www_path already contains a folder"
[[ ! -e $opt_path ]] || ynh_die "The path $opt_path already contains a folder"
......@@ -48,7 +49,7 @@ fi
# INSTALL DEPENDENCIES
#=================================================
ynh_print_info "Installing dependencies…"
ynh_script_progression "Installing dependencies…"
ynh_install_app_dependencies git python3-openssl python3-requests
......@@ -63,20 +64,20 @@ ynh_system_user_create $app_user "$www_path"
# RESTORE STATIC FILES
#=================================================
ynh_print_info "Restoring static site…"
ynh_script_progression "Restoring static site…"
ynh_restore_file "$www_path"
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file "$nginx_path"
chown -R $app_user: "$www_path"
nginx -tq
service nginx reload
ynh_systemd_action nginx reload
#=================================================
# RESTORE RENEW CERT
#=================================================
ynh_print_info "Restoring automatic VPN certificates renewal…"
ynh_script_progression "Restoring automatic VPN certificates renewal…"
ynh_restore_file "$opt_path"
ynh_restore_file "/etc/cron.daily/$app-renew-cert"
......@@ -91,7 +92,7 @@ chmod 0755 /etc/cron.daily/$app-renew-cert \
# FINALIZATION
#=================================================
ynh_print_info "Checking certificates…"
ynh_script_progression "Checking certificates…"
/etc/cron.daily/$app-renew-cert
......@@ -30,6 +30,8 @@ opt_path=$(ynh_app_setting_get $app opt_path)
manifest=/etc/yunohost/apps/$app/manifest.json
version=$(jq '.version // empty' -r -e $manifest || ynh_app_setting_get $app version)
nginx_path=/etc/nginx/conf.d/$domain.d/$app.conf
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
......@@ -53,6 +55,9 @@ if [[ -z $app_user ]]; then
ynh_app_setting_set $app app_user $app_user
fi
# Trim trailing slashes
path_url=$(sed 's@/*$@@' <<< $path_url)
if [[ -z $path_url ]]; then
path_url=$path
......@@ -63,12 +68,6 @@ if [[ -z $path_url ]]; then
fi
fi
if [[ $path_url == */ ]]; then
# Trim trailing slashes
path_url=$(sed 's@/*$@@' <<< $path_url)
ynh_app_setting_set $app path_url $path_url
fi
# path setting is needed by Yunohost
# when path is empty, Yunohost thinks the app is on the domain root
if [[ "$path" != "$path_url" ]]; then
......@@ -80,7 +79,7 @@ fi
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_print_info "Creating backup..."
ynh_script_progression "Creating backup..."
ynh_backup_before_upgrade
ynh_clean_setup () {
......@@ -97,6 +96,8 @@ ynh_abort_if_errors
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression "Upgrading dependencies..."
if [[ $version < "0.3.0~ynh1" ]]; then
ynh_app_setting_delete $app version
ynh_system_user_create --username $app_user --home_dir $www_path
......@@ -116,24 +117,31 @@ fi
# REINSTALL STATIC FILES
#=================================================
ynh_print_info "Installing static site..."
ynh_script_progression "Installing static site..."
rm -rf $www_path
mkdir -p $www_path
cp -r ../sources/. $www_path
chown -R $app_user: $www_path
sed -i "s@PATHTOCHANGE@$path_url@g" ../conf/nginx.conf
sed -i "s@ALIASTOCHANGE@$www_path@g" ../conf/nginx.conf
cp ../conf/nginx.conf "$nginx_path"
if [[ $path_url == "/" ]]; then
sed -i "/^rewrite/d" "$nginx_path"
path_url=""
fi
cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
sed -i "s@PATHTOCHANGE@$path_url@g" "$nginx_path"
sed -i "s@ALIASTOCHANGE@$www_path@g" "$nginx_path"
nginx -tq
service nginx reload
ynh_systemd_action nginx reload
#=================================================
# REINSTALL RENEW CERT
#=================================================
ynh_print_info "Installing automatic VPN certificate renewal..."
ynh_script_progression "Installing automatic VPN certificate renewal..."
renew_cert_repo="https://github.com/neutrinet/renew_cert"
renew_cert_version=$(jq .version ../manifest.json -r -e | cut -d '~' -f 1)
......@@ -152,7 +160,7 @@ git -C $renew_cert_path checkout $renew_cert_version
# This wrapper will be used as a daily cron task
cp $renew_cert_cron_script $renew_cert_path/$renew_cert_cron_script
ynh_print_info "Setting up permissions"
ynh_script_progression "Setting up permissions"
chown -R $app_user: $opt_path
chmod 755 $renew_cert_path/$renew_cert_cron_script
......@@ -162,7 +170,7 @@ chown root: $renew_cert_path/$renew_cert_cron_script
# SETTING UP CRONTAB
#=================================================
ynh_print_info "Setting up cron job for renewal..."
ynh_script_progression "Setting up cron job for renewal..."
cat <<EOF > /etc/cron.daily/$app-renew-cert
#!/bin/bash
......@@ -177,5 +185,5 @@ chmod 0755 /etc/cron.daily/$app-renew-cert
# FINALIZATION
#=================================================
ynh_print_info "Checking certificates..."
ynh_script_progression "Checking certificates..."
/etc/cron.daily/$app-renew-cert
......@@ -8,6 +8,7 @@
</head>
<body>
<div class='section language-menu'><a href="../nl/">nl</a>-<a href="../fr/">fr</a></div>
<div class='body'>
<div class='section'>
<h1 class='main-title'>
......@@ -32,6 +33,8 @@
<ul>
<li>Le site de Neutrinet : <a href="http://neutrinet.be">http://neutrinet.be</a></li>
<li>Le dépôt git de Neutrinet : <a href="https://gitlab.domainepublic.net/Neutrinet">https://gitlab.domainepublic.net/Neutrinet</a></li>
<li>Le code source de cette application : <a href="https://gitlab.domainepublic.net/Neutrinet/neutrinet_ynh">https://gitlab.domainepublic.net/Neutrinet/neutrinet_ynh</a></li>
<li>Le site de la Brique Internet : <a href="http://labriqueinter.net">http://labriqueinter.net</a></li>
<li>Le site pour gérer votre abonnement vpn : <a href="https://user.neutrinet.be">https://user.neutrinet.be</a></li>
<li>Le site de YunoHost : <a href="http://yunohost.org">http://yunohost.org</a></li>
......@@ -44,6 +47,4 @@
</div>
</div>
</body>
<script src='static/js/jquery-1.12.0.min.js'></script>
<script src='static/js/toolkit.min.js'></script>
</html>
<!DOCTYPE html>
<html>
<head>
<link href='static/css/toolkit.min.css' rel='stylesheet' />
<link href='static/css/style.css' rel='stylesheet' />
<meta charset="UTF-8">
<title>Neutrinet Help Centrum</title>
</head>
<body>
<div class='section language-menu'><a href="../nl/">nl</a>-<a href="../fr/">fr</a></div>
<div class='body'>
<div class='section'>
<h1 class='main-title'>
Neutrinet
</h1>
</div>
<div class='section'>
<h3>Algemene Informatie</h3>
<p>Waar je hulp kan krijgen (van het meest eenvoudigste en Neutrinet-specifieke tot het meest technisch en algemene):</p>
<ul>
<li>Je kan een mail sturen naar <a href="mailto: support@neutrinet.be">support@neutrinet.be</a></li>
<li>Je kan naar één van onze install-parties of ledenvergadering komen (agenda op <a href="https://neutrinet.be">neutrinet.be</a>)</li>
<li>Je kan posten op het <a href="https://forum.yunohost.org/c/support/internet-cube">YunoHost forum</a></li>
<li>Je kan je inschrijven en een mail sturen naar de <a href="https://listes.labriqueinter.net/mailman/listinfo/discussions">la Brique Internet mailing lijst</a></li>
<li>Je kan een ticket openen op de <a href="https://github.com/yunohost/issues/issues">issuetracker van yunohost en la Brique Internet</a></li>
</ul>
<p>Andere nuttige links:</p>
<ul>
<li>De Neutrinet website: <a href="http://neutrinet.be">http://neutrinet.be</a></li>
<li>De Neutrinet git repo: <a href="https://gitlab.domainepublic.net/Neutrinet">https://gitlab.domainepublic.net/Neutrinet</a></li>
<li>De broncode van deze applicatie: <a href="https://gitlab.domainepublic.net/Neutrinet/neutrinet_ynh">https://gitlab.domainepublic.net/Neutrinet/neutrinet_ynh</a></li>
<li>De la Brique Internet website: <a href="http://labriqueinter.net">http://labriqueinter.net</a></li>
<li>De site om je VPN-abonnement te beheren: <a href="https://user.neutrinet.be">https://user.neutrinet.be</a></li>
<li>De YunoHost website: <a href="http://yunohost.org">http://yunohost.org</a></li>
<li>De YunoHost documentatie: <a href="https://yunohost.org/docs">https://yunohost.org/#/docs</a></li>
<li>De YunoHost troubleshooting gids: <a href="https://yunohost.org/#/troubleshooting_guide_fr">https://yunohost.org/#/troubleshooting_guide_fr</a></li>
<li>De website voor het bestellen van een Neutrinet Brique Internet: <a href="https://cube.neutrinet.be">https://cube.neutrinet.be</a></li>
<li>De kaart met de ISP's van de FDN-federatie <a href="https://ffdn.org">Fédération FDN</a> (waar Neutrinet lid van is): <a href="http://db.ffdn.org">http://db.ffdn.org</a></li>
</ul>
</div>
</div>
</body>
</html>
......@@ -12,6 +12,10 @@
border-radius: 6px;
}
.language-menu {
text-align: right;
}
p {
margin: 0px;
}
......@@ -49,9 +53,8 @@ p {
a {
color: black;
font-weight: 600;
font-family: arial;
text-decoration: none;
text-decoration: underline;
}
.loader {
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment