bootstrap uptime kuma packaging

This commit is contained in:
Hadrien 2021-11-01 20:21:39 +03:00
parent 2101f9eafd
commit d5c2b991e0
6 changed files with 58 additions and 53 deletions

View file

@ -1,7 +1,7 @@
SOURCE_URL=url of app's source
SOURCE_SUM=sha256 checksum
SOURCE_SUM_PRG=sha256sum
SOURCE_URL=https://github.com/louislam/uptime-kuma/archive/refs/tags/1.10.0.tar.gz
SOURCE_SUM=b345072f426e52cda594a45a5096e6351ba5c42c3d4f8f4088a00c1c707cae7d
SOURCE_SUM_PRG=b345072f426e52cda594a45a5096e6351ba5c42c3d4f8f4088a00c1c707cae7d
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
SOURCE_FILENAME=uptime-kuma-1.10.0
SOURCE_EXTRACT=true

View file

@ -10,21 +10,21 @@ location __PATH__/ {
}
### Example PHP configuration (remove it if not used)
index index.php;
# index index.php;
proxy_pass localhost:3001
# 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(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
# try_files $uri $uri/ index.php;
# location ~ [^/]\.php(/|$) {
# fastcgi_split_path_info ^(.+?\.php)(/.*)$;
# fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $request_filename;
# fastcgi_index index.php;
# include fastcgi_params;
# fastcgi_param REMOTE_USER $remote_user;
# fastcgi_param PATH_INFO $fastcgi_path_info;
# fastcgi_param SCRIPT_FILENAME $request_filename;
}
### End of PHP configuration part

View file

@ -1,5 +1,5 @@
[Unit]
Description=Small description of the service
Description=Uptime Kuma
After=network.target
[Service]
@ -7,7 +7,8 @@ Type=simple
User=__APP__
Group=__APP__
WorkingDirectory=__FINALPATH__/
ExecStart=__FINALPATH__/script
ExecStart=pm2 start __FINALPATH__/server/server.js --name uptime-kuma
ExecStop=pm2 stop uptime-kuma
StandardOutput=append:/var/log/__APP__/__APP__.log
StandardError=inherit

View file

