Skip to content

Commit

Permalink
chore: release yukid as well (#50)
Browse files Browse the repository at this point in the history
* chore: release yukid as well

Signed-off-by: Jian Zeng <[email protected]>

* doc: update README

Signed-off-by: Jian Zeng <[email protected]>

---------

Signed-off-by: Jian Zeng <[email protected]>
  • Loading branch information
knight42 authored Jan 7, 2024
1 parent 94feecd commit 1898c9f
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 7 deletions.
18 changes: 16 additions & 2 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,21 @@ before:
hooks:
- go mod tidy
builds:
# NOTE: Currently, we cannot distribute yukid as a binary, because it requires CGO.
# Instead, we distribute it as a Docker image. Please refer to the release workflow for more details.
-
id: yukid
binary: yukid
env:
# required by sqlite lib
- CGO_ENABLED=1
main: ./cmd/yukid
goos:
- linux
goarch:
- amd64
flags:
- -trimpath
ldflags:
- -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}}
-
id: yukictl
binary: yukictl
Expand All @@ -20,6 +33,7 @@ builds:
- -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}}
archives:
- format: binary
name_template: "{{ .Binary }}_{{ .Os }}_{{ .Arch }}"
checksum:
name_template: 'checksums.txt'
snapshot:
Expand Down
60 changes: 55 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ README
- [Requirements](#requirements)
- [Quickstart](#quickstart)
- [Handbook](#handbook)
- [Troubleshooting](#troubleshooting)
- [Development](#development)

Sync local repositories with remote.

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

## Quickstart

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

```bash
wget https://github.com/ustclug/Yuki/releases/download/v0.2.2/yuki-v0.2.2-linux-amd64.tar.gz
wget https://github.com/ustclug/Yuki/releases/latest/download/yukictl_linux_amd64
wget https://github.com/ustclug/Yuki/releases/latest/download/yukid_linux_amd64

sudo cp yukictl_linux_amd64 /usr/local/bin/yukictl
sudo cp yukid_linux_amd64 /usr/local/bin/yukid
```

Configure yukid:
Expand All @@ -42,7 +48,7 @@ EOF
Configure systemd service:

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

```bash
# The repository directory must be created in advance
mkdir /tmp/repos/docker-ce
mkdir /tmp/repo-data/docker-ce

# Sync docker-ce repository from rsync.mirrors.ustc.edu.cn
cat <<EOF > /tmp/repo-configs/docker-ce.yaml
name: docker-ce
# every 1 hour
cron: "0 * * * *"
storageDir: /tmp/repos/docker-ce
storageDir: /tmp/repo-data/docker-ce
image: ustcmirror/rsync:latest
logRotCycle: 2
envs:
Expand Down Expand Up @@ -101,3 +107,47 @@ sed -i.bak 's/interval/cron/' /path/to/repo/configs/*.yaml
For post sync hook, the environment variables that are passed to the hook script are changed:
* `Dir` -> `DIR`: the directory of the repository
* `Name` -> `NAME`: the name of the repository

## Troubleshooting

### version `GLIBC_2.XX' not found

You might encounter the following error when running yukid:

```
$ ./yukid -V
./yukid: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by ./yukid)
./yukid: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by ./yukid)
./yukid: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./yukid)
```

This is because `yukid` is complied with CGO enabled, which is required by https://github.com/mattn/go-sqlite3.
The version of glibc that is linked to `yukid` might differ from the actual one that exists on your current machine.
You will need to compile `yukid` on your current machine or run `yukid` in container.

Tips:
* To check your current glibc version:
```
$ /lib/x86_64-linux-gnu/libc.so.6 | grep -i glibc
```
* The docker images of `yukid`: https://github.com/ustclug/Yuki/pkgs/container/yukid

## Development

* Build `yukid`:

```
make yukid
```

* Build `yukictl`:

```
make yukictl
```

* Lint the whole project:

```
make lint
```

0 comments on commit 1898c9f

Please sign in to comment.