feat: Add config

This commit is contained in:
Simon 2020-05-10 15:40:26 +02:00
parent 140c03bb44
commit 85a9a24085
8 changed files with 153 additions and 3 deletions

3
.dockerignore Normal file
View File

@ -0,0 +1,3 @@
**
!public
!.env

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
resources
public
.env

4
Dockerfile Normal file
View File

@ -0,0 +1,4 @@
FROM registry.lamelio.fr/nginx-lowtech:0.0.5
# Copie des sources du site
COPY public /usr/share/nginx/html

31
README.md Normal file
View File

@ -0,0 +1,31 @@
# Slides
## Install
```
git clone https://gitea.lamelio.fr/kosssi/slides.lamelio.fr.git --recurse-submodules
```
## Dev
```
./run dev
```
## Build
```
./run build
```
## Docker
```
./run docker
```
## Deploy
```
./run deploy
```

View File

@ -1,6 +1,6 @@
baseURL = "http://example.org/"
languageCode = "en-us"
title = "My New Hugo Site"
baseURL = "https://slides.lamelio.fr/"
languageCode = "fr-fr"
title = "Présentation"
theme = "reveal-hugo"

4
content/_index.md Normal file
View File

@ -0,0 +1,4 @@
---
title: Présentation
layout: slidelist
---

47
docker-compose.yml Normal file
View File

@ -0,0 +1,47 @@
version: "3.7"
volumes:
slides-log:
name: slides-log
slides-stats:
name: slides-stats
services:
slides-logs:
container_name: slides-logs
image: registry.lamelio.fr/goaccess
restart: always
volumes:
- slides-log:/var/log/nginx
- slides-stats:/usr/share/nginx/html/stats
labels:
com.centurylinklabs.watchtower.enable: true
slides:
container_name: ${NAME}
image: registry.lamelio.fr/slides
restart: always
environment:
- TZ=${TIMEZONE}
volumes:
- slides-log:/var/log/nginx
- slides-stats:/usr/share/nginx/html/stats
labels:
traefik.enable: "true"
traefik.http.routers.slides.rule: "Host(`${URL}`)"
traefik.http.routers.slides.entrypoints: "websecure"
traefik.http.routers.slides.tls.certResolver: "letsencrypt"
# Redirect https://www to https://
traefik.http.routers.slides-redirect-www.rule: "Host(`www.${URL}`)"
traefik.http.routers.slides-redirect-www.entrypoints: "websecure"
traefik.http.routers.slides-redirect-www.tls.certResolver: "letsencrypt"
traefik.http.routers.slides-redirect-www.middlewares: "redirect-www@docker"
com.centurylinklabs.watchtower.enable: true
networks:
default:
external:
name: traefik

58
run Executable file
View File

@ -0,0 +1,58 @@
#!/bin/bash
# -e Exit immediately if a command exits with a non-zero status.
# -u Treat unset variables as an error when substituting.
set -eu
START=`date +%s`
PROJECT=slides
build_production() {
echo "👷 Construction du site en mode production"
rm -rf public
hugo --environment production --minify
}
help() {
echo "💡 Aide"
echo "-------"
echo
echo "Commandes :"
echo "- ./run install 📦 Installation des dépendances"
echo "- ./run dev 🚧 Lancement du serveur pour le développement"
echo "- ./run build 👷 Construction du site en mode production"
echo "- ./run docker 🐳 Création de l'image Docker"
echo "- ./run deploy 🚀 Déploiement avec docker-compose"
echo
}
install() {
echo "📦 Installation des dépendances"
git submodule update --init
}
if [ $# -ge 1 ]; then
if [ $1 == "dev" ]; then
echo "🚧 Lancement du serveur pour le développement"
hugo server -D
elif [ $1 == "build" ]; then
build_production
elif [ $1 == "docker" ]; then
echo "🐳 Création de l'image Docker"
echo
docker build . -t kosssi/$PROJECT
docker tag kosssi/$PROJECT registry.lamelio.fr/$PROJECT
docker push registry.lamelio.fr/$PROJECT
elif [ $1 == "deploy" ]; then
echo "🚀 Déploiement avec docker-compose"
echo
docker-compose up -d
elif [ $1 == "install" ]; then
install
fi
else
help
fi
END=`date +%s`
echo "✨ Done in $((END-START))s"