@ -1,6 +1,6 @@
{
"name": "Example app",
"id": "example",
"name": "Uptime Kuma",
"id": "uptime-kuma",
"packaging_format": 1,
"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)",
@ -26,12 +26,13 @@
},
"multi_instance": true,
"services": [
"nginx",
"php7.3-fpm",
"mysql"
"nginx"
// "php7.3-fpm",
// "nodejs",
// "mysql"
],
"arguments": {
"install" : [
"install": [
{
"name": "domain",
"type": "domain"
@ -51,16 +52,19 @@
"type": "boolean",
"default": true
},
{
"name": "language",
"type": "string",
"ask": {
"en": "Choose the application language",
"fr": "Choisissez la langue de l'application"
},
"choices": ["fr", "en"],
"default": "fr"
},
// {
// "name": "language",
// "type": "string",
// "ask": {
// "en": "Choose the application language",
// "fr": "Choisissez la langue de l'application"
// },
// "choices": [
// "fr",
// "en"
// ],
// "default": "fr"
// },
{
"name": "password",
"type": "password",

View file

@ -5,7 +5,7 @@
#=================================================
# dependencies used by the app
pkg_dependencies="deb1 deb2 php$YNH_DEFAULT_PHP_VERSION-deb1 php$YNH_DEFAULT_PHP_VERSION-deb2"
pkg_dependencies="npm git pm2"
#=================================================
# PERSONAL HELPERS

View file

@ -28,7 +28,7 @@ domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN
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
@ -58,7 +58,7 @@ ynh_script_progression --message="Validating installation parameters..." --time
### 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=/opt/yunohost/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
# Register (book) web path
@ -72,7 +72,7 @@ ynh_script_progression --message="Storing installation settings..." --time --wei
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=language --value=$language
# ynh_app_setting_set --app=$app --key=language --value=$language
#=================================================
# STANDARD MODIFICATIONS
@ -87,7 +87,7 @@ ynh_script_progression --message="Finding an available port..." --time --weight=
### - Remove the section "CLOSE A PORT" in the remove script
# Find an available port
port=$(ynh_find_port --port=8095)
port=$(ynh_find_port --port=3001)
ynh_app_setting_set --app=$app --key=port --value=$port
# Optional: Expose this port publicly
@ -95,8 +95,8 @@ ynh_app_setting_set --app=$app --key=port --value=$port
# If you do this and the app doesn't actually need you are CREATING SECURITY HOLES IN THE SERVER !)
# Open the port
# ynh_script_progression --message="Configuring firewall..." --time --weight=1
# ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port
ynh_script_progression --message="Configuring firewall..." --time --weight=1
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port
#=================================================
# INSTALL DEPENDENCIES
@ -124,7 +124,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# CREATE A MYSQL DATABASE
#=================================================
ynh_script_progression --message="Creating a MySQL database..." --time --weight=1
# ynh_script_progression --message="Creating a MySQL database..." --time --weight=1
### Use these lines if you need a database for the application.
### `ynh_mysql_setup_db` will create a database, an associated user and a ramdom password.
@ -135,10 +135,10 @@ ynh_script_progression --message="Creating a MySQL database..." --time --weight=
### - Remove also the section "REMOVE THE MYSQL DATABASE" in the remove script
### - As well as the section "RESTORE THE MYSQL DATABASE" in the restore script
db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
# db_name=$(ynh_sanitize_dbid --db_name=$app)
# db_user=$db_name
# ynh_app_setting_set --app=$app --key=db_name --value=$db_name
# ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -176,7 +176,7 @@ ynh_add_nginx_config
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring PHP-FPM..." --time --weight=1
# ynh_script_progression --message="Configuring PHP-FPM..." --time --weight=1
### `ynh_add_fpm_config` is used to set up a PHP config.
### You can remove it if your app doesn't use PHP.
@ -190,7 +190,7 @@ ynh_script_progression --message="Configuring PHP-FPM..." --time --weight=1
### - And the section "PHP-FPM CONFIGURATION" in the upgrade script
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
# ynh_add_fpm_config
#=================================================
# SPECIFIC SETUP
@ -229,7 +229,7 @@ chown -R $app:www-data "$datadir"
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..." --time --weight=1
# ynh_script_progression --message="Adding a configuration file..." --time --weight=1
### You can add specific configuration files.
###
@ -243,13 +243,13 @@ ynh_script_progression --message="Adding a configuration file..." --time --weigh
###
### Check the documentation of `ynh_add_config` for more info.
ynh_add_config --template="some_config_file" --destination="$final_path/some_config_file"
# ynh_add_config --template="some_config_file" --destination="$final_path/some_config_file"
# FIXME: this should be handled by the core in the future
# You may need to use chmod 600 instead of 400,
# for example if the app is expected to be able to modify its own config
chmod 400 "$final_path/some_config_file"
chown $app:$app "$final_path/some_config_file"
# chmod 400 "$final_path/some_config_file"
# chown $app:$app "$final_path/some_config_file"
### For more complex cases where you want to replace stuff using regexes,
### you shoud rely on ynh_replace_string (which is basically a wrapper for sed)
@ -330,7 +330,7 @@ ynh_script_progression --message="Integrating service in YunoHost..." --time --w
### - As well as the section "INTEGRATE SERVICE IN YUNOHOST" in the restore script
### - And the section "INTEGRATE SERVICE IN YUNOHOST" in the upgrade script
yunohost service add $app --description="A short description of the app" --log="/var/log/$app/$app.log"
yunohost service add $app --description="Uptime Kuma" --log="/var/log/$app/$app.log"
### Additional options starting with 3.8:
###