Giter VIP home page Giter VIP logo

flux-domain-manager's Introduction

Flux Domain Manager

Flux.png

Flux Domain Manager (FDM) manages domains, certificates and load balancing for entire Flux network as well as for applications running on Flux network. FDM in its basics is HAProxy configurator connected to Flux network.

Flux Team is running FDM on runonflux.io domain and is automatically managed on cloudflare and pDNS solution. Anyone can stand up its own FDM on any domain with default settings providing own cloudflare API keys or pDNS keys.

FDM scans Flux network, every healthy node on Flux network is put into FDM for both HOME.yourroot.domain (providing UI) and API.yourroot.domain (providing API endpoints to entire Flux).

Furthermore FDM load balances all applications running on Flux network putting them begind YOURAPPNAME.app.yourroot.domain. If an application has more ports, applications lives on YOURAPPNAME_PORT.app.yourroot.domain in order of how ports were registered on Flux application specifications.

Enable automateCertificatesForFDMdomains flag in config if you want certificate management to be happening for automated domains generated by FDM. Default false.

Enable automateCertificates flag in config if you want certificate management to be happening for custom domains set by an application. Default true.

domainAppType: 'CNEME' or 'A'

  • FDM can create either CNAME records or A record of an application. In case of using CNAME record type (default), records will be pointed to fdmAppDomain.

  • provide domain

  • provide ssl

  • load balancing

  • Frontend (UI) for Flux network

  • API for Flux network

  • custom domains

  • health checks of applications

  • fully automated

  • pDNS/Cloudflare

  • letsencrypt, certbot, auto cert renewal

Application Overview

Prer equiswitories:

  • Nodejs 14+
  • haproxy
  • mongodb 4+
  • certbot
  • letsencrypt

Install FDM dependancies (Ubuntu/CentOS/Redhat):

cd Flux

npm install

To run this as Production:

npm start

Application will run on port 16130

Guide for ubuntu 20.04


sudo apt update
sudo apt upgrade
sudo apt-get install software-properties-common certbot haproxy curl git wget screen -y
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
nvm install 14
nvm use 14
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo systemctl start mongod
sudo systemctl daemon-reload
sudo systemctl enable mongod

Update haproxy

nano /etc/haproxy/haproxy.cfg

Paste this under all:

frontend wwwhttp
        bind 0.0.0.0:80
        option forwardfor except 127.0.0.0/8
        reqadd X-Forwarded-Proto:\ http

        acl letsencrypt-acl path_beg /.well-known/acme-challenge/
        use_backend letsencrypt-backend if letsencrypt-acl
        default_backend letsencrypt-backend

backend letsencrypt-backend
        server letsencrypt 127.0.0.1:8787

Reload haproxy

sudo service haproxy reload

Update crontab

sudo nano /etc/cron.d/certbot

Comment all other lines and paste this:

0 0 1 * * root bash /opt/update-certs.sh

Clone and run FDM

git clone https://github.com/runonflux/flux-domain-manager
cd flux-domain-manager/
npm i
screen -S FDM
npm start

Final words

FDM is updating /opt/update-certs.sh file automatically with following content

#!/usr/bin/env bash

# Renew the certificate
certbot renew --force-renewal --http-01-port=8787 --preferred-challenges http

# Concatenate new cert files, with less output (avoiding the use tee and its output to stdout)
bash -c "cat /etc/letsencrypt/live/rosetta.runonflux.io/fullchain.pem /etc/letsencrypt/live/rosetta.runonflux.io/privkey.pem > /etc/ssl/rosetta.runonflux.io/rosetta.runonflux.io.pem"

# Reload  HAProxy
service haproxy reload

flux-domain-manager's People

Contributors

thetrunk avatar alihm avatar kadefi avatar goshiz avatar cabecinha84 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.