mirror of
https://github.com/YunoHost-Apps/plume_ynh.git
synced 2024-09-03 20:15:54 +02:00
commit
40c9656f39
7 changed files with 41 additions and 47 deletions
15
README.md
15
README.md
|
@ -33,14 +33,9 @@ Federated blogging engine, based on ActivityPub. It uses the Rocket framework, a
|
||||||
|
|
||||||
* [List of instances](https://joinplu.me/#instances)
|
* [List of instances](https://joinplu.me/#instances)
|
||||||
|
|
||||||
## Configuration
|
|
||||||
|
|
||||||
How to configure this app: by an admin panel, a plain file with SSH, or any other way.
|
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
* Official documentation: https://docs.joinplu.me/
|
* Official documentation: https://docs.joinplu.me/
|
||||||
* YunoHost documentation: If specific documentation is needed, feel free to contribute.
|
|
||||||
|
|
||||||
## YunoHost specific features
|
## YunoHost specific features
|
||||||
|
|
||||||
|
@ -54,19 +49,11 @@ But the app can be used by multiple users
|
||||||
* x86-64b - [](https://ci-apps.yunohost.org/ci/apps/plume/)
|
* x86-64b - [](https://ci-apps.yunohost.org/ci/apps/plume/)
|
||||||
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/plume/)
|
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/plume/)
|
||||||
* Jessie x86-64b - [](https://ci-stretch.nohost.me/ci/apps/plume/)
|
* Jessie x86-64b - [](https://ci-stretch.nohost.me/ci/apps/plume/)
|
||||||
* Testing x86-64b - [](https://ci-apps-unstable.yunohost.org/ci/apps/plume/)
|
|
||||||
* Unstable x86-64b - [](https://ci-apps-unstable.yunohost.org/ci/apps/plume/)
|
|
||||||
|
|
||||||
## Limitations
|
## Limitations
|
||||||
|
|
||||||
* Any known limitations.
|
* No known limitations.
|
||||||
|
|
||||||
## Additional information
|
|
||||||
|
|
||||||
* Other information you would add about this application
|
|
||||||
|
|
||||||
**More information on the documentation page:**
|
|
||||||
https://yunohost.org/packaging_apps
|
|
||||||
## Links
|
## Links
|
||||||
|
|
||||||
* Report a bug: https://github.com/YunoHost-Apps/plume_ynh/issues
|
* Report a bug: https://github.com/YunoHost-Apps/plume_ynh/issues
|
||||||
|
|
|
@ -29,7 +29,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
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" db_name)
|
db_name=$(ynh_app_setting_get $app db_name)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD BACKUP STEPS
|
# STANDARD BACKUP STEPS
|
||||||
|
@ -52,11 +52,10 @@ ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
#ynh_backup "/etc/php5/fpm/pool.d/$app.conf"
|
#ynh_backup "/etc/php5/fpm/pool.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE PostgreSQL DATABASE
|
# BACKUP THE POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_psql_dump_db "$db_name" > db.sql
|
ynh_psql_dump_db "$db_name" > db.sql
|
||||||
#ynh_backup "db.sql"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC BACKUP
|
# SPECIFIC BACKUP
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
|
source ynh_systemd_action
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -59,8 +59,6 @@ test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||||
# 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)
|
||||||
|
|
||||||
# Check web path availability
|
|
||||||
ynh_webpath_available $domain $path_url
|
|
||||||
# Register (book) web path
|
# Register (book) web path
|
||||||
ynh_webpath_register $app $domain $path_url
|
ynh_webpath_register $app $domain $path_url
|
||||||
|
|
||||||
|
@ -105,7 +103,7 @@ ynh_app_setting_set $app port $port
|
||||||
### - As well as the section "REINSTALL DEPENDENCIES" in the restore script
|
### - As well as the section "REINSTALL DEPENDENCIES" in the restore script
|
||||||
### - And the section "UPGRADE DEPENDENCIES" in the upgrade 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 sqlite3 libsqlite3-dev
|
ynh_install_app_dependencies gettext postgresql postgresql-contrib libpq-dev git curl gcc make openssl libssl-dev pkg-config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE A POSTGRESQL DATABASE
|
# CREATE A POSTGRESQL DATABASE
|
||||||
|
@ -119,9 +117,9 @@ ynh_install_app_dependencies gettext postgresql postgresql-contrib libpq-dev git
|
||||||
### - As well as the section "RESTORE THE POSTGRESQL DATABASE" in the restore script
|
### - As well as the section "RESTORE THE POSTGRESQL DATABASE" in the restore script
|
||||||
|
|
||||||
ynh_psql_test_if_first_run
|
ynh_psql_test_if_first_run
|
||||||
db_name="$app"
|
db_name=$(ynh_sanitize_dbid $app)
|
||||||
db_pwd=$(ynh_string_random 30)
|
db_pwd=$(ynh_string_random 30)
|
||||||
ynh_app_setting_set "$app" db_name "$db_name"
|
ynh_app_setting_set $app db_name $db_name
|
||||||
ynh_app_setting_set "$app" db_pwd "$db_pwd"
|
ynh_app_setting_set "$app" db_pwd "$db_pwd"
|
||||||
ynh_psql_create_user "$db_name" "$db_pwd"
|
ynh_psql_create_user "$db_name" "$db_pwd"
|
||||||
ynh_psql_execute_as_root \
|
ynh_psql_execute_as_root \
|
||||||
|
@ -141,14 +139,13 @@ ynh_app_setting_set $app final_path $final_path
|
||||||
git clone https://github.com/Plume-org/Plume.git "$final_path/$app"
|
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 )
|
mkdir $final_path/media
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
### `ynh_add_nginx_config` will use the file conf/nginx.conf
|
### `ynh_add_nginx_config` will use the file conf/nginx.conf
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
|
@ -189,6 +186,7 @@ chown -R "$app":"$app" "/var/log/$app"
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY A CONFIG FILE
|
# MODIFY A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# setup application config
|
# setup application config
|
||||||
sudo cp "../conf/.env" "$final_path/$app/.env"
|
sudo cp "../conf/.env" "$final_path/$app/.env"
|
||||||
ynh_replace_string "__DB_NAME__" "$db_name" "$final_path/$app/.env"
|
ynh_replace_string "__DB_NAME__" "$db_name" "$final_path/$app/.env"
|
||||||
|
@ -209,7 +207,7 @@ pushd $final_path
|
||||||
sudo -u "$app" RUSTUP_HOME=$final_path/.rustup CARGO_HOME=$final_path/.cargo bash -c 'curl -sSf -L https://static.rust-lang.org/rustup.sh | sh -s -- -y --default-toolchain=nightly'
|
sudo -u "$app" RUSTUP_HOME=$final_path/.rustup CARGO_HOME=$final_path/.cargo bash -c 'curl -sSf -L https://static.rust-lang.org/rustup.sh | sh -s -- -y --default-toolchain=nightly'
|
||||||
popd
|
popd
|
||||||
|
|
||||||
export PATH="$PATH:$final_path/.cargo/bin:/usr/local/sbin"
|
export PATH="$PATH:$final_path/.cargo/bin:$final_path/.local/bin:/usr/local/sbin"
|
||||||
|
|
||||||
pushd $final_path/$app
|
pushd $final_path/$app
|
||||||
sudo -u "$app" env PATH=$PATH cargo install diesel_cli --no-default-features --features postgres --version '=1.3.0'
|
sudo -u "$app" env PATH=$PATH cargo install diesel_cli --no-default-features --features postgres --version '=1.3.0'
|
||||||
|
|
|
@ -18,7 +18,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
port=$(ynh_app_setting_get $app port)
|
port=$(ynh_app_setting_get $app port)
|
||||||
db_name=$(ynh_app_setting_get "$app" db_name)
|
db_name=$(ynh_app_setting_get $app db_name)
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -46,7 +46,7 @@ ynh_remove_systemd_config
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Remove a database if it exists, along with the associated user
|
# Remove a database if it exists, along with the associated user
|
||||||
ynh_psql_remove_db "$db_name" "$app"
|
ynh_psql_remove_db "$db_name" "$db_name"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ ynh_psql_remove_db "$db_name" "$app"
|
||||||
# Remove metapackage and its dependencies
|
# Remove metapackage and its dependencies
|
||||||
ynh_remove_app_dependencies
|
ynh_remove_app_dependencies
|
||||||
|
|
||||||
export PATH="$PATH:$final_path/.cargo/bin:/usr/local/sbin"
|
export PATH="$PATH:$final_path/.cargo/bin:$final_path/.local/bin:/usr/local/sbin"
|
||||||
|
|
||||||
pushd $final_path/$app
|
pushd $final_path/$app
|
||||||
sudo -u "$app" env PATH=$PATH cargo uninstall diesel_cli
|
sudo -u "$app" env PATH=$PATH cargo uninstall diesel_cli
|
||||||
|
@ -103,6 +103,7 @@ then
|
||||||
echo "Close port $port" >&2
|
echo "Close port $port" >&2
|
||||||
yunohost firewall disallow TCP $port 2>&1
|
yunohost firewall disallow TCP $port 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC REMOVE
|
# SPECIFIC REMOVE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -95,7 +95,7 @@ chown -R "$app":"$app" $final_path
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Define and install dependencies
|
# Define and install dependencies
|
||||||
ynh_install_app_dependencies gettext postgresql postgresql-contrib libpq-dev git curl gcc make openssl libssl-dev pkg-config sqlite3 libsqlite3-dev
|
ynh_install_app_dependencies gettext postgresql postgresql-contrib libpq-dev git curl gcc make openssl libssl-dev pkg-config
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -107,12 +107,19 @@ systemctl enable $app.service
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
|
|
||||||
#Fix Your search index is locked.
|
#Fix Your search index is locked.
|
||||||
export PATH="$PATH:$final_path/.cargo/bin:/usr/local/sbin"
|
export PATH="$PATH:$final_path/.cargo/bin:$final_path/.local/bin:/usr/local/sbin"
|
||||||
|
|
||||||
pushd $final_path/$app
|
pushd $final_path/$app
|
||||||
sudo -u "$app" env PATH=$PATH plm search unlock
|
sudo -u "$app" env PATH=$PATH plm search unlock
|
||||||
popd
|
popd
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CREATE LOG FOLDER
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
mkdir -p "/var/log/$app"
|
||||||
|
chown -R "$app":"$app" "/var/log/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -140,13 +147,6 @@ ynh_restore_file "/etc/logrotate.d/$app"
|
||||||
#systemctl reload php5-fpm
|
#systemctl reload php5-fpm
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE LOG FOLDER
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
mkdir -p "/var/log/$app"
|
|
||||||
chown -R "$app":"$app" "/var/log/$app"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SERVICE
|
# START SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -22,7 +22,7 @@ admin=$(ynh_app_setting_get $app admin)
|
||||||
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" db_name)
|
db_name=$(ynh_app_setting_get $app db_name)
|
||||||
admin_email=$(ynh_app_setting_get "$app" admin_email)
|
admin_email=$(ynh_app_setting_get "$app" admin_email)
|
||||||
secret_key=$(ynh_app_setting_get "$app" secret_key)
|
secret_key=$(ynh_app_setting_get "$app" secret_key)
|
||||||
name=$(ynh_app_setting_get "$app" name)
|
name=$(ynh_app_setting_get "$app" name)
|
||||||
|
@ -113,7 +113,7 @@ ynh_add_nginx_config
|
||||||
# UPGRADE DEPENDENCIES
|
# UPGRADE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_install_app_dependencies gettext postgresql postgresql-contrib libpq-dev git curl gcc make openssl libssl-dev pkg-config sqlite3 libsqlite3-dev
|
ynh_install_app_dependencies gettext postgresql postgresql-contrib libpq-dev git curl gcc make openssl libssl-dev pkg-config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
|
@ -152,14 +152,21 @@ fi
|
||||||
# DOWNLOAD, CHECK AND UNPACK PLUME SOURCE
|
# DOWNLOAD, CHECK AND UNPACK PLUME SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
( cd $final_path && sudo -u "$app" RUSTUP_HOME=$final_path/.rustup CARGO_HOME=$final_path/.cargo bash -c 'curl -sSf -L https://static.rust-lang.org/rustup.sh | sh -s -- -y --default-toolchain=nightly' )
|
# Set right permissions
|
||||||
PATH="$PATH:$final_path/.cargo/bin"
|
chown -R "$app":"$app" $final_path
|
||||||
export PATH="$PATH:$final_path/.cargo/bin:/usr/local/sbin"
|
|
||||||
export FEATURES=postgres
|
# Install
|
||||||
chown -R "$app":"$app" "$final_path"
|
pushd $final_path
|
||||||
( cd $final_path/$app && sudo -u "$app" $final_path/.cargo/bin/cargo install --no-default-features --features postgres --force )
|
sudo -u "$app" RUSTUP_HOME=$final_path/.rustup CARGO_HOME=$final_path/.cargo bash -c 'curl -sSf -L https://static.rust-lang.org/rustup.sh | sh -s -- -y --default-toolchain=nightly'
|
||||||
( cd $final_path/$app && sudo -u "$app" $final_path/.cargo/bin/cargo install --no-default-features --features postgres --path plume-cli --force )
|
popd
|
||||||
( cd $final_path/$app && diesel migration run )
|
|
||||||
|
export PATH="$PATH:$final_path/.cargo/bin:$final_path/.local/bin:/usr/local/sbin"
|
||||||
|
|
||||||
|
pushd $final_path/$app
|
||||||
|
sudo -u "$app" env PATH=$PATH cargo install --no-default-features --features postgres --force
|
||||||
|
sudo -u "$app" env PATH=$PATH cargo install --no-default-features --features postgres --path plume-cli --force
|
||||||
|
sudo -u "$app" env PATH=$PATH diesel migration run
|
||||||
|
popd
|
||||||
|
|
||||||
### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
||||||
### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it.
|
### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it.
|
||||||
|
@ -177,6 +184,7 @@ ynh_use_logrotate --non-append
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue