-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathsetup_environment.sh
69 lines (57 loc) · 2.27 KB
/
setup_environment.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
# Exit immediately if a command exits with a non-zero status
set -e
# Function to print messages
function print_message() {
echo "========================================"
echo "$1"
echo "========================================"
}
# Update package lists
print_message "Updating package lists..."
sudo apt-get update -y
# Install Node.js and npm
print_message "Installing Node.js and npm..."
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
# Install global npm packages
print_message "Installing global npm packages..."
npm install -g nodemon eslint prettier
# Install Docker (if not installed)
if ! command -v docker &> /dev/null; then
print_message "Installing Docker..."
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-get update -y
sudo apt-get install -y docker-ce
else
print_message "Docker is already installed."
fi
# Install Docker Compose (if not installed)
if ! command -v docker-compose &> /dev/null; then
print_message "Installing Docker Compose..."
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
else
print_message "Docker Compose is already installed."
fi
# Clone the stable-pi-core repository (if not already cloned)
if [ ! -d "stable-pi-core" ]; then
print_message "Cloning stable-pi-core repository..."
git clone https://github.com/yourusername/stable-pi-core.git
fi
# Navigate to the project directory
cd stable-pi-core
# Install project dependencies
print_message "Installing project dependencies..."
npm install
# Create a .env file if it doesn't exist
if [ ! -f ".env" ]; then
print_message "Creating .env file..."
echo "NODE_ENV=development" > .env
echo "PORT=3000" >> .env
echo "DB_URI=mongodb://localhost:27017/stable-pi" >> .env
echo "JWT_SECRET=your_jwt_secret" >> .env
fi
print_message "Development environment setup complete!"