Skip to content

Commit bd8088b

Browse files
committed
feat: update task configurations and add Docker deployment script for improved workflow
1 parent 3108ea7 commit bd8088b

5 files changed

Lines changed: 62 additions & 276 deletions

File tree

.vscode/tasks.json

Lines changed: 26 additions & 270 deletions
Original file line numberDiff line numberDiff line change
@@ -2,294 +2,50 @@
22
"version": "2.0.0",
33
"tasks": [
44
{
5-
"label": "🚀 cms: dev",
6-
"dependsOn": ["📦 strapi: dev", "🌐 next: dev"],
7-
"dependsOrder": "parallel",
8-
"group": {
9-
"kind": "build",
10-
"isDefault": true
11-
},
12-
"problemMatcher": [],
13-
"icon": {
14-
"id": "rocket",
15-
"color": "terminal.ansiYellow"
16-
}
17-
},
18-
{
19-
"label": "🐳 docker: db-up",
20-
"type": "shell",
21-
"command": "yarn setup",
22-
"presentation": {
23-
"reveal": "always",
24-
"panel": "dedicated"
25-
},
26-
"problemMatcher": [],
27-
"icon": {
28-
"id": "server-environment",
29-
"color": "terminal.ansiBlue"
30-
}
31-
},
32-
{
33-
"label": "📦 strapi: dev",
5+
"label": "🚀 [Dev] Start All",
6+
"detail": "Khởi chạy đồng thời Next.js và Strapi",
347
"type": "shell",
35-
"command": "yarn strapi",
36-
"presentation": {
37-
"reveal": "always",
38-
"panel": "dedicated"
39-
},
8+
"command": "yarn dev",
9+
"group": { "kind": "build", "isDefault": true },
10+
"presentation": { "reveal": "always", "panel": "shared", "clear": true },
4011
"problemMatcher": [],
41-
"icon": {
42-
"id": "package",
43-
"color": "terminal.ansiYellow"
44-
}
12+
"icon": { "id": "rocket", "color": "terminal.ansiYellow" }
4513
},
4614
{
47-
"label": "🌐 next: dev",
15+
"label": "🧹 [Dev] Clean Workspace",
16+
"detail": "Dọn dẹp cache Next.js, build Strapi và kill port bị treo",
4817
"type": "shell",
49-
"command": "yarn next",
50-
"presentation": {
51-
"reveal": "always",
52-
"panel": "dedicated"
53-
},
18+
"command": "yarn clean:full",
19+
"presentation": { "reveal": "always", "panel": "shared", "clear": true },
5420
"problemMatcher": [],
55-
"icon": {
56-
"id": "globe",
57-
"color": "terminal.ansiBlue"
58-
}
21+
"icon": { "id": "trash", "color": "terminal.ansiRed" }
5922
},
6023
{
61-
"label": "📖 docs: dev",
62-
"type": "shell",
63-
"command": "yarn docs:dev",
64-
"presentation": {
65-
"reveal": "always",
66-
"panel": "dedicated"
67-
},
68-
"problemMatcher": [],
69-
"icon": {
70-
"id": "book",
71-
"color": "terminal.ansiMagenta"
72-
}
73-
},
74-
{
75-
"label": "🌱 seed: dev",
24+
"label": "🌱 [Dev] Seed Studio UI",
25+
"detail": "Mở giao diện UI quản lý Seeding và Backup",
7626
"type": "shell",
7727
"command": "yarn seed:ui",
78-
"presentation": {
79-
"reveal": "always",
80-
"panel": "dedicated"
81-
},
82-
"problemMatcher": [],
83-
"icon": {
84-
"id": "code",
85-
"color": "terminal.ansiCyan"
86-
}
87-
},
88-
{
89-
"label": "🧹 cms: clean",
90-
"type": "shell",
91-
"command": "npx kill-port 3000 1337 && yarn clean && npx rimraf next/.next/dev/lock && yarn dev",
92-
"presentation": {
93-
"reveal": "always",
94-
"panel": "dedicated"
95-
},
96-
"problemMatcher": [],
97-
"icon": {
98-
"id": "trash",
99-
"color": "terminal.ansiRed"
100-
}
101-
},
102-
{
103-
"label": "🔑 registry: login",
104-
"type": "shell",
105-
"command": "docker login ${input:registry}",
106-
"presentation": {
107-
"reveal": "always",
108-
"panel": "new"
109-
},
110-
"problemMatcher": [],
111-
"icon": {
112-
"id": "key",
113-
"color": "terminal.ansiYellow"
114-
}
115-
},
116-
{
117-
"label": "🐳 docker: build-strapi",
118-
"type": "shell",
119-
"command": "docker build -t ${input:registry}/strapi-app:${input:tag} ./strapi",
120-
"presentation": {
121-
"reveal": "always",
122-
"panel": "new",
123-
"group": "docker-build"
124-
},
125-
"problemMatcher": [],
126-
"icon": {
127-
"id": "server-environment",
128-
"color": "terminal.ansiBlue"
129-
}
130-
},
131-
{
132-
"label": "🐳 docker: build-next",
133-
"type": "shell",
134-
"command": "docker build -t ${input:registry}/next-app:${input:tag} ./next",
135-
"presentation": {
136-
"reveal": "always",
137-
"panel": "new",
138-
"group": "docker-build"
139-
},
140-
"problemMatcher": [],
141-
"icon": {
142-
"id": "server-environment",
143-
"color": "terminal.ansiBlue"
144-
}
145-
},
146-
{
147-
"label": "🐳 docker: build-all",
148-
"dependsOrder": "sequence",
149-
"dependsOn": [
150-
"🐳 docker: build-strapi",
151-
"🐳 docker: build-next"
152-
],
153-
"problemMatcher": [],
154-
"icon": {
155-
"id": "server-environment",
156-
"color": "terminal.ansiBlue"
157-
}
158-
},
159-
{
160-
"label": "🐳 registry: push-strapi",
161-
"dependsOn": ["🐳 docker: build-strapi"],
162-
"type": "shell",
163-
"command": "docker push ${input:registry}/strapi-app:${input:tag}",
164-
"presentation": {
165-
"reveal": "always",
166-
"panel": "new",
167-
"group": "docker-build"
168-
},
169-
"problemMatcher": [],
170-
"icon": {
171-
"id": "server-environment",
172-
"color": "terminal.ansiBlue"
173-
}
174-
},
175-
{
176-
"label": "🐳 registry: push-next",
177-
"dependsOn": ["🐳 docker: build-next"],
178-
"type": "shell",
179-
"command": "docker push ${input:registry}/next-app:${input:tag}",
180-
"presentation": {
181-
"reveal": "always",
182-
"panel": "new",
183-
"group": "docker-build"
184-
},
185-
"problemMatcher": [],
186-
"icon": {
187-
"id": "server-environment",
188-
"color": "terminal.ansiBlue"
189-
}
190-
},
191-
{
192-
"label": "🐳 registry: push-all",
193-
"dependsOrder": "sequence",
194-
"dependsOn": [
195-
"🐳 registry: push-strapi",
196-
"🐳 registry: push-next"
197-
],
198-
"problemMatcher": [],
199-
"icon": {
200-
"id": "server-environment",
201-
"color": "terminal.ansiBlue"
202-
}
203-
},
204-
{
205-
"label": "🚀 docker compose: local-up",
206-
"type": "shell",
207-
"command": "docker compose up -d",
208-
"presentation": {
209-
"reveal": "always",
210-
"panel": "new",
211-
"group": "docker-local"
212-
},
213-
"problemMatcher": [],
214-
"icon": {
215-
"id": "rocket",
216-
"color": "terminal.ansiYellow"
217-
}
218-
},
219-
{
220-
"label": "🛑 docker compose: local-down",
221-
"type": "shell",
222-
"command": "docker compose down",
223-
"presentation": {
224-
"reveal": "always",
225-
"panel": "new",
226-
"group": "docker-local"
227-
},
228-
"problemMatcher": [],
229-
"icon": {
230-
"id": "stop",
231-
"color": "terminal.ansiRed"
232-
}
233-
},
234-
{
235-
"label": "📜 docker compose: local-logs",
236-
"type": "shell",
237-
"command": "docker compose logs -f",
238-
"presentation": {
239-
"reveal": "always",
240-
"panel": "new",
241-
"group": "docker-local"
242-
},
243-
"problemMatcher": [],
244-
"icon": {
245-
"id": "file-text",
246-
"color": "terminal.ansiCyan"
247-
}
248-
},
249-
{
250-
"label": "🚀 docker compose: prod-up",
251-
"type": "shell",
252-
"command": "docker compose -f compose.prod.yml pull && docker compose -f compose.prod.yml up -d",
253-
"presentation": {
254-
"reveal": "always",
255-
"panel": "new",
256-
"group": "docker-prod"
257-
},
28+
"presentation": { "reveal": "always", "panel": "shared" },
25829
"problemMatcher": [],
259-
"icon": {
260-
"id": "rocket",
261-
"color": "terminal.ansiYellow"
262-
}
30+
"icon": { "id": "code", "color": "terminal.ansiCyan" }
26331
},
26432
{
265-
"label": "🛑 docker compose: prod-down",
33+
"label": "🐳 [Docker] Local DB Up",
34+
"detail": "Khởi động container cơ sở dữ liệu",
26635
"type": "shell",
267-
"command": "docker compose -f compose.prod.yml down",
268-
"presentation": {
269-
"reveal": "always",
270-
"panel": "new",
271-
"group": "docker-prod"
272-
},
36+
"command": "yarn setup:db",
37+
"presentation": { "reveal": "always", "panel": "shared" },
27338
"problemMatcher": [],
274-
"icon": {
275-
"id": "stop",
276-
"color": "terminal.ansiRed"
277-
}
39+
"icon": { "id": "database", "color": "terminal.ansiBlue" }
27840
},
27941
{
280-
"label": "📜 docker compose: prod-logs",
42+
"label": "🚢 [Deploy] Build & Push Images",
43+
"detail": "Đóng gói và đẩy Docker image lên Registry (Next.js & Strapi)",
28144
"type": "shell",
282-
"command": "docker compose -f compose.prod.yml logs -f",
283-
"presentation": {
284-
"reveal": "always",
285-
"panel": "new",
286-
"group": "docker-prod"
287-
},
45+
"command": "yarn deploy ${input:registry} ${input:tag}",
46+
"presentation": { "reveal": "always", "panel": "shared", "clear": true },
28847
"problemMatcher": [],
289-
"icon": {
290-
"id": "file-text",
291-
"color": "terminal.ansiCyan"
292-
}
48+
"icon": { "id": "server-environment", "color": "terminal.ansiMagenta" }
29349
}
29450
],
29551
"inputs": [
@@ -302,7 +58,7 @@
30258
{
30359
"id": "tag",
30460
"type": "promptString",
305-
"description": "Image Tag (e.g. v1, latest, 2024-05-14)",
61+
"description": "Image Tag (e.g. v1, latest)",
30662
"default": "latest"
30763
}
30864
]

