mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2026-04-25 17:16:00 +03:00
[GH-ISSUE #1521] Bug: 0.7.2 Example docker-compose.yml sonic config download races with bind mounted config file and errors out #2413
Labels
No labels
expected: maybe someday
expected: next release
expected: release after next
expected: unlikely unless contributed
good first ticket
help wanted
pull-request
scope: all users
scope: windows users
size: easy
size: hard
size: medium
size: medium
status: backlog
status: blocked
status: done
status: idea-phase
status: needs followup
status: wip
status: wontfix
touches: API/CLI/Spec
touches: configuration
touches: data/schema/architecture
touches: dependencies/packaging
touches: docs
touches: js
touches: views/replayers/html/css
why: correctness
why: functionality
why: performance
why: security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ArchiveBox#2413
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @agowa on GitHub (Sep 22, 2024).
Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/1521
Describe the bug
The provided configuration for sonic within the easy setup docker-compose.yml is invalid.
Steps to reproduce
Enable sonic within the easy setup docker-compose.yml and run
docker compose upScreenshots or log output
ArchiveBox version
@agowa commented on GitHub (Sep 22, 2024):
the issue here is that docker-compose will create a folder "sonic.cfg" in the projects directory. See https://docs.docker.com/reference/compose-file/services/#long-syntax-5
The default is bind and for it when there is no file on the host it'll create a directory. The only other option is to disable this using the create_host_path option, but then our config would most likely stay inside the container.
The desired option of copying the sonic.cfg from within the container to the host if absent is only available for volumes. But volumes of type we would also get a folder and it would be way more difficult to have it point to a file in the project directory.
The most straight forward way would be to have the entrypoint/startup script of the sonic container check if /etc/sonic.cfg is empty and if it is overwrite it with the default config.
In k8s an alternative solution would be to use an initcontainer to do this but docker-compose doesn't have them. But in k8s we could also put this config file into a ConfigMap object. Interestingly docker-compose has also a "configs" section but sadly it does not allow to use the file within the container as the default. The "file" option of it only allows for using a file within the project directory as the default. See https://github.com/compose-spec/compose-spec/blob/main/08-configs.md and https://github.com/compose-spec/compose-spec/blob/main/spec.md Also the configs section in docker-compose is read-only I think...
Also when someone is using the podman-compose wrapper also this limitation can be observed: https://github.com/containers/podman-compose/issues/864
(but even with the "real" docker-compose then even though the dockerfile_inline is executed it still doesn't create the sonic.cfg as a file. I still did get it as a folder...
Either way the sonic section needs to be changed. For now the simplest workaround is to run
curl -fsSL 'https://raw.githubusercontent.com/ArchiveBox/ArchiveBox/stable/etc/sonic.cfg' > sonic.cfgwithin the directory of the docker-compose.yml file.@pirate commented on GitHub (Sep 22, 2024):
Fixed:
github.com/ArchiveBox/ArchiveBox@212280859cIt's just a race between the host bind and the container downloader, if host binds first then it's a folder, if container downloads it first then it's a file. I just commented out the bind in the example config.
:roensures the container will never overwrite a file provided by the host. There's no point mounting the default config outside the container, if the user wants to modify it they should just download it manually and bind mount it at that point.@agowa commented on GitHub (Sep 22, 2024):
Hi, I think I just now found a better way to fix this. In the attached PR.
@satonotdead commented on GitHub (Oct 7, 2024):
It doesn't fix the issue for me, I'm having permissions errors from a few months and I can't figure it out.
PID/GUID don't work. Tried archivebox/root/myuser as user owner or group, nothing helps. Original docker-compose show
archivebox-1 exited with code 0and all the ticket related are closed.It should be very valuable to keep issues opened until their get confirmations to get closed.
@pirate commented on GitHub (Oct 7, 2024):
@satoshinotdead there any many potential causes of permissions issues, I wouldn't be too sure that your issue is the same as the one here. Please open a new issue and share your full
docker-compose.ymlanddocker compose run archivebox versionoutput (even if it fails to start) + screenshot of any error output.@satonotdead commented on GitHub (Oct 7, 2024):
Thanks, I will look into it because tweaking the paths on sonic.cfg (with template updated ones) solves this issue but I'm still with permission errors.
@pirate commented on GitHub (Nov 13, 2024):
I made a new
amd64/arm64archivebox/soniccontainer that bundles the default config file, sodockerfile_inlineis no longer used indocker-compose.ymland podman should work now:github.com/ArchiveBox/ArchiveBox@6448968952