同步操作将从 Moe/TMOE 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
Chapter | Introduction | Doc |
---|---|---|
prologue | * | readme.md |
1: Container Installation and Configuration | In this chapter, we'll take you through the process of installing a rust container using TUI and dissect the concepts you'll encounter during operation. | 1.md |
2 | * | 2.md |
3 | * | 3.md |
Note: This chapter focuses on configuration files.
It is possible that the "configuration files" will be divided into a separate chapter.
English | Chinese
This part is being written!
Progress 0.00001
。。。
problem | note |
---|---|
cannot bind to ports below 1024 | see this issue |
。。。
。。。
。。。
This part hasn't even been started yet!
In tmoe, there are two kinds of configuration files.
One is read-only and the other is writable.
read-only | read-writeable |
---|---|
Generally package release information or data index information | True program configuration files |
We installed rust-nightly in section2 of this chapter, where we encountered "container property information" as a read-only configuration.
The read-only configuration referred to here is not "read only" in terms of file permissions, but is logically read-only.
In fact, you can modify the contents of the file directly, you just shouldn't do it manually.
As an example.
Say you see the version: "1.57.0".
You think : "That's a very low version number! Let's change it to 114514.999.9!"
So, you happily change its properties.
From a subjective point of view: you've had fun. That's great! Because happiness is a positive attitude to life.
From an objective point of view: you have fixed the problem of the low version number. That's good too!
From the original developer's point of view: Dear me, what the xxx (ó﹏ò.)
Note: The above changes will not take effect.
For read-only configurations, if the changes do take effect, then the container may have problems during installation or use.
I am sure you can find out why in the next subsection.
This section analyses the "container property information" that appears in Section 2 (Hello rust) of this chapter.
The read-only configuration of the output of the weekly build container for edition 2022 of tmoe is as follows.
(subject to change afterwards)
[main]
name = "rust"
tag = ["nightly", "unstable"]
os = "debian"
release = "sid"
arch = "arm64"
# If the value is false, then the container will not be downloaded.
completed = false
[file]
name = "rust-nightly-arm64_2021-09-17_20-39.tar.zst"
# Note: The version number refers not to the version number of rust itself, but to the version number of the file.
# In the 2021 edition, the version of the file is not semantic, but only "latest01" and "latest02"
# Since the server only keeps two versions, there are only two versions. Suppose this build is "latest01", then the next one will be "latest02".
# And which one will it be next time? You can take a wild guess.
# From edition 2022 onwards it's not so simple.
# It makes sense to include a specific version number, as the configuration properties may change in 2022 and newer editions.
version = "0.1.1"
# This value can be used to verify the integrity of the file
# For example, suppose there are two files with the same name, both called a.tar.zst and the same size, but in different directories: A/a.tar.zst, B/a.tar.zst
# You may not be able to tell directly if they are the same file
# At this point you can check if they are the same file by comparing their sha256 values, if the sha256 is the same, the files are the same, otherwise they are different.
# Note: Hash collisions etc. are ignored here.
sha256 = "acc668db456e94053322f7049469995ba20e9fe6dcb297367226dca4553b633e"
# [1-22]
zstd-level = 19
[file.size]
# Installed size ≈ tar-size
# Installed size is approximately equal to the size of the tar file
# The tar size is the size of the container image after packaging, the unpacked space may be slightly larger than the tar itself
# The exact size is related to file clusters, which in turn are related to the file system.
tar = "1.6G"
tar-bytes = 1717986919
# Space occupied ≈ tar-size + zstd-size
# You will need to prepare a large enough space before installation.
# Download size: zstd-size
# After the tar is packed, the image is also compressed.
# The size of the file you need to download is the size of zstd, the tar.zst file to be exact
# Before installing a container, you need to consider reserving some space for.
# 1. the size of the zip file, 2. the size of the zip after decompression, 3. the initialisation process of the container also takes up a little space.
zstd = "216M"
zstd-bytes = 226492416
# For edition 2022, the user only needs to look at the version number to know the order of the mirrors, and to know which is newer and which is older.
# It occurred to the developer that there is a feature in tmoe that automatically determines the time order, even if it is an older version.
# Actually time is for developers to see, ordinary users don't need to know how much time the server has spent on a certain process in the build process.
# If you are interested, then I can explain the process.
# 1. once the server has built the image, it needs to package and compress it.
# 2. the zstd below should be exactly "start-zstd", i.e. the point at which zstd compression starts, not the point at which I compressed a file that took dozens of hours!
# 3. After the compression is complete, the file needs to be transferred to another node.
# 3-1. For tmoe's weekly build, instead of all nodes building from scratch, one of the nodes completes the build and then syncs the relevant files to another node.
[time]
format = "rfc-3339"
zone = "UTC"
begin = 2021-09-17T20:08:33.801113258Z
start-zstd = 20:14:20
start-sync_0 = 20:39:22
start-sync_1 = 20:41:33
end = 2021-09-17T20:44:32.392018144Z
[server]
name = "tmoe-us"
node = 2
# available = [1, 2, 3, 4]
# Environment variables (●>ω<●)
[env]
LANG = "en_US.UTF-8"
PATH = "/usr/local/cargo/bin${PATH:+:${PATH}}"
RUSTUP_HOME = "/usr/local/rustup"
CARGO_HOME = "/usr/local/cargo"
[version]
rustup = 'rustup 1.24.3 (ce5817a94 2021-05-31)'
cargo = 'cargo 1.56.0-nightly (e515c3277 2021-09-08)'
rustc = 'rustc 1.57.0-nightly (e4828d5b7 2021-09-16)'
As you can see, there are quite a few differences compared to edition 2021.
The main thing that has changed is the file format, which is txt in edition 2021 and toml in edition 2022.
toml is an excellent format for configuration files.
Next, we will introduce the concept of toml and its common usage.
Finally, we will take a brief look at the concept and usage of "writable configuration".
Tom's Obvious, Minimal Language.
TOML aims to be a minimal configuration file format that's easy to read due to obvious semantics.
TOML is designed to map unambiguously to a hash table.
TOML should be easy to parse into data structures in a wide variety of languages.
The above description is taken from toml's official website, where you can find some detailed instructions.
When talking about toml, many people refer to json
Why not use json? Does it have any advantages over json?
The 2nd issue of toml-lang/toml on github is related to this topic.
But I don't know why too.
So why exactly?
The content of this section will provide the basis for (#3.3-Writable configuration).
In the configuration of the toml container, the following points may be covered.
These are actually common value types in toml itself.
A rarely covered point of knowledge is :
Table arrays are nice to use, but the developers of tmoe (trying to be lazy).
In fact, table arrays are a little bit more complicated to parse.
As a simple example.
[[bin]]
name = "tmm"
[[bin]]
name = "value"
[[bin]]
name = "tmoe"
It's easy to delete all the [[bin]]
or to append and write a new [[bin]]
.
But to modify the data containing the specified value
, you have to do a bit more processing.
Strings are probably the most common type in the configuration file of the tmoe container.
For example
str = "value"
The string type in toml can be either double-quoted or single-quoted.
This is different from rust, where if you use single quotes and do not specify the type, then the compiler will infer by default that the value is of type char (a single character).
let c = 'c';
Back to toml, if you need to enter more than one inverted comma, then write it like this!
str = """I have '''''5 single quotes, and two ""double quotes""""
There are three inverted commas before and after.
For integers, there is no need for inverted commas!
As an example for strings.
int1 = "233"
In the above equation, the value of int will be recognised as a string, not as an integer.
Another integer example.
int2 = 233
As an example of a negative integer.
int3 = -233
The range of integers that toml can accept is i64 (from -2^63 to 2^63-1).
As with rust, for particularly large numbers you can use _ to enhance readability.
int4 = 114_514_233
The above equation is equivalent to the following one
int4 = 114514233
An example of a binary, octal and hexadecimal integer:
# 0b11011111101010010 in binary equals 114514 in decimal
bin = 0b11011111101010010
# Values starting with 0o are octal numbers, guess which number this is
oct1 = 0o337522
# Values starting with 0x are in hexadecimal
hex1 = 0x1BF52
You can't put inverted commas around floating point numbers either!
Here are some examples in decimal and exponential form!
f1 = 3.14159265
f2 = -3.14159265
f3 = 314e-2
f4 = 0.1145e+4
Boolean values have only two values: true and false.
true is true, false is false
true ✓
false X
bool = true
bool2 = false
rfc3339 is a time format.
# You can write just the time
time1 = 01:25:57
time2 = 01:25:00.247810421
# You can also write just the date
date1 = 2021-09-29
# You can also write both
time3 = 2021-09-29T01:25:57Z
# You can split the one above
time4 = 2021-09-29 01:25:57Z
# The Z at the end is UTC, you can replace it with +00:00
# UTC+08:00
time5 = 2021-09-29 01:29:13.598811802+08:00
# You can write in a new line
array1 = [233,
22,
33]
# You can also write it without a line break
array2 = [ "hello", "world" ]
A standard table is also known as a hash table.
Take an example from Cargo
[dependencies]
nom = "7.0.0"
You can write the above table in the following format
[dependencies.nom]
version = "7.0.0"
Inline tables can write multiple rows into a single row.
Let's start with an example of a standard table
[dependencies.tokio]
version = "1.11.0"
features = ["macros", "tcp", "dns", "io-util"]
Another example of an inline table
[dependencies]
tokio = { version = "1.11.0", features = ["macros", "tcp", "dns", "io-util"] }
This part hasn't even been written yet!
This part hasn't even been written yet!
Edition 2022 will use the get
subcommand to get the configuration and the set
subcommand to set the configuration.
A few examples of get
:
# Enter
tmm get uuu distro
# Output
name
host
arch
dir
...
Enter
tmm get uuu distro.name
Output
ubuntu-devel
Enter
tmm get uuu distro.arch
Output
arm64
This part is being written!
Progress (1e-99)%
Chapter | Introduction | Doc |
---|---|---|
previous | Looking Back, Looking Forward | readme.md |
next | Analyzing Errors, Resolving Errors | 2.md |
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。