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}"
|
||||
read answer
|
||||
if [[ "$answer" == "y" ]]; then
|
||||
get_username
|
||||
get_ip
|
||||
|
||||
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}"
|
||||
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
|
||||
echo -e "${PURPLE}${BOLD}Enter the Directus Website user static token${RESET}"
|
||||
read -s website_token
|
||||
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} &&\
|
||||
cd ${front_folder} &&\
|
||||
cd ${front_directory} &&\
|
||||
git checkout prod &&\
|
||||
echo \"DIRECTUS_API_TOKEN=${website_token}\" > .env &&\
|
||||
echo \"URL=https://${domain_name}\" >> .env &&\
|
||||
echo \"DIRECTUS_URL=https://cms.${domain_name}\" >> .env" $username
|
||||
|
||||
su -s /bin/bash -c "tmux send-keys -t directus C-c" www-data
|
||||
|
||||
su -c "cd /home/${username}/${front_folder} &&\
|
||||
echo \"DIRECTUS_URL=https://cms.${domain_name}\" >> .env &&\
|
||||
tmux send-keys -t directus C-c &&\
|
||||
npm install &&\
|
||||
NUXT_TELEMETRY_DISABLED=1 bash -c \"npm run build\"" $username
|
||||
|
||||
mkdir /var/www/.nuxtrc
|
||||
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 &&\
|
||||
NUXT_TELEMETRY_DISABLED=1 bash -c \"npm run build\" &&\
|
||||
tmux new-session -d -s front &&\
|
||||
tmux send-keys -t front \"cd ${front_directory} && node .output/server/index.mjs\" C-m &&\
|
||||
tmux send-keys -t directus \"npx directus start\" C-m" www-data
|
||||
|
||||
caddyfile="/etc/caddy/Caddyfile"
|
||||
|
|
Loading…
Reference in New Issue