1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/silverbullet_ynh.git synced 2024-09-03 20:26:18 +02:00

WIP: manifest + install

This commit is contained in:
Florent 2024-03-10 00:45:58 +01:00 committed by Florent F
parent f1d087c77f
commit 7cd29869c7
3 changed files with 24 additions and 126 deletions

2
conf/default.env Normal file
View file

@ -0,0 +1,2 @@
SB_USER="__USER__:__PASSWORD__"
SB_FOLDER="__DATA_DIR__"

View file

@ -2,52 +2,30 @@
packaging_format = 2 packaging_format = 2
id = "example" id = "silverbullet"
name = "Example app" name = "SilverBullet"
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)" description.en = "a creative space where you collect, create and expand your personal knowledge"
description.fr = "Expliquez en *quelques* (10~15) mots l'utilité de l'app ou ce qu'elle fait (l'objectif est de donner une idée grossière pour des utilisateurs qui naviguent dans un catalogue de 100+ apps)" description.fr = "un espace créatif où vous recueillez, créez et élargissez vos connaissances personnelles"
version = "1.0~ynh1" version = "0.7.5~ynh1"
maintainers = ["johndoe"] maintainers = ["fflorent"]
[upstream] [upstream]
# NB: Only the "license" key is mandatory. Remove entries for which there's no relevant data license = "MIT"
license = "free" # you can see the available licenses identifiers list here: https://spdx.org/licenses/ website = "https://silverbullet.md"
website = "https://example.com" demo = "https://play.silverbullet.md/"
demo = "https://demo.example.com" code = "https://github.com/silverbulletmd/silverbullet"
admindoc = "https://yunohost.org/packaging_apps"
userdoc = "https://yunohost.org/apps"
code = "https://some.forge.com/example/example"
# FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is
# sort of a standard id for applications defined by the NIST. In particular, YunoHost may use this is in the future
# to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here:
# https://nvd.nist.gov/products/cpe/search.
# For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number)
cpe = "???"
# FIXME: optional but recommended (or remove if irrelevant / not applicable).
# This is meant to be an URL where people can financially support this app, especially when its development is based
# on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin.
fund = "???"
[integration] [integration]
yunohost = ">= 11.2" yunohost = ">= 11.2"
# FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] architectures = "amd64"
architectures = "all"
multi_instance = true multi_instance = true
# FIXME: replace with true, false, or "not_relevant". ldap = "false"
# Not to confuse with the "sso" key: the "ldap" key corresponds to wether or not a user *can* login on the app using
# its YunoHost credentials.
ldap = "?"
# FIXME: replace with true, false, or "not_relevant". sso = "false"
# Not to confuse with the "ldap" key: the "sso" key corresponds to wether or not a user is *automatically logged-in*
# on the app when logged-in on the YunoHost portal.
sso = "?"
# FIXME: replace with an **estimate** minimum disk and RAM requirements. e.g. 20M, 400M, 1G...
disk = "50M" disk = "50M"
ram.build = "50M" ram.build = "50M"
ram.runtime = "50M" ram.runtime = "50M"
@ -62,28 +40,15 @@ ram.runtime = "50M"
type = "path" type = "path"
default = "/example" default = "/example"
[install.init_main_permission] [install.user]
# this is a generic question - ask strings are automatically handled by YunoHost's core
# This won't be saved as setting and will instead be used to initialize the SSOwat permission
type = "group"
default = "visitors"
[install.language]
ask.en = "Choose the application language"
ask.fr = "Choisissez la langue de l'application"
type = "select"
choices = ["fr", "en"]
default = "fr"
[install.admin]
# this is a generic question - ask strings are automatically handled by YunoHost's core # this is a generic question - ask strings are automatically handled by YunoHost's core
help.en = "Choose the who can access to silverbullet"
help.fr = "Choisissez l'utilisateur pouvant accéder à silverbullet"
type = "user" type = "user"
[install.password] [install.password]
# this is a generic question - ask strings are automatically handled by YunoHost's core help.en = "Choose a password used to access to silverbullet?"
# Note that user-provided passwords questions are not automatically saved as setting help.fr = "Choisissez le mot de passe pour accéder à silverbullet"
help.en = "Use the help field to add an information for the admin about this question."
help.fr = "Utilisez le champ aide pour ajouter une information à l'intention de l'administrateur à propos de cette question."
type = "password" type = "password"
[resources] [resources]
@ -93,43 +58,18 @@ ram.runtime = "50M"
[resources.sources] [resources.sources]
[resources.sources.main] [resources.sources.main]
# This will pre-fetch the asset which can then be deployed during the install/upgrade scripts with : url = "https://github.com/silverbulletmd/silverbullet/releases/download/0.7.5/silverbullet-server-linux-x86_64.zip"
# ynh_setup_source --dest_dir="$install_dir" sha256 = "cdacbeff4fc92fa936650f3536bb89cb4d5ab0871d7c19f29a6145e74202a4d9"
# You can also define other assets than "main" and add --source_id="foobar" in the previous command autoupdate.strategy = "latest_github_release"
url = "https://github.com/foo/bar/archive/refs/tags/v1.2.3.tar.gz"
sha256 = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
# These infos are used by https://github.com/YunoHost/apps/blob/master/tools/autoupdate_app_sources/autoupdate_app_sources.py
# to auto-update the previous asset urls and sha256sum + manifest version
# assuming the upstream's code repo is on github and relies on tags or releases
# See the 'sources' resource documentation for more details
# autoupdate.strategy = "latest_github_tag"
[resources.system_user] [resources.system_user]
# This will provision/deprovision a unix system user
[resources.install_dir] [resources.install_dir]
# This will create/remove the install dir as /var/www/$app
# and store the corresponding setting $install_dir
[resources.data_dir] [resources.data_dir]
# This will create/remove the data dir as /home/yunohost.app/$app
# and store the corresponding setting $data_dir
[resources.permissions] [resources.permissions]
# This will configure SSOwat permission for $domain/$path/
# The initial allowed group of user is configured via the init_main_permission question (public=visitors, private=all_users)
main.url = "/" main.url = "/"
main.permissions = "visitors" # The app is protected by a user/password prompt
[resources.ports] [resources.ports]
# This will pick a random port for reverse-proxying and store it as the $port setting
[resources.apt]
# This will automatically install/uninstall the following apt packages
# and implicitly define the $phpversion setting as 8.0 (if phpX.Y-foobar dependencies are listed)
packages = "mariadb-server, deb1, deb2, php8.0-foo, php8.0-bar"
[resources.database]
# This will automatically provision/deprovison a MySQL DB and store the corresponding credentials in settings $db_user, $db_name, $db_pwd
type = "mysql"

