Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f8c2a85

Browse files
Merge pull request #16 from Mettmett/traefik-portainer
traefik with portainer - initial commit
2 parents 0d12e82 + 125d6e5 commit f8c2a85

File tree

8 files changed

+300
-0
lines changed

8 files changed

+300
-0
lines changed

‎traefik-portainer/.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
PORTAINERVERSION=portainer-ce:alpine
2+
TRAEFIKVERSION=saintmarcelin

‎traefik-portainer/README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# docker-compose Portainer
2+
3+
> A very simple docker-compose file to have a Portainer and Traefik, to manage your containers with a webGUI.
4+
5+
## :factory: Requirements
6+
7+
* linux host (tested successfully on Ubuntu 20.04 && 22.04, Debian 10 & 11)
8+
* docker >= 23.x
9+
* docker compose (plugin) >= 2.17.x
10+
11+
## :rocket: How to use
12+
13+
Clone this repo where you want with this line :
14+
15+
```bash
16+
git clone https://github.com/Mettmett/docker-compose.git:portainer
17+
```
18+
19+
You need to edit the file `.env` at the source folder to modify the values of some vars.
20+
21+
After that when you're all set, press the red button to initiate :fire: !
22+
23+
```bash
24+
docker compose pull && docker compose up -d && docker compose logs -f
25+
```
26+
27+
In Portainer 2.17+ administration page, you'll have to add the docker environment you want to connect to. Select "Docker Standalone" and use the "API" instead of "Socket". The docker API URL is the `dockerproxy` container, so type `dockerproxy:2375`.
28+
29+
## :star: Author
30+
31+
Made by Julien HOMMET :fr: for [my personnal website](https://j.hommet.net)
32+
33+
* Twitter: [@mettmettz](https://twitter.com/mettmettz)
34+
* GitHub: [Mettmett](https://github.com/Mettmett)
35+
36+
## :wrench: Support & Contribution
37+
38+
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
39+
40+
## :moneybag: Licence
41+
42+
[CC BY-NC-SA](https://creativecommons.org/licenses/by-nc-sa/4.0)
43+
44+
## :anchor: Misc

‎traefik-portainer/conf/acme.json

Whitespace-only changes.

‎traefik-portainer/conf/traefik.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
global:
3+
sendAnonymousUsage: true
4+
checkNewVersion: false
5+
6+
api:
7+
#insecure: true
8+
dashboard: true
9+
#debug: true
10+
11+
log:
12+
filePath: "/etc/traefik/applog.log"
13+
format: json
14+
level: "ERROR"
15+
16+
providers:
17+
docker:
18+
#endpoint: unix:///var/run/docker.sock
19+
endpoint: tcp://dockerproxy:2375
20+
network: dockerproxynet
21+
exposedByDefault: false
22+
watch: true
23+
swarmMode: false
24+
file:
25+
directory: "/etc/traefik/dynamic"
26+
watch: true
27+
28+
entryPoints:
29+
web:
30+
address: ":80"
31+
http:
32+
redirections:
33+
entryPoint:
34+
to: websecure
35+
scheme: https
36+
websecure:
37+
address: ":443"
38+
metrics:
39+
address: ":9090"
40+
ping:
41+
address: ":8082"
42+
43+
ping:
44+
entryPoint: "ping"
45+
46+
certificatesResolvers:
47+
letsencrypt:
48+
acme:
49+
email: mail@domain.name
50+
# caServer: https://acme-staging-v02.api.letsencrypt.org/directory
51+
caServer: https://acme-v02.api.letsencrypt.org/directory
52+
storage: acme.json
53+
keyType: EC256
54+
httpChallenge:
55+
entryPoint: web
56+
57+
metrics:
58+
prometheus:
59+
entryPoint: metrics
60+
addEntryPointsLabels: true
61+
addRoutersLabels: true
62+
addServicesLabels: true
63+
buckets:
64+
- 0.1
65+
- 0.3
66+
- 1.2
67+
- 5.0
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
tls:
3+
options:
4+
default:
5+
minVersion: VersionTLS12
6+
sniStrict: true
7+
cipherSuites:
8+
- TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
9+
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
10+
- TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305
11+
- TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
12+
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
13+
- TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305
14+
- TLS_AES_128_GCM_SHA256
15+
- TLS_AES_256_GCM_SHA384
16+
- TLS_CHACHA20_POLY1305_SHA256
17+
curvePreferences:
18+
- CurveP521
19+
- CurveP384
20+
alpnProtocols:
21+
- h2
22+
- http/1.1
23+
mintls13:
24+
minVersion: VersionTLS13
25+
26+
http:
27+
middlewares:
28+
security:
29+
headers:
30+
accessControlAllowMethods:
31+
- GET
32+
- OPTIONS
33+
- PUT
34+
accessControlMaxAge: 100
35+
addVaryHeader: true
36+
browserXssFilter: true
37+
contentTypeNosniff: true
38+
forceSTSHeader: true
39+
frameDeny: true
40+
sslRedirect: true
41+
sslForceHost: true
42+
stsPreload: true
43+
customFrameOptionsValue: SAMEORIGIN
44+
referrerPolicy: "same-origin"
45+
featurePolicy: "camera 'none'; microphone 'none'; payment 'none'; usb 'none';"
46+
stsSeconds: 315360000
47+
hostsProxyHeaders:
48+
- "X-Forwarded-Host"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
http:
3+
routers:
4+
rt-traefik:
5+
entryPoints:
6+
- websecure
7+
service: api@internal
8+
rule: Host (`traefik.domain.name`)
9+
tls:
10+
options: default
11+
certResolver: letsencrypt
12+
13+
rt-portainer:
14+
entryPoints:
15+
- websecure
16+
middlewares:
17+
- security
18+
service: sc-portainer
19+
rule: Host (`portainer.domain.name`)
20+
tls:
21+
options: default
22+
certResolver: letsencrypt
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
http:
3+
services:
4+
sc-portainer:
5+
loadBalancer:
6+
servers:
7+
- url: "http://portainer:9000"

‎traefik-portainer/docker-compose.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
---
2+
3+
services:
4+
dockerproxy:
5+
image: tecnativa/docker-socket-proxy:edge
6+
restart: always
7+
container_name: dockerproxy
8+
networks:
9+
- dockerproxynet
10+
volumes:
11+
- /var/run/docker.sock:/var/run/docker.sock:ro
12+
environment:
13+
LOG_LEVEL: info
14+
# 0 to revoke access / 1 to grant access.
15+
## Granted by Default
16+
EVENTS: 1
17+
PING: 1
18+
VERSION: 1
19+
## Revoked by Default
20+
# Security critical
21+
AUTH: 0
22+
SECRETS: 0
23+
# Not always needed
24+
BUILD: 0
25+
COMMIT: 0
26+
CONFIGS: 0
27+
CONTAINERS: 1 # Traefik, portainer, etc.
28+
DISTRIBUTION: 0
29+
EXEC: 0
30+
IMAGES: 1 # Portainer
31+
INFO: 1 # Portainer
32+
NETWORKS: 1 # Portainer
33+
NODES: 0
34+
PLUGINS: 0
35+
SERVICES: 1 # Portainer
36+
SESSION: 0
37+
SWARM: 0
38+
SYSTEM: 0
39+
TASKS: 1 # Portainer
40+
VOLUMES: 1 # Portainer
41+
TZ: "Europe/Paris"
42+
43+
traefik:
44+
image: traefik:${TRAEFIKVERSION}
45+
restart: unless-stopped
46+
container_name: traefik
47+
networks:
48+
- dockerproxynet
49+
ports:
50+
- target : 80
51+
published : 80
52+
protocol: tcp
53+
mode : host
54+
- target : 443
55+
published : 443
56+
protocol: tcp
57+
mode : host
58+
volumes:
59+
- ./conf/acme.json:/acme.json
60+
- ./conf/traefik.yml:/etc/traefik/traefik.yml:ro
61+
- ./conf/traefikdynamic:/etc/traefik/dynamic:ro
62+
- ./logs/traefik.log:/etc/traefik/applog.log
63+
- /etc/localtime:/etc/localtime:ro
64+
#- /var/run/docker.sock:/var/run/docker.sock:ro
65+
environment:
66+
TZ: "Europe/Paris"
67+
healthcheck:
68+
test: ["CMD", "traefik", "healthcheck", "--ping"]
69+
interval: 10s
70+
timeout: 5s
71+
retries: 3
72+
mem_limit: 256m
73+
mem_reservation: 128m
74+
depends_on:
75+
- dockerproxy
76+
77+
portainer:
78+
restart: unless-stopped
79+
image: portainer/${PORTAINERVERSION}
80+
container_name: portainer
81+
networks:
82+
- dockerproxynet
83+
depends_on:
84+
- traefik
85+
- dockerproxy
86+
command: ["-H", "tcp://dockerproxy:2375"]
87+
healthcheck:
88+
test: "wget --no-verbose --tries=1 --spider --no-check-certificate http://localhost:9000 || exit 1"
89+
interval: 60s
90+
timeout: 5s
91+
retries: 3
92+
start_period: 20s
93+
volumes:
94+
# - /var/run/docker.sock:/var/run/docker.sock:ro
95+
- /etc/localtime:/etc/localtime:ro
96+
- dataportainer:/data
97+
mem_limit: 256m
98+
mem_reservation: 128m
99+
security_opt:
100+
- no-new-privileges:true
101+
102+
volumes:
103+
dataportainer:
104+
105+
networks:
106+
dockerproxynet:
107+
name: dockerproxynet
108+
ipam:
109+
config:
110+
- subnet: 172.16.10.0/24

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /