From 352391ed6ad2d31543f09a52dd9d452be7bce6f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Thu, 10 Sep 2020 11:28:06 +0200 Subject: [PATCH 1/5] Def file for a CVMFS Squid Proxy in Singularity container --- containers/EESSI-squid-proxy.def | 49 ++++++++++++++++++++++++++++++++ containers/README.md | 30 +++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 containers/EESSI-squid-proxy.def create mode 100644 containers/README.md diff --git a/containers/EESSI-squid-proxy.def b/containers/EESSI-squid-proxy.def new file mode 100644 index 00000000..7d02f16a --- /dev/null +++ b/containers/EESSI-squid-proxy.def @@ -0,0 +1,49 @@ +BootStrap: docker +From: centos:7 + +%post + yum update -y + yum install -y squid which + +%environment + export LC_ALL=C + +%runscript + if [[ ${1:0:1} = '-' ]]; then + EXTRA_ARGS="$@" + set -- + elif [[ ${1} == squid || ${1} == $(which squid) ]]; then + EXTRA_ARGS="${@:2}" + set -- + fi + + if [[ -z ${1} ]]; then + if [[ ! -d /var/spool/squid/00 ]]; then + echo "Initializing cache..." + $(which squid) -N -f /etc/squid/squid.conf -z + fi + echo "Starting squid..." + exec $(which squid) -f /etc/squid/squid.conf -NYCd 1 ${EXTRA_ARGS} + else + exec "$@" + fi + +%startscript + if [[ ${1:0:1} = '-' ]]; then + EXTRA_ARGS="$@" + set -- + elif [[ ${1} == squid || ${1} == $(which squid) ]]; then + EXTRA_ARGS="${@:2}" + set -- + fi + + if [[ -z ${1} ]]; then + if [[ ! -d /var/spool/squid/00 ]]; then + echo "Initializing cache..." + $(which squid) -N -f /etc/squid/squid.conf -z + fi + echo "Starting squid..." + exec $(which squid) -f /etc/squid/squid.conf -NYCd 1 ${EXTRA_ARGS} + else + exec "$@" + fi diff --git a/containers/README.md b/containers/README.md new file mode 100644 index 00000000..6e1b1804 --- /dev/null +++ b/containers/README.md @@ -0,0 +1,30 @@ +## Squid proxy Singularity container + +Build the container using: +``` +sudo singularity build EESSI-squid-proxy.sif EESSI-squid-proxy.def +``` + +Make some directories on the host for storing the cache, logs, and PID file: +``` +cd /somewhere +mkdir logs cache run +``` + +Prepare a Squid configuration file, for instance based on our template: +https://github.com/EESSI/filesystem-layer/blob/master/templates/eessi_localproxy_squid.conf.j2 + +Run the container interactively: +``` +singularity run -B ./log:/var/log/squid -B ./cache:/var/spool/squid -B run:/var/run -B eessi_localproxy_squid.conf:/etc/squid/squid.conf EESSI-squid-proxy.sif +``` + +Or start it as an instance: +``` +singularity instance start -B ./log:/var/log/squid -B ./cache:/var/spool/squid -B run:/var/run -B eessi_localproxy_squid.conf:/etc/squid/squid.conf EESSI-squid-proxy.sif cvmfs_proxy +``` + +The last argument defines the name for this instance, which can be used to connect a shell (`singularity shell instance://cvmfs_proxy`) or stop the instance: +``` +singularity instance stop cvmfs_proxy +``` From 36317f1a198534f80a7139229f7dcc8c3383e19f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Wed, 23 Sep 2020 12:26:26 +0200 Subject: [PATCH 2/5] use default versions for lint CI --- .github/workflows/ansible-lint.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ansible-lint.yml b/.github/workflows/ansible-lint.yml index c9fe8f27..3d6dce1e 100644 --- a/.github/workflows/ansible-lint.yml +++ b/.github/workflows/ansible-lint.yml @@ -27,9 +27,9 @@ jobs: # [optional] # Arguments to override a package and its version to be set explicitly. # Must follow the example syntax. - override-deps: | - ansible==2.9 - ansible-lint==4.2.0 + #override-deps: | + # ansible==2.9 + # ansible-lint==4.2.0 # [optional] # Arguments to be passed to the ansible-lint From 5fdfdc83168ce3ac4ca314ee9029955a3de48ee5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Wed, 23 Sep 2020 12:28:53 +0200 Subject: [PATCH 3/5] remove containers from this branch --- containers/EESSI-squid-proxy.def | 49 -------------------------------- containers/README.md | 30 ------------------- 2 files changed, 79 deletions(-) delete mode 100644 containers/EESSI-squid-proxy.def delete mode 100644 containers/README.md diff --git a/containers/EESSI-squid-proxy.def b/containers/EESSI-squid-proxy.def deleted file mode 100644 index 7d02f16a..00000000 --- a/containers/EESSI-squid-proxy.def +++ /dev/null @@ -1,49 +0,0 @@ -BootStrap: docker -From: centos:7 - -%post - yum update -y - yum install -y squid which - -%environment - export LC_ALL=C - -%runscript - if [[ ${1:0:1} = '-' ]]; then - EXTRA_ARGS="$@" - set -- - elif [[ ${1} == squid || ${1} == $(which squid) ]]; then - EXTRA_ARGS="${@:2}" - set -- - fi - - if [[ -z ${1} ]]; then - if [[ ! -d /var/spool/squid/00 ]]; then - echo "Initializing cache..." - $(which squid) -N -f /etc/squid/squid.conf -z - fi - echo "Starting squid..." - exec $(which squid) -f /etc/squid/squid.conf -NYCd 1 ${EXTRA_ARGS} - else - exec "$@" - fi - -%startscript - if [[ ${1:0:1} = '-' ]]; then - EXTRA_ARGS="$@" - set -- - elif [[ ${1} == squid || ${1} == $(which squid) ]]; then - EXTRA_ARGS="${@:2}" - set -- - fi - - if [[ -z ${1} ]]; then - if [[ ! -d /var/spool/squid/00 ]]; then - echo "Initializing cache..." - $(which squid) -N -f /etc/squid/squid.conf -z - fi - echo "Starting squid..." - exec $(which squid) -f /etc/squid/squid.conf -NYCd 1 ${EXTRA_ARGS} - else - exec "$@" - fi diff --git a/containers/README.md b/containers/README.md deleted file mode 100644 index 6e1b1804..00000000 --- a/containers/README.md +++ /dev/null @@ -1,30 +0,0 @@ -## Squid proxy Singularity container - -Build the container using: -``` -sudo singularity build EESSI-squid-proxy.sif EESSI-squid-proxy.def -``` - -Make some directories on the host for storing the cache, logs, and PID file: -``` -cd /somewhere -mkdir logs cache run -``` - -Prepare a Squid configuration file, for instance based on our template: -https://github.com/EESSI/filesystem-layer/blob/master/templates/eessi_localproxy_squid.conf.j2 - -Run the container interactively: -``` -singularity run -B ./log:/var/log/squid -B ./cache:/var/spool/squid -B run:/var/run -B eessi_localproxy_squid.conf:/etc/squid/squid.conf EESSI-squid-proxy.sif -``` - -Or start it as an instance: -``` -singularity instance start -B ./log:/var/log/squid -B ./cache:/var/spool/squid -B run:/var/run -B eessi_localproxy_squid.conf:/etc/squid/squid.conf EESSI-squid-proxy.sif cvmfs_proxy -``` - -The last argument defines the name for this instance, which can be used to connect a shell (`singularity shell instance://cvmfs_proxy`) or stop the instance: -``` -singularity instance stop cvmfs_proxy -``` From 07c56b36c45473113c70435f31cb2af368a83aa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Wed, 23 Sep 2020 12:44:22 +0200 Subject: [PATCH 4/5] Fix CI issues --- .github/workflows/ansible-lint.yml | 2 +- stratum0-deploy-cvmfs-config.yml | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ansible-lint.yml b/.github/workflows/ansible-lint.yml index 3d6dce1e..2bc0a931 100644 --- a/.github/workflows/ansible-lint.yml +++ b/.github/workflows/ansible-lint.yml @@ -23,7 +23,7 @@ jobs: # targets: | # playbook_1.yml # playbook_2.yml - targets: "*.yml group_vars/*.yml " + targets: "*.yml inventory/group_vars/*.yml" # [optional] # Arguments to override a package and its version to be set explicitly. # Must follow the example syntax. diff --git a/stratum0-deploy-cvmfs-config.yml b/stratum0-deploy-cvmfs-config.yml index fd59aa62..ba718191 100644 --- a/stratum0-deploy-cvmfs-config.yml +++ b/stratum0-deploy-cvmfs-config.yml @@ -12,6 +12,7 @@ - name: create directories file: + mode: "755" path: "{{ item }}" state: directory with_list: @@ -21,12 +22,14 @@ - name: deploy public keys copy: content="{{ item.key }}" dest="/cvmfs/{{ eessi_cvmfs_config_repo.repository.repository }}{{ item.path }}" + mode: "755" with_items: "{{ eessi_cvmfs_keys }}" - name: create contacts file copy: content: "{{ eessi_email }}\n" dest: "/cvmfs/{{ eessi_cvmfs_config_repo.repository.repository }}/etc/cvmfs/contact/{{ eessi_cvmfs_config_repo.domain }}" + mode: "755" - name: create domain configuration file copy: @@ -35,6 +38,7 @@ CVMFS_KEYS_DIR="/cvmfs/{{ eessi_cvmfs_config_repo.repository.repository }}/etc/cvmfs/keys/{{ eessi_cvmfs_config_repo.domain }}" CVMFS_USE_GEOAPI="{{ eessi_cvmfs_server_urls[0].use_geoapi | default(false) | ternary('yes', 'no') }}" dest: "/cvmfs/{{ eessi_cvmfs_config_repo.repository.repository }}/etc/cvmfs/domain.d/{{ eessi_cvmfs_config_repo.domain }}.conf" + mode: "755" - name: create default CVMFS configuration file copy: @@ -42,6 +46,7 @@ # For reference see https://sft.its.cern.ch/jira/browse/CVM-878 CVMFS_LOW_SPEED_LIMIT=10000 dest: "/cvmfs/{{ eessi_cvmfs_config_repo.repository.repository }}/etc/cvmfs/default.conf" + mode: "755" - name: publish CVMFS transaction command: cvmfs_server publish "{{ eessi_cvmfs_config_repo.repository.repository }}" From cfa462eb503717f569cb11a4aa4f13852be70b79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Wed, 23 Sep 2020 12:48:55 +0200 Subject: [PATCH 5/5] Fix lint issue --- stratum0-deploy-cvmfs-config.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/stratum0-deploy-cvmfs-config.yml b/stratum0-deploy-cvmfs-config.yml index ba718191..86a13470 100644 --- a/stratum0-deploy-cvmfs-config.yml +++ b/stratum0-deploy-cvmfs-config.yml @@ -21,8 +21,10 @@ - "/cvmfs/{{ eessi_cvmfs_config_repo.repository.repository }}/etc/cvmfs/domain.d" - name: deploy public keys - copy: content="{{ item.key }}" dest="/cvmfs/{{ eessi_cvmfs_config_repo.repository.repository }}{{ item.path }}" - mode: "755" + copy: + content: "{{ item.key }}" + dest: "/cvmfs/{{ eessi_cvmfs_config_repo.repository.repository }}{{ item.path }}" + mode: "755" with_items: "{{ eessi_cvmfs_keys }}" - name: create contacts file