Commit 831c1ffc authored by root's avatar root

finish upgrade script

parent e916f983
# Pleroma for YunoHost
- [Yunohost project](https://yunohost.org)
- [Pleroma website](https://git.pleroma.social/pleroma/pleroma)
- [Pleroma project](https://git.pleroma.social/pleroma/pleroma)
## About Pleroma
......@@ -21,37 +21,25 @@ Mobile clients that are known to work well:
## About this package
I'm using this package as a way to learn packaging for yunohost. This package is far from perfect and should not be used on production servers. If you have recommendations, please let me know on the fediverse at `@Ilja@mastodon.pirateparty.be`
What should work:
* Installation
* Removal
* Backup (Should check if it still works properly with the last changes)
* Restore (You'll need to remove the instance prior to restore. This should change in the future.)
What does not work:
* upgrade (there's only a very naive implementation atm)
* Change URL (this is technically impossible at this time due to the nature of federation)
I'm using this package as a way to learn packaging for yunohost. This package is not completely ready yet, but installation, removal and upgrade should work. Backup should work as well, but restore may have some quirks. If you have recommendations, please let me know on the fediverse at `@Ilja@mastodon.pirateparty.be`
What is not implemented:
* There is no LDAP integration. Users on Pleroma are seperate from the yunohost users
* There is no integration with a mailbox and/or -service. This means that mails won't be sent from the application
* I'll may want to add the Pleroma source in the package eventually. Right now I get it from the Pleroma repo directly during install
* Changing the URL is technically impossible at this time due to the nature of federation
Extra info:
* Multiple installs are possible
* On installation you can choose to enable scopes on the Pleroma-FE
* You can choose to close regstrations on installation, but then you'll need to create invite tokens if you want others to join your instance as well. You can do this by accessing your yunohost server over ssh and run `cd /var/www/pleroma/pleroma/ && MIX_ENV=prod mix generate_invite_token`. See: https://git.pleroma.social/pleroma/pleroma/wikis/Admin%20tasks
* On installation you'll be able to chose a dedicated domain for Pleroma. You'll also be asked for a username and password for a user. This user will have moderator rights. Note that the password will be visible if you install using the `--debug` flag!
* On installation you'll need to chose a dedicated domain for Pleroma. You'll also be asked for a username and password for a user. This user will have moderator rights.
* Pleroma will be listed in the admin-panel under services, so you can stop and start the service there
* Postgresql will also be listed in the admin-panel
* If you're not afraid of the terminal, check out https://git.pleroma.social/pleroma/pleroma/wikis/home to see what more you can do with your awesome instance!
* You can upgrade your Pleroma instance by logging in over ssh as root and run `su - pleroma -c "cd /var/www/pleroma/pleroma;git pull;MIX_ENV=prod mix deps.get;MIX_ENV=prod mix ecto.migrate;" && systemctl restart pleroma`
* You can upgrade your Pleroma instance by logging in over ssh as root and run `yunohost app upgrade pleroma_ynh -u https://gitlab.com/Spctrl/pleroma_ynh`
* To check your current Pleroma version you can go to `yourdomain.tld/api/v1/instance`
* If you're not afraid of the terminal, check out https://git.pleroma.social/pleroma/pleroma/wikis/home to see what more you can do with your awesome instance!
TODO:
* Make the remove more elegant (esp the removal of the DB)
* Make backup and restore work as expected
* Use psql helpers for backup/restore if possible
* Make update work properly (atm there's only a very naive implementation)
* Check with linter/community... to add this to the community packages
......@@ -9,9 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
ynh_print_info '/!\'" Upgrade hasn't been tested yet "'/!\'
ynh_print_info 'nieuwe ding'
#=================================================
# LOAD SETTINGS
#=================================================
......@@ -25,10 +22,27 @@ final_path=$(ynh_app_setting_get $app final_path)
port=$(ynh_app_setting_get $app port)
db_name=$(ynh_app_setting_get $app db_name)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_print_info "Creating backup"
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
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_print_info "Ensuring backup"
# Pleroma sets the headers so ynh doesn't need to do it for us
if (cat "/etc/nginx/conf.d/$domain.d/$app.conf" | grep 'add_header')
then
......@@ -39,37 +53,22 @@ then
systemctl reload nginx
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
#=================================================
# CHECK THE PATH
#=================================================
# Normalize the URL path syntax
path_url=$(ynh_normalize_url_path $path_url)
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# PULL CHANGES AND SPECIFIC SETUP
#=================================================
ynh_print_info "Doing actual upgrade"
systemctl stop $app
su - $app -c "cd $final_path/pleroma;git pull;MIX_ENV=prod mix deps.get;MIX_ENV=prod mix ecto.migrate;"
su - $app -c "cd $final_path/pleroma;git pull --no-edit;MIX_ENV=prod mix deps.get;MIX_ENV=prod mix ecto.migrate;"
#=================================================
# RESTART PLEROMA
#=================================================
ynh_print_info "Restarting your new and improved version of Pleroma"
systemctl restart $app
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment