Last active
July 15, 2022 06:13
-
-
Save jbergstroem/5c308089c26e7ae7529a0ef2df92a7f9 to your computer and use it in GitHub Desktop.
dist "mirror" setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
server_name ~unencrypted.(?<dist_path>nodejs|iojs).org; | |
listen *:80; | |
listen [::]:80 ipv6only=on; | |
root /home/dist/www; | |
location /download { | |
alias /home/dist/$dist_path; | |
autoindex on; | |
default_type text/plain; | |
add_header X-Robots-Tag noindex; | |
add_header X-Service-Expires-At "2022-01-01"; | |
location ~ \.json$ { | |
add_header access-control-allow-origin *; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>Unencrypted Node.js/io.js downloads</h1> | |
<p>Only use this if you have clients that don't support SSL. | |
This service will cease to exist 2022-01-01.</p> | |
<p>I understand, <a href="/download/">take me to the downloads</a>.</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt-get update && apt-get -y upgrade && apt-get -y install nginx rsync | |
mkdir -p /home/dist/www | |
cp index.html /home/dist/www | |
cp rsyncd.conf /etc/rsyncd.conf | |
cp 00-unencrypted.conf /etc/nginx/sites-available | |
ln -s /etc/nginx/sites-{available,enabled}/00-unencrypted.conf | |
systemctl enable rsync nginx systemd-timesyncd && systemctl start rsync nginx systemd-timesyncd | |
# add proper key to /root/.ssh/id_rsa | |
# into cron: | |
flock -n /tmp/rsync_lock -c rsync -e "ssh" -a -q \ | |
--exclude "doc" \ | |
--exclude "docs" \ | |
--exclude "metrics" \ | |
--exclude "tools" \ | |
--exclude ".*" \ | |
--exclude "rsync-old-nodejs.org.sh" \ | |
--exclude "www" \ | |
--delete \ | |
root@host:/home/dist/ /home/dist/ | |
# todo: push as part of new release(s) | |
# todo2: avoid ssh for cpu savings? use ip acl? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pid file = /var/run/rsyncd.pid | |
lock file = /var/run/rsync.lock | |
log file = /var/log/rsync.log | |
[nodejs] | |
path = /home/dist/nodejs | |
comment = Node.js releases. This service expires 2022-01-01. | |
read only = true | |
timeout = 300 | |
[iojs] | |
path = /home/dist/iojs | |
comment = io.js releases. This service expires 2022-01-01. | |
read only = true | |
timeout = 300 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
luxevwood