Change pleroma directory
This commit is contained in:
parent
ecac6e9e7f
commit
b424e8899e
|
@ -40,6 +40,7 @@ PLEROMA_ONION_PORT=8011
|
|||
PLEROMA_REPO="https://git.pleroma.social/pleroma/pleroma.git"
|
||||
PLEROMA_COMMIT='7252f6b054dfdfac1f9bac77c442c5a1ebd898af'
|
||||
PLEROMA_ADMIN_PASSWORD=
|
||||
PLEROMA_DIR=/etc/pleroma
|
||||
|
||||
PLEROMA_BACKGROUND_IMAGE_URL=
|
||||
|
||||
|
@ -71,13 +72,6 @@ function remove_user_pleroma {
|
|||
remove_username="$1"
|
||||
|
||||
${PROJECT_NAME}-pass -u $remove_username --rmapp pleroma
|
||||
|
||||
function_check get_completion_param
|
||||
PLEROMA_DOMAIN_NAME=$(get_completion_param "pleroma domain")
|
||||
if [ -d /var/www/$PLEROMA_DOMAIN_NAME ]; then
|
||||
cd /var/www/$PLEROMA_DOMAIN_NAME/htdocs
|
||||
php scripts/deleteprofile.php -n $remove_username -y
|
||||
fi
|
||||
}
|
||||
|
||||
function add_user_pleroma {
|
||||
|
@ -86,15 +80,7 @@ function add_user_pleroma {
|
|||
|
||||
${PROJECT_NAME}-pass -u $new_username -a pleroma -p "$new_user_password"
|
||||
|
||||
PLEROMA_DOMAIN_NAME=$(get_completion_param "pleroma domain")
|
||||
if [ -d /var/www/${PLEROMA_DOMAIN_NAME}/htdocs ]; then
|
||||
cd /var/www/$PLEROMA_DOMAIN_NAME/htdocs
|
||||
php scripts/registeruser.php -n $new_username -w "$new_user_password" -e "$new_username@$HOSTNAME"
|
||||
${PROJECT_NAME}-addemail -u $new_username -e "noreply@$PLEROMA_DOMAIN_NAME" -g pleroma --public no
|
||||
echo '0'
|
||||
else
|
||||
echo '1'
|
||||
fi
|
||||
echo '0'
|
||||
}
|
||||
|
||||
function install_interactive_pleroma {
|
||||
|
@ -204,7 +190,7 @@ function pleroma_create_database {
|
|||
run_system_query_postgresql "GRANT ALL ON ALL tables IN SCHEMA public TO pleroma;"
|
||||
run_system_query_postgresql "GRANT ALL ON ALL sequences IN SCHEMA public TO pleroma;"
|
||||
|
||||
cd /var/www/$PLEROMA_DOMAIN_NAME/htdocs
|
||||
cd $PLEROMA_DIR
|
||||
mix ecto.create
|
||||
mix ecto.migrate
|
||||
}
|
||||
|
@ -341,7 +327,7 @@ function backup_local_pleroma {
|
|||
function_check suspend_site
|
||||
suspend_site ${PLEROMA_DOMAIN_NAME}
|
||||
|
||||
source_directory=/var/www/${PLEROMA_DOMAIN_NAME}/htdocs
|
||||
source_directory=$PLEROMA_DIR
|
||||
dest_directory=pleroma
|
||||
backup_directory_to_usb $source_directory $dest_directory
|
||||
|
||||
|
@ -361,7 +347,7 @@ function restore_local_pleroma {
|
|||
if [ $PLEROMA_DOMAIN_NAME ]; then
|
||||
echo $"Restoring pleroma"
|
||||
temp_restore_dir=/root/temppleroma
|
||||
pleroma_dir=/var/www/${PLEROMA_DOMAIN_NAME}/htdocs
|
||||
pleroma_dir=$PLEROMA_DIR
|
||||
|
||||
function_check pleroma_create_database
|
||||
pleroma_create_database
|
||||
|
@ -392,7 +378,7 @@ function backup_remote_pleroma {
|
|||
function_check suspend_site
|
||||
suspend_site ${PLEROMA_DOMAIN_NAME}
|
||||
|
||||
source_directory=/var/www/${PLEROMA_DOMAIN_NAME}/htdocs
|
||||
source_directory=$PLEROMA_DIR
|
||||
dest_directory=pleroma
|
||||
backup_directory_to_friend $source_directory $dest_directory
|
||||
|
||||
|
@ -412,7 +398,7 @@ function restore_remote_pleroma {
|
|||
if [ $PLEROMA_DOMAIN_NAME ]; then
|
||||
echo $"Restoring pleroma"
|
||||
temp_restore_dir=/root/temppleroma
|
||||
pleroma_dir=/var/www/${PLEROMA_DOMAIN_NAME}/htdocs
|
||||
pleroma_dir=$PLEROMA_DIR
|
||||
|
||||
function_check pleroma_create_database
|
||||
pleroma_create_database
|
||||
|
@ -445,6 +431,8 @@ function remove_pleroma {
|
|||
systemctl disable pleroma
|
||||
rm /etc/systemd/system/pleroma.service
|
||||
|
||||
apt-get -yq remove esl-erlang elixir
|
||||
|
||||
function_check remove_nodejs
|
||||
remove_nodejs pleroma-backend
|
||||
|
||||
|
@ -460,13 +448,17 @@ function remove_pleroma {
|
|||
if [ -f /etc/nginx/sites-available/$PLEROMA_DOMAIN_NAME ]; then
|
||||
rm /etc/nginx/sites-available/$PLEROMA_DOMAIN_NAME
|
||||
fi
|
||||
if [ -d $PLEROMA_DIR ]; then
|
||||
rm -rf $PLEROMA_DIR
|
||||
fi
|
||||
function_check drop_database_postgresql
|
||||
drop_database_postgresql
|
||||
function_check remove_onion_service
|
||||
remove_onion_service pleroma ${PLEROMA_ONION_PORT}
|
||||
remove_app pleroma
|
||||
remove_completion_param install_pleroma
|
||||
sed -i '/pleroma/d' $COMPLETION_FILE
|
||||
sed -i '/pleroma domain/d' $COMPLETION_FILE
|
||||
sed -i '/pleroma commit/d' $COMPLETION_FILE
|
||||
|
||||
function_check remove_ddns_domain
|
||||
remove_ddns_domain $PLEROMA_DOMAIN_NAME
|
||||
|
@ -508,32 +500,40 @@ function install_pleroma {
|
|||
install_nodejs pleroma-backend
|
||||
install_postgresql
|
||||
|
||||
# get the repo
|
||||
if [ ! -d /var/www/$PLEROMA_DOMAIN_NAME ]; then
|
||||
mkdir /var/www/$PLEROMA_DOMAIN_NAME
|
||||
fi
|
||||
if [ ! -d /var/www/$PLEROMA_DOMAIN_NAME/htdocs ]; then
|
||||
|
||||
if [ -d /repos/pleroma ]; then
|
||||
mkdir /var/www/$PLEROMA_DOMAIN_NAME/htdocs
|
||||
cp -r -p /repos/pleroma/. /var/www/$PLEROMA_DOMAIN_NAME/htdocs
|
||||
cd /var/www/$PLEROMA_DOMAIN_NAME/htdocs
|
||||
git pull
|
||||
else
|
||||
function_check git_clone
|
||||
git_clone $PLEROMA_REPO /var/www/$PLEROMA_DOMAIN_NAME/htdocs
|
||||
fi
|
||||
|
||||
if [ ! -d /var/www/$PLEROMA_DOMAIN_NAME/htdocs ]; then
|
||||
echo $'Unable to clone pleroma repo'
|
||||
exit 783523
|
||||
fi
|
||||
if [ -d $PLEROMA_DIR ]; then
|
||||
rm -rf $PLEROMA_DIR
|
||||
fi
|
||||
|
||||
cd /var/www/$PLEROMA_DOMAIN_NAME/htdocs
|
||||
|
||||
# create user
|
||||
useradd -d $PLEROMA_DIR -s /bin/false pleroma
|
||||
adduser pleroma www-data
|
||||
|
||||
# get the repo
|
||||
if [ -d /repos/pleroma ]; then
|
||||
mkdir -p $PLEROMA_DIR
|
||||
cp -r -p /repos/pleroma/. $PLEROMA_DIR
|
||||
cd $PLEROMA_DIR
|
||||
git pull
|
||||
else
|
||||
function_check git_clone
|
||||
git_clone $PLEROMA_REPO $PLEROMA_DIR
|
||||
fi
|
||||
|
||||
if [ ! -d $PLEROMA_DIR ]; then
|
||||
echo $'Unable to clone pleroma backend repo'
|
||||
exit 783523
|
||||
fi
|
||||
|
||||
|
||||
# checkout the commit
|
||||
cd $PLEROMA_DIR
|
||||
git checkout $PLEROMA_COMMIT -b $PLEROMA_COMMIT
|
||||
set_completion_param "pleroma commit" "$PLEROMA_COMMIT"
|
||||
chown -R www-data:www-data /var/www/$PLEROMA_DOMAIN_NAME/htdocs
|
||||
chown -R pleroma:pleroma $PLEROMA_DIR
|
||||
|
||||
|
||||
# web config
|
||||
|
@ -567,7 +567,7 @@ function install_pleroma {
|
|||
echo ' access_log /dev/null;' >> $pleroma_nginx_site
|
||||
echo ' error_log /dev/null;' >> $pleroma_nginx_site
|
||||
echo '' >> $pleroma_nginx_site
|
||||
echo " root /var/www/$PLEROMA_DOMAIN_NAME/htdocs;" >> $pleroma_nginx_site
|
||||
echo " root $PLEROMA_DIR;" >> $pleroma_nginx_site
|
||||
echo '' >> $pleroma_nginx_site
|
||||
echo ' index index.html;' >> $pleroma_nginx_site
|
||||
echo ' location / {' >> $pleroma_nginx_site
|
||||
|
@ -594,8 +594,7 @@ function install_pleroma {
|
|||
echo ' access_log /dev/null;' >> $pleroma_nginx_site
|
||||
echo ' error_log /dev/null;' >> $pleroma_nginx_site
|
||||
echo '' >> $pleroma_nginx_site
|
||||
echo ' # Root' >> $pleroma_nginx_site
|
||||
echo " root /var/www/$PLEROMA_DOMAIN_NAME/htdocs;" >> $pleroma_nginx_site
|
||||
echo " root $PLEROMA_DIR;" >> $pleroma_nginx_site
|
||||
echo '' >> $pleroma_nginx_site
|
||||
echo ' index index.html;' >> $pleroma_nginx_site
|
||||
echo ' location / {' >> $pleroma_nginx_site
|
||||
|
@ -621,10 +620,7 @@ function install_pleroma {
|
|||
|
||||
|
||||
# back end
|
||||
useradd -d /var/www/$PLEROMA_DOMAIN_NAME/htdocs/ -s /bin/false pleroma
|
||||
adduser pleroma www-data
|
||||
|
||||
cd /var/www/$PLEROMA_DOMAIN_NAME/htdocs
|
||||
cd $PLEROMA_DIR
|
||||
mix deps.get
|
||||
|
||||
function_check pleroma_create_database
|
||||
|
@ -637,7 +633,7 @@ function install_pleroma {
|
|||
sed -i "s|database:.*|database: \"pleroma\",|g" $pleroma_secret
|
||||
sed -i "/config :pleroma, Pleroma.Web.Endpoint/a url: [host: \"$PLEROMA_DOMAIN_NAME\", scheme: \"https\", port: 443]," $pleroma_secret
|
||||
|
||||
pleroma_config=/var/www/$PLEROMA_DOMAIN_NAME/htdocs/config/config.exs
|
||||
pleroma_config=config/config.exs
|
||||
sed -i "s|name: .*|name: \"$PLEROMA_TITLE\",|g" $pleroma_config
|
||||
sed -i "s|email: .*|email: \"$MY_EMAIL_ADDRESS\",|g" $pleroma_config
|
||||
|
||||
|
@ -658,8 +654,8 @@ function install_pleroma {
|
|||
echo '' >> /etc/systemd/system/pleroma.service
|
||||
echo '[Service]' >> /etc/systemd/system/pleroma.service
|
||||
echo 'User=pleroma' >> /etc/systemd/system/pleroma.service
|
||||
echo "WorkingDirectory=/var/www/$PLEROMA_DOMAIN_NAME/htdocs/pleroma"
|
||||
echo "Environment=\"HOME=/var/www/$PLEROMA_DOMAIN_NAME/htdocs\"" >> /etc/systemd/system/pleroma.service
|
||||
echo "WorkingDirectory=$PLEROMA_DIR"
|
||||
echo "Environment=\"HOME=$PLEROMA_DIR\"" >> /etc/systemd/system/pleroma.service
|
||||
echo 'ExecStart=/usr/local/bin/mix phx.server' >> /etc/systemd/system/pleroma.service
|
||||
echo 'ExecReload=/bin/kill $MAINPID' >> /etc/systemd/system/pleroma.service
|
||||
echo 'KillMode=process' >> /etc/systemd/system/pleroma.service
|
||||
|
|
Loading…
Reference in New Issue