home · contact · privacy
Improve microblog.pub setup.
[config] / bullseye / setup_scripts / setup_microblogpub.sh
1 #!/bin/sh
2 set -e
3 set -x
4
5 if [ "$#" -ne 2 ]; then
6     echo 'Need domain name and mail.'
7     false
8 fi
9 domain="$1"
10 mail="$2"
11
12 # Install configs, set up firewall.
13 config_tree_prefix="${HOME}/config/bullseye"
14 ./install_for_target.sh web
15 ./copy_dirtree.sh "${config_tree_prefix}/etc_files" "" web microblogpub
16 nft -f /etc/nftables.conf
17
18 # Set up letsencrypt certificate. TODO: Is it auto-renewed?
19 ln -sf /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
20 certbot --nginx --agree-tos --redirect --no-eff-email -m "${mail}" -d "${domain}"
21 rm /etc/nginx/sites-enabled/default
22
23 # Install Python 3.10 from source (Bullseye only has 3.9).
24 apt build-dep python3
25 python_version=3.11.1
26 python_dirname="Python-${python_version}"
27 su -lc "wget https://www.python.org/ftp/python/${python_version}/${python_dirname}.tgz" plom
28 su -lc "tar -xvf ${python_dirname}.tgz" plom
29 su -lc "cd ${python_dirname} && ./configure && make && make test"
30 cd /home/plom/${python_dirname}/
31 make altinstall
32 cd
33
34 # Prepare and start NGINX config.
35 sed -i "s/REPLACE_fqdn_ECALPER/${domain}/g" /etc/nginx/sites-available/microblogpub.nginx
36 ln -s /etc/nginx/sites-available/microblogpub.nginx /etc/nginx/sites-enabled/microblogpub.nginx
37 service nginx restart