Skip to content

Commit

Permalink
Manifestv2
Browse files Browse the repository at this point in the history
  • Loading branch information
Salamandar committed Mar 29, 2024
1 parent fabdf08 commit cf03501
Show file tree
Hide file tree
Showing 17 changed files with 222 additions and 446 deletions.
25 changes: 0 additions & 25 deletions check_process

This file was deleted.

7 changes: 0 additions & 7 deletions conf/app.src

This file was deleted.

2 changes: 1 addition & 1 deletion conf/base.config.yaml
Expand Up @@ -142,7 +142,7 @@ logging:
# Log files are rotated daily by default
files:
# Log file path
- file: "__LOG_PATH__/bridge.log" # Will capture logs from DiscordBot
- file: "/var/log/__APP__/bridge.log" # Will capture logs from DiscordBot
# Log level for this file
#
# Allowed values starting with most verbose:
Expand Down
6 changes: 3 additions & 3 deletions conf/run.sh
Expand Up @@ -3,11 +3,11 @@
set -o errexit
set -o nounset

echo <<EOF > __FINALPATH__/config.yaml
echo <<EOF > __INSTALL_DIR__/config.yaml
# /!\ FILE GENERATED AUTOMATICALLY BEFORE EACH SERVICE RESTART
# CONSIDER EDITING /etc/__APP__/user.config.yaml
EOF

__PIP_PATH__/bin/yq -y -s '.[0] * .[1]' __FINALPATH__/base.config.yaml /etc/__APP__/user.config.yaml > __FINALPATH__/config.yaml
__INSTALL_DIR__/venv/bin/yq -y -s '.[0] * .[1]' __INSTALL_DIR__/base.config.yaml /etc/__APP__/user.config.yaml > __INSTALL_DIR__/config.yaml

__YNH_NPM__ start -- -c config.yaml $@
__YNH_NPM__ start -- -c config.yaml "$@"
4 changes: 2 additions & 2 deletions conf/systemd.service
Expand Up @@ -8,8 +8,8 @@ Environment=NODE_ENV=production
Environment="__YNH_NODE_LOAD_PATH__"
User=__APP__
Group=__APP__
WorkingDirectory=__FINALPATH__/
ExecStart=__FINALPATH__/run.sh -f __APP__.yaml
WorkingDirectory=__INSTALL_DIR__/
ExecStart=__INSTALL_DIR__/run.sh -f __APP__.yaml
StandardOutput=syslog
StandardError=syslog

Expand Down
4 changes: 2 additions & 2 deletions conf/user.config.yaml
@@ -1,6 +1,6 @@
# You can edit this file.
# This will override the configuration contained in the __FINALPATH__/base.config.yaml file.
# Don't hesitate to take a look at __FINALPATH__/sample.config.yaml to see all the available options.
# This will override the configuration contained in the __INSTALL_DIR__/base.config.yaml file.
# Don't hesitate to take a look at __INSTALL_DIR__/sample.config.yaml to see all the available options.
# Then, in order to take into account the changes, run: systemctl restart __APP__

provisioning:
Expand Down
File renamed without changes.
File renamed without changes.
47 changes: 0 additions & 47 deletions manifest.json

This file was deleted.

65 changes: 65 additions & 0 deletions manifest.toml
@@ -0,0 +1,65 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json

packaging_format = 2

id = "matrix-puppet-discord"
name = "Matrix-Discord bridge"
description.en = "Discord puppeting bridge for Matrix/Synapse."
description.fr = "Passerelle Discord pour Matrix/Synapse."

version = "0.1.7~ynh5"

maintainers = ["fflorent"]

[upstream]
license = "Apache-2.0"
admindoc = "https://gitlab.com/mx-puppet/discord/mx-puppet-discord"
code = "https://gitlab.com/mx-puppet/discord/mx-puppet-discord"
fund = "https://liberapay.com/Sorunome/donate"

[integration]
yunohost = ">= 11.2"
architectures = "all"
multi_instance = true
ldap = "not_releant"
sso = "not_releant"
disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ...
ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...

[install.synapsenumber]
ask.en = "Choose the local synapse instance number to communicate with the Discord-Matrix bridge"
ask.fr = "Choisissez le numéro de l'instance synapse qui doit communiquer avec la passerelle Discord-Matrix"
help.en = "If you installed synapse only once time, then leave default value 1."
help.fr = "Si vous n'avez installé qu'une fois synapse, gardez la valeur par défaut 1."
type = "string"
example = "2 (for instance synapse__2)"
default = "1"

[resources]
[resources.sources.main]
url = "https://gitlab.com/mx-puppet/discord/mx-puppet-discord/-/archive/fd4402268e9a8b942ca632f3337702862e06d24f/mx-puppet-discord-master.tar.gz"
sha256 = "b0edc4dfe9d3670eb8b53dc229a8fd7fb794ada5fe1f3d3ba4c38b54ce5ca176"

autoupdate.strategy = "latest_gitlab_tag"

[resources.system_user]

[resources.install_dir]

[resources.permissions]

[resources.ports]

[resources.apt]
packages = [
"postgresql",
"libcairo2-dev",
"libpango1.0-dev",
"libjpeg-dev",
"libgif-dev",
"librsvg2-dev",
]

[resources.database]
type = "postgresql"
13 changes: 9 additions & 4 deletions scripts/_common.sh
Expand Up @@ -4,16 +4,21 @@
# COMMON VARIABLES
#=================================================

# Node version
NODEJS_VERSION=12

# dependencies used by the app (must be on a single line)
pkg_dependencies="postgresql libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev"

#=================================================
# PERSONAL HELPERS
#=================================================

_venv_install() {
ynh_exec_as "$app" python3 -m venv --upgrade "$install_dir/venv"
venvpy="$install_dir/venv/bin/python3"

ynh_exec_as "$app" "$venvpy" -m pip install --upgrade --no-cache-dir pip

ynh_exec_as "$app" "$venvpy" -m pip install setuptools wheel pyyaml
}

#=================================================
# EXPERIMENTAL HELPERS
#=================================================
Expand Down
31 changes: 3 additions & 28 deletions scripts/backup
@@ -1,7 +1,5 @@
#!/bin/bash

#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
Expand All @@ -10,29 +8,6 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers

#=================================================
# MANAGE SCRIPT FAILURE
#=================================================

ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors

#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."

app=$YNH_APP_INSTANCE_NAME

final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
log_path=$(ynh_app_setting_get --app=$app --key=log_path)
etc_path=$(ynh_app_setting_get --app=$app --key=etc_path)

#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
Expand All @@ -42,10 +17,10 @@ ynh_print_info --message="Declaring files to be backed up..."
# BACKUP THE APP MAIN DIR
#=================================================

ynh_backup --src_path="$final_path"
ynh_backup --src_path="$install_dir"

#=================================================
# BACKUP SYSTEMD
# BACKUP SYSTEM FILES
#=================================================

ynh_backup --src_path="/etc/systemd/system/$app.service"
Expand All @@ -54,7 +29,7 @@ ynh_backup --src_path="/etc/systemd/system/$app.service"
# BACKUP VARIOUS FILES
#=================================================

ynh_backup --src_path="$log_path"
ynh_backup --src_path="/var/log/$app"
ynh_backup --src_path="$etc_path"

#=================================================
Expand Down

0 comments on commit cf03501

Please sign in to comment.