Closed r00t1900 closed 2 years ago
Your analysis is correct. It is not a bug but a feature, because tunasync does not know how to setup the mapping. Actually, the script configured in command
field is executed in the docker image. It can be directly built into the image or mapped from other location. The mapping can be declared in the [docker]
section so that no repeated separated config is needed. For example:
[docker]
volumes = [
"/path/to/tunasync-scripts:/home/scripts:ro",
]
[[mirrors]]
name = "foo"
provider = "command"
upstream = "xxxxx"
command = "/home/scripts/foo.sh"
docker_image = "foo_image:latest"
docker_volumes = [
"/path/to/additional_volume1:/path/to/mountpoint:ro",
"/path/to/additional_volume2:/path/to/mountpoint2:ro"
]
Bandersnatch relies on xml-rpc interface provided by official pypi.org, and as a result cannot sync pypi repository from an alternative source. However, in its latest release, a new config is added entitled download-mirror
, to fetch package metadata from the rpc interface on pypi.org and actual packages from an alternative source.
Bandersnatch relies on xml-rpc interface provided by official pypi.org, and as a result cannot sync pypi repository from an alternative source. However, in its latest release, a new config is added entitled
download-mirror
, to fetch package metadata from the rpc interface on pypi.org and actual packages from an alternative source.
Thank you for replying. This really help a lot, bravo!
Your analysis is correct. It is not a bug but a feature, because tunasync does not know how to setup the mapping. Actually, the script configured in
command
field is executed in the docker image. It can be directly built into the image or mapped from other location. The mapping can be declared in the[docker]
section so that no repeated separated config is needed. For example:[docker] volumes = [ "/path/to/tunasync-scripts:/home/scripts:ro", ] [[mirrors]] name = "foo" provider = "command" upstream = "xxxxx" command = "/home/scripts/foo.sh" docker_image = "foo_image:latest" docker_volumes = [ "/path/to/additional_volume1:/path/to/mountpoint:ro", "/path/to/additional_volume2:/path/to/mountpoint2:ro" ]
Thank you, your mind and step are both right, problem solved :)
Env
Description
tunasync
can not run custom shell file with proper path:tunasync worker -c worker.conf -v --debug
:/tmp/tunasync/log/tunasync/pypi/pypi_2022-01-01_11_06.log
:Analysis
According to these debug information, I noticed that the docker commands did not map
pypi.sh
into docker filesystem, which might be the reason ofno such file or directory
.Solution
I try to append
-v /home/scripts/pypi.sh:/home/scripts/pypi.sh
to the docker commands and then manually execute it, and it shows that it works well:command output:
Further
worker.conf
:[docker] enable = true
[manager] api_base = "http://localhost:12345" token = "" ca_cert = ""
[cgroup] enable = false base_path = "/sys/fs/cgroup" group = "tunasync"
[server] hostname = "localhost" listen_addr = "127.0.0.1" listen_port = 6000 ssl_cert = "" ssl_key = ""
[[mirrors]] name = "pypi" provider = "command" upstream = "https://pypi.tuna.tsinghua.edu.cn/" command = "/home/scripts/pypi.sh" docker_image = "tunathu/bandersnatch:latest" interval = 5
/home/scripts/pypi.sh
:Thanks for viewing.