From: Christian Heller Date: Sun, 12 Apr 2020 21:42:57 +0000 (+0200) Subject: Add website migration. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/%7B%7Bprefix%7D%7D/add_free?a=commitdiff_plain;h=1f8bddc9121f9ca69eee4dd4c933bd3071aa6841;p=config Add website migration. --- diff --git a/buster/setup_scripts/setup_dumpsite.sh b/buster/setup_scripts/setup_dumpsite.sh index f1690ac..60757f0 100755 --- a/buster/setup_scripts/setup_dumpsite.sh +++ b/buster/setup_scripts/setup_dumpsite.sh @@ -78,6 +78,7 @@ su -lc "cd url-catcher && ln -s ../blog/captchas/linkable/ captchas" plom cp "${config_tree_prefix}/other_files/url-catcher_customizations.json" /home/plom/url-catcher/customizations.json systemctl enable url_catcher.service service url_catcher start +# Outcomment if setting up new / not migrating. cp "${config_tree_prefix}/setup_scripts/mirror_dir.sh" /home/plom/ su -lc "./mirror_dir.sh ${old_server} /home/plom/url-catcher/ips" plom su -lc "./mirror_dir.sh ${old_server} /home/plom/url-catcher/lists" plom diff --git a/buster/setup_scripts/setup_website.sh b/buster/setup_scripts/setup_website.sh index 5c8d00c..008fd34 100755 --- a/buster/setup_scripts/setup_website.sh +++ b/buster/setup_scripts/setup_website.sh @@ -21,12 +21,25 @@ ln -sf /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default certbot --nginx --agree-tos --redirect --no-eff-email -m "${mail}" -d "${domain}" rm /etc/nginx/sites-enabled/default +# Set up connection to old server. +cp "${config_tree_prefix}/setup_scripts/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 + # Set up repos dir. mkdir /var/repos chown plom:plom /var/repos # To use this dir, "git clone --mirror" repo source paths into it as user plom. # As user plom, touch git-daemon-export-ok files into it to make the repo # publically available. +# Outcomment following lines if setting up new / not migrating. +cp "${config_tree_prefix}/setup_scripts/mirror_dir.sh" /home/plom/ +chmod a+w /var +su -lc "./mirror_dir.sh ${old_server} /var/repos" plom +chmod a-w /var +rm /home/plom/mirror_dir.sh # Prepare NGINX and GitWeb config. sed -i "s/REPLACE_fqdn_ECALPER/${domain}/g" /etc/gitweb.conf @@ -37,14 +50,10 @@ ln -s /etc/nginx/sites-available/website.nginx /etc/nginx/sites-enabled/website. rm -rf /var/www mkdir /var/www chown plom:plom /var/www -cp "${config_tree_prefix}/setup_scripts/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 -su -lc "cd /var/repos && git clone --mirror ${old_server}:repos/website" plom -cp "${config_tree_prefix}/other_files/website_hook_post-receive" /var/repos/website.git/hooks/post-receive +# Use next two lines if setting up new / not migrating. +#su -lc "cd /var/repos && git clone --mirror ${old_server}:repos/website" plom +#cp "${config_tree_prefix}/other_files/website_hook_post-receive" /var/repos/website.git/hooks/post-receive su -lc 'cd /var/www && git clone /var/repos/website.git .' plom -rm /home/plom/prepare_to_meet_server.sh # Add encryption key. keyservers='sks-keyservers.net/ keys.gnupg.net' @@ -72,14 +81,21 @@ mkdir -p "${irclogs_dir}" chown -R plom:plom "${irclogs_dir}" mkdir -p "${irclogs_pw_dir}" chown -R plom:plom "${irclogs_pw_dir}" -su -lc "cd /var/repos && git clone --mirror https://plomlompom.com/repos/clone/plomlombot-irc" plom -su -lc "touch /var/repos/plomlombot-irc.git/git-daemon-export-ok" plom -cp "${config_tree_prefix}/other_files/plomlombot_hook_post-receive" /var/repos/plomlombot-irc.git/hooks/post-receive +# Use following lines if setting up new / not migrating. +#su -lc "cd /var/repos && git clone --mirror https://plomlompom.com/repos/clone/plomlombot-irc" plom +#su -lc "touch /var/repos/plomlombot-irc.git/git-daemon-export-ok" plom +#cp "${config_tree_prefix}/other_files/plomlombot_hook_post-receive" /var/repos/plomlombot-irc.git/hooks/post-receive + su -lc "git clone /var/repos/plomlombot-irc.git" plom cp "${config_tree_prefix}/other_files/plomlombot_daemon.sh" /home/plom/ chown plom:plom /home/plom/plomlombot_daemon.sh -echo 'bot: plomlombog plomlombog #plomlomtest irc.freenode.net foo bar' >> /home/plom/.plomlombot -chown plom:plom /home/plom/.plomlombot +# Use upper outcommented instead of lower code if setting up new empty server. +#echo 'bot: plomlombog plomlombog #plomlomtest irc.freenode.net foo bar' >> /home/plom/.plomlombot +#chown plom:plom /home/plom/.plomlombot +cp "${config_tree_prefix}/setup_scripts/mirror_dir.sh" /home/plom/ +su -lc "./mirror_dir.sh ${old_server} /home/plom/plomlombot_db" plom +rm /home/plom/,mirror_dir.sh +su -lc "scp plom@${old_server}:.plomlombot ~" plom systemctl enable plomlombot.service service plomlombot start