docs/guide/architecture.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ Sau khi push image lên Registry, bạn **không cần SSH** vào VPS. Watchtowe
177177
| Registry | `5000` | `5000` | Docker Registry API |
178178
| Registry UI | `5001` | `5001` | Registry Web UI |
179179
| Nginx UI | `80/443` | **Internet** | SSL + Reverse Proxy |
180-
| Dozzle | `8080` | `127.0.0.1` only | Log Viewer |
180+
| Dozzle | `8888` | `127.0.0.1` only | Log Viewer |
181181
| Cockpit | `9090` | `9090` | Server Admin |
182182

183183
::: warning Chỉ port 80/443 mở ra Internet
@@ -197,7 +197,7 @@ Bạn hoàn toàn có thể chạy hệ thống chỉ với IP. Xem hướng d
197197
| `nhaateliertattoo.com` | Website (Next.js) | `8000` | Trang chính |
198198
| `admin.nhaateliertattoo.com` | Strapi Admin | `1337` | Quản trị nội dung |
199199
| `nginx-ui.nhaateliertattoo.com` | Nginx UI | `9000` | Quản lý Nginx + SSL |
200-
| `dozzle.nhaateliertattoo.com` | Dozzle Logs | `8080` | Xem log (Basic Auth) |
200+
| `dozzle.nhaateliertattoo.com` | Dozzle Logs | `8080 (Docker) / 8888 (Host)` | Xem log (Basic Auth) |
201201
| `registry-ui.nhaateliertattoo.com` | Registry UI | `5001` | Quản lý Docker images |
202202
| `cockpit.nhaateliertattoo.com` | Cockpit | `9090` | Quản lý server |
203203

