Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .default
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This is an example of .env file whith the variables it must contain

ADMIN_NAME="xxxxxx"
ADMIN_PASSWORD="$2b$10$xxxxxxxxxxx"
JWT_SECRET="xxxxxxx"
20 changes: 20 additions & 0 deletions .nuxt/app.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

import { defuFn } from 'C:/Users/karim/Documents/Stage_UR/ProjetMilestone/Unitystation-MillstoneSteam/node_modules/defu/dist/defu.mjs'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

faut un chemin relatif. actuelement ca ne fonctionnera que sur ta machine


import fs from 'fs'
require('dotenv').config()

const httpsConfig = {
server: {
https: {
key: fs.readFileSync(process.env.KEY_PATH),
cert: fs.readFileSync(process.env.CERT_PATH)
}
}
}

const inlineConfig = {}



export default defuFn(inlineConfig, httpConfig)
3 changes: 3 additions & 0 deletions Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
milestone.unionrolistes.fr localhost 127.0.0.1 {
reverse_proxy app:3000
}
31 changes: 27 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,42 @@ version: '3.8'


services:
app:
app:
build: .
env_file:
- .env
# env_file:
# - .env
image: app
container_name: app
ports:
- "3000:3000"
restart: always
networks:
- default
- private
volumes:
- ./prisma/milestone.db:/app/.output/server/prisma/milestone.db

cadddy:
image: caddy:2.7-alpine
container_name: caddy
cap_add:
- NET_ADMIN
ports:
- "80:80"
- "443:443"
- "443:443/udp"
restart: unless-stopped
networks:
- default
- private
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- caddy_data:/data
- caddy_config:/config

volumes:
caddy_data:
caddy_config:

networks:
private:
driver: bridge
60 changes: 60 additions & 0 deletions install_ssl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash

# Définition des couleurs pour les messages
GREEN="\e[32m"
YELLOW="\e[33m"
RED="\e[31m"
RESET="\e[0m"

echo -e "${GREEN}🔹 Activation de HTTPS sur Apache (Debian) 🔹${RESET}"

# Vérifier si l'utilisateur est root
if [[ $EUID -ne 0 ]]; then
echo -e "${RED}❌ Ce script doit être exécuté en tant que root.${RESET}"
exit 1
fi

# Demander le nom de domaine
read -p "🔹 Entrez le nom de domaine (ex: monsite.com) : " DOMAIN

if [[ -z "$DOMAIN" ]]; then
echo -e "${RED}❌ Aucun domaine saisi. Script annulé.${RESET}"
exit 1
fi

# Vérifier et installer Certbot si absent
if ! command -v certbot &> /dev/null; then
echo -e "${YELLOW}🛠️ Installation de Certbot...${RESET}"
apt update && apt install -y certbot python3-certbot-apache
else
echo -e "${GREEN}✅ Certbot est déjà installé.${RESET}"
fi

# Générer le certificat SSL avec Certbot
echo -e "${YELLOW}🔹 Obtention du certificat SSL pour $DOMAIN...${RESET}"
certbot --apache -d "$DOMAIN"

if [[ $? -ne 0 ]]; then
echo -e "${RED}❌ Échec de la génération du certificat. Vérifiez que votre domaine pointe bien vers ce serveur.${RESET}"
exit 1
fi

echo -e "${GREEN}✅ Certificat SSL installé avec succès !${RESET}"

# Vérifier si le renouvellement automatique est actif
echo -e "${YELLOW}🔹 Vérification du renouvellement automatique...${RESET}"
if systemctl list-timers | grep -q certbot; then
echo -e "${GREEN}✅ Le renouvellement automatique du certificat SSL est actif.${RESET}"
else
echo -e "${RED}❌ Le renouvellement automatique n'est pas activé ! Ajoutons-le...${RESET}"
systemctl enable certbot.timer
systemctl start certbot.timer
echo -e "${GREEN}✅ Le renouvellement automatique est maintenant activé.${RESET}"
fi

# Redémarrer Apache pour appliquer les changements
echo -e "${YELLOW}🔄 Redémarrage d'Apache...${RESET}"
systemctl restart apache2

echo -e "${GREEN}🎉 HTTPS activé et renouvellement automatique configuré pour $DOMAIN ! ${RESET}"
echo -e "${GREEN}🔗 Testez votre site en HTTPS : https://$DOMAIN ${RESET}"