mirror of
https://github.com/YunoHost-Apps/plume_ynh.git
synced 2024-09-03 20:15:54 +02:00
Fixed many bugs
This commit is contained in:
parent
a82d850d29
commit
a2eba0bc4a
17 changed files with 266 additions and 70 deletions
22
README.md
Normal file → Executable file
22
README.md
Normal file → Executable file
|
@ -1,20 +1,4 @@
|
||||||
# Plume for Yunohost
|
# plume_ynh
|
||||||
Federated blogging application.
|
Federated blogging application https://github.com/Plume-org/Plume
|
||||||
|
|
||||||
Shipped version: **0.2.0(Alpa 1)**
|
|
||||||
|
|
||||||
## Interesting links
|
|
||||||
|
|
||||||
- [YunoHost project](https://yunohost.org)
|
|
||||||
- [Plume Github page](https://github.com/Plume-org/Plume)
|
|
||||||
- [Demo instance of Plume](https://baptiste.gelez.xyz/)
|
|
||||||
|
|
||||||
## Instruction
|
|
||||||
|
|
||||||
1. The app require dedicated domain like plume.domain.tld
|
|
||||||
1. Updated is not yet implimented yet.
|
|
||||||
1. You have to run cargo run and answer the qestions.
|
|
||||||
**$ cd /var/www/plume && cargo run**
|
|
||||||
1. The app will need to run inside **Screen** or **tmux** till the systemd gets implimented.
|
|
||||||
|
|
||||||
|
|
||||||
|
Now working
|
||||||
|
|
3
check_process
Normal file → Executable file
3
check_process
Normal file → Executable file
|
@ -6,6 +6,9 @@
|
||||||
;; Test complet
|
;; Test complet
|
||||||
; Manifest
|
; Manifest
|
||||||
domain="domain.tld" (DOMAIN)
|
domain="domain.tld" (DOMAIN)
|
||||||
|
admin="john" (USER)
|
||||||
|
name="my blog"
|
||||||
|
registration=0 (BOOLEAN)
|
||||||
is_public=1 (PUBLIC|public=1|private=0)
|
is_public=1 (PUBLIC|public=1|private=0)
|
||||||
; Checks
|
; Checks
|
||||||
pkg_linter=1
|
pkg_linter=1
|
||||||
|
|
15
conf/.env
Normal file → Executable file
15
conf/.env
Normal file → Executable file
|
@ -1,6 +1,19 @@
|
||||||
|
# The address of the database
|
||||||
|
# (replace USER, PASSWORD, PORT and DATABASE_NAME with your values)
|
||||||
|
#
|
||||||
|
# If you are using SQlite, use the path of the database file (`plume.db` for instance)
|
||||||
|
DATABASE_URL=postgres://__DB_USER__:__PSQLPWD__@localhost:5432/__DBNAME__
|
||||||
|
|
||||||
DB_URL=postgres://__DB_USER__:__PSQLPWD__@localhost:5432/__DBNAME__
|
# For PostgreSQL: migrations/postgres
|
||||||
|
# For SQlite: migrations/sqlite
|
||||||
|
MIGRATION_DIRECTORY=migrations/postgres
|
||||||
|
|
||||||
|
# The domain on which your instance will be available
|
||||||
BASE_URL=__DOMAIN__
|
BASE_URL=__DOMAIN__
|
||||||
|
|
||||||
ROCKET_PORT=__PORT__
|
ROCKET_PORT=__PORT__
|
||||||
ROCKET_ADDRESS=127.0.0.1
|
ROCKET_ADDRESS=127.0.0.1
|
||||||
|
|
||||||
|
# Secret key used for private cookies and CSRF protection
|
||||||
|
# You can generate one with `openssl rand -base64 32`
|
||||||
|
ROCKET_SECRET_KEY= __KEY__
|
||||||
|
|
0
conf/app.src
Normal file → Executable file
0
conf/app.src
Normal file → Executable file
0
conf/first_run.exp
Normal file → Executable file
0
conf/first_run.exp
Normal file → Executable file
0
conf/instance.txt
Normal file → Executable file
0
conf/instance.txt
Normal file → Executable file
0
conf/nginx.conf
Normal file → Executable file
0
conf/nginx.conf
Normal file → Executable file
0
conf/pass.txt
Normal file → Executable file
0
conf/pass.txt
Normal file → Executable file
8
conf/systemd.service
Normal file → Executable file
8
conf/systemd.service
Normal file → Executable file
|
@ -1,12 +1,12 @@
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=__APP__ service
|
Description=plume
|
||||||
After=network.target
|
After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
User=__APP__
|
User=plume
|
||||||
WorkingDirectory=__FINALPATH__/
|
WorkingDirectory=/home/plume/Plume
|
||||||
ExecStart=/bin/sh -c 'cargo run' >> /var/log/__APP__/__APP__.log 2>&1
|
ExecStart=__FINALPATH__/.cargo/bin/plume
|
||||||
TimeoutSec=30
|
TimeoutSec=30
|
||||||
Restart=always
|
Restart=always
|
||||||
|
|
||||||
|
|
31
manifest.json
Normal file → Executable file
31
manifest.json
Normal file → Executable file
|
@ -1,13 +1,13 @@
|
||||||
{
|
{
|
||||||
"name": "plume bloggin app for yunohost",
|
"name": "plume",
|
||||||
"id": "plume",
|
"id": "plume",
|
||||||
"packaging_format": 1,
|
"packaging_format": 1,
|
||||||
"description": {
|
"description": {
|
||||||
"en": "Package for Plume application."
|
"en": "Federated blogging application"
|
||||||
},
|
},
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"url": "https://baptiste.gelez.xyz/",
|
"url": "https://baptiste.gelez.xyz/",
|
||||||
"license": "free",
|
"license": "AGPL-3.0-only",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
"name": "Anmol Sharma",
|
"name": "Anmol Sharma",
|
||||||
"email": "anmol@datamol.org"
|
"email": "anmol@datamol.org"
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 2.7.14"
|
"yunohost": ">= 2.7.14"
|
||||||
},
|
},
|
||||||
"multi_instance": false,
|
"multi_instance": true,
|
||||||
"services": [
|
"services": [
|
||||||
"nginx",
|
"nginx",
|
||||||
"rust"
|
"rust"
|
||||||
|
@ -30,6 +30,29 @@
|
||||||
},
|
},
|
||||||
"example": "example.com"
|
"example": "example.com"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "admin",
|
||||||
|
"type": "user",
|
||||||
|
"ask": {
|
||||||
|
"en": "Choose the Plume administrator (must be an existing YunoHost user)",
|
||||||
|
"fr": "Choisissez l'administrateur de Plume (doit être un utilisateur YunoHost existant)"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "name",
|
||||||
|
"ask": {
|
||||||
|
"en": "Choose a name for your Plume instance"
|
||||||
|
}
|
||||||
|
"example": "My blog"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "registration",
|
||||||
|
"type": "boolean",
|
||||||
|
"ask": {
|
||||||
|
"en": "Is registrations open to everyone?"
|
||||||
|
},
|
||||||
|
"default": false
|
||||||
|
}
|
||||||
{
|
{
|
||||||
"name": "is_public",
|
"name": "is_public",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
|
|
58
scripts/_common.sh
Normal file → Executable file
58
scripts/_common.sh
Normal file → Executable file
|
@ -11,3 +11,61 @@ ynh_delete_file_checksum () {
|
||||||
local checksum_setting_name=checksum_${1//[\/ ]/_} # Replace all '/' and ' ' by '_'
|
local checksum_setting_name=checksum_${1//[\/ ]/_} # Replace all '/' and ' ' by '_'
|
||||||
ynh_app_setting_delete $app $checksum_setting_name
|
ynh_app_setting_delete $app $checksum_setting_name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Send an email to inform the administrator
|
||||||
|
#
|
||||||
|
# usage: ynh_send_readme_to_admin app_message [recipients]
|
||||||
|
# | arg: app_message - The message to send to the administrator.
|
||||||
|
# | arg: recipients - The recipients of this email. Use spaces to separate multiples recipients. - default: root
|
||||||
|
# example: "root admin@domain"
|
||||||
|
# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you
|
||||||
|
# example: "root admin@domain user1 user2"
|
||||||
|
ynh_send_readme_to_admin() {
|
||||||
|
local app_message="${1:-...No specific information...}"
|
||||||
|
local recipients="${2:-root}"
|
||||||
|
|
||||||
|
# Retrieve the email of users
|
||||||
|
find_mails () {
|
||||||
|
local list_mails="$1"
|
||||||
|
local mail
|
||||||
|
local recipients=" "
|
||||||
|
# Read each mail in argument
|
||||||
|
for mail in $list_mails
|
||||||
|
do
|
||||||
|
# Keep root or a real email address as it is
|
||||||
|
if [ "$mail" = "root" ] || echo "$mail" | grep --quiet "@"
|
||||||
|
then
|
||||||
|
recipients="$recipients $mail"
|
||||||
|
else
|
||||||
|
# But replace an user name without a domain after by its email
|
||||||
|
if mail=$(ynh_user_get_info "$mail" "mail" 2> /dev/null)
|
||||||
|
then
|
||||||
|
recipients="$recipients $mail"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "$recipients"
|
||||||
|
}
|
||||||
|
recipients=$(find_mails "$recipients")
|
||||||
|
|
||||||
|
local mail_subject="☁️🆈🅽🅷☁️: \`$app\` has important message for you"
|
||||||
|
|
||||||
|
local mail_message="This is an automated message from your beloved YunoHost server.
|
||||||
|
Specific information for the application $app.
|
||||||
|
$app_message
|
||||||
|
---
|
||||||
|
Automatic diagnosis data from YunoHost
|
||||||
|
$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')"
|
||||||
|
|
||||||
|
# Define binary to use for mail command
|
||||||
|
if [ -e /usr/bin/bsd-mailx ]
|
||||||
|
then
|
||||||
|
local mail_bin=/usr/bin/bsd-mailx
|
||||||
|
else
|
||||||
|
local mail_bin=/usr/bin/mail.mailutils
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Send the email to the recipients
|
||||||
|
echo "$mail_message" | $mail_bin -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients"
|
||||||
|
}
|
||||||
|
|
|
@ -31,6 +31,8 @@ final_path=$(ynh_app_setting_get $app final_path)
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
db_name=$(ynh_app_setting_get "$app" psql_db)
|
db_name=$(ynh_app_setting_get "$app" psql_db)
|
||||||
|
|
||||||
|
# Stop Pleroma for backup
|
||||||
|
systemctl stop "$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD BACKUP STEPS
|
# STANDARD BACKUP STEPS
|
||||||
|
@ -67,3 +69,13 @@ ynh_backup "/etc/logrotate.d/$app"
|
||||||
|
|
||||||
ynh_backup "/etc/systemd/system/$app.service"
|
ynh_backup "/etc/systemd/system/$app.service"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RELOAD NGINX
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
systemctl reload nginx
|
||||||
|
systemctl enable "$app"
|
||||||
|
systemctl start "$app"
|
||||||
|
# App needs time to start
|
||||||
|
sleep 10
|
||||||
|
|
||||||
|
|
102
scripts/install
102
scripts/install
|
@ -26,7 +26,13 @@ ynh_abort_if_errors
|
||||||
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url="/"
|
path_url="/"
|
||||||
|
instance_name=$YNH_APP_ARG_NAME
|
||||||
|
admin=$YNH_APP_ARG_ADMIN
|
||||||
|
admin_email=$(ynh_user_get_info $admin 'mail')
|
||||||
|
admin_pass=$(ynh_string_random 24)
|
||||||
|
registration=$YNH_APP_ARG_REGISTRATION
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
|
random_key=$(openssl rand -base64 32)
|
||||||
|
|
||||||
### If it's a multi-instance app, meaning it can be installed several times independently
|
### If it's a multi-instance app, meaning it can be installed several times independently
|
||||||
### The id of the app as stated in the manifest is available as $YNH_APP_ID
|
### The id of the app as stated in the manifest is available as $YNH_APP_ID
|
||||||
|
@ -64,6 +70,11 @@ ynh_webpath_register $app $domain $path_url
|
||||||
ynh_app_setting_set $app domain $domain
|
ynh_app_setting_set $app domain $domain
|
||||||
ynh_app_setting_set $app path $path_url
|
ynh_app_setting_set $app path $path_url
|
||||||
ynh_app_setting_set $app is_public $is_public
|
ynh_app_setting_set $app is_public $is_public
|
||||||
|
ynh_app_setting_set $app admin $admin
|
||||||
|
ynh_app_setting_set $app instance $instance
|
||||||
|
ynh_app_setting_set $app admin_email $admin_email
|
||||||
|
ynh_app_setting_set $app registration $registraion
|
||||||
|
ynh_app_setting_set $app random_key $random_key
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
|
@ -119,11 +130,24 @@ ynh_psql_execute_as_root \
|
||||||
|
|
||||||
ynh_app_setting_set $app final_path $final_path
|
ynh_app_setting_set $app final_path $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 "$final_path"
|
git clone https://github.com/Plume-org/Plume.git "$final_path/$app"
|
||||||
|
|
||||||
# Create the media directory, where uploads will be stored
|
# Create the media directory, where uploads will be stored
|
||||||
(cd $final_path && mkdir media )
|
(cd $final_path && mkdir media )
|
||||||
|
|
||||||
|
# setup application config
|
||||||
|
sudo cp ../conf/.env $final_path/$app/.env
|
||||||
|
#=================================================
|
||||||
|
# MODIFY A CONFIG FILE
|
||||||
|
#=================================================
|
||||||
|
ynh_replace_string "__DBNAME__" "$db_name" "$final_path/$app/.env"
|
||||||
|
ynh_replace_string "__PSQLPWD__" "$db_pwd" "$final_path/$app/.env"
|
||||||
|
ynh_replace_string "__DOMAIN__" "$domain" "$final_path/$app/.env"
|
||||||
|
ynh_replace_string "__PORT__" "$port" "$final_path/$app/.env"
|
||||||
|
ynh_replace_string "__DB_USER__" "$app" "$final_path/$app/.env"
|
||||||
|
ynh_replace_string "__KEY__" "$random_key" "$final_path/$app/.env"
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -131,11 +155,29 @@ ynh_setup_source "$final_path"
|
||||||
# Create a system user
|
# Create a system user
|
||||||
ynh_system_user_create $app $final_path
|
ynh_system_user_create $app $final_path
|
||||||
|
|
||||||
( cd $final_path && curl -sf -L https://static.rust-lang.org/rustup.sh | sh -s -- --channel=nightly --date=2018-07-17 )
|
# Set right permissions
|
||||||
export PATH="$PATH:/root/.cargo/bin:$final_path/.local/bin:/usr/local/sbin"
|
chown -R $app: $final_path
|
||||||
( cd $final_path && cargo build )
|
|
||||||
( cd $final_path && cargo install diesel_cli --no-default-features --features postgres --version '=1.2.0' )
|
|
||||||
( cd $final_path && diesel migration run --database-url postgres://$db_name:$db_pwd@localhost:5432/$app )
|
# App settings
|
||||||
|
( cd $final_path && sudo -u "$app" curl -sf -L https://static.rust-lang.org/rustup.sh | sh -s -- --channel=nightly --date=2018-07-17 )
|
||||||
|
( cd $final_path && sudo -u "$app" export PATH="$PATH:/var/www/$app/.cargo/bin:/var/$app/.local/bin:/usr/local/sbin" )
|
||||||
|
( cd $final_path/$app && sudo -u "$app" export FEATURES=postgres )
|
||||||
|
( cd $final_path/$app && sudo -u "$app" cargo install diesel_cli --no-default-features --features postgres --version '=1.3.0' )
|
||||||
|
( cd $final_path/$app && sudo -u "$app" diesel migration run )
|
||||||
|
( cd $final_path/$app && sudo -u "$app" cargo install --no-default-features --features postgres )
|
||||||
|
( cd $final_path/$app && sudo -u "$app" cargo install --no-default-features --features postgres --path plume-cli )
|
||||||
|
|
||||||
|
# Add new instance
|
||||||
|
if [ $registration -eq 1 ]
|
||||||
|
then
|
||||||
|
( cd $final_path/$app && sudo -u "$app" plm instance new --domain "$domain" --name '$instance_name' -l 'CC-BY' )
|
||||||
|
else
|
||||||
|
( cd $final_path/$app && sudo -u "$app" plm instance new --private --domain "$domain" --name '$instance_name' -l 'CC-BY' )
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Add admin user
|
||||||
|
( cd $final_path/$app && sudo -u "$app" plm users new --admin -n "$admin" -N "$admin" --email '$admin_email' --password "$admin_pass" )
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
|
@ -146,39 +188,9 @@ export PATH="$PATH:/root/.cargo/bin:$final_path/.local/bin:/usr/local/sbin"
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
# setup application config
|
|
||||||
sudo cp ../conf/.env $final_path/.env
|
|
||||||
#=================================================
|
|
||||||
# MODIFY A CONFIG FILE
|
|
||||||
#=================================================
|
|
||||||
ynh_replace_string "__DBNAME__" "$db_name" "$final_path/.env"
|
|
||||||
ynh_replace_string "__PSQLPWD__" "$db_pwd" "$final_path/.env"
|
|
||||||
ynh_replace_string "__DOMAIN__" "$domain" "$final_path/.env"
|
|
||||||
ynh_replace_string "__PORT__" "$port" "$final_path/.env"
|
|
||||||
ynh_replace_string "__DB_USER__" "$app" "$final_path/.env"
|
|
||||||
|
|
||||||
# Set right permissions
|
# Set right permissions
|
||||||
chown -R $app: $final_path
|
chown -R $app: $final_path
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SETUP SYSTEMD
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
### `ynh_systemd_config` is used to configure a systemd script for an app.
|
|
||||||
### It can be used for apps that use sysvinit (with adaptation) or systemd.
|
|
||||||
### Have a look at the app to be sure this app needs a systemd script.
|
|
||||||
### `ynh_systemd_config` will use the file conf/systemd.service
|
|
||||||
### If you're not using these lines:
|
|
||||||
### - You can remove those files in conf/.
|
|
||||||
### - Remove the section "BACKUP SYSTEMD" in the backup script
|
|
||||||
### - Remove also the section "STOP AND REMOVE SERVICE" in the remove script
|
|
||||||
### - As well as the section "RESTORE SYSTEMD" in the restore script
|
|
||||||
### - And the section "SETUP SYSTEMD" in the upgrade script
|
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
|
||||||
# ynh_add_systemd_config
|
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -206,8 +218,26 @@ then
|
||||||
ynh_app_setting_set $app unprotected_uris "/"
|
ynh_app_setting_set $app unprotected_uris "/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Create a dedicated systemd config
|
||||||
|
ynh_add_systemd_config
|
||||||
|
systemctl enable "$app"
|
||||||
|
systemctl start "$app"
|
||||||
|
sleep 30
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SEND A README FOR THE ADMIN
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
message=" $app was successfully installed :)
|
||||||
|
Please open your $app domain: https://$domain$path_url
|
||||||
|
|
||||||
|
The admin username is: $admin
|
||||||
|
The admin password is: $admin_pass
|
||||||
|
|
||||||
|
If you are facing any problem or want to improve this app, please open a new issue here: https://github.com/Plume-org/Plume"
|
||||||
|
ynh_send_readme_to_admin "$message" "$admin"
|
||||||
|
|
0
scripts/psql.sh
Normal file → Executable file
0
scripts/psql.sh
Normal file → Executable file
|
@ -49,7 +49,7 @@ fi
|
||||||
# Remove metapackage and its dependencies
|
# Remove metapackage and its dependencies
|
||||||
ynh_remove_app_dependencies
|
ynh_remove_app_dependencies
|
||||||
|
|
||||||
( cd $final_path && cargo uninstall diesel_cli )
|
( cd $final_path/$app && sudo -u "$app" cargo uninstall diesel_cli )
|
||||||
|
|
||||||
sudo /usr/local/lib/rustlib/uninstall.sh
|
sudo /usr/local/lib/rustlib/uninstall.sh
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,6 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_restore_file "$final_path"
|
ynh_restore_file "$final_path"
|
||||||
( cd $final_path && curl -sf -L https://static.rust-lang.org/rustup.sh | sh -s -- --channel=nightly --date=2018-05-31 )
|
|
||||||
|
|
||||||
# open port
|
# open port
|
||||||
yunohost firewall allow --no-upnp TCP $port 2>&1
|
yunohost firewall allow --no-upnp TCP $port 2>&1
|
||||||
|
@ -90,7 +89,7 @@ ynh_psql_execute_file_as_root ./db.sql "$db_name"
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Create the dedicated user (if not existing)
|
# Create the dedicated user (if not existing)
|
||||||
ynh_system_user_create $app
|
ynh_system_user_create $app "$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE USER RIGHTS
|
# RESTORE USER RIGHTS
|
||||||
|
@ -115,7 +114,11 @@ ynh_restore_file "/etc/logrotate.d/$app"
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX AND START PLEROMA
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
|
systemctl enable "$app"
|
||||||
|
systemctl start "$app"
|
||||||
|
# App needs time to start
|
||||||
|
sleep 10
|
||||||
|
|
|
@ -20,6 +20,11 @@ path_url=$(ynh_app_setting_get $app path)
|
||||||
is_public=$(ynh_app_setting_get $app is_public)
|
is_public=$(ynh_app_setting_get $app is_public)
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
db_name=$(ynh_app_setting_get "$app" psql_db)
|
db_name=$(ynh_app_setting_get "$app" psql_db)
|
||||||
|
admin=$(ynh_app_setting_get "$app" admin)
|
||||||
|
admin_email=$(ynh_app_setting_get "$app" admin_email)
|
||||||
|
random_key=$(ynh_app_setting_get "$app" random_key)
|
||||||
|
name=$(ynh_app_setting_get "$app" name)
|
||||||
|
port=$(ynh_app_setting_get "$app" port)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
|
@ -37,6 +42,22 @@ fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Stop Pleroma for upgrade
|
||||||
|
systemctl stop "$app"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -46,8 +67,53 @@ fi
|
||||||
# Normalize the URL path syntax
|
# Normalize the URL path syntax
|
||||||
path_url=$(ynh_normalize_url_path $path_url)
|
path_url=$(ynh_normalize_url_path $path_url)
|
||||||
|
|
||||||
|
# Open this port
|
||||||
|
yunohost firewall allow --no-upnp TCP $port 2>&1
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CREATE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Create a system user
|
||||||
|
ynh_system_user_create "$app" "$final_path"
|
||||||
|
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# INSTALL DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
### `ynh_install_app_dependencies` allows you to add any "apt" dependencies to the package.
|
||||||
|
### Those deb packages will be installed as dependencies of this package.
|
||||||
|
### If you're not using this helper:
|
||||||
|
### - Remove the section "REMOVE DEPENDENCIES" in the remove script
|
||||||
|
### - As well as the section "REINSTALL DEPENDENCIES" in the restore script
|
||||||
|
### - And the section "UPGRADE DEPENDENCIES" in the upgrade script
|
||||||
|
|
||||||
|
ynh_install_app_dependencies gettext postgresql postgresql-contrib libpq-dev git curl gcc make openssl libssl-dev pkg-config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# DOWNLOAD, CHECK AND UNPACK PLEROMA SOURCE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
( cd $final_path/$app && git pull )
|
||||||
|
# Give permisiion to the final_path
|
||||||
|
chown -R "$app":"$app" "$final_path"
|
||||||
|
( cd $final_path/$app && sudo -u "$app" cargo install --force )
|
||||||
|
( cd $final_path/$app && sudo -u "$app" cargo install --path plume-cli --force )
|
||||||
|
( cd $final_path/$app && sudo -u "$app" diesel migration run )
|
||||||
|
|
||||||
|
|
||||||
|
# Recalculate and store the config file checksum into the app settings
|
||||||
|
ynh_store_file_checksum "$final_path/$app/.env"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SETUP SYSTEMD
|
||||||
|
#=================================================
|
||||||
|
# Create a dedicated systemd config
|
||||||
|
ynh_add_systemd_config
|
||||||
|
|
||||||
|
# Set right permissions
|
||||||
|
chown -R "$app":"$app" "$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
|
@ -65,3 +131,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
|
systemctl enable "$app"
|
||||||
|
systemctl restart "$app"
|
||||||
|
# App needs time to start
|
||||||
|
sleep 10
|
||||||
|
|
Loading…
Add table
Reference in a new issue