-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor Docker/Compose #3
Conversation
@jippi any reason for building with bullseye and 8.1 ? |
it was the baseline for existing Dockerfile, so I just kept it |
Testing on a standard migration case, my observations:
Cc @jippi |
@jippi trying something on lock file but still not satisfactory : # @description Best effort file lock to ensure *something* is not running in multiple containers.
# The script uses "trap" to clean up after itself if the script crashes
# @arg $1 string The lock identifier
function acquire-lock() {
local name="${1:-$script_name}"
local file="${docker_locks_path}/${name}"
local lock_fd
ensure-directory-exists "$(dirname "${file}")"
exec {lock_fd}>"$file"
log-info "🔑 Trying to acquire lock: ${file}: "
while !(flock -n -x "$lock_fd"); do
log-info "🔒 Waiting on lock ${file}"
staggered-sleep
done
# not needed but does verify ownership
stream-prefix-command-output touch "${file}"
log-info "🔐 Lock acquired [${file}]"
on-trap "release-lock ${name} ${lock_fd}" EXIT INT QUIT TERM
}
# @description Release a lock aquired by [acquire-lock]
# @arg $1 string The lock identifier
function release-lock() {
local name="${1:-$script_name}"
local file="${docker_locks_path}/${name}"
local lock_fd="$2"
log-info "🔓 Releasing lock [${file}]"
exec {lock_fd}>&-
# Not sure if we should delete then
stream-prefix-command-output rm -fv "${file}"
} |
file lock broke shellcheck, but the CI passed. oh well. |
I plan to add a "timeout" to "wait" X time (maybe 60s or something) if it does deadlock (I've only seen this happen when ctrl+c'ing containers that have a lock during startup). Also considered using Redis as a lock hub, but not loving that a lot |
Also, any issues in |
Thanks. BTW docs is pushed here too : pixelfed-glitch.github.io/docs |
Cool - I'm only working on the upstream part of it to pixelfed/pixelfed atm :) |
This is kinda strange because it seemed like flock was working pretty well from a docker instance to another here, and I don't see conflicts. It is also recommended and tested by other docker devs : |
From @jippi PR in upstream : pixelfed#4844
I had to squash for convenience (110 commits ?) and rebase on latest.
(If there's any concern on using latest staging please reply and tell me why)