Skip to content

Commit

Permalink
Add yukina (#110)
Browse files Browse the repository at this point in the history
* Add yukina

* yukina: update version
  • Loading branch information
taoky authored Mar 31, 2024
1 parent 8a63154 commit 155497e
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 1 deletion.
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
- [stackage](#stackage)
- [tsumugu](#tsumugu)
- [winget-source](#winget-source)
- [yukina](#yukina)
- [yum-sync](#yum-sync)
- [License](#license)
- [Contributing](#contributing)
Expand Down Expand Up @@ -419,7 +420,7 @@ Stackage doesn't need to specify upstream.
### tsumugu

[![tsumugu](https://img.shields.io/docker/image-size/ustcmirror/tsumugu/latest)](https://hub.docker.com/r/ustcmirror/tsumugu "tsumugu")
[![stackage](https://img.shields.io/docker/pulls/ustcmirror/tsumugu)](https://hub.docker.com/r/ustcmirror/tsumugu "tsumugu")
[![tsumugu](https://img.shields.io/docker/pulls/ustcmirror/tsumugu)](https://hub.docker.com/r/ustcmirror/tsumugu "tsumugu")

An alternative HTTP(S) syncing tool, replacing `rclone` and `lftp` in some cases. See [usage](https://github.com/taoky/tsumugu#usage).

Expand All @@ -446,6 +447,23 @@ A handy tool to sync pre-indexed [Windows Package Manager](https://github.com/mi
| `WINGET_REPO_URL` | Sets the URL of upstream. Defaults to [`https://cdn.winget.microsoft.com/cache`](https://cdn.winget.microsoft.com/cache) |
| `WINGET_REPO_JOBS` | Parallel jobs. Defaults to 8. |

### yukina

[![yukina](https://img.shields.io/docker/image-size/ustcmirror/yukina/latest)](https://hub.docker.com/r/ustcmirror/yukina "yukina")
[![yukina](https://img.shields.io/docker/pulls/ustcmirror/yukina)](https://hub.docker.com/r/ustcmirror/yukina "yukina")

[yukina](https://github.com/taoky/yukina) analyses given nginx log, and maintains binary blobs (which does not modify once exist) state under given size limit.
Usually this shall be used with another sync container that only downloads index files.

Note that you shall bind necessary nginx log to `/nginx-log/` when syncing.

| Parameter | Description |
| ------------------ | ----------------------------------------------------------------------------------------------------- |
| `UPSTREAM` | Sets the url of upstream. |
| `YUKINA_SIZE_LIMIT` | The size limit of binary blobs. Defaults to `512g`. |
| `YUKINA_FILTER` | Accepts regex to filter out binary blobs. Defaults to empty. |
| `YUKINA_EXTRA` | Extra options. Defaults to empty. |

### yum-sync

[![yum-sync](https://img.shields.io/docker/image-size/ustcmirror/yum-sync/latest)](https://hub.docker.com/r/ustcmirror/yum-sync "yum-sync")
Expand Down
11 changes: 11 additions & 0 deletions yukina/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM ustcmirror/base:alpine
LABEL maintainer "Keyu Tao <taoky AT ustclug.org>"
ARG YUKINA_VERSION=20240331-2

RUN apk add --no-cache wget ca-certificates zstd && \
cd /tmp/ && wget -q "https://github.com/taoky/yukina/releases/download/${YUKINA_VERSION}/yukina" && \
mv /tmp/yukina /usr/local/bin/ && \
chmod +x /usr/local/bin/yukina && \
rm -rf /tmp/* && apk del wget

ADD sync.sh /
35 changes: 35 additions & 0 deletions yukina/sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

## EXPORTED IN entry.sh
#TO=
#REPO=

## SET IN ENVIRONMENT VARIABLES
#BIND_ADDRESS=
#UPSTREAM=
#YUKINA_SIZE_LIMIT=
#YUKINA_FILTER=
#YUKINA_EXTRA=

set -eu
[[ $DEBUG = true ]] && set -x

BIND_ADDRESS=${BIND_ADDRESS:-}
YUKINA_SIZE_LIMIT=${YUKINA_SIZE_LIMIT:-"512g"}
YUKINA_FILTER=${YUKINA_FILTER:-}
YUKINA_EXTRA=${YUKINA_EXTRA:-}

if [[ $DEBUG = true ]]; then
export RUST_LOG="yukina=debug"
fi

export NO_COLOR=1

exec yukina --name "$REPO" \
--log-path "/nginx-log" \
--repo-path "$TO" \
--size-limit "$YUKINA_SIZE_LIMIT" \
--url "$UPSTREAM" \
--remote-sizedb "$TO/.yukina-remote.db" \
--local-sizedb "$TO/.yukina-local.db" \
$YUKINA_FILTER $YUKINA_EXTRA

0 comments on commit 155497e

Please sign in to comment.