diff --git a/.copier-answers.yml b/.copier-answers.yml new file mode 100644 index 0000000..65f9797 --- /dev/null +++ b/.copier-answers.yml @@ -0,0 +1,8 @@ +# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY +_commit: 2024.2.5 +_src_path: gh:epics-containers/ioc-template +description: Generic IOC for Delta Tau power pmac and turbo pmac motion controllers +git_platform: github.com +github_org: epics-containers +name: ioc-pmac +repo_uri: git@github.com:epics-containers/ioc-pmac.git diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 9d2fd2d..4b185dd 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -58,16 +58,6 @@ // we also mount the project folder into a know location in the container // this is where the ibek-support and ioc folders reside in the container build // in this way the devcontainer and runtime look very similar - "source=${localWorkspaceFolder},target=/epics/generic-source,type=bind", - // this provides eternal bash history in and out of the container - "source=${localEnv:HOME}/.bash_eternal_history,target=/root/.bash_eternal_history,type=bind", - // this bashrc hooks up the .bashrc_dev_container in the following mount - "source=${localWorkspaceFolder}/.devcontainer/.bashrc,target=/root/.bashrc,type=bind", - // provides a place for you to put your shell customizations for all your dev containers - "source=${localEnv:HOME}/.bashrc_dev_container,target=/root/.bashrc_dev_container,type=bind", - // provides a place to install any packages you want to have across all your dev containers - "source=${localEnv:HOME}/.bashprofile_dev_container,target=/root/.bashprofile_dev_container,type=bind", - // provides the same command line editing experience as your host - "source=${localEnv:HOME}/.inputrc,target=/root/.inputrc,type=bind" + "source=${localWorkspaceFolder},target=/epics/generic-source,type=bind" ] } \ No newline at end of file diff --git a/.devcontainer/initializeCommand b/.devcontainer/initializeCommand index 4f32aa2..732ec1f 100644 --- a/.devcontainer/initializeCommand +++ b/.devcontainer/initializeCommand @@ -1,15 +1,6 @@ #!/bin/bash -# make sure all the files we mount into the container exist -for i in \ - .bash_eternal_history \ - .bashrc_dev_container \ - .bashprofile_dev_container \ - .inputrc - do - if [ ! -f $HOME/$i ] ; then - touch $HOME/$i; - fi -done +# custom initialization goes here - runs outside of the dev container +# just before the container is launched but after the container is created echo "devcontainerID ${1}" diff --git a/.devcontainer/postCreateCommand b/.devcontainer/postCreateCommand index f8160b3..50ec6e5 100644 --- a/.devcontainer/postCreateCommand +++ b/.devcontainer/postCreateCommand @@ -1,5 +1,8 @@ #!/bin/bash +# Custom initialization goes here if needed. +# Runs inside the dev container after the container is created + ################################################################################ # When using docker we will not be root inside the container # the following steps are then required @@ -9,21 +12,11 @@ if [[ $USER != "root" ]] ; then # make sure the non-root user can build iocs and (mounted in) support modules sudo chown -R ${USER}:${USER} /epics/ibek-defs /epics/pvi-defs /epics/support/configure /venv sudo chown -h ${USER}:${USER} /epics /epics/ioc /epics/support - - # also give non-root user access to the same bash config we use in podman - sudo chmod a+rx /root - for f in .inputrc .bash_eternal_history .bashrc .bashrc_dev_container; do - sudo chmod a+rw /root/$f - ln -sf /root/$f $HOME/$f - done fi ################################################################################ -# Custom install script for each developer to add whatever they like to -# all epics-containers devcontainers +# Make sure ibek completion is available ################################################################################ -# add user's custom profile container creation script -if [ -f ~/.bashprofile_dev_container ]; then - . ~/.bashprofile_dev_container -fi +echo 'source <(ibek --show-completion bash)' >> $HOME/.bashrc +echo 'source <(ibek --show-completion zsh)' >> $HOME/.zshrc diff --git a/Dockerfile b/Dockerfile index 40b5d6f..bc3c3f0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ FROM ${REGISTRY}/epics-base-${TARGET_ARCHITECTURE}-developer:${BASE} AS develop # The devcontainer mounts the project root to /epics/generic-source # Using the same location here makes devcontainer/runtime differences transparent. ENV SOURCE_FOLDER=/epics/generic-source -# connect ioc source folder its know location +# connect ioc source folder to its know location RUN ln -s ${SOURCE_FOLDER}/ioc ${IOC} # Get latest ibek while in development. Will come from epics-base when stable diff --git a/README.md b/README.md index 3530e3c..5df71f3 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,18 @@ -An epics-containers generic IOC source file for Delta Tau pmac motion controllers. +# Generic IOC Template Repository ioc-pmac -Generates a Generic IOC for running in a container and -creating IOC instances to control pmac motion controllers. +## Description +Generic IOC for Delta Tau power pmac and turbo pmac motion controllers -See the https://epics-containers.github.io +## Template Info +This repository was generated by +[ioc-template](https://github.com/epics-containers/ioc-template) +To update to the latest version of the template: + +```bash +# activate a python virtual environment + +pip install copier +cd ioc-pmac +copier update -a --trust . +``` \ No newline at end of file diff --git a/build b/build index 7c5d905..d04d45b 100755 --- a/build +++ b/build @@ -17,11 +17,11 @@ set -xe cd $(dirname ${0}) # use docker if available else use podman -if ! docker version &>/dev/null; then alias docker=podman; fi +if ! docker version &>/dev/null; then docker=podman; else docker=docker; fi # make sure new repos get their submodule ibek-support git submodule update --init # build and developer images -docker build -t ${TAG} --build-arg TARGET_ARCHITECTURE=$T_A --target $TARGET . +$docker build -t ${TAG} --build-arg TARGET_ARCHITECTURE=$T_A --target $TARGET . diff --git a/ioc/start.sh b/ioc/start.sh index 344edef..adfb82d 100755 --- a/ioc/start.sh +++ b/ioc/start.sh @@ -30,13 +30,23 @@ description=' 2. ioc.yaml ************************************************************* If the config folder contains a yaml file we invoke the ibek tool to generate the startup script and database. Then launch with the generated - startup script. The file name should be the name of the ioc with a 'yaml' - extension e.g. bl38p-ea-panda-02.yaml. Using a unique name allows for: + startup script. The file name should always be 'ioc.yaml'. The ioc instance + can determine its own name with the following as the first line in 'ioc.yaml' - ioc_name: "{{ ioc_yaml_file_name }}" + ioc_name: ""{{ __utils__.get_env('IOC_NAME') }}"" at the top of the file and in turn "{{ ioc_name }}"" can be used in any - of the fields within the file. + of the fields within the file. For example: by default Kubernetes will be + looking at the iocStats PV IOC_NAME:Uptime to validate health of the IOC, + therefore most IOC instances should include: + + entities: + - type: epics.EpicsEnvSet + name: EPICS_TZ + value: "GMT0BST" + + - type: devIocStats.iocAdminSoft + IOC: "{{ ioc_name | upper }}" 3. st.cmd + ioc.subst ********************************************************* If the config folder contains a st.cmd script and a ioc.subst file then diff --git a/requirements.txt b/requirements.txt index ca6692b..cc020ba 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ ibek==1.6.3 # to install direct from github during development in a branch -# git+https://github.com/epics-containers/ibek.git@fix-extract-assets +# git+https://github.com/epics-containers/ibek.git@fix-extract-assets \ No newline at end of file