X-Git-Url: https://plomlompom.com/repos/berlin_corona.txt?a=blobdiff_plain;f=bookworm%2Fsetup_scripts%2Fsetup_status.plomlompom.com.sh;h=e76b99540993a89517272646265a0f5d18afcdbb;hb=aebbb73738fd2a46c540497a32c1db0fb05defca;hp=d5e6d180b0a30ec0b681e5a3cf257adea1807dc1;hpb=b8b05111b04d46f777a4259c1b7310e3368c431c;p=config diff --git a/bookworm/setup_scripts/setup_status.plomlompom.com.sh b/bookworm/setup_scripts/setup_status.plomlompom.com.sh index d5e6d18..e76b995 100755 --- a/bookworm/setup_scripts/setup_status.plomlompom.com.sh +++ b/bookworm/setup_scripts/setup_status.plomlompom.com.sh @@ -4,14 +4,26 @@ set -e expect_setup_finished_file setup_web_has_been_run setup_web.sh -if [ -z "$1"]; then - domain="status.plomlompom.com" -else +mirror_ip="" +mirror_state="not mirroring automatically" +domain="status.plomlompom.com" +mail="plom+status@plomlompom.com" +if [ "$#" -gt 1 ]; then domain="$1" + if [ "$#" -gt 2 ]; then + mail="plom+testing@plomlompom.com" + if [ "$#" -gt 3]; then + mirror_ip="$3" + mirror_state="mirroring automatically from ${target_ip}" + fi + fi fi +echo "Assuming domain ${domain} and letsencrypt support mail address ${mail} and ${mirror_state}, abort and provide as arguments in this order if other desired! (Otherwise just hit Return.)" +read _ + # Install configs, set up firewall. -./install_for_target.sh static_websites -./copy_dirtree.sh "${config_tree_prefix}/etc_files" "" static_websites +./install_for_target.sh status.plomlompom.com +./copy_dirtree.sh "${config_tree_prefix}/etc_files" "" status.plomlompom.com nft -f /etc/nftables.conf # Set up letsencrypt certificate. TODO: Is it auto-renewed? @@ -23,5 +35,20 @@ rm /etc/nginx/sites-enabled/default sed -i "s/REPLACE_fqdn_ECALPER/${domain}/g" /etc/nginx/sites-available/status.plomlompom.com.nginx ln -s /etc/nginx/sites-available/status.plomlompom.com.nginx /etc/nginx/sites-enabled/status.plomlompom.com.nginx +if [ ! -z "${mirror_ip}" ]; then + # Set up connection to old server. + cp "${setup_scripts_dir}/prepare_to_meet_server.sh" /home/plom/ + chown plom:plom /home/plom/prepare_to_meet_server.sh + su -lc "./prepare_to_meet_server.sh ${old_server}" plom + read -p'Hit Enter when you are done.' ignore + rm /home/plom/prepare_to_meet_server.sh + + # Mirror dirs. + su -lc "ln -s /home/plom/status.plomlompom.com /var/www-dump/status.plomlompom.com" plom + cp "${setup_scripts_dir}/mirror_dir.sh" /home/plom/ + su -lc "./mirror_dir.sh ${mirror_ip} /var/www/status.plomlompom.com" plom + rm /home/plom/mirror_dir.sh +fi + service nginx restart