Skip to content

Commit 4ed6899

Browse files
committed
fix: 添加一体化部署的完整说明
1 parent dbe6e8c commit 4ed6899

4 files changed

Lines changed: 667 additions & 389 deletions

File tree

docs/en/guide/oneclickvirt/oneclickvirt_custom.md

Lines changed: 240 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,243 @@
22
outline: deep
33
---
44

5-
Occupancy pending construction
5+
## Configuration File
6+
7+
The default settings are sufficient for light usage. If advanced customization is needed, you need to modify the configuration file or make modifications in the admin interface after initialization.
8+
9+
https://github.com/oneclickvirt/oneclickvirt/blob/main/server/config.yaml
10+
11+
Here is the complete initialization configuration file. The specific configuration items will be explained below:
12+
13+
### auth Authentication Configuration
14+
15+
```yaml
16+
auth:
17+
email-password: ""
18+
email-smtp-host: ""
19+
email-smtp-port: "3306"
20+
email-username: root
21+
enable-email: false
22+
enable-oauth2: false
23+
enable-public-registration: false
24+
enable-qq: false
25+
enable-telegram: false
26+
qq-app-id: ""
27+
qq-app-key: ""
28+
telegram-bot-token: ""
29+
frontend-url: ""
30+
```
31+
32+
Configuration items for the authentication module, used to control user login and registration methods and third-party login integration.
33+
34+
- `email-password`: Authentication password for email service, used for identity verification when sending emails via SMTP
35+
- `email-smtp-host`: SMTP server address, such as `smtp.gmail.com`
36+
- `email-smtp-port`: SMTP server port, common ports are `25`, `465` (SSL), `587` (TLS)
37+
- `email-username`: SMTP server login username, usually the complete email address
38+
- `enable-email`: Whether to enable email login functionality
39+
- `enable-oauth2`: Whether to enable OAuth2 third-party login functionality
40+
- `enable-public-registration`: Whether to allow public registration; when disabled, only administrators can create accounts
41+
- `enable-qq`: Whether to enable QQ login
42+
- `enable-telegram`: Whether to enable Telegram login
43+
- `qq-app-id`: App ID applied for from QQ Connect platform
44+
- `qq-app-key`: App Key applied for from QQ Connect platform
45+
- `telegram-bot-token`: API Token for Telegram Bot
46+
- `frontend-url`: Frontend access address, must include protocol header (`http://` or `https://`), trailing slash is optional. OAuth2 callback address depends on this configuration
47+
48+
### captcha Verification Code Configuration
49+
50+
```yaml
51+
captcha:
52+
enabled: true
53+
expire-time: 300
54+
height: 40
55+
length: 4
56+
width: 120
57+
```
58+
59+
Configuration for generating and verifying graphical verification codes, used for security verification on frontend login and registration pages.
60+
61+
- `enabled`: Whether to enable verification code functionality
62+
- `expire-time`: Verification code expiration time, in seconds
63+
- `height`: Verification code image height, in pixels
64+
- `length`: Verification code character length
65+
- `width`: Verification code image width, in pixels
66+
67+
### cdn Content Delivery Network Configuration
68+
69+
```yaml
70+
cdn:
71+
base-endpoint: https://cdn.spiritlhl.net/
72+
endpoints:
73+
- https://cdn0.spiritlhl.top/
74+
- http://cdn3.spiritlhl.net/
75+
- http://cdn1.spiritlhl.net/
76+
- http://cdn2.spiritlhl.net/
77+
```
78+
79+
CDN acceleration node configuration used when downloading system images.
80+
81+
- `base-endpoint`: Primary CDN node address, used with priority
82+
- `endpoints`: Backup CDN node list, retried in order. The system will automatically select available nodes for image downloads
83+
84+
Generally, this configuration does not need to be modified. Preloaded system images are all hosted in the organization's repository, and the default CDN nodes already provide good download acceleration.
85+
86+
### mysql Database Configuration
87+
88+
```yaml
89+
mysql:
90+
auto-create: true
91+
config: charset=utf8mb4&parseTime=True&loc=Local
92+
db-name: oneclickvirt
93+
engine: InnoDB
94+
log-mode: error
95+
log-zap: false
96+
max-idle-conns: 10
97+
max-lifetime: 3600
98+
max-open-conns: 100
99+
password: ""
100+
path: ""
101+
port: ""
102+
prefix: ""
103+
singular: false
104+
username: root
105+
```
106+
107+
MySQL database connection and behavior configuration. Initialization judgment logic: when both `path` and `port` are empty, the system considers initialization is needed, and the target database must be an empty database at this time.
108+
109+
- `auto-create`: Whether to automatically create the database (if it doesn't exist)
110+
- `config`: Database connection parameters, including character set, time parsing, etc.
111+
- `db-name`: Database name
112+
- `engine`: Database storage engine, InnoDB is recommended
113+
- `log-mode`: Database log mode, options are `silent`, `error`, `warn`, `info`
114+
- `log-zap`: Whether to use zap log library to record database logs
115+
- `max-idle-conns`: Maximum number of idle connections
116+
- `max-lifetime`: Maximum connection lifetime, in seconds
117+
- `max-open-conns`: Maximum number of open connections
118+
- `password`: Database password
119+
- `path`: Database server address
120+
- `port`: Database server port
121+
- `prefix`: Database table name prefix
122+
- `singular`: Whether to use singular table names (default is plural)
123+
- `username`: Database username
124+
125+
### quota Quota Limit Configuration
126+
127+
```yaml
128+
quota:
129+
default-level: 1
130+
instance-type-permissions:
131+
min-level-for-container: 1
132+
min-level-for-delete: 2
133+
min-level-for-vm: 1
134+
level-limits:
135+
1:
136+
max-instances: 1
137+
max-resources:
138+
bandwidth: 10
139+
cpu: 1
140+
disk: 1025
141+
memory: 350
142+
max-traffic: 102400
143+
2:
144+
max-instances: 3
145+
max-resources:
146+
bandwidth: 20
147+
cpu: 2
148+
disk: 20480
149+
memory: 1024
150+
max-traffic: 204800
151+
3:
152+
max-instances: 5
153+
max-resources:
154+
bandwidth: 50
155+
cpu: 4
156+
disk: 40960
157+
memory: 2048
158+
max-traffic: 307200
159+
4:
160+
max-instances: 10
161+
max-resources:
162+
bandwidth: 100
163+
cpu: 8
164+
disk: 81920
165+
memory: 4096
166+
max-traffic: 409600
167+
5:
168+
max-instances: 20
169+
max-resources:
170+
bandwidth: 200
171+
cpu: 16
172+
disk: 163840
173+
memory: 8192
174+
max-traffic: 512000
175+
```
176+
177+
Configuration for controlling user levels and resource quotas. The default unit for memory, disk, and traffic is MB.
178+
179+
#### Global Configuration
180+
181+
- `default-level`: Default level for newly registered users
182+
183+
#### instance-type-permissions Instance Type Permissions
184+
185+
Controls the types of operations that users of different levels can perform.
186+
187+
- `min-level-for-container`: Minimum user level required to create container instances
188+
- `min-level-for-delete`: Minimum level required to perform delete operations on the regular user side
189+
- `min-level-for-vm`: Minimum user level required to create virtual machine instances
190+
191+
#### level-limits Level Quota Limits
192+
193+
Defines the resource quota limits corresponding to each user level, with the key being the level number.
194+
195+
Each level includes the following configurations:
196+
197+
- `max-instances`: Maximum number of instances that users of this level can create
198+
- `max-resources`: Maximum resource limits for a single instance
199+
- `bandwidth`: Maximum bandwidth, in Mbps
200+
- `cpu`: Maximum number of CPU cores
201+
- `disk`: Maximum disk space, in MB
202+
- `memory`: Maximum memory, in MB
203+
- `max-traffic`: Maximum total traffic for users of this level, in MB
204+
205+
### zap Log Configuration
206+
207+
```yaml
208+
zap:
209+
compress-logs: true
210+
director: storage/logs
211+
encode-level: LowercaseLevelEncoder
212+
format: console
213+
level: info
214+
log-in-console: false
215+
max-array-elements: 5
216+
max-backups: 15
217+
max-file-size: 5
218+
max-log-length: 2000
219+
max-string-length: 1000
220+
prefix: '[oneclickvirt]'
221+
retention-day: 3
222+
show-line: false
223+
stacktrace-key: stacktrace
224+
```
225+
226+
Detailed configuration for system log recording, based on the zap log library.
227+
228+
- `compress-logs`: Whether to compress archived log files
229+
- `director`: Log file storage directory
230+
- `encode-level`: Log level encoding method, options are `LowercaseLevelEncoder` (lowercase), `CapitalLevelEncoder` (uppercase)
231+
- `format`: Log output format, options are `console` (console format), `json` (JSON format)
232+
- `level`: Log level, options are `debug`, `info`, `warn`, `error`. It is recommended to use `debug` during development and debugging, and `info` or `warn` in production environments
233+
- `log-in-console`: Whether to also output logs to the console
234+
- `max-array-elements`: Maximum number of elements recorded for array type fields
235+
- `max-backups`: Maximum number of historical log files to retain
236+
- `max-file-size`: Maximum size of a single log file, in MB
237+
- `max-log-length`: Maximum length of a single log entry; parts exceeding this will be truncated
238+
- `max-string-length`: Maximum recording length for string fields
239+
- `prefix`: Log prefix identifier
240+
- `retention-day`: Number of days to retain log files; expired files are automatically deleted
241+
- `show-line`: Whether to display the filename and line number of the log call
242+
- `stacktrace-key`: Key name for stack trace information
243+
244+
Note: When debugging issues, `level` should be set to `debug` to obtain detailed log information.

0 commit comments

Comments
 (0)