1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/lemmy_ynh.git synced 2024-09-03 19:36:09 +02:00

Merge pull request #36 from YunoHost-Apps/version-2

Version 2
This commit is contained in:
Éric Gaspar 2023-05-26 18:46:40 +02:00 committed by GitHub
commit c548f76996
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 211 additions and 569 deletions

View file

@ -1,66 +0,0 @@
#!/bin/bash
#=================================================
# PACKAGE UPDATING HELPER
#=================================================
# This script is meant to be run by GitHub Actions
# The YunoHost-Apps organisation offers a template Action to run this script periodically
# Since each app is different, maintainers can adapt its contents so as to perform
# automatic actions when a new upstream release is detected.
#=================================================
# FETCHING LATEST RELEASE AND ITS ASSETS
#=================================================
# Fetching information
current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1)
version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .tag_name | contains("v") | not ) | .tag_name' | sort -V | tail -1)
# Later down the script, we assume the version has only digits and dots
# Sometimes the release name starts with a "v", so let's filter it out.
# You may need more tweaks here if the upstream repository has different naming conventions.
if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then
version=${version:1}
fi
# Setting up the environment variables
echo "Current version: $current_version"
echo "Latest release from upstream: $version"
echo "VERSION=$version" >> $GITHUB_ENV
echo "REPO=$repo" >> $GITHUB_ENV
# For the time being, let's assume the script will fail
echo "PROCEED=false" >> $GITHUB_ENV
# Proceed only if the retrieved version is greater than the current one
if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then
echo "::warning ::No new version available"
exit 0
# Proceed only if a PR for this new version does not already exist
elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then
echo "::warning ::A branch already exists for this update"
exit 0
fi
#=================================================
# SPECIFIC UPDATE STEPS
#=================================================
# Any action on the app's source code can be done.
# The GitHub Action workflow takes care of committing all changes after this script ends.
#=================================================
# GENERIC FINALIZATION
#=================================================
# Replace new version in manifest
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json
# No need to update the README, yunohost-bot takes care of it
# The Action will proceed only if the PROCEED environment variable is set to true
echo "PROCEED=true" >> $GITHUB_ENV
exit 0

View file

@ -1,49 +0,0 @@
# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected.
# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization.
# This file should be enough by itself, but feel free to tune it to your needs.
# It calls updater.sh, which is where you should put the app-specific update steps.
name: Check for new upstream releases
on:
# Allow to manually trigger the workflow
workflow_dispatch:
# Run it every day at 6:00 UTC
schedule:
- cron: '0 6 * * *'
jobs:
updater:
runs-on: ubuntu-latest
steps:
- name: Fetch the source code
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run the updater script
id: run_updater
run: |
# Setting up Git user
git config --global user.name 'yunohost-bot'
git config --global user.email 'yunohost-bot@users.noreply.github.com'
# Run the updater script
/bin/bash .github/workflows/updater.sh
- name: Commit changes
id: commit
if: ${{ env.PROCEED == 'true' }}
run: |
git commit -am "Upgrade to v$VERSION"
- name: Create Pull Request
id: cpr
if: ${{ env.PROCEED == 'true' }}
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update to version ${{ env.VERSION }}
committer: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
signoff: false
base: testing
branch: ci-auto-update-v${{ env.VERSION }}
delete-branch: true
title: 'Upgrade to version ${{ env.VERSION }}'
body: |
Upgrade to v${{ env.VERSION }}
draft: false

View file

