Skip to content

Commit

Permalink
Merge pull request #28 from vicradon/feat/add-pm2-setup-script
Browse files Browse the repository at this point in the history
chore: include setup script for pm2
  • Loading branch information
vicradon authored Jul 19, 2024
2 parents 346070d + bd1dc55 commit ee30afd
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 5 deletions.
File renamed without changes.
33 changes: 28 additions & 5 deletions scripts/install_app_dependencies.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,36 @@
#!/bin/bash

# Check if the script is run as root
# Ensure the script is run as root
if [ "$(id -u)" -ne 0 ]; then
echo "This script must be run as root. Use sudo."
exit 1
fi

chmod +x nginx.sh postgres_go.sh postgres_setup.sh
# Ensure the script is run from the scripts directory directly
SCRIPT_DIR_NAME="scripts"
CURRENT_DIR_NAME=$(basename "$PWD")

./nginx.sh
./postgres_go.sh
./postgres_setup.sh
if [ "$CURRENT_DIR_NAME" != "$SCRIPT_DIR_NAME" ]; then
echo "This script must be run from the $SCRIPT_DIR_NAME directory."
exit 1
fi

# Array of scripts to execute
SCRIPTS=(
"install_and_setup_nginx.sh"
"install_postgres_and_go.sh"
"install_pm2.sh"
"setup_postgres.sh"
)

# Make all scripts executable and execute them
for script in "${SCRIPTS[@]}"; do
if [ -f "$script" ]; then
chmod +x "$script"
echo "Executing $script..."
./"$script"
else
echo "Script $script does not exist."
exit 1
fi
done
9 changes: 9 additions & 0 deletions scripts/install_pm2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm

nvm install 20

npm i -g pm2
File renamed without changes.
File renamed without changes.

0 comments on commit ee30afd

Please sign in to comment.