overlay/www-apps/pleroma-installer/files/install_pleroma-r1.sh
tastytea 14baf1f984
www-apps/pleroma-installer: Version bump: 5
Package-Manager: Portage-2.3.51, Repoman-2.3.11
Manifest-Sign-Key: 3555266864CA6D7FF45AA6E7CFC39497F1B26E07
2019-02-23 07:33:15 +01:00

45 lines
1.3 KiB
Bash

#!/bin/sh
echo "This script is only suitable for the initial installation, not for upgrades."
echo "Make sure postgresql is configured and running."
echo "Hit enter to proceed."
read sure
if [ -n "${sure}" ]; then
exit
fi
purple='\033[1;35m'
nocolor='\033[0m'
function die()
{
if [ -n "${1}" ]; then
echo "${1}" >&2
fi
exit 1
}
echo -e "${purple}Cloning pleroma into current dir...${nocolor}"
sudo -u pleroma git clone https://git.pleroma.social/pleroma/pleroma.git || die
mv pleroma/{*,.[a-zA-Z0-9]*} . || die
rmdir pleroma || die
echo -e "${purple}Installing the dependencies for pleroma..."
echo -e "Answer with yes if it asks you to install Hex.${nocolor}"
sudo -u pleroma mix deps.get || die
echo -e "${purple}Generating the configuration..."
echo -e "Answer with yes if it asks you to install rebar3.${nocolor}"
sudo -u pleroma mix pleroma.instance gen || die
mv -v config/{generated_config.exs,prod.secret.exs} || die
echo -e "${purple}Creating the database...${nocolor}"
sudo -u postgres psql -f config/setup_db.psql || die
echo -e "${purple}Running the database migration...${nocolor}"
sudo -u pleroma MIX_ENV=prod mix ecto.migrate || die
echo -en "\n${purple}Done! You can now start pleroma with${nocolor} "
echo "/etc/init.d/pleroma start"
echo "{purple}The configuration file is in${nocolor} config/prod.secret.exs"