-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·135 lines (113 loc) · 2.9 KB
/
setup.sh
File metadata and controls
executable file
·135 lines (113 loc) · 2.9 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/usr/bin/env bash
set -e
echo "Checking Projections - Install"
echo "==============================="
echo
# Create directories
mkdir -p data secrets config
# Create config/.env if missing
if [ ! -f config/.env ]; then
touch config/.env
echo "Created config/.env"
else
echo "config/.env already exists, skipping"
fi
# Create secrets/plaid_tokens.json if missing
if [ ! -f secrets/plaid_tokens.json ]; then
echo '{}' > secrets/plaid_tokens.json
chmod 600 secrets/plaid_tokens.json
echo "Created secrets/plaid_tokens.json"
else
echo "secrets/plaid_tokens.json already exists, skipping"
fi
# Create config/config.yaml if missing
if [ ! -f config/config.yaml ]; then
cat > config/config.yaml <<'EOF'
plaid:
environment: development
accounts:
checking:
plaid_item: ""
account_name: ""
credit_cards: []
smtp:
host: smtp.gmail.com
port: 465
username: ""
password: ""
from: ""
to: ""
thresholds:
low_balance_warning: 5000
schedule:
sync:
days: "mon,wed,sat"
hour: 10
minute: 0
digest:
days: "sat"
hour: 10
minute: 5
digest:
projection_days_detail: 30
projection_days_lowpoint: 30
data_dir: ./data
EOF
echo "Created config/config.yaml"
else
echo "config/config.yaml already exists, skipping"
fi
# Create config/recurring.yaml if missing
if [ ! -f config/recurring.yaml ]; then
cat > config/recurring.yaml <<'EOF'
transactions: []
EOF
echo "Created config/recurring.yaml"
else
echo "config/recurring.yaml already exists, skipping"
fi
# Build image if it doesn't exist yet
IMAGE=$(docker compose config --images 2>/dev/null | head -1)
if [ -z "$(docker images -q "$IMAGE" 2>/dev/null)" ]; then
echo
echo "Building Docker image..."
docker compose build
else
echo
echo "Docker image already built, skipping (run 'docker compose build' to rebuild)"
fi
# Stop running application if needed
if docker compose ps --status running 2>/dev/null | grep -q checking-projections; then
echo
echo "Stopping running application..."
docker compose down
fi
echo
echo "Starting setup wizard..."
echo
# Run the wizard in the background, then open the browser once it's ready
docker compose run --rm -p 8485:8485 checking-projections setup &
WIZARD_PID=$!
# Wait for the wizard to be reachable
until curl -s -o /dev/null http://localhost:8485/ 2>/dev/null; do
sleep 0.5
done
# Open in default browser (macOS: open, Linux: xdg-open)
if command -v open &>/dev/null; then
open http://localhost:8485
elif command -v xdg-open &>/dev/null; then
xdg-open http://localhost:8485
else
echo "Open http://localhost:8485 in your browser to complete setup."
fi
echo "Complete the setup in your browser."
echo
# Wait for the wizard to exit (user clicks "Finish & Close")
wait $WIZARD_PID 2>/dev/null || true
echo
echo "Setup complete. Starting application..."
docker compose up -d
echo
echo "Checking Projections is now running."
echo "View logs with: docker compose logs -f"
echo