Skip to content

Commit 1898c9f

Browse files
authored
chore: release yukid as well (#50)
* chore: release yukid as well Signed-off-by: Jian Zeng <anonymousknight96@gmail.com> * doc: update README Signed-off-by: Jian Zeng <anonymousknight96@gmail.com> --------- Signed-off-by: Jian Zeng <anonymousknight96@gmail.com>
1 parent 94feecd commit 1898c9f

File tree

2 files changed

+71
-7
lines changed

2 files changed

+71
-7
lines changed

.goreleaser.yaml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,21 @@ before:
22
hooks:
33
- go mod tidy
44
builds:
5-
# NOTE: Currently, we cannot distribute yukid as a binary, because it requires CGO.
6-
# Instead, we distribute it as a Docker image. Please refer to the release workflow for more details.
5+
-
6+
id: yukid
7+
binary: yukid
8+
env:
9+
# required by sqlite lib
10+
- CGO_ENABLED=1
11+
main: ./cmd/yukid
12+
goos:
13+
- linux
14+
goarch:
15+
- amd64
16+
flags:
17+
- -trimpath
18+
ldflags:
19+
- -s -w -X github.com/ustclug/Yuki/pkg/info.Version={{.Version}} -X github.com/ustclug/Yuki/pkg/info.BuildDate={{.Date}} -X github.com/ustclug/Yuki/pkg/info.GitCommit={{.Commit}}
720
-
821
id: yukictl
922
binary: yukictl
@@ -20,6 +33,7 @@ builds:
2033
- -s -w -X github.com/ustclug/Yuki/pkg/info.Version={{.Version}} -X github.com/ustclug/Yuki/pkg/info.BuildDate={{.Date}} -X github.com/ustclug/Yuki/pkg/info.GitCommit={{.Commit}}
2134
archives:
2235
- format: binary
36+
name_template: "{{ .Binary }}_{{ .Os }}_{{ .Arch }}"
2337
checksum:
2438
name_template: 'checksums.txt'
2539
snapshot:

README.md

Lines changed: 55 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ README
77
- [Requirements](#requirements)
88
- [Quickstart](#quickstart)
99
- [Handbook](#handbook)
10+
- [Troubleshooting](#troubleshooting)
11+
- [Development](#development)
1012

1113
Sync local repositories with remote.
1214

@@ -17,10 +19,14 @@ Sync local repositories with remote.
1719

1820
## Quickstart
1921

20-
Download the binaries from the [Release](https://github.com/ustclug/Yuki/releases) page, for example:
22+
Download the binaries from the [Release](https://github.com/ustclug/Yuki/releases) page. For example:
2123

2224
```bash
23-
wget https://github.com/ustclug/Yuki/releases/download/v0.2.2/yuki-v0.2.2-linux-amd64.tar.gz
25+
wget https://github.com/ustclug/Yuki/releases/latest/download/yukictl_linux_amd64
26+
wget https://github.com/ustclug/Yuki/releases/latest/download/yukid_linux_amd64
27+
28+
sudo cp yukictl_linux_amd64 /usr/local/bin/yukictl
29+
sudo cp yukid_linux_amd64 /usr/local/bin/yukid
2430
```
2531

2632
Configure yukid:
@@ -42,7 +48,7 @@ EOF
4248
Configure systemd service:
4349

4450
```bash
45-
curl 'https://raw.githubusercontent.com/ustclug/Yuki/master/deploy/yukid.service' | sudo tee /etc/systemd/system/yukid.service
51+
curl 'https://raw.githubusercontent.com/ustclug/Yuki/main/deploy/yukid.service' | sudo tee /etc/systemd/system/yukid.service
4652
systemctl enable yukid
4753
systemctl start yukid
4854
systemctl status yukid
@@ -52,14 +58,14 @@ Setup repository:
5258

5359
```bash
5460
# The repository directory must be created in advance
55-
mkdir /tmp/repos/docker-ce
61+
mkdir /tmp/repo-data/docker-ce
5662

5763
# Sync docker-ce repository from rsync.mirrors.ustc.edu.cn
5864
cat <<EOF > /tmp/repo-configs/docker-ce.yaml
5965
name: docker-ce
6066
# every 1 hour
6167
cron: "0 * * * *"
62-
storageDir: /tmp/repos/docker-ce
68+
storageDir: /tmp/repo-data/docker-ce
6369
image: ustcmirror/rsync:latest
6470
logRotCycle: 2
6571
envs:
@@ -101,3 +107,47 @@ sed -i.bak 's/interval/cron/' /path/to/repo/configs/*.yaml
101107
For post sync hook, the environment variables that are passed to the hook script are changed:
102108
* `Dir` -> `DIR`: the directory of the repository
103109
* `Name` -> `NAME`: the name of the repository
110+
111+
## Troubleshooting
112+
113+
### version `GLIBC_2.XX' not found
114+
115+
You might encounter the following error when running yukid:
116+
117+
```
118+
$ ./yukid -V
119+
./yukid: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by ./yukid)
120+
./yukid: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by ./yukid)
121+
./yukid: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./yukid)
122+
```
123+
124+
This is because `yukid` is complied with CGO enabled, which is required by https://github.com/mattn/go-sqlite3.
125+
The version of glibc that is linked to `yukid` might differ from the actual one that exists on your current machine.
126+
You will need to compile `yukid` on your current machine or run `yukid` in container.
127+
128+
Tips:
129+
* To check your current glibc version:
130+
```
131+
$ /lib/x86_64-linux-gnu/libc.so.6 | grep -i glibc
132+
```
133+
* The docker images of `yukid`: https://github.com/ustclug/Yuki/pkgs/container/yukid
134+
135+
## Development
136+
137+
* Build `yukid`:
138+
139+
```
140+
make yukid
141+
```
142+
143+
* Build `yukictl`:
144+
145+
```
146+
make yukictl
147+
```
148+
149+
* Lint the whole project:
150+
151+
```
152+
make lint
153+
```

0 commit comments

Comments
 (0)