Revert "dist: support nonroot and offline mode for scylla-housekeeping"
This reverts commit c3bea539b6.
Since it breaking offline-installer artifact-tests. Also, it seems that we should have merged it in the first place since we don't need scylla-housekeeping checks for offline-installer
Closes scylladb/scylladb#19976
This commit is contained in:
committed by
Botond Dénes
parent
39b49a41cc
commit
8221a178d8
73
dist/common/scripts/scylla_setup
vendored
73
dist/common/scripts/scylla_setup
vendored
@@ -343,53 +343,46 @@ if __name__ == '__main__':
|
||||
if enable_service:
|
||||
systemd_unit('scylla-server.service').enable()
|
||||
|
||||
housekeeping_cfg = etcdir_p() / 'scylla.d/housekeeping.cfg'
|
||||
if not housekeeping_cfg.exists():
|
||||
version_check = interactive_ask_service('Do you want to enable Scylla to check if there is a newer version of Scylla available?', 'Yes - start the Scylla-housekeeping service to check for a newer version. This check runs periodically. No - skips this step.', version_check)
|
||||
args.no_version_check = not version_check
|
||||
if version_check:
|
||||
if not is_offline():
|
||||
if not is_nonroot():
|
||||
if not os.path.exists('/etc/scylla.d/housekeeping.cfg'):
|
||||
version_check = interactive_ask_service('Do you want to enable Scylla to check if there is a newer version of Scylla available?', 'Yes - start the Scylla-housekeeping service to check for a newer version. This check runs periodically. No - skips this step.', version_check)
|
||||
args.no_version_check = not version_check
|
||||
if version_check:
|
||||
cfg = sysconfig_parser(sysconfdir_p() / 'scylla-housekeeping')
|
||||
repo_files = cfg.get('REPO_FILES')
|
||||
for f in glob.glob(repo_files):
|
||||
os.chmod(f, 0o644)
|
||||
with housekeeping_cfg.open('w') as f:
|
||||
f.write('[housekeeping]\ncheck-version: True\n')
|
||||
housekeeping_cfg.chmod(0o644)
|
||||
systemd_unit('scylla-housekeeping-daily.timer').unmask()
|
||||
systemd_unit('scylla-housekeeping-restart.timer').unmask()
|
||||
else:
|
||||
with housekeeping_cfg.open('w') as f:
|
||||
f.write('[housekeeping]\ncheck-version: False\n')
|
||||
housekeeping_cfg.chmod(0o644)
|
||||
hk_daily = systemd_unit('scylla-housekeeping-daily.timer')
|
||||
hk_daily.mask()
|
||||
hk_daily.stop()
|
||||
hk_restart = systemd_unit('scylla-housekeeping-restart.timer')
|
||||
hk_restart.mask()
|
||||
hk_restart.stop()
|
||||
with open('/etc/scylla.d/housekeeping.cfg', 'w') as f:
|
||||
f.write('[housekeeping]\ncheck-version: True\n')
|
||||
os.chmod('/etc/scylla.d/housekeeping.cfg', 0o644)
|
||||
systemd_unit('scylla-housekeeping-daily.timer').unmask()
|
||||
systemd_unit('scylla-housekeeping-restart.timer').unmask()
|
||||
else:
|
||||
with open('/etc/scylla.d/housekeeping.cfg', 'w') as f:
|
||||
f.write('[housekeeping]\ncheck-version: False\n')
|
||||
os.chmod('/etc/scylla.d/housekeeping.cfg', 0o644)
|
||||
hk_daily = systemd_unit('scylla-housekeeping-daily.timer')
|
||||
hk_daily.mask()
|
||||
hk_daily.stop()
|
||||
hk_restart = systemd_unit('scylla-housekeeping-restart.timer')
|
||||
hk_restart.mask()
|
||||
hk_restart.stop()
|
||||
|
||||
cur_version=out('scylla --version')
|
||||
housekeeping_cmd = [f'{scriptsdir()}/scylla-housekeeping', '--uuid-file', str(housekeepingdatadir_p() / 'housekeeping.uuid')]
|
||||
if not is_offline():
|
||||
if is_debian_variant():
|
||||
housekeeping_cmd.extend(['--repo-files', '\'/etc/apt/sources.list.d/scylla*.list\''])
|
||||
cur_version=out('scylla --version')
|
||||
if len(cur_version) > 0:
|
||||
if is_debian_variant():
|
||||
new_version=out('{}/scylla-housekeeping --uuid-file /var/lib/scylla-housekeeping/housekeeping.uuid --repo-files \'/etc/apt/sources.list.d/scylla*.list\' version --version {} --mode i'.format(scriptsdir(), cur_version), user='scylla', group='scylla', timeout=HOUSEKEEPING_TIMEOUT)
|
||||
else:
|
||||
new_version=out('{}/scylla-housekeeping --uuid-file /var/lib/scylla-housekeeping/housekeeping.uuid --repo-files \'/etc/yum.repos.d/scylla*.repo\' version --version {} --mode i'.format(scriptsdir(), cur_version), user='scylla', group='scylla', timeout=HOUSEKEEPING_TIMEOUT)
|
||||
if len(new_version) > 0:
|
||||
print(new_version)
|
||||
else:
|
||||
housekeeping_cmd.extend(['--repo-files', '\'/etc/yum.repos.d/scylla*.repo\''])
|
||||
if len(cur_version) > 0:
|
||||
housekeeping_cmd.extend(['version', '--version', cur_version, '--mode', 'i'])
|
||||
else:
|
||||
housekeeping_cmd.extend(['version', '--version', 'unknown', '--mode', 'u'])
|
||||
if is_nonroot():
|
||||
new_version = out(' '.join(housekeeping_cmd), timeout=HOUSEKEEPING_TIMEOUT)
|
||||
else:
|
||||
new_version = out(' '.join(housekeeping_cmd), user='scylla', group='scylla', timeout=HOUSEKEEPING_TIMEOUT)
|
||||
if len(cur_version) > 0:
|
||||
print(new_version)
|
||||
else:
|
||||
print(f'A Scylla executable was not found, please check your installation {new_version}')
|
||||
if is_debian_variant():
|
||||
new_version=out('{}/scylla-housekeeping --uuid-file /var/lib/scylla-housekeeping/housekeeping.uuid --repo-files \'/etc/apt/sources.list.d/scylla*.list\' version --version unknown --mode u'.format(scriptsdir()), user='scylla', group='scylla', timeout=HOUSEKEEPING_TIMEOUT)
|
||||
else:
|
||||
new_version=out('{}/scylla-housekeeping --uuid-file /var/lib/scylla-housekeeping/housekeeping.uuid --repo-files \'/etc/yum.repos.d/scylla*.repo\' version --version unknown --mode u'.format(scriptsdir()), user='scylla', group='scylla', timeout=HOUSEKEEPING_TIMEOUT)
|
||||
print('A Scylla executable was not found, please check your installation {}'.format(new_version))
|
||||
|
||||
if not is_nonroot():
|
||||
if is_redhat_variant():
|
||||
selinux_setup = interactive_ask_service('Do you want to disable SELinux?', 'Yes - disables SELinux. Choosing Yes greatly improves performance. No - keeps SELinux activated.', selinux_setup)
|
||||
args.no_selinux_setup = not selinux_setup
|
||||
|
||||
9
dist/common/scripts/scylla_util.py
vendored
9
dist/common/scripts/scylla_util.py
vendored
@@ -88,12 +88,6 @@ def datadir_p():
|
||||
else:
|
||||
return Path('/var/lib/scylla')
|
||||
|
||||
def housekeepingdatadir_p():
|
||||
if is_nonroot():
|
||||
return scylladir_p() / 'scylla-housekeeping'
|
||||
else:
|
||||
return Path('/var/lib/scylla-housekeeping')
|
||||
|
||||
def scyllabindir_p():
|
||||
return scylladir_p() / 'bin'
|
||||
|
||||
@@ -115,9 +109,6 @@ def etcdir():
|
||||
def datadir():
|
||||
return str(datadir_p())
|
||||
|
||||
def housekeepingdatadir():
|
||||
return str(housekeepingdatadir_p())
|
||||
|
||||
def scyllabindir():
|
||||
return str(scyllabindir_p())
|
||||
|
||||
|
||||
46
install.sh
46
install.sh
@@ -312,7 +312,6 @@ else
|
||||
rsystemd="$HOME/.config/systemd/user"
|
||||
rdoc="$rprefix/share/doc"
|
||||
rdata="$rprefix"
|
||||
rhkdata="$rprefix/scylla-housekeeping"
|
||||
fi
|
||||
|
||||
# scylla-conf
|
||||
@@ -436,7 +435,6 @@ install -m755 -d "$rdata"/commitlog
|
||||
install -m755 -d "$rdata"/hints
|
||||
install -m755 -d "$rdata"/view_hints
|
||||
install -m755 -d "$rdata"/coredump
|
||||
install -m755 -d "$rhkdata"
|
||||
install -m755 -d "$rprefix"/swagger-ui
|
||||
cp -r swagger-ui/dist "$rprefix"/swagger-ui
|
||||
install -d -m755 -d "$rprefix"/api
|
||||
@@ -481,13 +479,6 @@ EOS
|
||||
EnvironmentFile=
|
||||
EnvironmentFile=$sysconfdir/scylla-housekeeping
|
||||
EOS
|
||||
if ! $packaging; then
|
||||
cat << EOS > "$retc"/systemd/system/scylla-housekeeping-$i.service.d/offline.conf
|
||||
[Service]
|
||||
ExecStart=
|
||||
ExecStart=$rprefix/scripts/scylla-housekeeping --uuid-file \$UUID_FILE -q -c \$CONFIG_FILE version --mode ${i:0:1}
|
||||
EOS
|
||||
fi
|
||||
done
|
||||
fi
|
||||
elif ! $without_systemd; then
|
||||
@@ -524,39 +515,6 @@ StandardError=
|
||||
StandardError=inherit
|
||||
EOS
|
||||
fi
|
||||
for i in daily restart; do
|
||||
install -d -m755 "$rsystemd"/scylla-housekeeping-$i.service.d
|
||||
if [ $i = "daily" ]; then
|
||||
mode="d"
|
||||
else
|
||||
mode="r"
|
||||
fi
|
||||
if [ -d /var/log/journal ]; then
|
||||
cat << EOS > "$rsystemd"/scylla-housekeeping-$i.service.d/nonroot.conf
|
||||
[Service]
|
||||
EnvironmentFile=
|
||||
EnvironmentFile=$(realpath -m "$rsysconfdir/scylla-housekeeping")
|
||||
ExecStart=
|
||||
ExecStart=$rprefix/scripts/scylla-housekeeping --uuid-file \$UUID_FILE -q -c \$CONFIG_FILE version --mode ${i:0:1}
|
||||
User=
|
||||
Group=
|
||||
EOS
|
||||
else
|
||||
cat << EOS > "$rsystemd"/scylla-housekeeping-$i.service.d/nonroot.conf
|
||||
[Service]
|
||||
EnvironmentFile=
|
||||
EnvironmentFile=$(realpath -m "$rsysconfdir/scylla-housekeeping")
|
||||
ExecStart=
|
||||
ExecStart=$rprefix/scripts/scylla-housekeeping --uuid-file \$UUID_FILE -q -c \$CONFIG_FILE version --mode ${i:0:1}
|
||||
User=
|
||||
Group=
|
||||
StandardOutput=
|
||||
StandardOutput=file:$rprefix/scylla-housekeeping-$i.log
|
||||
StandardError=
|
||||
StandardError=inherit
|
||||
EOS
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
@@ -567,6 +525,7 @@ SYSCONFDIR="$sysconfdir"
|
||||
EOS
|
||||
fi
|
||||
install -m755 -d "$rusr/bin"
|
||||
install -m755 -d "$rhkdata"
|
||||
ln -srf "$rprefix/bin/scylla" "$rusr/bin/scylla"
|
||||
ln -srf "$rprefix/bin/iotune" "$rusr/bin/iotune"
|
||||
ln -srf "$rprefix/bin/scyllatop" "$rusr/bin/scyllatop"
|
||||
@@ -650,8 +609,6 @@ if $nonroot; then
|
||||
if [ ! -d /var/log/journal ] || $supervisor_log_to_stdout; then
|
||||
sed -i -e "s#--log-to-stdout 0#--log-to-stdout 1#g" $rsysconfdir/scylla-server
|
||||
fi
|
||||
sed -i -e "s#/var/lib/scylla-housekeeping#$rprefix/scylla-housekeeping#g" $rsysconfdir/scylla-housekeeping
|
||||
sed -i -e "s#/etc/scylla.d#$retc/scylla.d#g" $rsysconfdir/scylla-housekeeping
|
||||
# nonroot install is also 'offline install'
|
||||
touch $rprefix/SCYLLA-OFFLINE-FILE
|
||||
touch $rprefix/SCYLLA-NONROOT-FILE
|
||||
@@ -663,7 +620,6 @@ elif ! $packaging; then
|
||||
if $supervisor_log_to_stdout; then
|
||||
sed -i -e "s#--log-to-stdout 0#--log-to-stdout 1#g" $rsysconfdir/scylla-server
|
||||
fi
|
||||
sed -i -e "s#REPO_FILES=.*#REPO_FILES=#g" $rsysconfdir/scylla-housekeeping
|
||||
# run install.sh without --packaging is 'offline install'
|
||||
touch $rprefix/SCYLLA-OFFLINE-FILE
|
||||
nousr=
|
||||
|
||||
Reference in New Issue
Block a user