1. Qu'est-ce que l'auto-hébergement ?
2. Pourquoi ?
3. Comment ?
Techno que je connais bien
Est-ce que c'est suffisant pour mes besoins ?
Stable et répandu
Pas (ou peu) de maintenance serveur
Simple à tester en local si besoin
https://github.com/Kickball/awesome-selfhosted
https://www.reddit.com/r/selfhosted/
https://github.com/veggiemonk/awesome-docker/
Créer une image soit même et la partager
Un serveur par service. Chacun exposé sur le port 80 !
$ docker run -p 80:3000 -d rails
defaultEntryPoints = ["http", "https"]
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.http.redirect]
entryPoint = "https"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
[docker]
watch = true
exposedbydefault = false
[acme]
email = "[email protected]"
storage = "acme.json"
entryPoint = "https"
[acme.dnsChallenge]
provider = "gandiv5"
delayBeforeCheck = 0
[[acme.domains]]
main = "*.guillaumebriday.xyz"
sans = ["guillaumebriday.xyz"]
- name: Create the traefik container
docker_container:
image: traefik
restart_policy: unless-stopped
networks:
- name: web
ports:
- "80:80"
- "443:443"
volumes:
- "path/to/traefik.toml:/etc/traefik/traefik.toml"
- "path/to/acme.json:/acme.json"
- /var/run/docker.sock:/var/run/docker.sock
env:
GANDIV5_API_KEY: "ma-super-cle"
Configuration (ou surchage) via les labels de Docker
- name: Create the nextcloud container
docker_container:
name: nextcloud
image: nextcloud:15
restart_policy: unless-stopped
networks:
- name: web
labels:
traefik.frontend.rule: "Host:nextcloud.guillaumebriday.xyz"
traefik.enable: "true"
traefik.port: "80"
volumes:
- "/var/www/nextcloud/data:/var/www/html"
Deux lignes suffisent
* 10800 IN CNAME guillaumebriday.xyz.
@ 10800 IN A 172.217.18.238
Objectif : Remplacer Google Drive.
Repo : https://github.com/guillaumebriday/selfhosted-services/tree/next-cloud
Résultat : https://nextcloud.guillaumebriday.xyz
review_app:
<<: *setup_deploy_env
stage: review
script:
- docker run --rm --name db_${CI_COMMIT_REF_SLUG} -e POSTGRES_DB=${POSTGRES_DB} -e POSTGRES_PASSWORD=secret -d postgres:11
- docker run --rm -d --name app_${CI_COMMIT_REF_SLUG} \
--link db_${CI_COMMIT_REF_SLUG} \
-e DB_HOST=db_${CI_COMMIT_REF_SLUG} \
-l traefik.frontend.rule=Host:${CI_COMMIT_REF_SLUG}.guillaumebriday.xyz \
${IMAGE_TAG}