Consolidates the last duplicated derivations, and removes the ansible
tree along with the CLI surface that existed only to drive it.
Naming rules:
* agebd/names.py holds ServiceName -- the single definition of how a
service name is spelled in each context: dir_name, module_name,
ioc_name, systemd_unit_name and the case forms. The environment
suffix is deliberately not part of it; that stays a deploy-time
token applied to these base names.
* cli's Service model delegates every name_* property to it, so the
CLI and the CI scripts derive names the same way.
* scripts/ci/service_names.py emits the derived forms as shell
assignments, and deploy-and-restart-service.sh evals them instead of
carrying its own tr calls and its own copy of the systemd naming
convention. Values are shell-quoted, and an invalid name exits
non-zero emitting nothing, so an eval cannot leave empty variables
behind.
Registry lookups:
* agebd.subs.find_service_entry is now the only place that answers
"which registry entry is this service", used by read_ioc_port,
get_ioc_port.py and cli's ServiceRegistry. get_ioc_port.py no longer
parses the registry itself.
* That also settles a semantic split: ServiceRegistry matched names
case-sensitively while read_ioc_port did not. Both now match
case-insensitively via ServiceName, so 'tune', 'Tune' and 'TUNE'
resolve to the same service everywhere.
Ansible removal:
* ansible/ is deleted, along with cli/src/ioc.py, cli/src/core/
ansible.py, the IOC_ENV enum, the ansible and ansible-runner
dependencies, and docs/developer/ansible.md.
* This removes the 'agebd ioc install|start|restart' commands. They
were pure playbook wrappers, so they could not outlive the
playbooks; IOC install, start and restart now have no automation
path in this repo.
bin/start_service.sh keeps deriving its two name forms in bash, with a
comment saying why: it runs on the deploy host before the service venv
exists, so it cannot import agebd. It is the one deliberate exception.
Verified: get_ioc_port.py, cli's ServiceRegistry and agebd's renderer all
return 50007 for 'tune', 'Tune' and 'TUNE'; the shell-emitted names match
the committed on-disk layout for real services including the dashed
OpticsFF-X02S; the CLI runs with only the 'service' command left.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
51 lines
1.6 KiB
Bash
Executable File
51 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
SVC_NAME=$1
|
|
set --
|
|
|
|
# TODO: remove?
|
|
# PSI_FACILITY=SLS
|
|
|
|
SERVICES_DIR=/sls/bd/hla/${AGEBD_ENV}/services
|
|
# These two derivations are the one place that deliberately does not use
|
|
# agebd.names.ServiceName: this runs on the deploy host before any Python
|
|
# environment for the service exists (the venv is built further down), so it
|
|
# cannot import agebd. Keep the rules here in step with agebd/names.py.
|
|
SVC_NAME_LOWER=${SVC_NAME,,}
|
|
SVC_NAME_LOWER_UNDERSCORES="${SVC_NAME_LOWER//-/_}"
|
|
SVC_DIR=${SERVICES_DIR}/${SVC_NAME_LOWER}
|
|
|
|
# gfa_12_epics.sh died on the 16.04.2026 due to required AFS write access
|
|
#. /etc/profile.d/gfa_12_epics.sh
|
|
#. /sls/bd/exchange/BeamData/user/felix/workarounds/epicsRHEL8.rc # temporary fix
|
|
. /etc/profile.d/cas_12_epics.sh
|
|
|
|
if [ "${AGEBD_ENV}" = "dev" ]; then
|
|
export EPICS_CA_ADDR_LIST="$EPICS_CA_ADDR_LIST 129.129.146.255"
|
|
fi
|
|
|
|
# activate conda environment
|
|
. /opt/gfa/python-3.10/latest/bin/activate
|
|
|
|
# TODO: building the .venv should be done in CICD (only when uv.lock changes)
|
|
pip install uv
|
|
# to run `uv ...`
|
|
PATH="${HOME}/.local/bin:${PATH}"
|
|
|
|
export UV_CACHE_DIR="/var/cache/uv"
|
|
export UV_LINK_MODE="copy"
|
|
|
|
APP_DIR=${SVC_DIR}/current/app
|
|
echo "App dir: ${APP_DIR}"
|
|
|
|
uv venv --project "${APP_DIR}" --allow-existing
|
|
# install custom python packages from pyproject.toml / uv.lock
|
|
uv sync --frozen --project ${APP_DIR}
|
|
# activate .venv, this works in conjunction with the conda environment
|
|
source ${APP_DIR}/.venv/bin/activate
|
|
|
|
# TODO: use `exec python3 ...` here?
|
|
python -u -B -m agebd_${SVC_NAME_LOWER_UNDERSCORES}.main
|
|
|
|
# TODO: remove: cicd test 54
|