5 expect_setup_finished_file setup_web_has_been_run setup_web.sh
8 mirror_state="not mirroring automatically"
9 domain="tube.plomlompom.com"
10 mail="plom+tube@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 tube.plomlompom.com
26 ./copy_dirtree.sh "${config_tree_prefix}/etc_files" "" tube.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 tube.plomlompom.com.
35 sed -i "s/REPLACE_fqdn_ECALPER/${domain}/g" /etc/nginx/sites-available/tube.plomlompom.com.nginx
36 ln -s /etc/nginx/sites-available/tube.plomlompom.com.nginx /etc/nginx/sites-enabled/tube.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 ${mirror_ip}" plom
44 read -p 'Hit Enter when you are done.' ignore
45 rm /home/plom/prepare_to_meet_server.sh
48 cp "${setup_scripts_dir}/mirror_dir.sh" /home/plom/
49 su -lc "./mirror_dir.sh ${mirror_ip} /var/www/tube.plomlompom.com" plom
50 rm /home/plom/mirror_dir.sh