forked from jphacks/tk_a_2515
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmise.toml
More file actions
133 lines (115 loc) · 3.8 KB
/
Copy pathmise.toml
File metadata and controls
133 lines (115 loc) · 3.8 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
[tools]
node = "26.3.0"
"npm:pnpm" = "11.8.0"
python = "3.12"
uv = "0.11.21"
[tasks.export-openapi]
description = "Export Django OpenAPI schema to YAML"
run = """
cd backend && docker compose exec -T api \
bash -lc 'uv run python -u commons/export_openapi.py docs/openapi.yaml'
"""
[tasks.generate-lib-api]
description = "docs/openapi.yamlに基づいてlib/apiを作成"
run = "npx orval --config ./frontend/orval.config.cjs"
depends = ["export-openapi"]
[tasks.start-backend]
run = "cd backend && docker compose up -d"
description = "Start backend services using Docker Compose"
[tasks.prepare-db]
run = """
cd backend && docker compose exec -T api \
bash -lc 'uv run python -u manage.py makemigrations && uv run python -u manage.py migrate'
"""
[tasks.backend-uv]
description = "Run backend with uv"
run = "cd backend && uv sync"
[tasks.merge-path]
description = "Merge path data"
run = """
cd backend && docker compose exec -T api bash -lc 'uv run python -u paths/merge.py'
"""
depends = ["prepare-db"]
[tasks.import-mountain-data]
description = "Import mountain data"
run = """cd backend && docker compose exec -T api \
bash -lc 'uv run python -u commons/import_mountains.py'
"""
depends = ["prepare-db"]
[tasks.import-path-data]
description = "Import path data"
run = """
cd backend && docker compose exec -T api bash -lc 'uv run python -u commons/import_paths.py'
"""
depends = ["prepare-db"]
[tasks.delete-path-data]
description = "Delete path data"
run = """
cd backend && docker compose exec -T api bash -lc 'uv run python -u commons/delete_paths.py'
"""
depends = ["prepare-db"]
[tasks.import-bear-sight]
description = "Import bear sighting data"
run = """cd backend && docker compose exec -T api \
bash -lc 'uv run python -u commons/import_bear_sight.py'
"""
depends = ["prepare-db"]
[tasks.start-frontend]
run = "cd frontend && docker compose up --build -d"
description = "Start frontend services (Next.js + Redis) using Docker Compose"
[tasks.frontend-setup]
run = "cd frontend && pnpm install && docker compose up -d"
[tasks.frontend-dev]
run = """
cd frontend && bash -c '
docker compose stop app || true
docker compose up -d redis
set -a
[ -f .env ] && source .env
set +a
pnpm dev
'
"""
[tasks.build-preview]
description = "Build the All-in-One deployment Docker image locally for testing"
run = """
bash -c '
set -a
source frontend/.env
set +a
docker build -t peak-sight-preview -f Dockerfile.deploy \\
--build-arg NEXT_PUBLIC_FULL_URL=${NEXT_PUBLIC_FULL_URL:-http://localhost:3400/peak-sight} \\
--build-arg NEXT_PUBLIC_BACKEND_URL=${NEXT_PUBLIC_BACKEND_URL:-http://localhost:8200} \\
--build-arg NEXT_PUBLIC_BASE_PATH=${NEXT_PUBLIC_BASE_PATH:-/peak-sight} \\
--build-arg POSTGRES_DB=${POSTGRES_DB:-app} \\
--build-arg POSTGRES_USER=${POSTGRES_USER:-app} \\
--build-arg POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-app} \\
.
'
"""
[tasks.start-preview]
description = "Start the locally built All-in-One deployment image with Redis Exporter"
run = """
bash -c '
docker stop peak-sight-preview || true
docker rm peak-sight-preview || true
docker stop peak-sight-preview-redis-exporter || true
docker rm peak-sight-preview-redis-exporter || true
docker network create peak-sight-preview-net || true
docker run -d --name peak-sight-preview \
--network peak-sight-preview-net \
-p 127.0.0.1:3400:3400 \
-p 127.0.0.1:8200:8200 \
--env-file frontend/.env \
--env-file backend/.env \
peak-sight-preview
docker run -d --name peak-sight-preview-redis-exporter \
--network peak-sight-preview-net \
-p 127.0.0.1:9121:9121 \
-e REDIS_ADDR=redis://peak-sight-preview:6379 \
bitnami/redis-exporter:latest
echo "Containers started!"
echo "- App logs: docker logs -f peak-sight-preview"
echo "- Exporter logs: docker logs -f peak-sight-preview-redis-exporter"
'
"""