2024-05-02 23:54:06 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
. bin/variables.sh
|
|
|
|
. bin/functions.sh
|
|
|
|
|
|
|
|
install_pkg tmux
|
|
|
|
|
|
|
|
if [[ -z "$DB_DIRECTUS_PASSWORD" ]]; then
|
|
|
|
echo -e "${PURPLE}${BOLD}Enter the MariaDB Directus password : ${RESET}"
|
|
|
|
read -s DB_DIRECTUS_PASSWORD
|
|
|
|
echo
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z "$CMS_DIRECTORY" ]]; then
|
|
|
|
. bin/set_url.sh
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "set -g default-shell /bin/sh" >> /etc/tmux.conf
|
|
|
|
su -s /bin/bash -c "mkdir ${CMS_DIRECTORY}" www-data
|
|
|
|
|
|
|
|
echo -e "${PURPLE}${BOLD}Import the Directus database ? (y/N) ${RESET}"
|
|
|
|
read answer
|
|
|
|
if [[ "$answer" == "y" ]]; then
|
|
|
|
. bin/import_directus_db.sh
|
|
|
|
else
|
|
|
|
. bin/setup_directus.sh
|
2024-05-03 17:19:46 +02:00
|
|
|
|
|
|
|
echo -e "${PURPLE}${BOLD}Import Directus data model ? (y/N) ${RESET}"
|
|
|
|
read answer
|
|
|
|
if [[ "$answer" == "y" ]]; then
|
|
|
|
. bin/import_directus_schema.sh
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo -e "${PURPLE}${BOLD}You can now add some content${RESET}"
|
|
|
|
echo -e "${ORANGE}${BOLD}Do not forget to set the permissions${RESET}"
|
|
|
|
echo -e "${ORANGE}${BOLD}Website role ${RESET}${ORANGE}Read content collections and directus_files${RESET}"
|
|
|
|
echo -e "${ORANGE}${BOLD}User role ${RESET}${ORANGE}All permissions on content collections, directus_files and directus_folders${RESET}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "cms.${DOMAIN_NAME} {" >> $CADDYFILE
|
|
|
|
echo "reverse_proxy ${ip}:${port}" >> $CADDYFILE
|
|
|
|
echo "}" >> $CADDYFILE
|
|
|
|
caddy fmt $CADDYFILE -w
|
|
|
|
caddy reload -c $CADDYFILE
|
|
|
|
|
|
|
|
echo -e "${PURPLE}${BOLD}Access Directus ${RESET}${PURPLE}https://cms.${DOMAIN_NAME}${RESET}"
|