www-data installe front
This commit is contained in:
parent
59b0533026
commit
787c5ed9e1
31
install.sh
31
install.sh
|
@ -337,7 +337,6 @@ fi
|
||||||
echo -e "${PURPLE}${BOLD}Install the front-end ? (y/N) ${RESET}"
|
echo -e "${PURPLE}${BOLD}Install the front-end ? (y/N) ${RESET}"
|
||||||
read answer
|
read answer
|
||||||
if [[ "$answer" == "y" ]]; then
|
if [[ "$answer" == "y" ]]; then
|
||||||
get_username
|
|
||||||
get_ip
|
get_ip
|
||||||
|
|
||||||
echo -e "${PURPLE}${BOLD}Create and push a prod branch on the repo${RESET}"
|
echo -e "${PURPLE}${BOLD}Create and push a prod branch on the repo${RESET}"
|
||||||
|
@ -347,34 +346,28 @@ if [[ "$answer" == "y" ]]; then
|
||||||
echo -e "${PURPLE}${BOLD}Enter the .git url of the repo${RESET}"
|
echo -e "${PURPLE}${BOLD}Enter the .git url of the repo${RESET}"
|
||||||
read repo_url
|
read repo_url
|
||||||
|
|
||||||
front_folder=$(echo "$repo_url" | sed 's#.*/\([^/]*\)\.git#\1#')
|
front_repo_name=$(echo "$repo_url" | sed 's#.*/\([^/]*\)\.git#\1#')
|
||||||
|
front_directory="${repo_directory}/${front_repo_name}"
|
||||||
if [[ -z "$website_token" ]]; then
|
if [[ -z "$website_token" ]]; then
|
||||||
echo -e "${PURPLE}${BOLD}Enter the Directus Website user static token${RESET}"
|
echo -e "${PURPLE}${BOLD}Enter the Directus Website user static token${RESET}"
|
||||||
read -s website_token
|
read -s website_token
|
||||||
fi
|
fi
|
||||||
|
|
||||||
su -c "cd /home/${username} &&\
|
mkdir /var/www/.nuxtrc
|
||||||
|
chown -R www-data:www-data /var/www/.nuxtrc
|
||||||
|
|
||||||
|
su -s /bin/bash -c "cd ${repo_directory} &&\
|
||||||
git clone ${repo_url} &&\
|
git clone ${repo_url} &&\
|
||||||
cd ${front_folder} &&\
|
cd ${front_directory} &&\
|
||||||
git checkout prod &&\
|
git checkout prod &&\
|
||||||
echo \"DIRECTUS_API_TOKEN=${website_token}\" > .env &&\
|
echo \"DIRECTUS_API_TOKEN=${website_token}\" > .env &&\
|
||||||
echo \"URL=https://${domain_name}\" >> .env &&\
|
echo \"URL=https://${domain_name}\" >> .env &&\
|
||||||
echo \"DIRECTUS_URL=https://cms.${domain_name}\" >> .env" $username
|
echo \"DIRECTUS_URL=https://cms.${domain_name}\" >> .env &&\
|
||||||
|
tmux send-keys -t directus C-c &&\
|
||||||
su -s /bin/bash -c "tmux send-keys -t directus C-c" www-data
|
|
||||||
|
|
||||||
su -c "cd /home/${username}/${front_folder} &&\
|
|
||||||
npm install &&\
|
npm install &&\
|
||||||
NUXT_TELEMETRY_DISABLED=1 bash -c \"npm run build\"" $username
|
NUXT_TELEMETRY_DISABLED=1 bash -c \"npm run build\" &&\
|
||||||
|
tmux new-session -d -s front &&\
|
||||||
mkdir /var/www/.nuxtrc
|
tmux send-keys -t front \"cd ${front_directory} && node .output/server/index.mjs\" C-m &&\
|
||||||
chown -R www-data:www-data /var/www/.nuxtrc
|
|
||||||
chown -R www-data:www-data /home/$username/.nvm
|
|
||||||
chown -R www-data:www-data /home/$username/.npm
|
|
||||||
chown -R www-data:www-data /home/$username/$front_folder
|
|
||||||
|
|
||||||
su -s /bin/bash -c "tmux new-session -d -s front &&\
|
|
||||||
tmux send-keys -t front \"cd /home/${username}/${front_folder} && node .output/server/index.mjs\" C-m &&\
|
|
||||||
tmux send-keys -t directus \"npx directus start\" C-m" www-data
|
tmux send-keys -t directus \"npx directus start\" C-m" www-data
|
||||||
|
|
||||||
caddyfile="/etc/caddy/Caddyfile"
|
caddyfile="/etc/caddy/Caddyfile"
|
||||||
|
|
Loading…
Reference in New Issue