Compare commits
10 Commits
d5d60e2fa6
...
main
Author | SHA1 | Date | |
---|---|---|---|
b4094ce508 | |||
0e0cd5aaba | |||
938009c86d | |||
|
cd63ad4a55 | ||
|
2b81e486fc | ||
|
1d85d0cc4e | ||
|
d3c4eb3e11 | ||
|
49e1a85ef2 | ||
|
55d174e16b | ||
|
28e8dba716 |
3
.env.sample
Normal file
3
.env.sample
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
PROJECT_NAME=sample
|
||||||
|
PROJECT_URL=localhost
|
||||||
|
TRAEFIK_NETWORK=traefik_net
|
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
.env
|
||||||
|
|
||||||
|
*.back
|
||||||
|
tls-data/*.key
|
||||||
|
tls-data/*.crt
|
||||||
|
|
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2023 docker
|
Copyright (c) 2023 altogether
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
24
README.md
24
README.md
@@ -1,11 +1,11 @@
|
|||||||
# traefik
|
# traefik
|
||||||
|
|
||||||
### get started
|
## get started
|
||||||
|
|
||||||
you will need a .env file
|
you will need a .env file
|
||||||
|
|
||||||
sample .env:
|
sample .env:
|
||||||
|
|
||||||
# .env
|
# .env
|
||||||
|
|
||||||
PROJECT_NAME=sample
|
PROJECT_NAME=sample
|
||||||
@@ -16,8 +16,24 @@ place the tls crt and key in the tls-data
|
|||||||
and append them also to the tls.yml
|
and append them also to the tls.yml
|
||||||
|
|
||||||
|
|
||||||
then execute init
|
then execute init with
|
||||||
|
|
||||||
|
chmod +x init && ./init
|
||||||
|
|
||||||
|
now traefik gui should be accessable: https://${PROJECT_URL}
|
||||||
|
if you use the sample .env: https://localhost
|
||||||
|
|
||||||
|
|
||||||
### additional links
|
## test your compose network
|
||||||
|
|
||||||
|
to test your traefik network you can start the whoami compose with:
|
||||||
|
|
||||||
|
docker compose -f ./docker-compose-whoami.yml up -d
|
||||||
|
|
||||||
|
you can stop the whoami with
|
||||||
|
|
||||||
|
docker compose -f ./docker-compose-whoami.yml down -v
|
||||||
|
|
||||||
|
|
||||||
|
## additional links
|
||||||
- [traefik docu](https://doc.traefik.io/traefik/)
|
- [traefik docu](https://doc.traefik.io/traefik/)
|
@@ -1,4 +1,4 @@
|
|||||||
version: "1.0"
|
version: "3.9"
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
default:
|
default:
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
version: "1.0"
|
version: "3.9"
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
default:
|
default:
|
||||||
@@ -16,6 +16,7 @@ services:
|
|||||||
- "./traefik.yml:/traefik.yml:ro"
|
- "./traefik.yml:/traefik.yml:ro"
|
||||||
- "/var/run/docker.sock:/var/run/docker.sock:ro"
|
- "/var/run/docker.sock:/var/run/docker.sock:ro"
|
||||||
- "./tls.yml:/etc/traefik/dynamic_conf/conf.yml:ro"
|
- "./tls.yml:/etc/traefik/dynamic_conf/conf.yml:ro"
|
||||||
|
- "./acme.json:/certificates/acme.json"
|
||||||
- "./tls-data:/tls:ro"
|
- "./tls-data:/tls:ro"
|
||||||
labels:
|
labels:
|
||||||
- "traefik.enable=true"
|
- "traefik.enable=true"
|
||||||
@@ -31,4 +32,4 @@ services:
|
|||||||
- "traefik.http.routers.${PROJECT_NAME}_traefik.rule=Host(`${PROJECT_URL}`)"
|
- "traefik.http.routers.${PROJECT_NAME}_traefik.rule=Host(`${PROJECT_URL}`)"
|
||||||
- "traefik.http.services.${PROJECT_NAME}_traefik.loadbalancer.server.port=8080"
|
- "traefik.http.services.${PROJECT_NAME}_traefik.loadbalancer.server.port=8080"
|
||||||
- "traefik.http.routers.${PROJECT_NAME}_traefik.tls=true"
|
- "traefik.http.routers.${PROJECT_NAME}_traefik.tls=true"
|
||||||
- "traefik.http.routers.${PROJECT_NAME}_traefik.entrypoints=websecure"
|
- "traefik.http.routers.${PROJECT_NAME}_traefik.entrypoints=websecure"
|
||||||
|
2
init
2
init
@@ -6,6 +6,8 @@ mkdir tls-data
|
|||||||
|
|
||||||
docker network create $TRAEFIK_NETWORK
|
docker network create $TRAEFIK_NETWORK
|
||||||
|
|
||||||
|
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ./tls-data/selfsigned.key -out ./tls-data/selfsigned.crt
|
||||||
|
|
||||||
docker compose up -d
|
docker compose up -d
|
||||||
docker compose -f docker-compose-whoami.yml up -d
|
docker compose -f docker-compose-whoami.yml up -d
|
||||||
|
|
||||||
|
18
tls.yml
18
tls.yml
@@ -12,10 +12,16 @@ tls:
|
|||||||
stores:
|
stores:
|
||||||
default:
|
default:
|
||||||
defaultCertificate:
|
defaultCertificate:
|
||||||
certFile: /tls/CF-altogether.at.crt
|
certFile: /tls/selfsigned.crt
|
||||||
keyFile: /tls/CF-altogether.at.key
|
keyFile: /tls/selfsigned.key
|
||||||
certificates:
|
certificates:
|
||||||
- certFile: /tls/CF-altogether.at.crt
|
- certFile: /tls/selfsigned.crt
|
||||||
keyFile: /tls/CF-altogether.at.key
|
keyFile: /tls/selfsigned.key
|
||||||
stores:
|
|
||||||
- default
|
options:
|
||||||
|
default:
|
||||||
|
clientAuth:
|
||||||
|
# in PEM format. each file can contain multiple CAs.
|
||||||
|
caFiles:
|
||||||
|
- /tls/selfsigned.crt
|
||||||
|
clientAuthType: VerifyClientCertIfGiven
|
25
traefik.yml
25
traefik.yml
@@ -1,6 +1,16 @@
|
|||||||
## STATIC CONFIGURATION
|
## STATIC CONFIGURATION
|
||||||
|
global:
|
||||||
|
checkNewVersion: true
|
||||||
|
sendAnonymousUsage: false
|
||||||
|
|
||||||
log:
|
log:
|
||||||
level: INFO
|
level: "INFO"
|
||||||
|
|
||||||
|
accessLog:
|
||||||
|
filePath: "/logs/access.log"
|
||||||
|
bufferingSize: 100 # Configuring a buffer of 100 lines
|
||||||
|
filters:
|
||||||
|
statusCodes: "204-299,400"
|
||||||
|
|
||||||
api:
|
api:
|
||||||
insecure: true
|
insecure: true
|
||||||
@@ -24,9 +34,14 @@ entryPoints:
|
|||||||
providers:
|
providers:
|
||||||
docker:
|
docker:
|
||||||
endpoint: "unix:///var/run/docker.sock"
|
endpoint: "unix:///var/run/docker.sock"
|
||||||
# endpoint: "tcp://dockerproxy:2375"
|
|
||||||
exposedByDefault: false
|
exposedByDefault: false
|
||||||
# swarmMode: false
|
|
||||||
# network: "socket_proxy"
|
|
||||||
file:
|
file:
|
||||||
directory: "/etc/traefik/dynamic_conf"
|
watch: true
|
||||||
|
directory: "/etc/traefik/dynamic_conf"
|
||||||
|
|
||||||
|
certificatesresolvers:
|
||||||
|
le:
|
||||||
|
acme:
|
||||||
|
email: "rama@altogether.at"
|
||||||
|
storage: "/certificates/acme.json"
|
||||||
|
tlschallenge: true
|
Reference in New Issue
Block a user