All Projects → brunosimoes → Docker Cdn

brunosimoes / Docker Cdn

Script for creating and deploying a CDN (HAProxy, Registrator, Consul and Nginx)

Labels

Projects that are alternatives of or similar to Docker Cdn

Hdpslam
The implementation of HDP SLAM
Stars: ✭ 16 (-11.11%)
Mutual labels:  makefile
Mesos Dns Pkg
Packaging utilities for Mesos-DNS
Stars: ✭ 16 (-11.11%)
Mutual labels:  makefile
Device Sony Loire
Stars: ✭ 17 (-5.56%)
Mutual labels:  makefile
Python Mk
A Makefile that contains the seed of a python development environment.
Stars: ✭ 16 (-11.11%)
Mutual labels:  makefile
Docker Release Toolkit
My personal toolkit for building releases with Docker
Stars: ✭ 16 (-11.11%)
Mutual labels:  makefile
Compiletools
Build C++ fast, with practically no configuration
Stars: ✭ 16 (-11.11%)
Mutual labels:  makefile
Ansible Freeipa
An Ansible playbook for configuring FreeIPA server(s) and clients.
Stars: ✭ 7 (-61.11%)
Mutual labels:  makefile
Emojione Color Font
End of Life. Switch to https://github.com/eosrei/twemoji-color-font
Stars: ✭ 899 (+4894.44%)
Mutual labels:  makefile
Pymake
A Makefile generator in Python
Stars: ✭ 16 (-11.11%)
Mutual labels:  makefile
Hdfs Spark Hive Dev Setup
This repository contains makescript and instruction on how to setup local hdfs+spark+hive setup.
Stars: ✭ 17 (-5.56%)
Mutual labels:  makefile
League Gothic
A revival of an old classic, Alternate Gothic #1
Stars: ✭ 887 (+4827.78%)
Mutual labels:  makefile
Crazyarcade
A coco2d-x game
Stars: ✭ 16 (-11.11%)
Mutual labels:  makefile
Cxcore
A prebuilt Linux system use UEFI and f2fs for RaspberryPi 3B, RaspberryPi 3B+, RaspberryPi 4B
Stars: ✭ 17 (-5.56%)
Mutual labels:  makefile
Device xiaomi cepheus
Stars: ✭ 16 (-11.11%)
Mutual labels:  makefile
Gitsem
a command line utility for managing semantically versioned (semver) git tags
Stars: ✭ 17 (-5.56%)
Mutual labels:  makefile
Disco
decentralized infrastructure for serverless computing operations
Stars: ✭ 16 (-11.11%)
Mutual labels:  makefile
Ports
Developer FreeBSD Haskell "overlay" for the mighty FreeBSD Ports Collection. Use with caution, slippery when wet, etc.
Stars: ✭ 16 (-11.11%)
Mutual labels:  makefile
New Php Project
Template for new PHP projects. Also see https://github.com/JeroenDeDauw/new-php-library
Stars: ✭ 18 (+0%)
Mutual labels:  makefile
Go Book Store Api
Go Sample project to understand Mysql CRUD operation with best practises Includes logging, JWT, Swagger and Transactions
Stars: ✭ 18 (+0%)
Mutual labels:  makefile
Articles
Article Publish in Wechat & Toutiao
Stars: ✭ 896 (+4877.78%)
Mutual labels:  makefile

CDN with HAProxy, Consul and Nginx

This project contains scripts to automatically deploy a cdn that serves content with nginx.

HAProxy with Consul

Consul provides both a DNS and HTTP interface for doing service discovery. Using consul-haproxy allows applications to route to a local HAProxy instance which can perform the rich routing and load balancing. The load balancer is reconfigured automatically anytime the underlying service changes ensuring an up-to-date configuration.

Installation

This script requires virtualbox and docker-machine to be pre-installed.

First, we have to create a virtual machine where we will deploy the CDN. In the example, we create a virtual machine called cdn. You can use a different name for the VM or skip the commands if you already have one.

make create-vm VM_NAME=cdn

Once done, we have to connect our Docker Client to the Docker Engine running on this virtual machine. Please change the token cdn with the name of your virtual machine.

eval $(docker-machine env cdn)

To install and configure HAProxy, Registrator and Consul type (do not change cdn with the name of your machine):

make cdn

or the following to setup a cdn that will join another cdn:

make cdn JOIN_NODE=192.XX.XX.XX

Once done, you will find the admin URLs (HAProxy and Consul) in your terminal. The default user:password is admin:password.

Setup a demo

You can verify the deployment by installing two demo webservers. But first, we have to connect our Docker Client to the Docker Engine running on this virtual machine (in case you missed the previous steps). Please change the token cdn with the name of your virtual machine.

eval $(docker-machine env cdn)

After you can execute:

make demo

Once executed, you will find the entry point URL in your terminal. If you refresh the URL you will see that content changes reflecting the name of the webserver that handled the request.

Setup a nginx node

Now we create a minimalist Nginx server based on Alpine linux (6 MB). But first, we have to connect our Docker Client to the Docker Engine running on this virtual machine (in case you missed the previous steps). Please change the token cdn with the name of your virtual machine.

eval $(docker-machine env cdn)

Add the content to be server by nginx to the folder nginx/website and add a new nginx server to the CDN. Replace the web with the url path prefix for the group of servers serving the website and demo with the name for the nginx container (keep it unique).

make webserver ENTRYPOINT=web SERVERNAME=demo 

You can access your website using the following URL pattern http://machine-ip/web. Repeat the same step with different SERVERNAME params to create more nodes.

License

The code and content of the cheat sheet is release under Creative Commons.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].