Skip to content

Commit

Permalink
Merge pull request #33 from epics-containers/example
Browse files Browse the repository at this point in the history
Update to template 3.0.0
  • Loading branch information
gilesknap authored Feb 21, 2024
2 parents 325d957 + f7433d2 commit 691e09a
Show file tree
Hide file tree
Showing 12 changed files with 62 additions and 199 deletions.
2 changes: 1 addition & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: 2024.2.2b1
_commit: 3.0.0
_src_path: gh:epics-containers/ioc-template
description: The simulation AreaDetector
git_platform: github.com
Expand Down
84 changes: 0 additions & 84 deletions .devcontainer/.bashrc

This file was deleted.

12 changes: 1 addition & 11 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
13 changes: 2 additions & 11 deletions .devcontainer/initializeCommand
Original file line number Diff line number Diff line change
@@ -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}"
27 changes: 15 additions & 12 deletions .devcontainer/postCreateCommand
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -9,21 +12,21 @@ 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
# Shell customizations for Generic IOC devcontainers
################################################################################

# add user's custom profile container creation script
if [ -f ~/.bashprofile_dev_container ]; then
. ~/.bashprofile_dev_container
# add ibek completion to bash and zsh
echo 'source <(ibek --show-completion bash)' >> $HOME/.bashrc
echo 'source <(ibek --show-completion zsh)' >> $HOME/.zshrc

# pick a theme that does not cause completion corruption in zsh
sed -i $HOME/.zshrc -e 's/ZSH_THEME="devcontainers"/ZSH_THEME="eastwood"/'

# allow personalization of all devcontainers in this subdirectory
# by placing a .devcontainer_rc file in the workspace root
if [[ -f /workspaces/.devcontainer_rc ]] ; then
source /workspaces/.devcontainer_rc
fi
23 changes: 3 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,9 @@ COPY ibek-support/_global/ _global
COPY ibek-support/iocStats/ iocStats
RUN iocStats/install.sh 3.1.16

COPY ibek-support/asyn/ asyn/
RUN asyn/install.sh R4-42

COPY ibek-support/autosave/ autosave/
RUN autosave/install.sh R5-11

COPY ibek-support/busy/ busy/
RUN busy/install.sh R1-7-3

COPY ibek-support/sscan/ sscan/
RUN sscan/install.sh R2-11-6

COPY ibek-support/calc/ calc/
RUN calc/install.sh R3-7-5

COPY ibek-support/ADCore/ ADCore/
RUN ADCore/install.sh R3-12-1

COPY ibek-support/ADSimDetector/ ADSimDetector/
RUN ADSimDetector/install.sh R2-10
################################################################################
# TODO - Add further support module installations here
################################################################################

# get the ioc source and build it
COPY ioc ${SOURCE_FOLDER}/ioc
Expand Down
18 changes: 14 additions & 4 deletions ioc/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 25 additions & 0 deletions services/bl01t-ea-ioc-02/config/ioc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# yaml-language-server: $schema=https://github.com/epics-containers/ioc-adsimdetector/releases/download/2024.1.1/ibek.ioc.schema.json

ioc_name: "{{ __utils__.get_env('IOC_NAME') }}"

description: Example simulated camera

entities:
- type: epics.EpicsEnvSet
name: EPICS_TZ
value: "GMT0BST"

- type: devIocStats.iocAdminSoft
IOC: "{{ ioc_name | upper }}"

- type: ADSimDetector.simDetector
PORT: DET.DET
P: BL01T-EA-TST-02
R: ":DET:"

- type: ADCore.NDPvaPlugin
PORT: DET.PVA
PVNAME: BL01T-EA-TST-02:PVA:OUTPUT
P: BL01T-EA-TST-02
R: ":PVA:"
NDARRAY_PORT: DET.DET
1 change: 1 addition & 0 deletions services/bl01t-ea-ioc-02/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
image: ghcr.io/epics-containers/ioc-adsimdetector-linux-runtime:2024.2.2
15 changes: 0 additions & 15 deletions user_examples/.bashprofile_dev_container

This file was deleted.

28 changes: 0 additions & 28 deletions user_examples/.bashrc_dev_container

This file was deleted.

13 changes: 0 additions & 13 deletions user_examples/README.md

This file was deleted.

0 comments on commit 691e09a

Please sign in to comment.