From: Christian Heller Date: Thu, 27 Feb 2020 23:32:36 +0000 (+0100) Subject: Extend Pleroma-from-source scripting. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/decks/%7B%7Btodo.comment%7D%7D?a=commitdiff_plain;h=f1901562e5d3859b4e9a9eb7c5f48c6db73fc8b1;p=config Extend Pleroma-from-source scripting. --- diff --git a/buster/setup_scripts/migrate_app.sh b/buster/setup_scripts/migrate_app.sh index cda12f5..6e18f33 100755 --- a/buster/setup_scripts/migrate_app.sh +++ b/buster/setup_scripts/migrate_app.sh @@ -6,15 +6,18 @@ if [ "$#" -lt 2 ]; then echo 'Need two arguments: old server IP, and service name.' false fi -if [ ! "$2" = "pleroma" ] && [ ! "$2" = "peertube" ]; then - echo "Need legal service name (pleroma or peertube)." +if [ ! "$2" = "pleroma_otp" ] && [ ! "$2" = "pleroma_source" ] && [ ! "$2" = "peertube" ]; then + echo "Need legal service name (pleroma_otp or pleroma_source or peertube)." false fi server_ip="$1" app="$2" -if [ "${app}" = "pleroma" ]; then +if [ "${app}" = "pleroma_otp" ]; then db_name="pleroma" dirs="/var/lib/pleroma/uploads /etc/pleroma" +if [ "${app}" = "pleroma_source" ]; then + db_name="pleroma" + dirs="/var/lib/pleroma/uploads /opt/pleroma/config" elif [ "${app}" = "peertube" ]; then db_name="peertube_prod" dirs="/var/www/peertube/storage /var/www/peertube/config" diff --git a/buster/setup_scripts/restore_app.sh b/buster/setup_scripts/restore_app.sh index dd1d856..363a5f6 100755 --- a/buster/setup_scripts/restore_app.sh +++ b/buster/setup_scripts/restore_app.sh @@ -6,8 +6,8 @@ if [ "$#" -lt 2 ]; then echo 'Need two arguments: service name and DB name.' false fi -if [ ! "$1" = "pleroma" ] && [ ! "$1" = "peertube" ]; then - echo "Need legal service name (pleroma or peertube)." +if [ ! "$1" = "pleroma_otp" ] && [ ! "$1" = "pleroma_sourc" ] && [ ! "$1" = "peertube" ]; then + echo "Need legal service name (pleroma_otp or pleroma_source or peertube)." false fi app="$1" @@ -24,6 +24,11 @@ rm "${app}_backup/${db_name}.pgdump" cd "${app}_backup" for path in $(find . -type f); do + if [ "${app}" = "pleroma_source" ]; then + if [ "${path}" = '/opt/pleroma/config/prod.secret.exs' ]; then + continue # skip file that contains passwords + fi + fi target_path=$(echo "${path}" | cut -c2-) source_path=$(realpath "${path}") dir=$(dirname "${target_path}") @@ -32,7 +37,7 @@ for path in $(find . -type f); do done # TODO: Horrible hack, improve. -if [ "${app}" = "pleroma" ]; then +if [ "${app}" = "pleroma_otp" ]; then db_pw=$(cat /etc/pleroma/config.exs | grep password | sed 's/[ ]*password\: *//g' | sed 's/,//g' | sed 's/"//g') elif [ "${app}" = "peertube" ]; then db_pw=$(cat /var/www/peertube/config/production.yaml | grep password | head -1 | sed "s/[ ]*password\: *//g" | sed "s/'//g") diff --git a/buster/setup_scripts/setup_pleroma_source.sh b/buster/setup_scripts/setup_pleroma_source.sh index 614a7ed..e60350f 100755 --- a/buster/setup_scripts/setup_pleroma_source.sh +++ b/buster/setup_scripts/setup_pleroma_source.sh @@ -58,7 +58,11 @@ mv config/{generated_config.exs,prod.secret.exs}" su postgres -s $SHELL -lc 'psql -f /tmp/setup_db.psql' su pleroma -s $SHELL -lc 'cd /opt/pleroma && MIX_ENV=prod mix ecto.migrate' -# TODO: config customization, prod.secret.exs +# Add our own plom.exs and import it to prod.secret.exs +echo '' >> /opt/pleroma/config/prod.secret.exs +echo 'import_config "plom.exs"' >> /opt/pleroma/config/prod.secret.exs +echo 'import Config' > /opt/pleroma/config/plom.exs +cat "${config_tree_prefix}/other_files/append_pleroma_config" >> /opt/pleroma/config/plom.exs # Single-pixel picture hack for removing Pleroma FE images. cp "${config_tree_prefix}/other_files/pixel.png" /var/lib/pleroma/static/