Here's where the IITG Web-based iPerf containers come into play. With this guide, you can setup iPerf servers in multiple locations and allow network support staff to perform network testing without the need to give them console access to the server itself.
Let's get started!
Installation
Install web interface, iperf-servers and iperf command
curl -L https://raw.githubusercontent.com/iitggithub/iperf-web/master/install.sh | bash
Configure iperf-web
If the URL you will be using to access the iperf web interface does not match the fully qualfied domain name of your docker container host, make sure you set FQDN_SERVER_NAME to something more meaningful.
Set a variable to contain the hostname
FQDN_SERVER_NAME="`hostname`"
By default iperf-web exposes port 80. That's not necessary since we'll use a self signed certificate and HTTPS later on. You can manually edit the /data/iperf-web/docker-compose.yml file to disable exposing port 80 to the outside world or just recreate from scratch using the code below
Reconfigure iperf-web docker-compose.yml file
cat | sudo tee /data/iperf-web/docker-compose.yml <<EOFserver:image: iitgdocker/iperf-web:latestvolumes:- /var/run/docker.sock:/var/run/docker.sock- /data/iperf-web/images:/var/www/html/imagesenvironment:- VIRTUAL_HOST=${FQDN_SERVER_NAME}EOF
Configure An Nginx Web Server
Assuming you don't already run your own webserver on the host, we'll use a docker container for that too. This one will automatically regenerate and reload nginx whenever a compatible container is detected. This is based on jwilders nginx proxy. You can find more detailed information on how to use it here: https://github.com/jwilder/nginx-proxy.
Create a self-signed SSL certificate (Optional)
mkdir -p /data/nginx/certs
Install Your Own Company Logo (Optional)openssl req -new -newkey rsa:2048 -nodes -out /data/nginx/certs/${FQDN_SERVER_NAME}.crt -keyout /data/nginx/certs/${FQDN_SERVER_NAME}.key -subj "/C=/ST=/L=/O=IITG Blog/CN=${FQDN_SERVER_NAME}"
mkdir -p /data/nginx/imagesInstall the nginx docker compose file
cp <path_to_my_logo>.png /data/nginx/images
cat | tee /data/nginx/docker-compose.yml <<EOFproxy:image: jwilder/nginx-proxy:latestports:- "80:80"- "443:443"volumes:- /var/run/docker.sock:/tmp/docker.sock- /data/nginx/certs:/etc/nginx/certsEOF
Install the systemd service file
If you can make use of a systemd service file, here's the one you'll need for the nginx proxy
cat | sudo tee /usr/lib/systemd/system/docker-nginx.service <<EOF[Unit]Description=Nginx web proxyAfter=docker.service[Service]Conflicts=shutdown.targetStartLimitInterval=0Restart=alwaysTimeoutStartSec=0Restart=on-failureWorkingDirectory=/data/nginxExecStartPre=-/usr/local/bin/docker-compose stopExecStartPre=-/usr/local/bin/docker-compose pullExecStart=/usr/local/bin/docker-compose upExecStop=-/usr/local/bin/docker-compose stop[Install]WantedBy=multi-user.targetEOF
Start the nginx proxy
sudo systemctl start docker-nginxRestart the iperf-web server
sudo systemctl enable docker-nginx
sudo systemctl restart docker-iperf-web
No comments:
Post a Comment