5 expect_setup_finished_file setup_web_has_been_run setup_web.sh
8 mirror_state="not mirroring automatically"
9 domain="status.plomlompom.com"
10 mail="plom+status@plomlompom.com"
11 if [ "$#" -gt 0 ]; then
13 if [ "$#" -gt 1 ]; then
14 mail="plom+testing@plomlompom.com"
15 if [ "$#" -gt 2 ]; then
17 mirror_state="mirroring automatically from ${mirror_ip}"
21 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.)"
24 # Install configs, set up firewall.
25 ./install_for_target.sh status.plomlompom.com
26 ./copy_dirtree.sh "${config_tree_prefix}/etc_files" "" status.plomlompom.com
27 nft -f /etc/nftables.conf
29 # Set up letsencrypt certificate. TODO: Is it auto-renewed?
30 ln -sf /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
31 certbot --nginx --agree-tos --redirect --no-eff-email -m "${mail}" -d "${domain}"
32 rm /etc/nginx/sites-enabled/default
34 # Prepare NGINX for status.plomlompom.com.
35 sed -i "s/REPLACE_fqdn_ECALPER/${domain}/g" /etc/nginx/sites-available/status.plomlompom.com.nginx
36 ln -s /etc/nginx/sites-available/status.plomlompom.com.nginx /etc/nginx/sites-enabled/status.plomlompom.com.nginx
38 if [ ! -z "${mirror_ip}" ]; then
39 # Set up connection to old server.
40 cp "${setup_scripts_dir}/misc.sh" /home/plom/
41 cp "${setup_scripts_dir}/prepare_to_meet_server.sh" /home/plom/
42 chown plom:plom /home/plom/prepare_to_meet_server.sh
43 su -lc "./prepare_to_meet_server.sh ${old_server}" plom
44 read -p'Hit Enter when you are done.' ignore
45 rm /home/plom/prepare_to_meet_server.sh
48 su -lc "ln -s /home/plom/status.plomlompom.com /var/www/status.plomlompom.com" plom
49 cp "${setup_scripts_dir}/mirror_dir.sh" /home/plom/
50 su -lc "./mirror_dir.sh ${mirror_ip} /var/www/status.plomlompom.com" plom
51 rm /home/plom/mirror_dir.sh