/traefik

Awesome **TangoMan Traefik Boilerplate** is a fast and handy tool to manage Traefik with Docker.

Primary LanguageShellMIT LicenseMIT

GH language GH release GH license GH stars

YamlLint CI ShellCheck CI

TangoMan Traefik

Awesome TangoMan Traefik is a fast and handy tool to manage Traefik with Docker.

📝 Notes

Dashboard is available here: http://traefik.localhost/dashboard

Traefik api endpoint is available here: http://traefik.localhost/api/rawdata

🎯 Features

TangoMan Traefik provides the following features:

  • Docker compose.yaml configuration for dev and prod environments
  • Makefile
  • entrypoint.sh script

🚀 Installation

Simply enter following command in your terminal

# build and run with `dev` settings
make up

# build and run with `prod` configuration
make up env=prod

💻 Dependencies

TangoMan Traefik requires the following dependencies:

  • apache2-utils
  • Docker
  • Docker compose plugin
  • Make
  • mkcert
  • yamllint
  • yq

🖥 apache2-utils

🐧 Install apache2-utils (Linux)

On linux machine enter following command

sudo apt-get install --assume-yes apache2-utils

🐋 Docker

🐧 Install Docker (Linux)

On linux machine enter following command

sudo apt-get install --assume-yes docker.io

🔧 Configure Docker (Linux)

Add current user to docker group

sudo usermod -a -G docker ${USER}

You will need to log out and log back in current user to use docker

If your group membership is not properly re-evaluated, enter following command

newgrp docker

🏁 Install Docker (Windows)

Download docker community edition installer from docker hub:

🍎 Install Docker (OSX)

Download docker community edition installer from docker hub:


🐳 Docker Compose

🐧 Install Docker Compose (Linux)

On linux machine you will need curl to install docker-compose with the following commands

sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-`uname -s`-`uname -m`" -o /usr/bin/docker-compose
sudo chmod uga+x /usr/bin/docker-compose
mkdir -p ~/.docker/cli-plugins/
ln -s /usr/bin/docker-compose ~/.docker/cli-plugins/docker-compose
sync

🛠 Make

🐧 Install Make (Linux)

On linux machine enter following command

sudo apt-get install --assume-yes make

🏁 Install Make (Windows)

On windows machine you will need to install cygwin or GnuWin make first to execute make script.

🍎 Install Make (OSX)

Make should be available by default on OSX system, but you can upgrade make version with following command

brew install make

🧽 yamllint

🐧 Install yamllint (Linux)

On linux machine enter following command

sudo apt-get install --assume-yes yamllint

🖥 yq

🐧 Install yq (Linux)

On linux machine enter following command

sudo wget -nv https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq
sudo chmod +x /usr/bin/yq

🔥 Usage

🤖 Make

Run make to print help

make [command] 

🤖 entrypoint

sh traefik [command] (--env dev) (--network '') (--user '') (--password '') (--email '')

🧱 Constants

  1. ALIAS
  • Script alias
  • Value: traefik

⚙️ Options

  1. --env
  • Description: Environment
  • Constraint: /^(dev|prod)$/
  • Default: dev
  1. --network
  • Description: Network
  • Constraint: /^[a-z0-9_-]+$/
  • Default: ''
  1. --user
  • Description: User
  • Constraint: /^[a-z0-9_-]+$/
  • Default: ''
  1. --password
  • Description: Password
  • Constraint: /^.+$/
  • Default: ''
  1. --email
  • Description: email
  • Constraint: /^.+@.+..+$/
  • Default: ''

🤖 Commands

Install

  1. up
  • Build and start traefik
  1. set_env
  • Set dev or prod environment
  1. requirements
  • Check requirements
  1. uninstall
  • Uninstall Traefik

Local

  1. open
  • Open traefik and whoami dashboard in default browser
  1. clear
  • Clear logs
  1. backup
  • Backup traefik configuration
  1. restore
  • Restore traefik configuration

Security

  1. password
  • Set traefik dashboard password

Let's Encrypt

  1. letsencrypt
  • Config letsencrypt
  1. acme
  • Create empty Let's Encrypt acme.json file
  1. email
  • Set Let's Encrypt email

Local Certificates

  1. certs
  • Install local SSL certificates
  1. remove_certs
  • Remove local SSL certificates

Network

  1. network
  • Create network
  1. remove_network
  • Remove network

Docker

  1. build
  • Build docker stack
  1. start
  • Start docker stack
  1. stop
  • Stop docker stack

CI

  1. lint
  • Sniff errors with linters
  1. lint_yaml
  • Sniff errors with yamllint
  1. lint_shell
  • Sniff errors with shellcheck

Self Install

  1. self_install
  • Install script and enable completion
  1. self_uninstall
  • Uninstall script from system
  1. generate_doc
  • Generate Markdown documentation

Help

  1. help
  • Print this help (default)

🤝 Contributing

Thank you for your interest in contributing to TangoMan Traefik.

Please review the code of conduct and contribution guidelines before starting to work on any features.

If you want to open an issue, please check first if it was not reported already before creating a new one.

📜 License

Copyrights (c) 2024 "Matthias Morin" <mat@tangoman.io>

License Distributed under the MIT license.

If you like TangoMan Traefik please star, follow or tweet:

GitHub stars GitHub followers Twitter

... And check my other cool projects.

LinkedIn

🙏 Acknowledgements

  • shellcheck: a static analysis tool for shell scripts (used for CI/CD)
  • yamllint: a static analysis tool for yaml files (used for CI/CD)

Script created with shoe