summaryrefslogtreecommitdiff
path: root/microservices/start-all.sh
blob: d00c79ac1c685b8ebb77df0d3589def9ed133058 (plain)
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
#!/bin/bash

echo Starting the authorization server, API gateway, resourece server, Vite dev server...

# 1. Clean up background tasks on CTRL+C (SIGINT) or script exit
cleanup() {
    echo " Catching CTRL+C. Terminating background jobs..."
    # Kill all child processes of this script
    pkill -P $$
    exit 1
}

# 2. Assign the cleanup function to the INT signal
trap cleanup INT

# 3. Start your background commands using '&'
echo "Starting tasks..."

cd 01-oauth2-server
./mvnw spring-boot:run &
# Wait a few seconds until authorization server starts
sleep 10 

cd ../02-api-gateway
./mvnw spring-boot:run &

cd ../03-resource-server
./mvnw spring-boot:run &

sleep 10
cd ../04-react-app
npm run dev

# 4. Wait for all background processes to finish
wait