View file

@ -7,49 +7,17 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
### Install parameters are automatically saved as settings
###
### Settings are automatically loaded as bash variables
### in every app script context, therefore typically these will exist:
### - $domain
### - $path
### - $language
### ... etc
###
### Resources defined in the manifest are provisioned prior to this script
### and corresponding settings are also available, such as:
### - $install_dir
### - $port
### - $db_name
### ...
###
### $app is the app id (i.e. 'example' for first install,
### or 'example__2', '__3', ... for multi-instance installs)
#================================================= #=================================================
# INITIALIZE AND STORE SETTINGS # INITIALIZE AND STORE SETTINGS
#================================================= #=================================================
# If you need to, you can define custom settings
# (or remove this section entirely if not relevant for you)
foo="bar"
ynh_app_setting_set --app=$app --key=foo --value=$foo
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." --weight=1 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 manifest.toml
# Download, check integrity, uncompress and patch the source from manifest.toml
ynh_setup_source --dest_dir="$install_dir" ynh_setup_source --dest_dir="$install_dir"
### $install_dir will automatically be initialized with some decent
### permission by default ... however, you may need to recursively reapply
### ownership to all files such as after the ynh_setup_source step
chown -R "$app:www-data" "$install_dir" chown -R "$app:www-data" "$install_dir"
#================================================= #=================================================
@ -57,18 +25,6 @@ chown -R "$app:www-data" "$install_dir"
#================================================= #=================================================
ynh_script_progression --message="Adding $app's configuration files..." --weight=1 ynh_script_progression --message="Adding $app's configuration files..." --weight=1
### You can add specific configuration files.
###
### Typically, put your template conf file in ../conf/your_config_file
### The template may contain strings such as __FOO__ or __FOO_BAR__,
### which will automatically be replaced by the values of $foo and $foo_bar
###
### ynh_add_config will also keep track of the config file's checksum,
### which later during upgrade may allow to automatically backup the config file
### if it's found that the file was manually modified
###
### Check the documentation of `ynh_add_config` for more info.
ynh_add_config --template="some_config_file" --destination="$install_dir/some_config_file" ynh_add_config --template="some_config_file" --destination="$install_dir/some_config_file"
# FIXME: this should be handled by the core in the future # FIXME: this should be handled by the core in the future