Below is a very brief version that demonstrates how a mirror of Team RabbitMQ's apt repository can be set up and hosted by anyone.
It assumes basic familiarity with Debian-based Linux and Nginx. There are only two tools involved:
apt-mirror
to sync the repo (please sync fromppa1.novemberain.com
which has a very ample traffic quota in comparison to our Cloudsmith account)- Nginx to serve the synchronized static files
A few more things that have to be set up
- A certificate and private key pair Nginx will use to serve HTTPS traffic. They can be obtained from Cloudflare or any other way
- A hostname Nginx will use
The above setup can happily run on a really basic VM from any providers you like. For example, a basic Digital Ocean droplet 50 GiB of storage (built-in or an extra volume) would do. Such setup would usually cost between USD 6 and USD 16 per month, depending on how much disk space you'd like to provision ahead of time.
- Run
apt update -y; apt upgrade -y
- Install
apt-mirror
withapt install -y apt-mirror
- Create an apt mirror list:
touch /etc/apt/mirror.list
- Edit
/etc/apt/mirror.list
(see below) - Run
apt-mirror
- Wait for all packages to be synced (about 15 GiB worth)
- Inspect the local copy:
/var/spool/apt-mirror/mirror/ppa1.novemberain.com/
- Install Nginx
- Obtain a pair of certificates to serve packages over HTTPS, for example, from Cloudflare
- Install the certificates
- Configure Nginx to serve the files under
/var/spool/apt-mirror
(see below) - Set up DNS records to point to the newly synchronized mirror
- Use a VM or container to test the mirror on recent Ubuntu and Debian distributions, except configure
/etc/apt/sources.list.d/rabbitmq.list
to use the new mirror - Optional: copy Cloudsmith signing keys (https://ppa1.novemberain.com/gpg.E495BB49CC4BBE5B.key, https://ppa1.novemberain.com/gpg.9F4587F226208342.key) to
/var/spool/apt-mirror/mirror/ppa1.novemberain.com/public/
or a similar location so that they can be downloaded from your mirror's host and notppa1.novemberain.com
or Cloudsmith.io - Voilà! You have your own mirror of the apt repositories maintained by Team RabbitMQ
- To sync the packages, schedule
apt-mirror
to run every couple of days or a week, depending on your needs
############# config ##################
#
# set base_path /var/spool/apt-mirror
#
# set mirror_path $base_path/mirror
# set skel_path $base_path/skel
# set var_path $base_path/var
# set cleanscript $var_path/clean.sh
# set defaultarch <running host architecture>
# set postmirror_script $var_path/postmirror.sh
# set run_postmirror 0
set nthreads 20
set _tilde 0
#
############# end config ##############
#
# Erlang
#
deb https://ppa1.novemberain.com/rabbitmq/rabbitmq-erlang/deb/ubuntu lunar main
deb https://ppa1.novemberain.com/rabbitmq/rabbitmq-erlang/deb/ubuntu jammy main
deb https://ppa1.novemberain.com/rabbitmq/rabbitmq-erlang/deb/ubuntu focal main
deb https://ppa1.novemberain.com/rabbitmq/rabbitmq-erlang/deb/ubuntu bionic main
deb https://ppa1.novemberain.com/rabbitmq/rabbitmq-erlang/deb/debian buster main
deb https://ppa1.novemberain.com/rabbitmq/rabbitmq-erlang/deb/debian bullseye main
#
# RabbitMQ
#
deb https://ppa1.novemberain.com/rabbitmq/rabbitmq-server/deb/ubuntu lunar main
deb https://ppa1.novemberain.com/rabbitmq/rabbitmq-server/deb/ubuntu jammy main
deb https://ppa1.novemberain.com/rabbitmq/rabbitmq-server/deb/ubuntu focal main
deb https://ppa1.novemberain.com/rabbitmq/rabbitmq-server/deb/ubuntu bionic main
deb https://ppa1.novemberain.com/rabbitmq/rabbitmq-server/deb/debian buster main
deb https://ppa1.novemberain.com/rabbitmq/rabbitmq-server/deb/debian bullseye main
server {
listen 80;
listen 443 ssl;
server_name ppa.yourdomain.com;
ssl_certificate /etc/ssl/certs/yourdomain.com.pem;
ssl_certificate_key /etc/ssl/private/yourdomain.com.key;
location / {
alias /var/spool/apt-mirror/mirror/ppa1.novemberain.com/;
try_files $uri $uri/ =404;
}
location /mirrors {
alias /var/spool/apt-mirror/mirror/ppa1.novemberain.com/;
try_files $uri $uri/ =404;
}
}