Skip to content

Commit ea0d758

Browse files
committed
chore: initial commit
0 parents  commit ea0d758

File tree

9 files changed

+254
-0
lines changed

9 files changed

+254
-0
lines changed

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
# Conf files
12+
[*.{toml,yml}]
13+
indent_size = 2
14+
15+
[*.md]
16+
trim_trailing_whitespace = false

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
certs/*

CODE_OF_CONDUCT.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6+
7+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8+
9+
## Our Standards
10+
11+
Examples of behavior that contributes to a positive environment for our community include:
12+
13+
* Demonstrating empathy and kindness toward other people
14+
* Being respectful of differing opinions, viewpoints, and experiences
15+
* Giving and gracefully accepting constructive feedback
16+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17+
* Focusing on what is best not just for us as individuals, but for the overall community
18+
19+
Examples of unacceptable behavior include:
20+
21+
* The use of sexualized language or imagery, and sexual attention or
22+
advances of any kind
23+
* Trolling, insulting or derogatory comments, and personal or political attacks
24+
* Public or private harassment
25+
* Publishing others' private information, such as a physical or email
26+
address, without their explicit permission
27+
* Other conduct which could reasonably be considered inappropriate in a
28+
professional setting
29+
30+
## Enforcement Responsibilities
31+
32+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33+
34+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35+
36+
## Scope
37+
38+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39+
40+
## Enforcement
41+
42+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [[email protected]](mailto:[email protected]). All complaints will be reviewed and investigated promptly and fairly.
43+
44+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45+
46+
## Enforcement Guidelines
47+
48+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49+
50+
### 1. Correction
51+
52+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53+
54+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55+
56+
### 2. Warning
57+
58+
**Community Impact**: A violation through a single incident or series of actions.
59+
60+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61+
62+
### 3. Temporary Ban
63+
64+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65+
66+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67+
68+
### 4. Permanent Ban
69+
70+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71+
72+
**Consequence**: A permanent ban from any sort of public interaction within the project community.
73+
74+
## Attribution
75+
76+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78+
79+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80+
81+
[homepage]: https://www.contributor-covenant.org
82+
83+
For answers to common questions about this code of conduct, see the FAQ at
84+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 Heziode <[email protected]>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Traefik v2 HTTPS (SSL) on localhost
2+
3+
This repo is a minimal template to use Traefik v2 on localhost with HTTPS support.
4+
5+
6+
7+
To get started, just clone this repo:
8+
9+
```
10+
git clone https://github.com/Heziode/traefik-v2-https-ssl-localhost.git
11+
```
12+
13+
14+
15+
Next, go to the root of the repo (`cd traefik-v2-https-ssl-localhost`) and generate certificates using [mkcert](https://github.com/FiloSottile/mkcert) :
16+
17+
```bash
18+
# If it's the firt install of mkcert, run
19+
mkcert -install
20+
21+
# Generate certificate for domain "docker.localhost", "domain.local" and their sub-domains
22+
mkcert -cert-file certs/local-cert.pem -key-file certs/local-key.pem "docker.localhost" "*.docker.localhost" "domain.local" "*.domain.local"
23+
```
24+
25+
26+
27+
Now, start containers with :
28+
29+
```bash
30+
docker-compose -f docker-compose.yml up
31+
```
32+
33+
34+
35+
You can now go to your browser at [whoami.domain.local](https://whoami.domain.local), enjoy :rocket: !
36+
37+
38+
39+
## Code of Conduct
40+
41+
This project adheres to the [Contributor Covenant](https://www.contributor-covenant.org/). By participating in this project you agree to abide by its terms.
42+
43+
44+
45+
# License
46+
47+
MIT

certs/.gitkeep

Whitespace-only changes.

docker-compose.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
version: '3'
2+
3+
networks:
4+
frontend:
5+
driver: bridge
6+
backend:
7+
8+
services:
9+
reverse-proxy:
10+
image: traefik:v2.0
11+
container_name: reverse-proxy
12+
# Enable the web interface and asks Traefik to listen to Docker
13+
command:
14+
- --api.insecure=true
15+
- --providers.docker
16+
ports:
17+
- "80:80"
18+
- "443:443"
19+
# Web interface port (enabled by --api.insecure=true)
20+
- "8080:8080"
21+
volumes:
22+
- /var/run/docker.sock:/var/run/docker.sock
23+
# Map the static conf into the container
24+
- ./traefik/traefik.toml:/etc/traefik/traefik.toml:ro
25+
# Map the dynamic conf into the container
26+
- ./traefik/traefik.config.toml:/etc/traefik/traefik.config.toml:ro
27+
# Map the certificats into the container
28+
- ./certs:/etc/certs:ro
29+
networks:
30+
- backend
31+
- frontend
32+
labels:
33+
- "traefik.frontend.redirect.entryPoint=https"
34+
35+
whoami:
36+
image: containous/whoami
37+
container_name: whoami
38+
labels:
39+
# URL HTTP
40+
- traefik.http.routers.whoami.rule=Host(`whoami.domain.local`)
41+
# HTTP entrypoint
42+
- traefik.http.routers.whoami.entrypoints=http
43+
# Use of middleware to redirect HTTP to HTTPS
44+
- traefik.http.routers.whoami.middlewares=redirect@file
45+
# URL HTTPS
46+
- traefik.http.routers.whoamis.rule=Host(`whoami.domain.local`)
47+
# HTTPS entrypoint
48+
- traefik.http.routers.whoamis.entrypoints=https
49+
# Activation of TLS
50+
- traefik.http.routers.whoamis.tls=true
51+
networks:
52+
- frontend

traefik/traefik.config.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[http.middlewares]
2+
[http.middlewares.redirect.redirectscheme]
3+
scheme = "https"
4+
5+
[tls]
6+
[[tls.certificates]]
7+
certFile = "/etc/certs/local-cert.pem"
8+
keyFile = "/etc/certs/local-key.pem"

traefik/traefik.toml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[global]
2+
sendAnonymousUsage = false
3+
4+
[log]
5+
level = "INFO" #DEBUG, INFO, WARN, ERROR, FATAL, PANIC
6+
format = "common"
7+
8+
[entryPoints]
9+
[entryPoints.http]
10+
address = ":80"
11+
12+
[entryPoints.https]
13+
address = ":443"
14+
15+
[providers]
16+
[providers.file]
17+
filename = "/etc/traefik/traefik.config.toml"
18+
watch = true
19+
20+
[providers.docker]
21+
endpoint = "unix:///var/run/docker.sock"
22+
watch = true
23+
[docker.tls]
24+
cert = "/etc/certs/local-cert.pem"
25+
key = "/etc/certs/local-key.pem"

0 commit comments

Comments
 (0)