-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstartup.sh
More file actions
54 lines (43 loc) · 1.09 KB
/
Copy pathstartup.sh
File metadata and controls
54 lines (43 loc) · 1.09 KB
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
#!/bin/bash
set -euo pipefail
# Load environment variables
if [ -f .env ]; then
source .env
fi
# Validate environment variables
if [ -z "$NEXT_PUBLIC_API_URL" ]; then
echo "Error: NEXT_PUBLIC_API_URL is not set"
exit 1
fi
# Project root directory
PROJECT_ROOT=$(pwd)
# Logging
LOG_FILE="$PROJECT_ROOT/logs/startup.log"
log_info() {
echo "$(date +"%Y-%m-%d %H:%M:%S") - $1" >> "$LOG_FILE"
}
log_error() {
echo "$(date +"%Y-%m-%d %H:%M:%S") - ERROR: $1" >&2
}
# Cleanup handler
cleanup() {
log_info "Cleaning up..."
# Add cleanup logic for specific services, if needed
# Example:
# pkill -f "your_service_name"
# rm -f "$PROJECT_ROOT/logs/startup.log"
# rm -f "$PROJECT_ROOT/pid/your_service.pid"
}
trap cleanup EXIT ERR
# Main execution flow
log_info "Starting Fitness Tracker MVP..."
# Install dependencies
log_info "Installing dependencies..."
npm install
# Build the Next.js application
log_info "Building the application..."
npm run build
# Start the development server
log_info "Starting the development server..."
npm run dev
log_info "Fitness Tracker MVP started successfully."