docs/guide/registry-stack.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ flowchart TB
3535
subgraph Services["Docker Services"]
3636
Registry["📦 Docker Registry\n(:5000)"]
3737
RegUI["🖼️ Registry UI\n(:5001)"]
38-
Dozzle["📜 Dozzle Logs\n(:8080 localhost)"]
38+
Dozzle["📜 Dozzle Logs\n(:8888 localhost)"]
3939
WT["🔄 Watchtower\n(no port)"]
4040
end
4141
@@ -182,7 +182,10 @@ server {
182182
auth_basic_user_file /etc/nginx/registry.password;
183183
184184
location / {
185-
proxy_pass http://127.0.0.1:8080;
185+
# Nếu Nginx chạy chung network Docker (Nginx UI - Khuyến nghị):
186+
proxy_pass http://dozzle:8080;
187+
# Nếu Nginx chạy trực tiếp trên Host (ngoài Docker):
188+
# proxy_pass http://127.0.0.1:8888;
186189
proxy_set_header Host $host;
187190
proxy_set_header X-Real-IP $remote_addr;
188191
@@ -327,7 +330,7 @@ Chỉ các port sau được mở ra Internet:
327330
| `80` | HTTP | Nginx UI |
328331
| `443` | HTTPS | Nginx UI (SSL) |
329332

330-
Tất cả port khác (`5000`, `5001`, `8080`, `9090`) chỉ truy cập qua Docker network nội bộ hoặc qua reverse proxy của Nginx UI.
333+
Tất cả port khác (`5000`, `5001`, `8888`, `9090`) chỉ truy cập qua Docker network nội bộ hoặc qua reverse proxy của Nginx UI.
331334

332335
---
333336

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
"docs:preview": "cd docs && yarn preview",
2929
"seed:disable": "bash scripts/toggle-seed.sh disable",
3030
"seed:enable": "bash scripts/toggle-seed.sh enable",
31-
"seed:ui": "cd seed-studio && concurrently -n \"vite,server\" -c \"cyan,magenta\" \"yarn dev\" \"npm run server\""
31+
"seed:ui": "cd seed-studio && concurrently -n \"vite,server\" -c \"cyan,magenta\" \"yarn dev\" \"npm run server\"",
32+
"deploy": "bash scripts/docker-deploy.sh"
3233
},
3334
"dependencies": {
3435
"@strapi/plugin-documentation": "^5.45.1",

0 commit comments

Comments
 (0)