For CTDB switch to suprvisord so ctdb reloadnodes can be called periodically
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -56,7 +56,6 @@ RUN apt-get -y update && \
|
||||
supervisor \
|
||||
cups \
|
||||
ctdb \
|
||||
tini \
|
||||
samba-exporter && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
|
||||
@@ -79,12 +78,12 @@ RUN apt-get -y update && \
|
||||
#RUN chmod 777 /home
|
||||
|
||||
COPY *.conf.j2 /root/
|
||||
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
COPY crontab /etc
|
||||
COPY supervisord.*.conf /root
|
||||
COPY crontab.* /root
|
||||
|
||||
#VOLUME /etc/samba /var/lib/samba /etc/cups-persist
|
||||
|
||||
EXPOSE 135 137 138 139 445 631 4379 9100 9922
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["/usr/bin/supervisord","-c","/etc/supervisor/conf.d/supervisord.conf"]
|
||||
CMD [""]
|
||||
|
||||
10
crontab.ctdb
Normal file
10
crontab.ctdb
Normal file
@@ -0,0 +1,10 @@
|
||||
SHELL=/bin/bash
|
||||
# Example of job definition:
|
||||
# .---------------- minute (0 - 59)
|
||||
# | .------------- hour (0 - 23)
|
||||
# | | .---------- day of month (1 - 31)
|
||||
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
|
||||
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
|
||||
# | | | | |
|
||||
# * * * * * user-name command to be executed
|
||||
* * * * * root ctdb reloadnodes
|
||||
@@ -1,5 +1,11 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
#
|
||||
# TODO
|
||||
# * on startup resolveNodes.sh usually resolves just itself and 'ctdb reloadnodes' must be called on some node
|
||||
# * maybe remove ctdb-volatile
|
||||
# * 'net ads info' is not a proper join status check
|
||||
|
||||
# Loosely based on https://github.com/fjudith/docker-samba-join-ad/tree/master/sssd
|
||||
|
||||
if [ "$1" = "ctdb" ]; then
|
||||
@@ -42,8 +48,13 @@ if [ "$1" = "ctdb" ]; then
|
||||
rm -rf /run/ctdb
|
||||
ln -s "$CLUSTER_SYSDIR_LOCAL/ctdb-run" /run/ctdb
|
||||
|
||||
# Wait a little bit so we see all/most peer nodes through DNS (resolveNodes.sh)
|
||||
sleep 15
|
||||
|
||||
# We cannot run as PID 1 due to orphans (see https://lists.samba.org/archive/samba-technical/2021-July/136753.html)
|
||||
exec tini -- /usr/sbin/ctdbd --interactive
|
||||
echo 'Restarting CTDB using supervisord'
|
||||
cp /root/crontab.ctdb /etc/crontab
|
||||
exec /usr/bin/supervisord -c /root/supervisord.ctdb.conf
|
||||
fi
|
||||
|
||||
if [ -z "$NETBIOS_NAME" ]; then
|
||||
@@ -148,8 +159,7 @@ fi
|
||||
#echo "session required pam_mkhomedir.so skel=/etc/skel/ umask=0022" | tee -a /etc/pam.d/common-session
|
||||
|
||||
# Join
|
||||
REAL_REALM=$(net ads info 2>/dev/null | awk -F': ' '/Realm/ {print $2; exit}')
|
||||
if [ -z "$REAL_REALM" ]; then
|
||||
if ! net ads testjoin; then
|
||||
if [ ! -f /run/secrets/$ADMIN_PASSWORD_SECRET ]; then
|
||||
echo 'Cannot read secret $ADMIN_PASSWORD_SECRET in /run/secrets'
|
||||
exit 1
|
||||
@@ -212,4 +222,5 @@ chown "$pipe_owner" "$response_pipe_file"
|
||||
chmod "$pipe_permissions" "$response_pipe_file"
|
||||
|
||||
echo 'Restarting Samba using supervisord'
|
||||
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
|
||||
cp /root/crontab.samba /etc/crontab
|
||||
exec /usr/bin/supervisord -c /root/supervisord.samba.conf
|
||||
|
||||
13
supervisord.ctdb.conf
Normal file
13
supervisord.ctdb.conf
Normal file
@@ -0,0 +1,13 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
loglevel=info
|
||||
user=root
|
||||
|
||||
[program:ctdb]
|
||||
command=/usr/sbin/ctdbd --interactive
|
||||
priority=1
|
||||
redirect_stderr=true
|
||||
|
||||
[program:cron]
|
||||
command=/usr/sbin/cron -f
|
||||
redirect_stderr=true
|
||||
Reference in New Issue
Block a user