wip: stalled changes

This commit is contained in:
Yann Autissier
2024-12-15 14:16:05 +01:00
parent d07a6aafaf
commit 65d739ee27
24 changed files with 393 additions and 17 deletions
+30
View File
@@ -0,0 +1,30 @@
# link: https://github.com/kvaps/docker-rozofs/blob/master/Dockerfile
FROM debian:bookworm as master
ARG DOCKER_BUILD_DIR
# Make sure the package repository is up to date and install required packages
RUN apt-get -y update \
&& apt-get install -fy gnupg lsb-release tini wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists
# Avoid warning during packet installations
ENV DEBIAN_FRONTEND noninteractive
# Install the release key
# Set the RozoFS repository to access RozoFS packages
# Install RozoFS manager (optionally) required for all nodes
RUN wget -O - http://dl.rozofs.org/deb/devel@rozofs.com.gpg.key | apt-key add - \
&& echo deb http://dl.rozofs.org/deb/master $(lsb_release -sc) main | tee /etc/apt/sources.list.d/rozofs.list \
&& echo 'APT::Install-Recommends "0";' > /etc/apt/apt.conf.d/01norecommend \
&& echo 'APT::Install-Suggests "0";' >> /etc/apt/apt.conf.d/01norecommend \
&& echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d \
&& apt-get -y update \
&& apt-get install -y rozofs-manager* rozofs-* busybox inotify-tools \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists
COPY ${DOCKER_BUILD_DIR}/rozofs.sh /
ENTRYPOINT ["/usr/bin/tini", "--"]
CMD [ "/rozofs.sh" ]
+50
View File
@@ -0,0 +1,50 @@
#!/bin/bash
# link: https://github.com/kvaps/docker-rozofs/blob/master/rozofs.sh
start_daemons() {
# restore fstab
cp -f /etc/rozofs/fstab /etc/fstab
# start rozo agent
/etc/init.d/rozofs-manager-agent start
# start rozo export
if [ "$(grep -c '\(volumes\|exports\) *= *( *) *;' /etc/rozofs/export.conf)" != "2" ]; then
/etc/init.d/rozofs-exportd start
fi
# start rozo storage
if [ "$(grep -c 'storages *= *( *) *;' /etc/rozofs/storage.conf)" != "1" ]; then
/etc/init.d/rozofs-storaged start
fi
# start rozo mounts
awk '$1 == "rozofsmount" {print $2}' /etc/fstab |
while read mount; do
mkdir -p "$mount"
mount "$mount"
done
}
stop_daemons() {
# save fstab
cp -f /etc/fstab /etc/rozofs/fstab.bak
mv /etc/rozofs/fstab.bak /etc/rozofs/fstab
awk '$1 == "rozofsmount" {print $2}' /etc/fstab |
while read mount; do
umount "$mount"
done
/etc/init.d/rozofs-storaged stop
/etc/init.d/rozofs-exportd stop
/etc/init.d/rozofs-manager-agent stop
}
# start logging
/bin/busybox syslogd
tail -F /var/log/messages 2>/dev/null &
trap stop_daemons EXIT
start_daemons
while inotifywait -e modify /etc/fstab; do
cp -f /etc/fstab /etc/rozofs/fstab.bak
mv /etc/rozofs/fstab.bak /etc/rozofs/fstab
done &
wait $!