From 0826fce448dcd51b22aa525f882b73033f167b2e Mon Sep 17 00:00:00 2001 From: tastytea Date: Wed, 6 Feb 2019 12:44:24 +0100 Subject: [PATCH] www-apps/pleroma-installer: New package Package-Manager: Portage-2.3.51, Repoman-2.3.11 Manifest-Sign-Key: 3555266864CA6D7FF45AA6E7CFC39497F1B26E07 --- www-apps/pleroma-installer/Manifest | 14 ++++ .../files/install_pleroma.sh | 43 ++++++++++++ .../files/upgrade_pleroma.sh | 34 ++++++++++ www-apps/pleroma-installer/metadata.xml | 18 +++++ .../pleroma-installer-1.ebuild | 67 +++++++++++++++++++ 5 files changed, 176 insertions(+) create mode 100644 www-apps/pleroma-installer/Manifest create mode 100644 www-apps/pleroma-installer/files/install_pleroma.sh create mode 100644 www-apps/pleroma-installer/files/upgrade_pleroma.sh create mode 100644 www-apps/pleroma-installer/metadata.xml create mode 100644 www-apps/pleroma-installer/pleroma-installer-1.ebuild diff --git a/www-apps/pleroma-installer/Manifest b/www-apps/pleroma-installer/Manifest new file mode 100644 index 0000000..e1218ea --- /dev/null +++ b/www-apps/pleroma-installer/Manifest @@ -0,0 +1,14 @@ +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA256 + +AUX install_pleroma.sh 1219 BLAKE2B d97ea44cd608ff0528134093f17bbea2aada5ed57ad69444a7847a924a4b4368055116ff8cf46b2ba7c423c6adc0adedb5179e1f9729cb28f6b2bbd495daab25 SHA512 f4c24ac6547924787f7ef033d75748f4e30657ff1d84aaaffdeb40f17f21adaaa581335e894bbb0009b119a759637af00ed9cd4667dfcdeac886916c5c08b017 +AUX upgrade_pleroma.sh 791 BLAKE2B 3123e3bcc06bab422a554eeb9c5da6b100107125d16e9a661c90b1c09d1f4b8fd5cbdc743ed521db0ba7593a4967bd384695834d1951fa84ca2dd802773e31c1 SHA512 d08ffce3cfeba971022c0e1f9a08daffc10e60fa8d7920d99a840bbe7744d487d064e9d641f57ff89db77ba9c5fe0fd51999cce112ef7e8a2c1a5bf5a8c021ad +EBUILD pleroma-installer-1.ebuild 1699 BLAKE2B d8a7c3ffb779d09c2be1a5c18039c29c97dabc320e9fca0771bd900c8c685f72ce9c5678c9473159a92da04d85c7860a2d4b819eb8f92b01f5105e321dd58e49 SHA512 76c8030249f205623e97915116efc1118a90687dee46e4491727905accbe51b17bfd5c328aaca426ae625b0fab95587adb225396419f63a61e0dd043cb73e175 +MISC metadata.xml 993 BLAKE2B adc5c72fe12b6fdb4eb20c1d79dde227b088b437ffd21d16cc5775fa5bb7fa6363890dd5017fbe7f5a00a794a38fb298ce17e6402f6d3d5441985effd0d7e1db SHA512 6ff23fa60c0f22ef7a433e3d1b4919d074508898504b7168c925da8840f542afcdc891a9f4df69dc8eb6c44b7d9c41e6b94fdecd404ca738169124bcdab0af0d +-----BEGIN PGP SIGNATURE----- + +iHUEAREIAB0WIQQ1VSZoZMptf/RapufPw5SX8bJuBwUCXFrIfQAKCRDPw5SX8bJu +BxPQAPsGT+R5s50Fn9r0UTUQNYkMYI2iDwmTNX4z54zHBEvVlwD/UrjWU4oFTAE2 +BSvi0QLkQYD1mT51L41Qhyry3EKGoCs= +=92wY +-----END PGP SIGNATURE----- diff --git a/www-apps/pleroma-installer/files/install_pleroma.sh b/www-apps/pleroma-installer/files/install_pleroma.sh new file mode 100644 index 0000000..f126070 --- /dev/null +++ b/www-apps/pleroma-installer/files/install_pleroma.sh @@ -0,0 +1,43 @@ +#!/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}" +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}" +mix deps.get || die + +echo -e "${purple}Generating the configuration..." +echo -e "Answer with yes if it asks you to install rebar3.${nocolor}" +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}" +MIX_ENV=prod mix ecto.migrate || die + +echo -e "\n${purple}Done! You can now start pleroma with:${nocolor}" +echo "/etc/init.d/pleroma start" diff --git a/www-apps/pleroma-installer/files/upgrade_pleroma.sh b/www-apps/pleroma-installer/files/upgrade_pleroma.sh new file mode 100644 index 0000000..04c7804 --- /dev/null +++ b/www-apps/pleroma-installer/files/upgrade_pleroma.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +echo "This script will upgrade your pleroma installation." +echo "Pleroma will be stopped for the duration of the update." +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}Stopping pleroma...${nocolor}" +sudo /etc/init.d/pleroma stop || die + +echo -e "${purple}Pulling the latest changes from upstream...${nocolor}" +git pull || die +echo -e "${purple}Upgrading dependencies...${nocolor}" +mix deps.get || die + +echo -e "${purple}Performing database migrations...${nocolor}" +MIX_ENV=prod mix ecto.migrate || die + +echo -e "\n${purple}Done! Restarting pleroma...${nocolor}" +sudo /etc/init.d/pleroma restart || die diff --git a/www-apps/pleroma-installer/metadata.xml b/www-apps/pleroma-installer/metadata.xml new file mode 100644 index 0000000..5d3ad25 --- /dev/null +++ b/www-apps/pleroma-installer/metadata.xml @@ -0,0 +1,18 @@ + + + + + Pleroma is a microblogging server software that can federate (= exchange messages with) other servers that support the same federation standards (OStatus and ActivityPub). Pleroma will federate with all servers that implement either OStatus or ActivityPub, like Friendica, GNU Social, Hubzilla, Mastodon, Misskey, Peertube, and Pixelfed. For clients it supports both the GNU Social API with Qvitter extensions and the Mastodon client API. + + + gentoo@tastytea.de + tastytea + + + https://git.pleroma.social/pleroma/pleroma/issues + + + Installs a configuration file for apache. + Installs a configuration file for nginx. + + diff --git a/www-apps/pleroma-installer/pleroma-installer-1.ebuild b/www-apps/pleroma-installer/pleroma-installer-1.ebuild new file mode 100644 index 0000000..a745adb --- /dev/null +++ b/www-apps/pleroma-installer/pleroma-installer-1.ebuild @@ -0,0 +1,67 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit git-r3 user systemd + +DESCRIPTION="Microblogging server software that can federate with other servers." +HOMEPAGE="https://pleroma.social/ https://git.pleroma.social/pleroma/pleroma/" +EGIT_REPO_URI="https://git.pleroma.social/pleroma/pleroma.git" + +LICENSE="AGPL-3" +SLOT="0" +KEYWORDS="" +IUSE="apache +nginx systemd" + +RDEPEND=" + >=dev-lang/elixir-1.6.6 + >=dev-db/postgresql-9.6.11[uuid] + app-admin/sudo + apache? ( www-servers/apache ) + nginx? ( www-servers/nginx[nginx_modules_http_slice] ) +" +DEPEND="" + +pkg_setup() { + enewgroup pleroma + enewuser pleroma -1 /bin/bash /var/lib/pleroma pleroma +} + +src_install() { + local pleromadir="${EPREFIX}/var/lib/pleroma/pleroma" + diropts -o pleroma -g pleroma + exeopts -o pleroma -g pleroma + + dodir "${pleromadir}" + exeinto "${pleromadir}" + doexe "${FILESDIR}/install_pleroma.sh" + doexe "${FILESDIR}/upgrade_pleroma.sh" + + if use nginx; then + dodoc installation/pleroma.nginx + fi + if use apache; then + dodoc installation/pleroma-apache.conf + fi + + dodoc docs/* + + if use systemd; then + systemd_dounit installation/pleroma.service + else + doinitd installation/init.d/pleroma + fi +} + +pkg_postinst() { + elog 'For the initial installation, become the user pleroma, cd to ${HOME}/pleroma and run ./install_pleroma.sh.' + elog "To upgrade, run ./upgrade_pleroma.sh." + elog "Make sure the user pleroma can use sudo and has a strong password." + if use nginx; then + einfo "An example config for nginx has been installed in the doc directory." + fi + if use apache; then + einfo "An example config for apache has been installed in the doc directory." + fi +}