@ -6,6 +6,7 @@ It shall NOT be edited by hand.
# Lemmy for YunoHost # Lemmy for YunoHost
[![Integration level](https://dash.yunohost.org/integration/lemmy.svg)](https://dash.yunohost.org/appci/app/lemmy) ![Working status](https://ci-apps.yunohost.org/ci/badges/lemmy.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/lemmy.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/lemmy.svg)](https://dash.yunohost.org/appci/app/lemmy) ![Working status](https://ci-apps.yunohost.org/ci/badges/lemmy.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/lemmy.maintain.svg)
[![Install Lemmy with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lemmy) [![Install Lemmy with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lemmy)
*[Lire ce readme en français.](./README_fr.md)* *[Lire ce readme en français.](./README_fr.md)*
@ -15,23 +16,17 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
## Overview ## Overview
[Lemmy](https://github.com/LemmyNet/lemmy) is similar to sites like [Reddit](https://reddit.com), [Lobste.rs](https://lobste.rs), or [Hacker News](https://news.ycombinator.com/): you subscribe to forums you're interested in, post links and discussions, then vote, and comment on them. Behind the scenes, it is very different; anyone can easily run a server, and all these servers are federated (think email), and connected to the same universe, called the [Fediverse](https://en.wikipedia.org/wiki/Fediverse). Lemmy is similar to sites like Reddit, Lobste.rs, or Hacker News: you subscribe to forums you're interested in, post links and discussions, then vote, and comment on them. Behind the scenes, it is very different; anyone can easily run a server, and all these servers are federated (think email), and connected to the same universe, called the Fediverse.
**Shipped version:** 0.16.7~ynh1 **Shipped version:** 0.16.7~ynh1
**Demo:** https://lemmy.ml/ **Demo:** https://lemmy.ml/
## Screenshots ## Screenshots
![Screenshot of Lemmy](./doc/screenshots/screenshot1.webp) ![Screenshot of Lemmy](./doc/screenshots/screenshot1.webp)
## Disclaimers / important information
* Lemmy require full domain path to be installed. Eg. lemmy.domain.tld
* pict-rs image hosting service has been removed, it caused too much issue during compilation
## Documentation and resources ## Documentation and resources
* Official app website: <https://join-lemmy.org/> * Official app website: <https://join-lemmy.org/>

View file

@ -5,38 +5,33 @@ It shall NOT be edited by hand.
# Lemmy pour YunoHost # Lemmy pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/lemmy.svg)](https://dash.yunohost.org/appci/app/lemmy) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/lemmy.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/lemmy.maintain.svg) [![Niveau dintégration](https://dash.yunohost.org/integration/lemmy.svg)](https://dash.yunohost.org/appci/app/lemmy) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/lemmy.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/lemmy.maintain.svg)
[![Installer Lemmy avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lemmy) [![Installer Lemmy avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lemmy)
*[Read this readme in english.](./README.md)* *[Read this readme in english.](./README.md)*
> *Ce package vous permet d'installer Lemmy rapidement et simplement sur un serveur YunoHost. > *Ce package vous permet dinstaller Lemmy rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* Si vous navez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment linstaller et en profiter.*
## Vue d'ensemble ## Vue densemble
[Lemmy](https://github.com/LemmyNet/lemmy) is similar to sites like [Reddit](https://reddit.com), [Lobste.rs](https://lobste.rs), or [Hacker News](https://news.ycombinator.com/): you subscribe to forums you're interested in, post links and discussions, then vote, and comment on them. Behind the scenes, it is very different; anyone can easily run a server, and all these servers are federated (think email), and connected to the same universe, called the [Fediverse](https://en.wikipedia.org/wiki/Fediverse). Lemmy is similar to sites like Reddit, Lobste.rs, or Hacker News: you subscribe to forums you're interested in, post links and discussions, then vote, and comment on them. Behind the scenes, it is very different; anyone can easily run a server, and all these servers are federated (think email), and connected to the same universe, called the Fediverse.
**Version incluse :** 0.16.7~ynh1 **Version incluse :** 0.16.7~ynh1
**Démo :** https://lemmy.ml/ **Démo :** https://lemmy.ml/
## Captures d'écran ## Captures décran
![Capture d'écran de Lemmy](./doc/screenshots/screenshot1.webp) ![Capture décran de Lemmy](./doc/screenshots/screenshot1.webp)
## Avertissements / informations importantes
* Lemmy require full domain path to be installed. Eg. lemmy.domain.tld
* pict-rs image hosting service has been removed, it caused too much issue during compilation
## Documentations et ressources ## Documentations et ressources
* Site officiel de l'app : <https://join-lemmy.org/> * Site officiel de lapp : <https://join-lemmy.org/>
* Documentation officielle de l'admin : <https://join-lemmy.org/docs/en/> * Documentation officielle de ladmin : <https://join-lemmy.org/docs/en/>
* Dépôt de code officiel de l'app : <https://github.com/LemmyNet/lemmy> * Dépôt de code officiel de lapp : <https://github.com/LemmyNet/lemmy>
* Documentation YunoHost pour cette app : <https://yunohost.org/app_lemmy> * Documentation YunoHost pour cette app : <https://yunohost.org/app_lemmy>
* Signaler un bug : <https://github.com/YunoHost-Apps/lemmy_ynh/issues> * Signaler un bug : <https://github.com/YunoHost-Apps/lemmy_ynh/issues>
@ -52,4 +47,4 @@ ou
sudo yunohost app upgrade lemmy -u https://github.com/YunoHost-Apps/lemmy_ynh/tree/testing --debug sudo yunohost app upgrade lemmy -u https://github.com/YunoHost-Apps/lemmy_ynh/tree/testing --debug
``` ```
**Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps> **Plus dinfos sur le packaging dapplications :** <https://yunohost.org/packaging_apps>

View file

@ -1,27 +0,0 @@
;; Test complet
; Manifest
domain="domain.tld"
path="/"
admin="john"
sitename="lemmy website"
; Checks
pkg_linter=1
setup_sub_dir=0
setup_root=1
setup_nourl=0
setup_private=0
setup_public=1
upgrade=1
# 0.15.2~ynh3
upgrade=1 from_commit=206df4db0b99c52f07ea1a2d5daf799d4b8357fd
backup_restore=1
multi_instance=0
port_already_use=0
change_url=0
;;; Options
Email=
Notification=none
;;; Upgrade options
; commit=206df4db0b99c52f07ea1a2d5daf799d4b8357fd
name=0.15.2~ynh3
manifest_arg=domain=DOMAIN&admin=USER&sitename=lemmy_website&

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://codeload.github.com/jjlin/docker-image-extract/tar.gz/a9e455e44bbbfba897bf3342d9661b182cee67a9
SOURCE_SUM=9eb0c734e83a3fd7102fc7209af4977024ec467fbc819782491af47295675f67
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
SOURCE_EXTRACT=true

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://codeload.github.com/LemmyNet/lemmy-translations/tar.gz/00e4efbef6c3ac34cd2f5f444a95eddce9ec12d7
SOURCE_SUM=0587c1867c785e6d229d1519a37fc9a280e78f356d919f868f21a896abddff71
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
SOURCE_EXTRACT=true

View file

@ -1,16 +1,16 @@
[Unit] [Unit]
Description=__APP__ UI Daemon Description=Lemmy: UI Daemon
After=network.target After=network.target
[Service] [Service]
Type=simple Type=simple
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
Environment="LEMMY_INTERNAL_HOST=127.0.0.1:__PORT_LEMMY__" Environment="LEMMY_INTERNAL_HOST=127.0.0.1:__PORT__"
Environment="LEMMY_EXTERNAL_HOST=__DOMAIN__" Environment="LEMMY_EXTERNAL_HOST=__DOMAIN__"
Environment="LEMMY_HTTPS=true" Environment="LEMMY_HTTPS=true"
Environment="LEMMY_UI_HOST=0.0.0.0:__PORT_UI__" Environment="LEMMY_UI_HOST=0.0.0.0:__PORT_UI__"
WorkingDirectory=__FINALPATH__/lemmy-ui/ WorkingDirectory=__INSTALL_DIR__/lemmy-ui/
ExecStart=__YNH_NODE__ dist/js/server.js ExecStart=__YNH_NODE__ dist/js/server.js
StandardOutput=append:/var/log/__APP__/__APP__-ui.log StandardOutput=append:/var/log/__APP__/__APP__-ui.log
StandardError=inherit StandardError=inherit

View file

@ -84,7 +84,7 @@
# Address where lemmy should listen for incoming requests # Address where lemmy should listen for incoming requests
bind: "0.0.0.0" bind: "0.0.0.0"
# Port where lemmy should listen for incoming requests # Port where lemmy should listen for incoming requests
port: __PORT_LEMMY__ port: __PORT__
# Whether the site is available over TLS. Needs to be true for federation to work. # Whether the site is available over TLS. Needs to be true for federation to work.
tls_enabled: true tls_enabled: true
# Address where pictrs is available (for image hosting) # Address where pictrs is available (for image hosting)

View file

@ -1,14 +1,14 @@
[Unit] [Unit]
Description=__APP__ Daemon Description=Lemmy: Link aggregator
After=network.target After=network.target
[Service] [Service]
Type=simple Type=simple
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
Environment="LEMMY_CONFIG_LOCATION=__FINALPATH__/config/config.hjson" Environment="LEMMY_CONFIG_LOCATION=__INSTALL_DIR__/config/config.hjson"
WorkingDirectory=__FINALPATH__/lemmy/ WorkingDirectory=__INSTALL_DIR__/lemmy/
ExecStart=__FINALPATH__/lemmy/lemmy ExecStart=__INSTALL_DIR__/lemmy/lemmy
StandardOutput=append:/var/log/__APP__/__APP__.log StandardOutput=append:/var/log/__APP__/__APP__.log
StandardError=inherit StandardError=inherit

View file

@ -20,10 +20,10 @@ location / {
set $proxpass "http://127.0.0.1:__PORT_UI__"; set $proxpass "http://127.0.0.1:__PORT_UI__";
if ($http_accept ~ "^application/.*$") { if ($http_accept ~ "^application/.*$") {
set $proxpass "http://127.0.0.1:__PORT_LEMMY__"; set $proxpass "http://127.0.0.1:__PORT__";
} }
if ($request_method = POST) { if ($request_method = POST) {
set $proxpass "http://127.0.0.1:__PORT_LEMMY__"; set $proxpass "http://127.0.0.1:__PORT__";
} }
proxy_pass $proxpass; proxy_pass $proxpass;
@ -37,7 +37,7 @@ location / {
# backend # backend
location ~ ^/(api|pictrs|feeds|nodeinfo|.well-known) { location ~ ^/(api|pictrs|feeds|nodeinfo|.well-known) {
proxy_pass http://127.0.0.1:__PORT_LEMMY__; proxy_pass http://127.0.0.1:__PORT__;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";

View file

@ -1 +1 @@
[Lemmy](https://github.com/LemmyNet/lemmy) is similar to sites like [Reddit](https://reddit.com), [Lobste.rs](https://lobste.rs), or [Hacker News](https://news.ycombinator.com/): you subscribe to forums you're interested in, post links and discussions, then vote, and comment on them. Behind the scenes, it is very different; anyone can easily run a server, and all these servers are federated (think email), and connected to the same universe, called the [Fediverse](https://en.wikipedia.org/wiki/Fediverse). Lemmy is similar to sites like Reddit, Lobste.rs, or Hacker News: you subscribe to forums you're interested in, post links and discussions, then vote, and comment on them. Behind the scenes, it is very different; anyone can easily run a server, and all these servers are federated (think email), and connected to the same universe, called the Fediverse.

View file

@ -1,2 +0,0 @@
* Lemmy require full domain path to be installed. Eg. lemmy.domain.tld
* pict-rs image hosting service has been removed, it caused too much issue during compilation

View file

@ -1,38 +0,0 @@
{
"name": "Lemmy",
"id": "lemmy",
"packaging_format": 1,
"description": {
"en": "Link aggregator/Reddit clone for the fediverse",
"fr": "Agrégateur de liens/clone Reddit pour le fedivers"
},
"version": "0.16.7~ynh1",
"url": "https://join.lemmy.ml/",
"upstream": {
"license": "GPL-3.0",
"website": "https://join-lemmy.org/",
"demo": "https://lemmy.ml/",
"admindoc": "https://join-lemmy.org/docs/en/",
"code": "https://github.com/LemmyNet/lemmy"
},
"license": "GPL-3.0",
"maintainer": {
"name": "",
"email": ""
},
"requirements": {
"yunohost": ">= 4.3.0"
},
"multi_instance": false,
"services": [
"nginx"
],
"arguments": {
"install": [
{
"name": "domain",
"type": "domain"
}
]
}
}

62
manifest.toml Normal file
View file

@ -0,0 +1,62 @@
packaging_format = 2
id = "lemmy"
name = "Lemmy"
description.en = "Link aggregator/Reddit clone for the fediverse"
description.fr = "Agrégateur de liens/clone Reddit pour le fedivers"
version = "0.16.7~ynh1"
maintainers = []
[upstream]
license = "GPL-3.0"
website = "https://join-lemmy.org/"
demo = "https://lemmy.ml/"
admindoc = "https://join-lemmy.org/docs/en/"
code = "https://github.com/LemmyNet/lemmy"
[integration]
yunohost = ">= 11.1.19"
architectures = "all"
multi_instance = false
ldap = false
sso = false
disk = "50M"
ram.build = "100M"
ram.runtime = "50M"
[install.domain]
type = "domain"
full_domain = true
[resources]
[resources.sources]
[resources.sources.main]
url = "https://codeload.github.com/jjlin/docker-image-extract/tar.gz/a9e455e44bbbfba897bf3342d9661b182cee67a9"
sha256 = "9eb0c734e83a3fd7102fc7209af4977024ec467fbc819782491af47295675f67"
[resources.sources.lemmy-translations]
url = "https://codeload.github.com/LemmyNet/lemmy-translations/tar.gz/ddf0d3a4dcfba5eddbcdb702db2470b52abb3815"
sha256 = "7df72cdba8a6c23c9dca528d3fd71dce13f5263b7a59c8512253364d94797757"
[resources.ports]
main.default = 8536
ui.default = 8537
[resources.system_user]
[resources.install_dir]
[resources.data_dir]
subdirs = ["pictrs-data"]
[resources.permissions]
main.url = "/"
[resources.apt]
packages = "postgresql espeak"
[resources.database]
type = "postgresql"

View file

@ -4,13 +4,7 @@
# COMMON VARIABLES # COMMON VARIABLES
#================================================= #=================================================
# dependencies used by the app NODEJS_VERSION=18
lemmy_dependencies="postgresql postgresql-contrib"
lemmyui_dependencies="espeak"
pkg_dependencies="$lemmy_dependencies $lemmyui_dependencies"
NODEJS_VERSION=12
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS

View file

@ -10,28 +10,6 @@
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers 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)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#================================================= #=================================================
# DECLARE DATA AND CONF FILES TO BACKUP # DECLARE DATA AND CONF FILES TO BACKUP
#================================================= #=================================================
@ -41,13 +19,13 @@ ynh_print_info --message="Declaring files to be backed up..."
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_backup --src_path="$final_path" ynh_backup --src_path="$install_dir"
#================================================= #=================================================
# BACKUP THE DATA DIR # BACKUP THE DATA DIR
#================================================= #=================================================
ynh_backup --src_path="$datadir" --is_big ynh_backup --src_path="$data_dir" --is_big
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION

54
scripts/change_url Normal file
View file

@ -0,0 +1,54 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" --line_match="Stopped" --log_path=systemd
ynh_systemd_action --service_name=$app-ui --action="stop" --line_match="Stopped" --log_path=systemd
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
ynh_change_url_nginx_config
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
mkdir -p "$install_dir/config/"
ynh_add_config --template="../conf/lemmy.hjson" --destination="$install_dir/config/config.hjson"
chmod 400 "$install_dir/config/config.hjson"
chown $app:$app "$install_dir/config/config.hjson"
#=================================================
# GENERIC FINALISATION
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --line_match="Starting http server at" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name=$app-ui --action="start" --line_match="http://0.0.0.0" --log_path="/var/log/$app/$app-ui.log"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for $app" --last

View file

@ -9,87 +9,21 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers 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
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
domain=$YNH_APP_ARG_DOMAIN
path_url="/"
app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=1
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
# Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_script_progression --message="Finding an available port..." --weight=1
# Find an available port
port_lemmy=$(ynh_find_port --port=8536)
ynh_app_setting_set --app=$app --key=port_lemmy --value=$port_lemmy
port_ui=$(ynh_find_port --port=1235)
ynh_app_setting_set --app=$app --key=port_ui --value=$port_ui
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Installing dependencies..." --weight=1 ynh_script_progression --message="Installing dependencies..." --weight=1
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_use_nodejs ynh_use_nodejs
ln -fs /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1 ln -fs /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# CREATE A POSTGRESQL DATABASE # CREATE A POSTGRESQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=1 ynh_script_progression --message="Creating a PostgreSQL database..." --weight=1
ynh_psql_test_if_first_run
db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
db_pwd=$(ynh_string_random --length=30)
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pgcrypto;" --database="$db_name" ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pgcrypto;" --database="$db_name"
#================================================= #=================================================
@ -97,15 +31,13 @@ ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pgcrypto;" --data
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." --weight=1 ynh_script_progression --message="Setting up source files..." --weight=1
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path/build-lemmy/" --source_id="docker-image-extract" ynh_setup_source --dest_dir="$install_dir/build-lemmy/"
ynh_setup_source --dest_dir="$final_path/build-lemmy-ui/" --source_id="docker-image-extract" ynh_setup_source --dest_dir="$install_dir/build-lemmy-ui/"
ynh_setup_source --dest_dir="$final_path/lemmy-ui/lemmy-translations/" --source_id="lemmy-translations" ynh_setup_source --dest_dir="$install_dir/lemmy-ui/lemmy-translations/" --source_id="lemmy-translations"
chmod 750 "$final_path" chmod -R o-rwx "$install_dir"
chmod -R o-rwx "$final_path" chown -R $app:$app "$install_dir"
chown -R $app:$app "$final_path"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
@ -115,57 +47,41 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
#=================================================
# SPECIFIC SETUP
#=================================================
# CREATE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Creating a data directory..." --weight=1
datadir=/home/yunohost.app/$app
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
mkdir -p $datadir/pictrs-data
chmod 750 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:$app "$datadir"
#================================================= #=================================================
# MAKE INSTALL # MAKE INSTALL
#================================================= #=================================================
ynh_script_progression --message="Making install..." --weight=1 ynh_script_progression --message="Making install..." --weight=1
# Install lemmy-ui # Install lemmy-ui
pushd $final_path/build-lemmy-ui pushd $install_dir/build-lemmy-ui
./docker-image-extract dessalines/lemmy-ui:$(ynh_app_upstream_version) ./docker-image-extract dessalines/lemmy-ui:$(ynh_app_upstream_version)
popd popd
mkdir -p "$final_path/lemmy-ui/" mkdir -p "$install_dir/lemmy-ui/"
rsync -a "$final_path/build-lemmy-ui/output/app/" "$final_path/lemmy-ui/" rsync -a "$install_dir/build-lemmy-ui/output/app/" "$install_dir/lemmy-ui/"
ynh_secure_remove --file="$final_path/build-lemmy-ui" ynh_secure_remove --file="$install_dir/build-lemmy-ui"
# Install lemmy # Install lemmy
pushd $final_path/build-lemmy pushd $install_dir/build-lemmy
./docker-image-extract dessalines/lemmy:$(ynh_app_upstream_version) ./docker-image-extract dessalines/lemmy:$(ynh_app_upstream_version)
popd popd
mkdir -p "$final_path/lemmy/" mkdir -p "$install_dir/lemmy/"
mv -f "$final_path/build-lemmy/output/app/lemmy" "$final_path/lemmy/lemmy" mv -f "$install_dir/build-lemmy/output/app/lemmy" "$install_dir/lemmy/lemmy"
ynh_secure_remove --file="$final_path/build-lemmy" ynh_secure_remove --file="$install_dir/build-lemmy"
chmod 750 "$final_path" chmod 750 "$install_dir"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$install_dir"
chown -R $app:$app "$final_path" chown -R $app:$app "$install_dir"
#================================================= #=================================================
# ADD A CONFIGURATION # ADD A CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_script_progression --message="Adding a configuration file..." --weight=1
mkdir -p "$final_path/config/" mkdir -p "$install_dir/config/"
ynh_add_config --template="../conf/lemmy.hjson" --destination="$final_path/config/config.hjson" ynh_add_config --template="../conf/lemmy.hjson" --destination="$install_dir/config/config.hjson"
chmod 400 "$final_path/config/config.hjson" chmod 400 "$install_dir/config/config.hjson"
chown $app:$app "$final_path/config/config.hjson" chown $app:$app "$install_dir/config/config.hjson"
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
@ -208,21 +124,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --line_match="Starting http server at" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name=$app --action="start" --line_match="Starting http server at" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name=$app-ui --action="start" --line_match="http://0.0.0.0" --log_path="/var/log/$app/$app-ui.log" ynh_systemd_action --service_name=$app-ui --action="start" --line_match="http://0.0.0.0" --log_path="/var/log/$app/$app-ui.log"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public
ynh_permission_update --permission="main" --add="visitors"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -9,19 +9,6 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
#================================================= #=================================================
@ -57,33 +44,6 @@ ynh_script_progression --message="Removing logrotate configuration..." --weight=
# Remove the app-specific logrotate config # Remove the app-specific logrotate config
ynh_remove_logrotate ynh_remove_logrotate
#=================================================
# REMOVE THE POSTGRESQL DATABASE
#=================================================
ynh_script_progression --message="Removing the PostgreSQL database..." --weight=1
# Remove a database if it exists, along with the associated user
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing app main directory..." --weight=1
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE DATA DIR
#=================================================
# Remove the data directory if --purge option is used
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
then
ynh_script_progression --message="Removing app data directory..." --weight=1
ynh_secure_remove --file="$datadir"
fi
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION
#================================================= #=================================================
@ -99,7 +59,6 @@ ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies # Remove metapackage and its dependencies
ynh_remove_nodejs ynh_remove_nodejs
ynh_remove_app_dependencies
ynh_secure_remove --file="/lib/libc.musl-x86_64.so.1" ynh_secure_remove --file="/lib/libc.musl-x86_64.so.1"
#================================================= #=================================================
@ -112,16 +71,6 @@ ynh_script_progression --message="Removing various files..." --weight=1
# Remove the log files # Remove the log files
ynh_secure_remove --file="/var/log/$app" ynh_secure_remove --file="/var/log/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
# Delete a system user
ynh_system_user_delete --username=$app
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -10,72 +10,24 @@
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers 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_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1 ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_restore_file --origin_path="$final_path" ynh_restore_file --origin_path="$install_dir"
chmod 750 "$final_path" chmod -R o-rwx "$install_dir"
chmod -R o-rwx "$final_path" chown -R $app:$app "$install_dir"
chown -R $app:$app "$final_path"
#================================================= #=================================================
# RESTORE THE DATA DIRECTORY # RESTORE THE DATA DIRECTORY
#================================================= #=================================================
ynh_script_progression --message="Restoring the data directory..." --weight=1 ynh_script_progression --message="Restoring the data directory..." --weight=1
ynh_restore_file --origin_path="$datadir" --not_mandatory ynh_restore_file --origin_path="$data_dir" --not_mandatory
mkdir -p $datadir chown -R $app:$app "$data_dir"
chmod 750 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:$app "$datadir"
#================================================= #=================================================
# SPECIFIC RESTORATION # SPECIFIC RESTORATION
@ -85,7 +37,6 @@ chown -R $app:$app "$datadir"
ynh_script_progression --message="Reinstalling dependencies..." --weight=1 ynh_script_progression --message="Reinstalling dependencies..." --weight=1
# Define and install dependencies # Define and install dependencies
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_use_nodejs ynh_use_nodejs
ln -fs /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1 ln -fs /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1
@ -102,8 +53,6 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1 ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1
ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name" ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name"
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pgcrypto;" --database="$db_name" ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pgcrypto;" --database="$db_name"

View file

@ -9,45 +9,12 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
admin=$(ynh_app_setting_get --app=$app --key=admin)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
port_lemmy=$(ynh_app_setting_get --app=$app --key=port_lemmy)
port_ui=$(ynh_app_setting_get --app=$app --key=port_ui)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
#================================================= #=================================================
ynh_script_progression --message="Checking version..." --weight=1
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
#================================================= #=================================================
@ -63,13 +30,6 @@ ynh_systemd_action --service_name=$app-ui --action="stop" --line_match="Stopped"
#================================================= #=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
# Removing previously installed iframely # Removing previously installed iframely
if ynh_exec_warn_less yunohost service status $app-iframely >/dev/null if ynh_exec_warn_less yunohost service status $app-iframely >/dev/null
then then
@ -87,17 +47,9 @@ then
yunohost service remove $app-pict-rs yunohost service remove $app-pict-rs
fi fi
ynh_remove_systemd_config --service=$app-pict-rs ynh_remove_systemd_config --service=$app-pict-rs
ynh_secure_remove --file="$final_path/pict-rs" ynh_secure_remove --file="$install_dir/pict-rs"
ynh_app_setting_delete --app=$app --key=port_pictrs ynh_app_setting_delete --app=$app --key=port_pictrs
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
@ -107,21 +59,20 @@ then
ynh_script_progression --message="Upgrading source files..." --weight=1 ynh_script_progression --message="Upgrading source files..." --weight=1
# Download, check integrity, uncompress the source of lemmy from app.src to his build directory # Download, check integrity, uncompress the source of lemmy from app.src to his build directory
ynh_setup_source --dest_dir="$final_path/build-lemmy/" --source_id="docker-image-extract" ynh_setup_source --dest_dir="$install_dir/build-lemmy/"
ynh_setup_source --dest_dir="$final_path/build-lemmy-ui/" --source_id="docker-image-extract" ynh_setup_source --dest_dir="$install_dir/build-lemmy-ui/"
ynh_setup_source --dest_dir="$final_path/lemmy-ui/lemmy-translations/" --source_id="lemmy-translations" ynh_setup_source --dest_dir="$install_dir/lemmy-ui/lemmy-translations/" --source_id="lemmy-translations"
fi fi
chmod 750 "$final_path" chmod 750 "$install_dir"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$install_dir"
chown -R $app:$app "$final_path" chown -R $app:$app "$install_dir"
#================================================= #=================================================
# UPGRADE DEPENDENCIES # UPGRADE DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=1 ynh_script_progression --message="Upgrading dependencies..." --weight=1
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_use_nodejs ynh_use_nodejs
ln -fs /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1 ln -fs /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1
@ -144,36 +95,36 @@ ynh_script_progression --message="Making upgrade..." --weight=1
if [ "$upgrade_type" == "UPGRADE_APP" ] if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
# Install lemmy-ui # Install lemmy-ui
pushd $final_path/build-lemmy-ui pushd $install_dir/build-lemmy-ui
./docker-image-extract dessalines/lemmy-ui:$(ynh_app_upstream_version) ./docker-image-extract dessalines/lemmy-ui:$(ynh_app_upstream_version)
popd popd
mkdir -p "$final_path/lemmy-ui/" mkdir -p "$install_dir/lemmy-ui/"
rsync -a "$final_path/build-lemmy-ui/output/app/" "$final_path/lemmy-ui/" rsync -a "$install_dir/build-lemmy-ui/output/app/" "$install_dir/lemmy-ui/"
ynh_secure_remove --file="$final_path/build-lemmy-ui" ynh_secure_remove --file="$install_dir/build-lemmy-ui"
# Install lemmy # Install lemmy
pushd $final_path/build-lemmy pushd $install_dir/build-lemmy
./docker-image-extract dessalines/lemmy:$(ynh_app_upstream_version) ./docker-image-extract dessalines/lemmy:$(ynh_app_upstream_version)
popd popd
mkdir -p "$final_path/lemmy/" mkdir -p "$install_dir/lemmy/"
mv -f "$final_path/build-lemmy/output/app/lemmy" "$final_path/lemmy/lemmy" mv -f "$install_dir/build-lemmy/output/app/lemmy" "$install_dir/lemmy/lemmy"
ynh_secure_remove --file="$final_path/build-lemmy" ynh_secure_remove --file="$install_dir/build-lemmy"
fi fi
chmod 750 "$final_path" chmod 750 "$install_dir"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$install_dir"
chown -R $app:$app "$final_path" chown -R $app:$app "$install_dir"
#================================================= #=================================================
# UPDATE A CONFIG FILE # UPDATE A CONFIG FILE
#================================================= #=================================================
ynh_script_progression --message="Updating a configuration file..." --weight=1 ynh_script_progression --message="Updating a configuration file..." --weight=1
mkdir -p "$final_path/lemmy/" mkdir -p "$install_dir/lemmy/"
ynh_add_config --template="../conf/lemmy.hjson" --destination="$final_path/config/config.hjson" ynh_add_config --template="../conf/lemmy.hjson" --destination="$install_dir/config/config.hjson"
chmod 400 "$final_path/config/config.hjson" chmod 400 "$install_dir/config/config.hjson"
chown $app:$app "$final_path/config/config.hjson" chown $app:$app "$install_dir/config/config.hjson"
#================================================= #=================================================
# CREATE EXTENSION IF NOT EXISTS pgcrypto # CREATE EXTENSION IF NOT EXISTS pgcrypto
@ -222,13 +173,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --line_match="Starting http server at" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name=$app --action="start" --line_match="Starting http server at" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name=$app-ui --action="start" --line_match="http://0.0.0.0" --log_path="/var/log/$app/$app-ui.log" ynh_systemd_action --service_name=$app-ui --action="start" --line_match="http://0.0.0.0" --log_path="/var/log/$app/$app-ui.log"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

17
tests.toml Normal file
View file

@ -0,0 +1,17 @@
test_format = 1.0
[default]
# -------------------------------
# Default args to use for install
# -------------------------------
args.admin = "john"
args.sitename = "lemmy website"
# -------------------------------
# Commits to test upgrade from
# -------------------------------
test_upgrade_from.206df4db0b99c52f07ea1a2d5daf799d4b8357fd.name = "Upgrade from 0.15.2~ynh3"