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"
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"
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}")
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")
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/