ajout de trucs

This commit is contained in:
Valentin 2024-11-11 20:25:35 +01:00
parent 724ef50568
commit fcf0998212
7 changed files with 73 additions and 1 deletions

View File

@ -1,2 +1,13 @@
Deployment [**D**ebian](https://www.debian.org/) (os) + [**D**ocker](https://www.docker.com/) (containerization) + [**C**addy](https://caddyserver.com/) (webserver) + [**D**irectus](https://directus.io/) (cms) + [**N**uxt](https://nuxt.com/) (static front).
Installation
On a fresh install as root user using
sudo passwd root
su - root
Upgrade
apt update && apt upgrade -y

View File

@ -0,0 +1,7 @@
#!/bin/bash
mkdir /home/$username/cms.$DOMAIN_NAME
cp assets/directus.docker-compose.yml /home/$username/cms.$DOMAIN_NAME/docker-compose.yml
cp assets/.env.example /home/$username/cms.$DOMAIN_NAME/.env
cd /home/$username/cms.$DOMAIN_NAME
docker compose up -d

15
bin/add-site/set_url.sh Normal file
View File

@ -0,0 +1,15 @@
#!/bin/bash
echo -e "${PURPLE}${BOLD}Enter the domain name of the website${RESET}"
read DOMAIN_NAME
if [[ -z "$ip" ]]; then
ip=$(hostname -I | cut -d' ' -f1)
fi
echo -e "${PURPLE}${BOLD}Configure the ${DOMAIN_NAME} DNS ZONE as the following${RESET}"
echo -e "${BLUE}Domain : ${DOMAIN_NAME} | Type : A | Target : ${ip}${RESET}"
echo -e "${BLUE}Domain : cms.${DOMAIN_NAME} | Type : A | Target : ${ip}${RESET}"
echo -e "${BLUE}Domain : www.${DOMAIN_NAME} | Type : A | Target : ${ip}${RESET}"
echo -e "${PURPLE}${BOLD}Press any key when done${RESET}"
read

15
bin/add_site.sh Normal file
View File

@ -0,0 +1,15 @@
#!/bin/bash
# SET URL
echo -e "${PURPLE}${BOLD}Set url ? (y/N) ${RESET}"
read answer
if [[ "$answer" == "y" ]]; then
. bin/add-site/set_url.sh
fi
# INSTALL DIRECTUS
echo -e "${PURPLE}${BOLD}Install Directus ? (y/N) ${RESET}"
read answer
if [[ "$answer" == "y" ]]; then
. bin/add-site/install_directus.sh
fi

View File

@ -31,4 +31,22 @@ echo -e "${PURPLE}${BOLD}Setup Firewall and Fail2ban ? (y/N) ${RESET}"
read answer
if [[ "$answer" == "y" ]]; then
. bin/first-install/setup_firewall_fail2ban.sh
fi
# Check if Docker is installed
if ! command -v docker &> /dev/null; then
echo "Docker is not installed."
exit 1
else
echo "Docker is installed."
fi
# Check if a Caddy container is running
if docker ps --filter "ancestor=caddy" --format '{{.Names}}' | grep -q .; then
echo "A Caddy container is running."
else
mkdir /home/$username/caddy
cp assets/caddy.docker-compose.yml /home/$username/caddy/docker-compose.yml
cd /home/$username/caddy
docker compose up -d
fi

View File

@ -5,4 +5,6 @@ PURPLE='\033[35m'
ORANGE='\033[33m'
BLUE='\033[34m'
BOLD='\033[1m'
RESET='\033[0m'
RESET='\033[0m'
DOMAIN_NAME=""

View File

@ -12,3 +12,7 @@ fi
# First install, root only
echo -e "${PURPLE}${BOLD}First server installation${RESET}"
. bin/first_install.sh
# Install website
echo -e "${PURPLE}${BOLD}Install website${RESET}"
. bin/add_site.sh