5 if [ "$#" -ne 2 ]; then
6 echo 'Need domain name and mail.'
12 # Install configs, set up firewall.
13 config_tree_prefix="${HOME}/config/bullseye"
14 ./install_for_target.sh web microblogpub
15 ./copy_dirtree.sh "${config_tree_prefix}/etc_files" "" web microblogpub
16 apt update # since we just updated /etc/apt/sources.list
17 nft -f /etc/nftables.conf
19 # Set up letsencrypt certificate. TODO: Is it auto-renewed?
20 ln -sf /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
21 certbot --nginx --agree-tos --redirect --no-eff-email -m "${mail}" -d "${domain}"
22 rm /etc/nginx/sites-enabled/default
24 # Install Python >=3.10 from source (Bullseye only has 3.9).
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 /home/plom/${python_dirname} && ./configure --enable-optimizations && make && make test"
30 su -lc "cd /home/plom/${python_dirname} && ./configure --enable-optimizations && make"
31 cd /home/plom/${python_dirname}/
34 # TODO delete python build dir
35 su -lc "curl -sSL https://install.python-poetry.org | python3.11" - plom
36 su -lc "git clone https://git.sr.ht/~tsileo/microblog.pub testing.microblog.pub" - plom
37 su -lc "poetry config installer.parallel false" - plom
38 su -lc "cd testing.microblog.pub && poetry install" - plom
39 su -lc "cd testing.microblog.pub && poetry run inv configuration-wizard" - plom
40 su -lc "cd testing.microblog.pub && poetry run inv migrate-db" - plom
41 # VENV_DIR=/home/ubuntu/.cache/pypoetry/virtualenvs/microblogpub-chx-y1oE-py3.10 poetry run supervisord -c misc/supervisord.conf -n
43 # Prepare and start NGINX config.
44 sed -i "s/REPLACE_fqdn_ECALPER/${domain}/g" /etc/nginx/sites-available/microblogpub.nginx
45 ln -s /etc/nginx/sites-available/microblogpub.nginx /etc/nginx/sites-enabled/microblogpub.nginx