From ff30fa3f21a8c11a735527f4abeb77f1b052afb3 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Sat, 7 Mar 2020 22:24:31 +0100 Subject: [PATCH] Refactor Pleroma/PeerTupe setups. --- buster/apt-mark/peertube | 3 --- buster/apt-mark/pleroma | 7 ------- buster/apt-mark/pleroma_otp | 4 ++++ buster/apt-mark/pleroma_source | 4 ++++ buster/apt-mark/web | 4 ++++ buster/setup_scripts/setup_peertube.sh | 12 ++++++------ .../{setup_pleroma.sh => setup_pleroma_otp.sh} | 4 ++-- buster/setup_scripts/setup_pleroma_source.sh | 12 ++++-------- 8 files changed, 24 insertions(+), 26 deletions(-) create mode 100644 buster/apt-mark/pleroma_otp create mode 100644 buster/apt-mark/pleroma_source create mode 100644 buster/apt-mark/web rename buster/setup_scripts/{setup_pleroma.sh => setup_pleroma_otp.sh} (97%) diff --git a/buster/apt-mark/peertube b/buster/apt-mark/peertube index 9a08c8d..5b73bac 100644 --- a/buster/apt-mark/peertube +++ b/buster/apt-mark/peertube @@ -1,12 +1,9 @@ -nginx-light ffmpeg postgresql postgresql-contrib openssl redis-server python-dev -certbot -python3-certbot-nginx # only needed for setup g++ make diff --git a/buster/apt-mark/pleroma b/buster/apt-mark/pleroma index eadc572..ec7a134 100644 --- a/buster/apt-mark/pleroma +++ b/buster/apt-mark/pleroma @@ -1,12 +1,5 @@ -nginx-light -# for SSL -certbot -python3-certbot-nginx # Pleroma DB postgresql postgresql-contrib # only needed for setup -curl -unzip -libncurses5 pwgen diff --git a/buster/apt-mark/pleroma_otp b/buster/apt-mark/pleroma_otp new file mode 100644 index 0000000..4805a43 --- /dev/null +++ b/buster/apt-mark/pleroma_otp @@ -0,0 +1,4 @@ +# only needed for setup +curl +unzip +libncurses5 diff --git a/buster/apt-mark/pleroma_source b/buster/apt-mark/pleroma_source new file mode 100644 index 0000000..2b1cd35 --- /dev/null +++ b/buster/apt-mark/pleroma_source @@ -0,0 +1,4 @@ +# only needed for setup +build-essential +wget +gnupg diff --git a/buster/apt-mark/web b/buster/apt-mark/web new file mode 100644 index 0000000..4912b8a --- /dev/null +++ b/buster/apt-mark/web @@ -0,0 +1,4 @@ +nginx-light +# for SSL +certbot +python3-certbot-nginx diff --git a/buster/setup_scripts/setup_peertube.sh b/buster/setup_scripts/setup_peertube.sh index c92be5c..3ff8e48 100755 --- a/buster/setup_scripts/setup_peertube.sh +++ b/buster/setup_scripts/setup_peertube.sh @@ -15,15 +15,10 @@ mail="$2" # Install dependencies, set up firewall. config_tree_prefix="${HOME}/config/buster" -./install_for_target.sh peertube +./install_for_target.sh web peertube ./copy_dirtree.sh "${config_tree_prefix}/etc_files" "" web nft -f /etc/nftables.conf -# Set up letsencrypt certificate. TODO: Is it auto-renewed? -ln -sf /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default -certbot --nginx --agree-tos --redirect --no-eff-email -m "${mail}" -d "${domain}" -rm /etc/nginx/sites-enabled/default - # Get NodeJS. See # curl -sL https://deb.nodesource.com/setup_10.x | bash - @@ -60,6 +55,11 @@ sed -i "s/admin\@example\.com/${mail}/g" config/production.yaml sed -i "s/example\.com/${domain}/g" config/production.yaml sed -i "s/password: 'peertube'/password: '${db_pw}'/g" config/production.yaml +# Set up letsencrypt certificate. TODO: Is it auto-renewed? +ln -sf /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default +certbot --nginx --agree-tos --redirect --no-eff-email -m "${mail}" -d "${domain}" +rm /etc/nginx/sites-enabled/default + # Configure NGINX. cp /var/www/peertube/peertube-latest/support/nginx/peertube /etc/nginx/sites-available/peertube sed -i "s/peertube.example.com/${domain}/g" /etc/nginx/sites-available/peertube diff --git a/buster/setup_scripts/setup_pleroma.sh b/buster/setup_scripts/setup_pleroma_otp.sh similarity index 97% rename from buster/setup_scripts/setup_pleroma.sh rename to buster/setup_scripts/setup_pleroma_otp.sh index fc30e1d..49d28b9 100755 --- a/buster/setup_scripts/setup_pleroma.sh +++ b/buster/setup_scripts/setup_pleroma_otp.sh @@ -11,7 +11,7 @@ mail="$2" # Install dependencies, set up firewall. config_tree_prefix="${HOME}/config/buster" -./install_for_target.sh pleroma +./install_for_target.sh web pleroma pleroma_otp ./copy_dirtree.sh "${config_tree_prefix}/etc_files" "" web nft -f /etc/nftables.conf @@ -51,7 +51,7 @@ su pleroma -s $SHELL -lc "./bin/pleroma_ctl instance gen \ --dbname pleroma \ --dbuser pleroma \ --rum N \ ---indexable N \ +--indexable Y \ --uploads-dir /var/lib/pleroma/uploads \ --static-dir /var/lib/pleroma/static \ --listen-ip 127.0.0.1 \ diff --git a/buster/setup_scripts/setup_pleroma_source.sh b/buster/setup_scripts/setup_pleroma_source.sh index c56006f..82b3203 100755 --- a/buster/setup_scripts/setup_pleroma_source.sh +++ b/buster/setup_scripts/setup_pleroma_source.sh @@ -10,20 +10,16 @@ fi domain="$1" mail="$2" -# Install dependencies, set up firewall. +# Install dependencies, configs, set up firewall. config_tree_prefix="${HOME}/config/buster" -./install_for_target.sh pleroma +./install_for_target.sh web pleroma pleroma_source ./copy_dirtree.sh "${config_tree_prefix}/etc_files" "" web nft -f /etc/nftables.conf # Prepare user. adduser --system --group --shell /bin/false --home /var/lib/pleroma pleroma -# TODO: integrate this into apt-mark/pleroma -apt -y install build-essential #elixir erlang-dev erlang-tools erlang-parsetools erlang-eldap erlang-ssh erlang-xmerl build-essential -# Not listed by doc. -apt -y install wget gnupg #erlang-inets erlnag-erlware-commons - +# Setup Erlang. wget -P /tmp/ https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb dpkg -i /tmp/erlang-solutions_1.0_all.deb apt update @@ -48,7 +44,7 @@ mix pleroma.instance gen \ --dbuser pleroma \ --db-configurable N \ --rum N \ ---indexable N \ +--indexable Y \ --uploads-dir /var/lib/pleroma/uploads \ --static-dir /var/lib/pleroma/static \ --listen-ip 127.0.0.1 \ -- 2.30.2