Skip to content

Commit 00352fb

Browse files
committed
docs: update README for callback port description
1 parent 8d16ee7 commit 00352fb

2 files changed

Lines changed: 400 additions & 2 deletions

File tree

docs/USER_GUIDE.md

Lines changed: 398 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,398 @@
1+
# AgbCloud CLI User Guide
2+
3+
This guide will walk you through how to use the AgbCloud CLI tool for image management operations.
4+
5+
## Table of Contents
6+
7+
- [Prerequisites](#prerequisites)
8+
- [1. Login Authentication](#1-login-authentication)
9+
- [2. Create Image](#2-create-image)
10+
- [3. Activate Image](#3-activate-image)
11+
- [4. Deactivate Image](#4-deactivate-image)
12+
- [5. List Images](#5-list-images)
13+
- [FAQ](#faq)
14+
15+
## Prerequisites
16+
17+
Before getting started, please ensure:
18+
- AgbCloud CLI tool is installed
19+
- You have a valid AgbCloud account
20+
- Network connection is available
21+
22+
## 1. Login Authentication
23+
24+
Before using any image management features, you need to log in to AgbCloud.
25+
26+
### Command Syntax
27+
28+
```bash
29+
agb login
30+
```
31+
32+
### Usage Steps
33+
34+
1. **Execute login command**:
35+
```bash
36+
agb login
37+
```
38+
39+
2. **System response**:
40+
```
41+
[SEC] Starting AgbCloud authentication...
42+
[SIGNAL] Using callback port: 8080
43+
[WEB] Requesting OAuth login URL...
44+
[OK] Successfully retrieved OAuth URL!
45+
[DOC] Request ID: req-xxxxx
46+
[SEARCH] Trace ID: trace-xxxxx
47+
48+
[>>] Starting local callback server on port 8080...
49+
[LINK] OAuth URL:
50+
https://agb.cloud/oauth/authorize?...
51+
52+
[WEB] Opening the browser for authentication...
53+
```
54+
55+
3. **Browser authentication**:
56+
- CLI will automatically open the browser
57+
- If the browser doesn't open automatically, manually copy the URL to your browser
58+
- Complete Google account authentication in the browser
59+
60+
4. **Authentication successful**:
61+
```
62+
[OK] Authentication successful!
63+
[KEY] Received authorization code: abcd1234...
64+
[REFRESH] Exchanging authorization code for access token...
65+
[OK] Login successful!
66+
```
67+
68+
### Notes
69+
70+
- Login session has a certain validity period, re-login is required after expiration
71+
- Login information is securely stored in local configuration files
72+
73+
## 2. Create Image
74+
75+
Creating custom images requires providing a Dockerfile and base image ID.
76+
77+
### Command Syntax
78+
79+
```bash
80+
agb image create <image-name> --dockerfile <dockerfile-path> --imageId <base-image-id>
81+
```
82+
83+
### Parameter Description
84+
85+
- `<image-name>`: Custom image name (required)
86+
- `--dockerfile, -f`: Dockerfile file path (required)
87+
- `--imageId, -i`: Base image ID (required)
88+
89+
### Usage Examples
90+
91+
```bash
92+
# Full command
93+
agb image create myCustomImage --dockerfile ./Dockerfile --imageId agb-code-space-1
94+
95+
# Using short parameters
96+
agb image create myCustomImage -f ./Dockerfile -i agb-code-space-1
97+
```
98+
99+
### Execution Flow
100+
101+
1. **Start creation**:
102+
```
103+
[BUILD] Creating image 'myCustomImage'...
104+
[SIGNAL] Getting upload credentials...
105+
[OK] Upload credentials obtained (Task ID: task-xxxxx)
106+
```
107+
108+
2. **Upload Dockerfile**:
109+
```
110+
[UPLOAD] Uploading Dockerfile...
111+
[OK] Dockerfile uploaded successfully
112+
```
113+
114+
3. **Create image**:
115+
```
116+
[WORK] Creating image...
117+
[OK] Image creation initiated
118+
```
119+
120+
4. **Monitor progress**:
121+
```
122+
[MONITOR] Monitoring image creation progress...
123+
[DATA] Status: Creating
124+
[DATA] Status: Available
125+
[OK] Image creation completed successfully!
126+
```
127+
128+
### Image Status Description
129+
130+
- **Creating**: Image is being created
131+
- **Create Failed**: Image creation failed
132+
- **Available**: Image creation completed and ready to use
133+
134+
## 3. Activate Image
135+
136+
Activating an image starts a running instance. You can specify CPU and memory resources.
137+
138+
### Command Syntax
139+
140+
```bash
141+
agb image activate <image-id> [--cpu <cores>] [--memory <gb>]
142+
```
143+
144+
### Parameter Description
145+
146+
- `<image-id>`: Image ID to activate (required)
147+
- `--cpu, -c`: CPU cores (optional, must be used together with memory parameter)
148+
- `--memory, -m`: Memory size in GB (optional, must be used together with CPU parameter)
149+
150+
**Supported CPU/Memory combinations:**
151+
- `2c4g`: 2 CPU cores + 4 GB memory
152+
- `4c8g`: 4 CPU cores + 8 GB memory
153+
- `8c16g`: 8 CPU cores + 16 GB memory
154+
155+
**Note:** If CPU and memory parameters are not specified, default resource configuration will be used. If specified, both CPU and memory must be provided and must be one of the supported combinations above.
156+
157+
### Usage Examples
158+
159+
```bash
160+
# Basic activation (using default resources)
161+
agb image activate img-7a8b9c1d0e
162+
163+
# Using 2c4g configuration
164+
agb image activate img-7a8b9c1d0e --cpu 2 --memory 4
165+
166+
# Using 4c8g configuration
167+
agb image activate img-7a8b9c1d0e --cpu 4 --memory 8
168+
169+
# Using 8c16g configuration
170+
agb image activate img-7a8b9c1d0e --cpu 8 --memory 16
171+
172+
# Using short parameters
173+
agb image activate img-7a8b9c1d0e -c 4 -m 8
174+
```
175+
176+
### Execution Flow
177+
178+
1. **Start activation**:
179+
```
180+
[>>] Activating image 'img-7a8b9c1d0e'...
181+
[SAVE] CPU: 4 cores, Memory: 8 GB
182+
[SEARCH] Checking current image status...
183+
```
184+
185+
2. **Status check**:
186+
```
187+
[DATA] Current Status: Available
188+
[OK] Image is available, proceeding with activation...
189+
[REFRESH] Starting image activation...
190+
```
191+
192+
3. **Activation successful**:
193+
```
194+
[OK] Image activation initiated successfully!
195+
[DATA] Operation Status: true
196+
[SEARCH] Request ID: req-xxxxx
197+
```
198+
199+
4. **Monitor activation status**:
200+
```
201+
[MONITOR] Monitoring image activation status...
202+
[DATA] Status: Activating
203+
[DATA] Status: Activated
204+
[OK] Image activation completed successfully!
205+
```
206+
207+
### Image Activation Status Description
208+
209+
- **Available**: Image is available but not activated
210+
- **Activating**: Image is being activated
211+
- **Activated**: Image is activated and running
212+
- **Activate Failed**: Image activation failed
213+
- **Ceased Billing**: Image has stopped billing
214+
215+
### Special Case Handling
216+
217+
- If the image is already activated, the system will display the current status
218+
- If the image is being activated, it will automatically join the monitoring process
219+
- If the image is in a failed state, it will attempt to reactivate
220+
- **If an invalid CPU/memory combination is specified, the system will show an error and display supported combinations**
221+
222+
### Error Examples
223+
224+
```bash
225+
# Invalid combination example
226+
agb image activate img-7a8b9c1d0e --cpu 3 --memory 6
227+
228+
# Error output
229+
[ERROR] Invalid CPU/Memory combination: 3c6g
230+
231+
[TOOL] Supported combinations:
232+
• 2c4g: --cpu 2 --memory 4
233+
• 4c8g: --cpu 4 --memory 8
234+
• 8c16g: --cpu 8 --memory 16
235+
```
236+
237+
## 4. Deactivate Image
238+
239+
Deactivate (stop) a running image instance.
240+
241+
### Command Syntax
242+
243+
```bash
244+
agb image deactivate <image-id>
245+
```
246+
247+
### Parameter Description
248+
249+
- `<image-id>`: Image ID to deactivate (required)
250+
251+
### Usage Examples
252+
253+
```bash
254+
agb image deactivate img-7a8b9c1d0e
255+
```
256+
257+
### Execution Flow
258+
259+
1. **Start deactivation**:
260+
```
261+
🛑 Deactivating image 'img-7a8b9c1d0e'...
262+
[REFRESH] Deactivating image instance...
263+
```
264+
265+
2. **Deactivation successful**:
266+
```
267+
[OK] Image deactivation initiated successfully!
268+
[DATA] Operation Status: true
269+
[SEARCH] Request ID: req-xxxxx
270+
```
271+
272+
### Notes
273+
274+
- Deactivating an image will terminate the running instance
275+
- The image status will change to "Available" after deactivation
276+
- Deactivation operation usually takes effect immediately
277+
278+
## 5. List Images
279+
280+
View your image list with pagination and type filtering support.
281+
282+
### Command Syntax
283+
284+
```bash
285+
agb image list [--type <type>] [--page <page-number>] [--size <page-size>]
286+
```
287+
288+
### Parameter Description
289+
290+
- `--type, -t`: Image type, options:
291+
- `User`: User custom images (default)
292+
- `System`: System-provided base images
293+
- `--page, -p`: Page number, default is 1
294+
- `--size, -s`: Items per page, default is 10
295+
296+
### Usage Examples
297+
298+
```bash
299+
# View user images (default)
300+
agb image list
301+
302+
# View system images
303+
agb image list --type System
304+
305+
# Paginated view
306+
agb image list --page 2 --size 5
307+
308+
# Using short parameters
309+
agb image list -t User -p 1 -s 20
310+
```
311+
312+
### Output Example
313+
314+
```
315+
[DOC] Listing User images (Page 1, Size 10)...
316+
[SEARCH] Fetching image list...
317+
[OK] Found 3 images (Total: 3)
318+
[PAGE] Page 1 of 1 (Page Size: 10)
319+
320+
IMAGE ID IMAGE NAME STATUS TYPE UPDATED AT
321+
-------- ---------- ------ ---- ----------
322+
img-7a8b9c1d0e myCustomImage Available User 2025-01-15 10:30
323+
img-2f3g4h5i6j webAppImage Activated User 2025-01-15 09:15
324+
img-8k9l0m1n2o dataProcessImage Creating User 2025-01-15 11:45
325+
```
326+
327+
### Status Description
328+
329+
Images can be in the following states:
330+
331+
**Creation-related statuses:**
332+
- **Creating**: Image is being created
333+
- **Create Failed**: Image creation failed
334+
- **Available**: Image creation completed and ready to use
335+
336+
**Activation-related statuses:**
337+
- **Activating**: Image is being activated
338+
- **Activated**: Image is activated and running
339+
- **Deactivating**: Image is being deactivated
340+
- **Activate Failed**: Image activation failed
341+
- **Ceased Billing**: Image has stopped billing
342+
343+
## FAQ
344+
345+
### Q: How to view command help?
346+
347+
A: Add `--help` or `-h` parameter after any command:
348+
349+
```bash
350+
agb --help
351+
agb image --help
352+
agb image create --help
353+
```
354+
355+
### Q: What to do if login fails?
356+
357+
A: Please check:
358+
1. Network connection is normal
359+
2. Browser can access agb.cloud normally
360+
3. You have a valid Google account
361+
4. Firewall is not blocking the callback port
362+
363+
### Q: What to do if image creation fails?
364+
365+
A: Please check:
366+
1. Dockerfile syntax is correct
367+
2. Base image ID is valid
368+
3. Network connection is stable
369+
4. Check the Request ID in error messages for technical support
370+
371+
### Q: How to view detailed execution information?
372+
373+
A: Use `--verbose` or `-v` parameter:
374+
375+
```bash
376+
agb -v image create myImage -f ./Dockerfile -i agb-code-space-1
377+
```
378+
379+
### Q: What to do if image activation is slow?
380+
381+
A: Image activation may take several minutes, especially when:
382+
- First time activating a specific image
383+
- Image is large
384+
- System load is high
385+
386+
Please be patient, the system will automatically monitor activation status.
387+
388+
### Q: How to get base image IDs?
389+
390+
A: Use the image list command to view system images:
391+
392+
```bash
393+
agb image list --type System
394+
```
395+
396+
---
397+
398+
**Technical Support**: If you encounter issues, please contact the technical support team and provide relevant Request ID and Trace ID.

0 commit comments

Comments
 (0)