Skip to content
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

updates to enviroment.sh #11

Merged
merged 2 commits into from
Oct 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,39 @@ echo "Loading IOC environment for BL45P ..."

# a mapping between genenric IOC repo roots and the related container registry
export EC_REGISTRY_MAPPING='github.com=ghcr.io gitlab.diamond.ac.uk=gcr.io/diamond-privreg/controls/ioc'
# the namespace to use for kubernetes deployments
export EC_K8S_NAMESPACE=bl45p
# the git organisation used for beamline repositories
export EC_GIT_ORG=https://github.com/epics-containers
# the git repo for this beamline (or accelerator domain)
export [email protected]:epics-containers/bl45p.git
# declare your centralised log server Web UI
export EC_LOG_URL='https://graylog2.diamond.ac.uk/search?rangetype=relative&fields=message%2Csource&width=1489&highlightMessage=&relative=172800&q=pod_name%3A{ioc_name}*'
# export EC_CONTAINER_CLI=podman (uncomment to enforce a specific container cli)
# export EC_DEBUG=1 (uncomment to enable debug output)
# enforce a specific container cli - defaults to whatever is available
# export EC_CONTAINER_CLI=podman
# enable debug output in all 'ec' commands
# export EC_DEBUG=1

# the following configures kubernetes inside DLS.
# replace this with however your cluster is configured - essenially needs to
# ~/.kube/config
if module --version &> /dev/null; then
if module avail pollux > /dev/null; then
module unload pollux > /dev/null
module load pollux > /dev/null
fi
fi

# must be in a venv and this is the reliable check
if python3 -c 'import sys; sys.exit(0 if sys.base_prefix==sys.prefix else 1)'
then
echo "ERROR: Please activate a virtualenv and re-run"
else
if ! ec --version &> /dev/null; then
# check if epics-containers-cli (ec command) is installed and install if not
if ! ec --version &> /dev/null; then
# must be in a venv and this is the reliable check
if python3 -c 'import sys; sys.exit(0 if sys.base_prefix==sys.prefix else 1)'; then
echo "ERROR: Please activate a virtualenv and re-run"
return
elif ! ec --version &> /dev/null; then
pip install epics-containers-cli
fi
ec --install-completion ${SHELL} &> /dev/null
fi

# enable shell completion for ec commands
source <(ec --show-completion ${SHELL})