-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
64 lines (53 loc) · 1.48 KB
/
setup.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
#! bin/bash
# Create .env file in the ./backend folder
if [ ! -f backend/.env ]; then
echo "Creating backend/.env..."
touch backend/.env
cat <<EOF > backend/.env
DATABASE_URL=postgres://postgres:password@medieteknik_db:5432/medieteknik
POSTGRES_DB=medieteknik
POSTGRES_USER=postgres
POSTGRES_PASSWORD=password
SECRET_KEY=secret_key
RECEPTION_MODE=0
EOF
fi
# Check for node and npm
if ! command -v node &> /dev/null
then
echo "Node is not installed. Please install Node.js and try again."
exit
fi
# Installing Frontend requirements
echo "Installing frontend dependencies..."
cd frontend || exit
npm install
# Check for python and pip
if ! command -v python &> /dev/null
then
echo "Python is not installed. Please install Python and try again."
exit
fi
if ! command -v pip &> /dev/null
then
echo "pip is not installed. Please install pip and try again."
exit
fi
cd ..
# Installing Backend requirements
echo "Installing backend dependencies..."
cd backend || exit
pip install -r requirements.txt
# Docker setup
echo "Checking docker status..."
if ! command -v docker &> /dev/null; then
echo "Docker is not installed. Please install Docker and try again."
exit
fi
if ! docker info > /dev/null 2>&1; then
echo "Docker is not running. Please start Docker and try again."
exit
fi
echo "Docker is running. Proceeding with initialization..."
docker-compose up -d --build || { echo "Docker-compose failed. Aborting."; exit 1; }
echo "Initialization complete."