Skip to content

Commit

Permalink
lug: support proxy (#481)
Browse files Browse the repository at this point in the history
  • Loading branch information
PhotonQuantum authored Jul 3, 2024
1 parent a9cfa67 commit 647152a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ services:
- USE_SJTUG=true
- CLONE_VERSION=v0.1.18
- CLONE_V2_VERSION=v0.2.37
- RSYNC_SJTUG_VERSION=v0.4.15
- RSYNC_SJTUG_VERSION=v0.4.16
- LUG_VERSION=v0.12.10
expose:
- 8081
Expand Down Expand Up @@ -211,6 +211,7 @@ services:
- proxy-net
expose:
- 8080
- 1080
restart: unless-stopped
logging:
options:
Expand Down
8 changes: 4 additions & 4 deletions lug/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM debian:bullseye
FROM debian:bookworm

ARG USE_SJTUG
RUN if [ "$USE_SJTUG" = true ] ; then sed -i 's/http:\/\/deb.debian.org/http:\/\/mirror.sjtu.edu.cn/g' /etc/apt/sources.list ; fi
RUN if [ "$USE_SJTUG" = true ] ; then sed -i 's/http:\/\/security.debian.org/http:\/\/mirror.sjtu.edu.cn/g' /etc/apt/sources.list ; fi
RUN if [ "$USE_SJTUG" = true ] ; then sed -i 's/http:\/\/deb.debian.org/http:\/\/mirror.sjtu.edu.cn/g' /etc/apt/sources.list.d/debian.sources ; fi
RUN if [ "$USE_SJTUG" = true ] ; then sed -i 's/http:\/\/security.debian.org/http:\/\/mirror.sjtu.edu.cn/g' /etc/apt/sources.list.d/debian.sources ; fi

WORKDIR /app
RUN apt-get update && apt-get install rsync wget git jq curl unzip -y
Expand All @@ -28,7 +28,7 @@ RUN /app/build-script/setup-julia.sh
ENV PATH="/app/julia-1.5.0/bin:${PATH}"

# Python packages
RUN if [ "$USE_SJTUG" = true ] ; then pip3 install python-dateutil -i https://mirror.sjtu.edu.cn/pypi/web/simple; else pip3 install python-dateutil ; fi
RUN apt-get install python3-dateutil -y

# StorageMirrorServer.jl
COPY build-script/setup-julia-mirror.sh build-script/setup-julia-mirror.sh
Expand Down
4 changes: 2 additions & 2 deletions lug/build-script/setup-php.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -e

wget -q -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
if [ "$USE_SJTUG" = true ] ; then
echo "deb https://mirror.sjtu.edu.cn/sury/php/ bullseye main" > /etc/apt/sources.list.d/php.list
echo "deb https://mirror.sjtu.edu.cn/sury/php/ bookworm main" > /etc/apt/sources.list.d/php.list
else
echo "deb https://packages.sury.org/php/ bullseye main" > /etc/apt/sources.list.d/php.list
echo "deb https://packages.sury.org/php/ bookworm main" > /etc/apt/sources.list.d/php.list
fi
4 changes: 4 additions & 0 deletions lug/worker-script/rsync-fetcher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,9 @@ mkdir -p "${LUG_tmp_path}"

LUG_timeout="${LUG_timeout:-4h}"

if [ "${LUG_use_proxy}" ]; then
export SOCKS5_PROXY=socks5://clash:1080
fi

eval timeout $LUG_timeout /app/rsync_sjtug/rsync-gc --s3-url "\"${LUG_s3_api}\"" --s3-region "\"${LUG_s3_region}\"" --s3-bucket "\"${LUG_s3_bucket}\"" --s3-prefix "\"rsync/${LUG_name}\"" --pg-url "\"${LUG_pg}\"" --namespace "\"${LUG_name}\"" --keep "\"${LUG_keep}\"" --partial "\"${LUG_partial}\""
eval timeout $LUG_timeout /app/rsync_sjtug/rsync-fetcher --src "\"${LUG_source}\"" --s3-url "\"${LUG_s3_api}\"" --s3-region "\"${LUG_s3_region}\"" --s3-bucket "\"${LUG_s3_bucket}\"" --s3-prefix "\"rsync/${LUG_name}\"" --pg-url "\"${LUG_pg}\"" --namespace "\"${LUG_name}\"" --tmp-path "\"${LUG_tmp_path}\"" ${LUG_rsync_extra_flags}

0 comments on commit 647152a

Please sign in to comment.