2024-02-23 14:28:42 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-02-23 15:38:12 +01:00
|
|
|
|
2024-05-03 17:19:46 +02:00
|
|
|
# TODO
|
|
|
|
## DIRECTUS EMAIL
|
|
|
|
## DIRECTUS REDIS
|
|
|
|
## LOGING DE TOUT
|
|
|
|
## CADDYFILE EN JSON
|
|
|
|
## MÀJ
|
|
|
|
## reboot a running system
|
|
|
|
## MATOMO
|
|
|
|
## NODE EXPORTER
|
|
|
|
|
|
|
|
. bin/functions.sh
|
|
|
|
. bin/variables.sh
|
2024-04-17 16:48:16 +02:00
|
|
|
|
2024-02-23 15:46:03 +01:00
|
|
|
echo -e "${PURPLE}${BOLD}Deployment Debian + Caddy + Directus + Nuxt${RESET}"
|
2024-02-23 14:28:42 +01:00
|
|
|
|
|
|
|
if [ "$EUID" -ne 0 ]; then
|
|
|
|
echo "Please run as root"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2024-05-03 17:19:46 +02:00
|
|
|
if [ "$(dirname "$0")" != "$(pwd)" ]; then
|
|
|
|
echo "Please run this script from its directory."
|
|
|
|
exit
|
|
|
|
fi
|
2024-02-25 22:18:51 +01:00
|
|
|
|
2024-02-23 14:28:42 +01:00
|
|
|
# USER
|
2024-02-23 20:15:32 +01:00
|
|
|
echo -e "${PURPLE}${BOLD}Create a user ? (y/N) ${RESET}"
|
2024-02-23 15:38:12 +01:00
|
|
|
read answer
|
2024-02-23 15:14:36 +01:00
|
|
|
if [[ "$answer" == "y" ]]; then
|
2024-05-03 17:19:46 +02:00
|
|
|
. bin/create_user.sh
|
2024-02-23 15:14:36 +01:00
|
|
|
fi
|
2024-02-23 14:28:42 +01:00
|
|
|
|
|
|
|
# SSH
|
2024-02-23 20:15:32 +01:00
|
|
|
echo -e "${PURPLE}${BOLD}Setup SSH ? (y/N) ${RESET}"
|
2024-02-23 15:38:12 +01:00
|
|
|
read answer
|
2024-02-23 15:14:36 +01:00
|
|
|
if [[ "$answer" == "y" ]]; then
|
2024-05-03 17:19:46 +02:00
|
|
|
. bin/setup_ssh.sh
|
2024-02-23 15:14:36 +01:00
|
|
|
fi
|
2024-02-23 15:01:45 +01:00
|
|
|
|
|
|
|
# FIREWALL AND FAIL2BAN
|
2024-02-23 20:15:32 +01:00
|
|
|
echo -e "${PURPLE}${BOLD}Setup Firewall and Fail2ban ? (y/N) ${RESET}"
|
2024-02-23 15:38:12 +01:00
|
|
|
read answer
|
2024-02-23 15:14:36 +01:00
|
|
|
if [[ "$answer" == "y" ]]; then
|
2024-05-03 17:19:46 +02:00
|
|
|
. bin/setup_firewall_fail2ban.sh
|
2024-02-23 15:14:36 +01:00
|
|
|
fi
|
2024-02-23 15:01:45 +01:00
|
|
|
|
|
|
|
# CADDY
|
2024-02-23 20:15:32 +01:00
|
|
|
echo -e "${PURPLE}${BOLD}Install Caddy webserver ? (y/N) ${RESET}"
|
2024-02-23 15:38:12 +01:00
|
|
|
read answer
|
2024-02-23 15:14:36 +01:00
|
|
|
if [[ "$answer" == "y" ]]; then
|
2024-05-03 17:19:46 +02:00
|
|
|
. bin/install_caddy.sh
|
2024-02-23 15:38:12 +01:00
|
|
|
fi
|
|
|
|
|
2024-02-23 15:46:03 +01:00
|
|
|
# MARIADB
|
2024-02-23 20:15:32 +01:00
|
|
|
echo -e "${PURPLE}${BOLD}Install MariaDB ? (y/N) ${RESET}"
|
2024-02-23 15:46:03 +01:00
|
|
|
read answer
|
|
|
|
if [[ "$answer" == "y" ]]; then
|
2024-05-03 17:19:46 +02:00
|
|
|
. bin/install_mariadb.sh
|
2024-02-23 15:46:03 +01:00
|
|
|
fi
|
|
|
|
|
2024-02-23 17:07:19 +01:00
|
|
|
# DIRECTUS DB
|
2024-02-23 20:15:32 +01:00
|
|
|
echo -e "${PURPLE}${BOLD}Setup Directus database ? (y/N) ${RESET}"
|
2024-02-23 15:46:03 +01:00
|
|
|
read answer
|
|
|
|
if [[ "$answer" == "y" ]]; then
|
2024-05-03 17:19:46 +02:00
|
|
|
. bin/setup_directus_db.sh
|
2024-02-23 18:40:03 +01:00
|
|
|
fi
|
|
|
|
|
2024-02-23 20:04:32 +01:00
|
|
|
# NODE
|
2024-02-23 20:15:32 +01:00
|
|
|
echo -e "${PURPLE}${BOLD}Install Node ? (y/N) ${RESET}"
|
2024-02-23 18:40:03 +01:00
|
|
|
read answer
|
|
|
|
if [[ "$answer" == "y" ]]; then
|
2024-05-03 17:19:46 +02:00
|
|
|
. bin/install_node.sh
|
2024-02-23 18:05:07 +01:00
|
|
|
fi
|
|
|
|
|
2024-05-03 17:19:46 +02:00
|
|
|
# SET URL
|
|
|
|
echo -e "${PURPLE}${BOLD}Set url ? (y/N) ${RESET}"
|
|
|
|
read answer
|
|
|
|
if [[ "$answer" == "y" ]]; then
|
|
|
|
. bin/set_url.sh
|
|
|
|
fi
|
2024-02-23 20:04:32 +01:00
|
|
|
|
2024-05-03 17:19:46 +02:00
|
|
|
# INSTALL DIRECTUS
|
2024-02-23 20:15:32 +01:00
|
|
|
echo -e "${PURPLE}${BOLD}Install Directus ? (y/N) ${RESET}"
|
2024-02-23 20:04:32 +01:00
|
|
|
read answer
|
|
|
|
if [[ "$answer" == "y" ]]; then
|
2024-05-03 17:19:46 +02:00
|
|
|
. bin/install_directus.sh
|
2024-02-23 20:04:32 +01:00
|
|
|
fi
|
2024-02-23 22:32:51 +01:00
|
|
|
|
2024-05-03 17:19:46 +02:00
|
|
|
# NUXT STATIC
|
2024-02-25 17:14:22 +01:00
|
|
|
echo -e "${PURPLE}${BOLD}Install the front-end ? (y/N) ${RESET}"
|
2024-02-25 01:55:30 +01:00
|
|
|
read answer
|
|
|
|
if [[ "$answer" == "y" ]]; then
|
2024-05-03 17:19:46 +02:00
|
|
|
. bin/install_nuxt_front.sh
|
2024-02-25 17:14:22 +01:00
|
|
|
|
|
|
|
echo -e "${PURPLE}${BOLD}Setup a webhook ? (y/N) ${RESET}"
|
|
|
|
read answer
|
|
|
|
if [[ "$answer" == "y" ]]; then
|
2024-05-03 17:19:46 +02:00
|
|
|
. bin/setup_webhook.sh
|
2024-02-25 17:14:22 +01:00
|
|
|
fi
|
2024-05-03 17:19:46 +02:00
|
|
|
fi
|