Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing #2

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
4 changes: 2 additions & 2 deletions conf/config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ database_url: postgres://__DB_USER__:[email protected]:5432/__DB_NAME__
#database_tls_ca_file: /etc/mitra/database.pem

# Directory where media attachments and temporary files are stored
storage_dir: __DATA_DIR__
storage_dir: /var/lib/__APP__
# Directory where static files for web client (frontend) are stored
web_client_dir: /usr/share/mitra/www

http_host: '127.0.0.1'
http_port: 8383
http_port: __PORT__

# List of allowed origins for CORS (in addition to `instance_uri`)
# Trailing slashes are not allowed.
Expand Down
4 changes: 2 additions & 2 deletions conf/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {

proxy_pass http://127.0.0.1:8383;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:__PORT__;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
}
6 changes: 3 additions & 3 deletions manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ code = "https://codeberg.org/silverpill/mitra"
[integration]
yunohost = ">= 11.2.30"
helpers_version = "2.1"
architectures = "amd64"
architectures = ["amd64"]
multi_instance = true
ldap = false
sso = false
Expand Down Expand Up @@ -52,8 +52,6 @@ ram.runtime = "50M"
autoupdate.strategy = "latest_forgejo_tag"
autoupdate.version_regex = "^v(.*)$"

[resources.ports]

[resources.system_user]

[resources.install_dir]
Expand All @@ -63,6 +61,8 @@ ram.runtime = "50M"
[resources.permissions]
main.url = "/"

[resources.ports]

[resources.apt]
packages = "postgresql"

Expand Down
28 changes: 5 additions & 23 deletions scripts/backup
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/bash

# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers

Expand All @@ -11,42 +10,25 @@ ynh_print_info "Declaring files to be backed up..."
#=================================================

ynh_backup "$install_dir"
ynh_backup "$data_dir"

#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================

ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"

#=================================================
# BACKUP THE PHP-FPM CONFIGURATION
#=================================================

#=================================================
# BACKUP FAIL2BAN CONFIGURATION
# BACKUP THE DATA DIR
#=================================================

#ynh_backup "/etc/fail2ban/jail.d/$app.conf"
#ynh_backup "/etc/fail2ban/filter.d/$app.conf"
ynh_backup "$data_dir"

#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP LOGROTATE
# SYSTEM CONFIGURATION
#=================================================

#ynh_backup "/etc/logrotate.d/$app"
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"

#=================================================
# BACKUP CONFIG FILE
#=================================================
ynh_backup "/etc/$app/config.yaml"

#=================================================
# BACKUP THE DATABASE
#=================================================
ynh_print_info "Backup of the MySQL database..."
ynh_print_info "Backup of the database..."

ynh_psql_dump_db > db.sql

Expand Down
8 changes: 4 additions & 4 deletions scripts/install
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ ynh_setup_source --dest_dir="$install_dir"
#=================================================
# INSTALL MITRA
#=================================================

# We need this for the systemd script
ln -s $data_dir /var/lib/

# Download mitra deb file and install it.
dpkg --install --force-confnew "$install_dir/mitra.deb" || true
dpkg_install_failed=$(dpkg-query -f '${status} ${package}\n' -W | awk '$4 ~ /^mitra.*/ && $3 != "installed" {print $4}' | wc -l)
Expand All @@ -29,11 +33,7 @@ if [[ $dpkg_install_failed -ge 1 ]]; then
ynh_die --message="The service mitra cannot be installed for now."
fi

# We need this for the systemd script
ln -s $data_dir /var/lib/$app

# List systemd service in YunoHost

yunohost service add "$app" --description="Mitra server backend"

#=================================================
Expand Down
7 changes: 4 additions & 3 deletions scripts/remove
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,19 @@ ynh_script_progression --message="Removing system configurations related to $app
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
yunohost service remove "$app"

ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd"
ynh_systemctl --service="$app" --action="stop" --log_path="systemd"

# Remove the dedicated NGINX config
ynh_remove_nginx_config
ynh_config_remove_nginx

#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing Mitra deb packages..."

# Remove metapackage and its dependencies
ynh_package_autopurge "$app"
apt purge "$app"
ynh_apt_remove_dependencies

#=================================================
# REMOVE VARIOUS FILES
Expand Down
5 changes: 5 additions & 0 deletions tests.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json

test_format = 1.0

[default]