home · contact · privacy
Extend Pleroma-from-source scripting.
authorChristian Heller <c.heller@plomlompom.de>
Thu, 27 Feb 2020 23:32:36 +0000 (00:32 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Thu, 27 Feb 2020 23:32:36 +0000 (00:32 +0100)
buster/setup_scripts/migrate_app.sh
buster/setup_scripts/restore_app.sh
buster/setup_scripts/setup_pleroma_source.sh

index cda12f564a010c764eff894b438b17f1ee8b6834..6e18f330e89eb5febf4c69302997a768fb13f33f 100755 (executable)
@@ -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"
index dd1d85624368f11f15513b8f570b0223105154aa..363a5f6edb4c859d7e81532ee317322b3a1fc270 100755 (executable)
@@ -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")
index 614a7ed37f565986ce7035f568a557ad8913cf37..e60350f78e70b029697ea1d5ddf2c5b5adeaedcc 100755 (executable)
@@ -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/