From 230c285324e00cd7bf0d18cce0410c465a26750a Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Mon, 6 Jul 2020 10:59:01 -0700 Subject: [PATCH 01/39] Update linter.yml --- .github/workflows/linter.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 8047879..4690855 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -17,6 +17,6 @@ jobs: - name: Lint Code Base uses: docker://github/super-linter:latest env: -# VALIDATE_ALL_CODEBASE: true - VALIDATE_MD: true - VALIDATE_BASH: true + VALIDATE_ALL_CODEBASE: true +# VALIDATE_MD: true +# VALIDATE_BASH: true From 25220e8bee5083c5cdf8d807a88adc7d0f24026e Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Mon, 6 Jul 2020 11:02:35 -0700 Subject: [PATCH 02/39] Update .dockerfilelintrc --- .github/linters/.dockerfilelintrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/linters/.dockerfilelintrc b/.github/linters/.dockerfilelintrc index d5d9330..251130e 100644 --- a/.github/linters/.dockerfilelintrc +++ b/.github/linters/.dockerfilelintrc @@ -1,3 +1,3 @@ rules: - uppercase_commands: off - expose_host_port: off + uppercase_commands: on + expose_host_port: on From b5f9247246a56b89aecd2e80991195cfb201aeda Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Mon, 6 Jul 2020 11:05:22 -0700 Subject: [PATCH 03/39] Delete .dockerfilelintrc --- .github/linters/.dockerfilelintrc | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .github/linters/.dockerfilelintrc diff --git a/.github/linters/.dockerfilelintrc b/.github/linters/.dockerfilelintrc deleted file mode 100644 index 251130e..0000000 --- a/.github/linters/.dockerfilelintrc +++ /dev/null @@ -1,3 +0,0 @@ -rules: - uppercase_commands: on - expose_host_port: on From 0e2aea178974b15a1f7f16812f8693506c6a5662 Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Mon, 6 Jul 2020 11:12:13 -0700 Subject: [PATCH 04/39] Update linter.yml --- .github/workflows/linter.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 4690855..525a275 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -17,6 +17,8 @@ jobs: - name: Lint Code Base uses: docker://github/super-linter:latest env: - VALIDATE_ALL_CODEBASE: true -# VALIDATE_MD: true -# VALIDATE_BASH: true + VALIDATE_MD: true + VALIDATE_BASH: true + VALIDATE_DOCKER: true + VALIDATE_PYTHON: true + From 3db7fc851c936b37f312503274d3003085bc1373 Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Mon, 6 Jul 2020 11:17:50 -0700 Subject: [PATCH 05/39] Update linter.yml --- .github/workflows/linter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 525a275..34803d6 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -17,8 +17,8 @@ jobs: - name: Lint Code Base uses: docker://github/super-linter:latest env: + VALIDATE_ALL_CODEBASE: true VALIDATE_MD: true VALIDATE_BASH: true VALIDATE_DOCKER: true VALIDATE_PYTHON: true - From 04f90fb619f83d5d29a1f6814c463c12adce28f3 Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Thu, 24 Jun 2021 19:43:48 -0700 Subject: [PATCH 06/39] switch to alscontrols, update it to the latest one --- .github/workflows/docker-image.yml | 21 ------ .github/workflows/docker.yml | 68 ++++++++++++++++++ .github/workflows/linter.yml | 24 ------- configure/RELEASE | 2 +- docker/Dockerfile | 90 +++++++++++++++++++++++- docker/Dockerfile.alpine | 89 ----------------------- docker/{ => old}/Dockerfile.bluster-slim | 0 7 files changed, 158 insertions(+), 136 deletions(-) delete mode 100644 .github/workflows/docker-image.yml create mode 100644 .github/workflows/docker.yml delete mode 100644 .github/workflows/linter.yml mode change 120000 => 100644 docker/Dockerfile delete mode 100644 docker/Dockerfile.alpine rename docker/{ => old}/Dockerfile.bluster-slim (100%) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml deleted file mode 100644 index 76a7351..0000000 --- a/.github/workflows/docker-image.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Docker Image - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - - build: - - runs-on: ubuntu-latest - - continue-on-error: false - - steps: - - uses: actions/checkout@v2 - - name: Build the Docker image - run: | - make build.docker || exit diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..c4b4871 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,68 @@ +# 0. change name +name: Record Syn +# change path name +on: + push: + branches: [ master ] + paths: + - 'docker/**' + - '.github/workflows/docker.yml' + pull_request: + branches: [ master ] +# +jobs: +# change job name + debian10: + runs-on: ubuntu-latest + env: + # change the following 4 variables + DOCKER_FILE: docker/Dockerfile + DOCKER_ACCOUNT: alscontrols + DOCKER_REPO: recsync + DOCKER_TAG: latest + + steps: + - + name: checkout + uses: actions/checkout@v2 + - + name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + # list of Docker images to use as base name for tags + images: | + ${{ env.DOCKER_ACCOUNT }}/${{ env.DOCKER_REPO }} + # generate Docker tags based on the following events/attributes + tags: | + type=schedule + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + context: . + file: ${{ github.workspace }}/${{ env.DOCKER_FILE }} + push: ${{ github.event_name != 'pull_request' }} + #tags: ${{ steps.meta.outputs.tags }} + tags: ${{ env.DOCKER_ACCOUNT }}/${{ env.DOCKER_REPO }}:${{ env.DOCKER_TAG }} + labels: ${{ steps.meta.outputs.labels }} + diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml deleted file mode 100644 index 34803d6..0000000 --- a/.github/workflows/linter.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Linter Run - -on: - push: - branches: [master] - pull_request: - branches: [master] - -jobs: - build: - name: Lint Code Base - runs-on: ubuntu-latest - - steps: - - name: Checkout Code - uses: actions/checkout@v2 - - name: Lint Code Base - uses: docker://github/super-linter:latest - env: - VALIDATE_ALL_CODEBASE: true - VALIDATE_MD: true - VALIDATE_BASH: true - VALIDATE_DOCKER: true - VALIDATE_PYTHON: true diff --git a/configure/RELEASE b/configure/RELEASE index 314dc0a..9968377 100644 --- a/configure/RELEASE +++ b/configure/RELEASE @@ -4,7 +4,7 @@ CF_SRC_URL:=https://github.com/ChannelFinder RS_SRC_NAME:=recsync ### Which the source tag / branch / hash id would like to use -RS_SRC_TAG:=ae7f476 +RS_SRC_TAG:=48fcbe8 ### Placeholder for the site-specific version control RS_SRC_VERSION:=$(RS_SRC_TAG) # diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 120000 index 45cc04d..0000000 --- a/docker/Dockerfile +++ /dev/null @@ -1 +0,0 @@ -Dockerfile.alpine \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..86907b5 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,89 @@ +# +# author : Jeong Han Lee +# email : jeonghan.lee@gmail.com +# date : Wednesday, July 1 15:39:00 PDT 2020 +# version : 0.0.2 + +## builder : 28.4MB +FROM alpine:3.12 AS builder +ENV WorkPath /home/RecSyn-env + +ARG RS_SERVER_PORT=5075 +ARG RS_PORT_BROADCAST=5076 +ARG RS_INSTALL_LOCATION=/opt/recsync +ARG CF_PORT_HTTP=8080 +ARG RS_BIND_PORT=45722 + +RUN apk --no-cache add bash git make + +WORKDIR $WorkPath +COPY . . +RUN echo "CF_PORT:=${CF_PORT_HTTP}" > configure/CONFIG_COMMON.local +RUN echo "RS_INSTALL_LOCATION:=${RS_INSTALL_LOCATION}" > configure/CONFIG_SITE.local +RUN make distclean && \ + make init && \ + make install.docker + +## Multi-Stages build : 124MB (buster-slim : 166MB) +FROM alpine:3.12 +LABEL maintainer="Jeong Han Lee " + +ARG BUILD_DATE +ARG BUILD_VERSION +ARG RS_SERVER_PORT=5075 +ARG RS_PORT_BROADCAST=5076 +ARG RS_INSTALL_LOCATION=/opt/recsync +ARG CF_PORT_HTTP=8080 +ARG RS_BIND_PORT=45722 +ARG TZ=America/Los_Angeles + +# Labels. +LABEL org.label-schema.schema-version="1.0" +LABEL org.label-schema.build-date=$BUILD_DATE +LABEL org.label-schema.name="jeonghanlee/recsync" +LABEL org.label-schema.description="EPICS RecSync Server (RecCeiver) Docker Image" +LABEL org.label-schema.url="https://github.com/ChannelFinder/RecSync-env/" +LABEL org.label-schema.version=$BUILD_VERSION +LABEL org.label-schema.docker.cmd="docker run --network=host --detach --rm --name=recsync jeonghanlee/recsync:tagname" + +### RecCeiver PORT / Installation location configuration. +ENV RS_SERVER_PORT $RS_SERVER_PORT +ENV RS_PORT_BROADCAST $RS_PORT_BROADCAST +ENV RS_INSTALL_LOCATION $RS_INSTALL_LOCATION +ENV CF_PORT_HTTP $CF_PORT_HTTP +ENV RS_BIND_PORT $RS_BIND_PORT +ENV PYTHONPATH $RS_INSTALL_LOCATION +# +# +### YOUR TIME ZONE +ENV TZ $TZ +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +### Install minimal packages for RecSync with alpine +## Python 3.8.3-r0 in alpine 3.12, we can reduce the image size of 85.2MB, but it doesn't work due to +## imcompatiblities in py3-requests +## RUN apk add --no-cache bash py3-twisted py3-simplejson py3-urllib3 py3-setuptools py3-requests +### Even if Python2, apk install a lot of Python3 packages, so we reduce the size only 43MB +RUN apk add --no-cache bash py-twisted py-simplejson py-urllib3 py2-setuptools py-requests tzdata + +WORKDIR ${RS_INSTALL_LOCATION} +COPY --from=builder $RS_INSTALL_LOCATION . +COPY --from=builder $RS_INSTALL_LOCATION/dropin.cache ./twisted/plugins/ +#RUN rm -f $RS_INSTALL_LOCATION/dropin.cache +## +# CF Port : http +EXPOSE $CF_PORT_HTTP/tcp +EXPOSE $CF_PORT_HTTP/udp +# RecCeiver Broadcast Port +EXPOSE $RS_PORT_BROADCAST/udp +# RecCeiver Server Port +EXPOSE $RS_SERVER_PORT/udp +# +EXPOSE $RS_BIND_PORT/tcp +EXPOSE $RS_BIND_PORT/udp +# +COPY ./docker/scripts/entrypoint.sh /entrypoint.sh +# First run is necessary, because of the following error +# /usr/bin/twistd: The specified reactor cannot be used, failed with error: reactor already installed. +RUN /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] diff --git a/docker/Dockerfile.alpine b/docker/Dockerfile.alpine deleted file mode 100644 index 86907b5..0000000 --- a/docker/Dockerfile.alpine +++ /dev/null @@ -1,89 +0,0 @@ -# -# author : Jeong Han Lee -# email : jeonghan.lee@gmail.com -# date : Wednesday, July 1 15:39:00 PDT 2020 -# version : 0.0.2 - -## builder : 28.4MB -FROM alpine:3.12 AS builder -ENV WorkPath /home/RecSyn-env - -ARG RS_SERVER_PORT=5075 -ARG RS_PORT_BROADCAST=5076 -ARG RS_INSTALL_LOCATION=/opt/recsync -ARG CF_PORT_HTTP=8080 -ARG RS_BIND_PORT=45722 - -RUN apk --no-cache add bash git make - -WORKDIR $WorkPath -COPY . . -RUN echo "CF_PORT:=${CF_PORT_HTTP}" > configure/CONFIG_COMMON.local -RUN echo "RS_INSTALL_LOCATION:=${RS_INSTALL_LOCATION}" > configure/CONFIG_SITE.local -RUN make distclean && \ - make init && \ - make install.docker - -## Multi-Stages build : 124MB (buster-slim : 166MB) -FROM alpine:3.12 -LABEL maintainer="Jeong Han Lee " - -ARG BUILD_DATE -ARG BUILD_VERSION -ARG RS_SERVER_PORT=5075 -ARG RS_PORT_BROADCAST=5076 -ARG RS_INSTALL_LOCATION=/opt/recsync -ARG CF_PORT_HTTP=8080 -ARG RS_BIND_PORT=45722 -ARG TZ=America/Los_Angeles - -# Labels. -LABEL org.label-schema.schema-version="1.0" -LABEL org.label-schema.build-date=$BUILD_DATE -LABEL org.label-schema.name="jeonghanlee/recsync" -LABEL org.label-schema.description="EPICS RecSync Server (RecCeiver) Docker Image" -LABEL org.label-schema.url="https://github.com/ChannelFinder/RecSync-env/" -LABEL org.label-schema.version=$BUILD_VERSION -LABEL org.label-schema.docker.cmd="docker run --network=host --detach --rm --name=recsync jeonghanlee/recsync:tagname" - -### RecCeiver PORT / Installation location configuration. -ENV RS_SERVER_PORT $RS_SERVER_PORT -ENV RS_PORT_BROADCAST $RS_PORT_BROADCAST -ENV RS_INSTALL_LOCATION $RS_INSTALL_LOCATION -ENV CF_PORT_HTTP $CF_PORT_HTTP -ENV RS_BIND_PORT $RS_BIND_PORT -ENV PYTHONPATH $RS_INSTALL_LOCATION -# -# -### YOUR TIME ZONE -ENV TZ $TZ -RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone - -### Install minimal packages for RecSync with alpine -## Python 3.8.3-r0 in alpine 3.12, we can reduce the image size of 85.2MB, but it doesn't work due to -## imcompatiblities in py3-requests -## RUN apk add --no-cache bash py3-twisted py3-simplejson py3-urllib3 py3-setuptools py3-requests -### Even if Python2, apk install a lot of Python3 packages, so we reduce the size only 43MB -RUN apk add --no-cache bash py-twisted py-simplejson py-urllib3 py2-setuptools py-requests tzdata - -WORKDIR ${RS_INSTALL_LOCATION} -COPY --from=builder $RS_INSTALL_LOCATION . -COPY --from=builder $RS_INSTALL_LOCATION/dropin.cache ./twisted/plugins/ -#RUN rm -f $RS_INSTALL_LOCATION/dropin.cache -## -# CF Port : http -EXPOSE $CF_PORT_HTTP/tcp -EXPOSE $CF_PORT_HTTP/udp -# RecCeiver Broadcast Port -EXPOSE $RS_PORT_BROADCAST/udp -# RecCeiver Server Port -EXPOSE $RS_SERVER_PORT/udp -# -EXPOSE $RS_BIND_PORT/tcp -EXPOSE $RS_BIND_PORT/udp -# -COPY ./docker/scripts/entrypoint.sh /entrypoint.sh -# First run is necessary, because of the following error -# /usr/bin/twistd: The specified reactor cannot be used, failed with error: reactor already installed. -RUN /entrypoint.sh -ENTRYPOINT ["/entrypoint.sh"] diff --git a/docker/Dockerfile.bluster-slim b/docker/old/Dockerfile.bluster-slim similarity index 100% rename from docker/Dockerfile.bluster-slim rename to docker/old/Dockerfile.bluster-slim From 0f009d71fbc1331f404db78bf844f607db22188a Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Thu, 24 Jun 2021 19:44:41 -0700 Subject: [PATCH 07/39] rename it --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index c4b4871..4cb6630 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -12,7 +12,7 @@ on: # jobs: # change job name - debian10: + recsync: runs-on: ubuntu-latest env: # change the following 4 variables From b18d624fd57d4d778e8fd290c61b5cc516e4980c Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Thu, 24 Jun 2021 19:51:08 -0700 Subject: [PATCH 08/39] switch to 18.04 as runner --- .github/workflows/Installation.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/Installation.yml b/.github/workflows/Installation.yml index 7bf9314..15ddb6b 100644 --- a/.github/workflows/Installation.yml +++ b/.github/workflows/Installation.yml @@ -1,5 +1,4 @@ - name: RecSync-env installation test on: @@ -11,7 +10,7 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: uubuntu-18.04 steps: - uses: actions/checkout@v2 From 505e154fe702e6df83a43223c143084dd6fd7d62 Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Thu, 24 Jun 2021 19:52:05 -0700 Subject: [PATCH 09/39] fixed typo --- .github/workflows/Installation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Installation.yml b/.github/workflows/Installation.yml index 15ddb6b..81a360f 100644 --- a/.github/workflows/Installation.yml +++ b/.github/workflows/Installation.yml @@ -10,7 +10,7 @@ on: jobs: build: - runs-on: uubuntu-18.04 + runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 From 7b9fbc794ec8e4ae36349593780f9dcd00d142a0 Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Thu, 24 Jun 2021 19:58:20 -0700 Subject: [PATCH 10/39] use alscontrols --- docker/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 86907b5..e1be617 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -40,11 +40,11 @@ ARG TZ=America/Los_Angeles # Labels. LABEL org.label-schema.schema-version="1.0" LABEL org.label-schema.build-date=$BUILD_DATE -LABEL org.label-schema.name="jeonghanlee/recsync" +LABEL org.label-schema.name="alscontrols/recsync" LABEL org.label-schema.description="EPICS RecSync Server (RecCeiver) Docker Image" LABEL org.label-schema.url="https://github.com/ChannelFinder/RecSync-env/" LABEL org.label-schema.version=$BUILD_VERSION -LABEL org.label-schema.docker.cmd="docker run --network=host --detach --rm --name=recsync jeonghanlee/recsync:tagname" +LABEL org.label-schema.docker.cmd="docker run --network=host --detach --rm --name=recsync alscontrols/recsync:latest" ### RecCeiver PORT / Installation location configuration. ENV RS_SERVER_PORT $RS_SERVER_PORT From 0e0f2ebd53b13e9f5ab9746a013e7ef21e0e0894 Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Sun, 18 Sep 2022 22:57:31 -0700 Subject: [PATCH 11/39] update all to latest strucutre --- .github/workflows/Installation.yml | 23 ------ .github/workflows/debian11.yml | 47 ++++++++++++ .github/workflows/rocky8.yml | 47 ++++++++++++ .github/workflows/ubuntu.yml | 46 +++++++++++ .gitignore | 1 + configure/CONFIG_COMMON | 1 + configure/CONFIG_SITE | 38 ++++++++-- configure/CONFIG_SRC | 1 - configure/CONFIG_VARS | 5 ++ configure/RELEASE | 7 +- configure/RULES | 11 ++- configure/RULES_INSTALL | 72 +++--------------- configure/RULES_PROPERTIES | 36 +++++++++ configure/RULES_SYSTEMD | 76 +++++++++++++++++++ configure/RULES_VARS | 43 ++++++++--- site-template/recsync.conf.in | 16 ++-- .../{rs.service.in => recsync.service.in} | 21 +++-- 17 files changed, 357 insertions(+), 134 deletions(-) delete mode 100644 .github/workflows/Installation.yml create mode 100644 .github/workflows/debian11.yml create mode 100644 .github/workflows/rocky8.yml create mode 100644 .github/workflows/ubuntu.yml create mode 100644 configure/RULES_PROPERTIES create mode 100644 configure/RULES_SYSTEMD rename site-template/{rs.service.in => recsync.service.in} (58%) diff --git a/.github/workflows/Installation.yml b/.github/workflows/Installation.yml deleted file mode 100644 index 81a360f..0000000 --- a/.github/workflows/Installation.yml +++ /dev/null @@ -1,23 +0,0 @@ - -name: RecSync-env installation test - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - - runs-on: ubuntu-18.04 - - steps: - - uses: actions/checkout@v2 - - run: sudo apt install -y python-twisted python-requests python-simplejson python-urllib3 git make - - run: | - make init || exit - make vars || exit - - run: | - make install || exit - make exist || exist diff --git a/.github/workflows/debian11.yml b/.github/workflows/debian11.yml new file mode 100644 index 0000000..5c1ace1 --- /dev/null +++ b/.github/workflows/debian11.yml @@ -0,0 +1,47 @@ +--- +name: Debian 11 + +on: + push: + branches: [ master ] + paths-ignores: + - '*.md' + - 'docker/**' + - '.github/workflows/docker.yml' + - '.github/workflows/ubuntu.yml' + - '.github/workflows/rocky8.yml' + - '.github/workflows/linter.yml' + + pull_request: + branches: [ master ] + +jobs: + Debian11: + + runs-on: ubuntu-latest + container: debian:bullseye + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Install required packages + run: | + apt update -y + apt install -y python-twisted python-requests python-simplejson python-urllib3 + - name: Check PYTHON environment + run: | + which python + which twisted + python --version + - name: Configuration + run: | + make init + make vars + - name: Build + run: | + make src_install + - name: Environment Check + run: make exist + diff --git a/.github/workflows/rocky8.yml b/.github/workflows/rocky8.yml new file mode 100644 index 0000000..c7b04a4 --- /dev/null +++ b/.github/workflows/rocky8.yml @@ -0,0 +1,47 @@ +--- +name: Rocky8 + +on: + push: + branches: [ master ] + paths-ignores: + - '*.md' + - 'examples/*.bash' + - 'docker/**' + - '.github/workflows/ubuntu.yml' + - '.github/workflows/docker.yml' + - '.github/workflows/ubuntu.yml' + - '.github/workflows/linter.yml' + + pull_request: + branches: [ master ] + +jobs: + Rocky8: + + runs-on: ubuntu-latest + container: rockylinux/rockylinux:8 + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Install required packages + run: | + dnf update -y + dnf install -y git make sudo which python3-twisted python-requests python3-simplejson python3-urllib3 + - name: Check PYTHON environment + run: | + which python + which twisted + python --version + - name: Configuration + run: | + make init + make vars + - name: Build + run: | + make src_install + - name: Environment Check + run: make exist diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml new file mode 100644 index 0000000..387268e --- /dev/null +++ b/.github/workflows/ubuntu.yml @@ -0,0 +1,46 @@ +--- +name: Ubuntu latest + +on: + push: + branches: [ master ] + paths-ignores: + - '*.md' + - 'docker/**' + - '.github/workflows/docker.yml' + - '.github/workflows/ubuntu.yml' + - '.github/workflows/rocky8.yml' + - '.github/workflows/linter.yml' + + pull_request: + branches: [ master ] + +jobs: + Ubuntu: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Install required packages + run: | + apt update -y + apt install -y python-twisted python-requests python-simplejson python-urllib3 + - name: Check PYTHON environment + run: | + which python + which twisted + python --version + - name: Configuration + run: | + make init + make vars + - name: Build + run: | + make src_install + - name: Environment Check + run: make exist + diff --git a/.gitignore b/.gitignore index 2adaeb4..6e0510f 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ site-template/recsync.conf /modules/RELEASE.*.local /modules/Makefile.local /*Top/configure/*.local +*.swp diff --git a/configure/CONFIG_COMMON b/configure/CONFIG_COMMON index 4c42655..1a7e486 100644 --- a/configure/CONFIG_COMMON +++ b/configure/CONFIG_COMMON @@ -1,3 +1,4 @@ + # CF_PRTO:=http CF_HOST:=localhost diff --git a/configure/CONFIG_SITE b/configure/CONFIG_SITE index 06549c1..10d6f9a 100644 --- a/configure/CONFIG_SITE +++ b/configure/CONFIG_SITE @@ -1,20 +1,30 @@ # # ### channelfinder installation location -RS_INSTALL_LOCATION=/opt/RecSync +RS_INSTALL_PATH=/opt +RS_INSTALL_LOCATION=$(RS_INSTALL_PATH)/recsync # # # -RS_CFG_FILE:=recsync.conf -RS_CFG_FILE_IN:=$(RS_CFG_FILE).in +RECSYNC_CONF:=recsync.conf # ### CF Properties for DB info tag -CF_PROPERTIES:=archive elemName elemType elemField devName handle area sector -# +RS_PROPERTIES_INFOTAGS:=archive elemName elemType elemField devName handle area sector +RS_CFG_LOGLEVEL=WARN +RS_BIND_ADDR=0.0.0.0:45722 +RS_PROCS_CHAIN=cf +RS_ANNOUNCE_INTERVAL=15 +RS_TCPTIMEOUT=15.0 +RS_COMMIT_INTERVAL=5 +RS_MAXACTIVE=20 +# +# +### Default TWISTD path and its options +TWISTD_PATH:=/usr/bin + # -### Default TWISD path and its options -TWISD_PATH:=/usr/bin +CFAPI_CONF:=channelfinderapi.conf SYSTEMD_PATH:=/etc/systemd/system # @@ -28,10 +38,22 @@ RS_USERID:=recceiver ### nfsgroup is valid for CentOS ### Both has 65534 gid, ### Do not change it if one doesn't know what could be done properly. -GROUPID:=65534 +RS_GROUPID:=65534 # # +RS_SITE_TEMPLATE_PATH=$(TOP)/site-template + + +# SYSTEDM Required and After Service List +# This is After and Required services for the systemd archiver appliance systemd service. +# mariadb.service was defined in there, but sometimes, we need to check our directories where +# our data will be saved. +# one can check the mounting service name through `systemctl list-units --type=mount` +# Here is the example for the ALS environment +# CONFIG_SITE.local can be used to hold this information locally +# Each service need one space between them, and backslash must be double backslash +RS_SYSTEMD_SERVICES:=channelfinder.service # These allow developers to override the CONFIG_SITE variable # settings without having to modify the configure/CONFIG_SITE diff --git a/configure/CONFIG_SRC b/configure/CONFIG_SRC index f36b54c..85d5ec6 100644 --- a/configure/CONFIG_SRC +++ b/configure/CONFIG_SRC @@ -24,7 +24,6 @@ INIT_SRC2 = 1 endif # # -RS_SITE_TEMPLATE_PATH:=$(TOP)/site-template RS_SYSTEMD_FILENAME:=recsync.service # # diff --git a/configure/CONFIG_VARS b/configure/CONFIG_VARS index 6279c5a..7358a1a 100644 --- a/configure/CONFIG_VARS +++ b/configure/CONFIG_VARS @@ -9,8 +9,13 @@ RS_SRC_GITURL:=$(CF_SRC_URL)/$(RS_SRC_NAME) ### SRC_PATH used for a local directory which is a clone git repository RS_SRC_PATH:=$(RS_SRC_NAME)-src # +#DOCURL:=https://docs.payara.fish/community/docs/$(SRC_VERSION)/README.html +DOCURL1:=$(RS_SRC_GITURL) + # PY_CF_SRC_GITURL:=$(CF_SRC_URL)/$(PY_CF_SRC_NAME) ### SRC_PATH used for a local directory which is a clone git repository PY_CF_SRC_PATH:=$(PY_CF_SRC_NAME)-src # +DOCURL2:=$(PY_CF_SRC_GITURL) + diff --git a/configure/RELEASE b/configure/RELEASE index 9968377..00c320e 100644 --- a/configure/RELEASE +++ b/configure/RELEASE @@ -4,7 +4,8 @@ CF_SRC_URL:=https://github.com/ChannelFinder RS_SRC_NAME:=recsync ### Which the source tag / branch / hash id would like to use -RS_SRC_TAG:=48fcbe8 +# 2022-05-17 +RS_SRC_TAG:=32a49d1 ### Placeholder for the site-specific version control RS_SRC_VERSION:=$(RS_SRC_TAG) # @@ -12,14 +13,12 @@ RS_SRC_VERSION:=$(RS_SRC_TAG) ### Where the Source repository SRC2_URL/SRC2_NAME PY_CF_SRC_NAME:=pyCFClient ### Which the source tag / branch / hash id would like to use +# 2019-03-04 PY_CF_SRC_TAG:=9689d5b ### Placeholder for the site-specific version control PY_CF_SRC_VERSION:=$(PY_CF_SRC_TAG) # # - - - -include $(TOP)/../RELEASE.local -include $(TOP)/configure/RELEASE.local diff --git a/configure/RULES b/configure/RULES index 8915579..d1e5eb6 100644 --- a/configure/RULES +++ b/configure/RULES @@ -1,12 +1,15 @@ +vpath %.local $(TOP)/configure +vpath %.in $(RS_SITE_TEMPLATE_PATH) +vpath %.in $(RS_SITE_TEMPLATE_PATH)/systemd +vpath %.services $(RS_SITE_TEMPLATE_PATH)/systemd + # include $(TOP)/configure/RULES_FUNC -# include $(TOP)/configure/RULES_SRC -# include $(TOP)/configure/RULES_INSTALL -# +include $(TOP)/configure/RULES_SYSTEMD include $(TOP)/configure/RULES_DOCKER -# +include $(TOP)/configure/RULES_PROPERTIES include $(TOP)/configure/RULES_VARS # diff --git a/configure/RULES_INSTALL b/configure/RULES_INSTALL index 228fb24..71ed92a 100644 --- a/configure/RULES_INSTALL +++ b/configure/RULES_INSTALL @@ -1,75 +1,21 @@ # # -.PHONY: sd_config sd_install sd_status sd_start sd_stop sd_restart sd_clean sd_enable sd_disable -# -# -sd_config: - $(QUIET)sed -e "s:_PYTHONPATH_:$(RS_INSTALL_LOCATION):g" \ - -e "s:_TWISDPATH_:$(TWISD_PATH):g" \ - -e "s:_CONFIGFILE_:$(RS_CFG_FILE):g" \ - -e "s:_USERID_:$(RS_USERID):g" \ - -e "s:_GROUPID_:$(GROUPID):g" \ - < $(RS_SITE_TEMPLATE_PATH)/rs.service.in > $(RS_SITE_TEMPLATE_PATH)/$(RS_SYSTEMD_FILENAME) -# -# -sd_install: sd_config - $(QUIET)$(SUDO) $(INSTALL_DATA) -b $(RS_SITE_TEMPLATE_PATH)/$(RS_SYSTEMD_FILENAME) $(SYSTEMD_PATH)/ - $(QUIET)$(SUDO) systemctl daemon-reload -# -# -sd_status: - $(QUIET) systemctl status -l $(RS_SYSTEMD_FILENAME) | cat -b -# -# -sd_start: - $(QUIET)$(SUDO) systemctl start $(RS_SYSTEMD_FILENAME) -# -# We ignore its error -sd_stop: - -$(QUIET)$(SUDO) systemctl stop $(RS_SYSTEMD_FILENAME) -# -# -sd_restart: - $(QUIET)$(SUDO) systemctl restart $(RS_SYSTEMD_FILENAME) -# -# We ignore its error -sd_clean: - -$(QUIET)$(SUDO) systemctl disable $(RS_SYSTEMD_FILENAME) - -$(QUIET)$(SUDO) rm -f $(SYSTEMD_PATH)/$(RS_SYSTEMD_FILENAME) -# -# -sd_enable: - $(if $(wildcard $(SYSTEMD_PATH)/$(RS_SYSTEMD_FILENAME)), $(SUDO) systemctl enable $(RS_SYSTEMD_FILENAME)) -# -# -sd_disable: - $(if $(wildcard $(SYSTEMD_PATH)/$(RS_SYSTEMD_FILENAME)), $(SUDO) systemctl disable $(RS_SYSTEMD_FILENAME)) -# -# .PHONY: src_install src_preinst src_versions src_postrm install uninstall restart src_install: src_preinst - $(QUIET)$(SUDO) $(INSTALL) --owner=$(RS_USERID) --group=$(GROUPID) -d $(RS_INSTALL_LOCATION) + $(QUIET)$(SUDO) $(INSTALL) --owner=$(RS_USERID) --group=$(RS_GROUPID) -d $(RS_INSTALL_LOCATION) $(QUIET)$(SUDO) cp -r $(RS_SRC_PATH)/server/recceiver/ $(RS_INSTALL_LOCATION)/ $(QUIET)$(SUDO) cp -r $(RS_SRC_PATH)/server/twisted/ $(RS_INSTALL_LOCATION)/ $(QUIET)$(SUDO) cp -r $(PY_CF_SRC_PATH)/channelfinder/ $(RS_INSTALL_LOCATION)/ - $(QUIET)$(SUDO) $(INSTALL) -m 400 -b $(RS_SITE_TEMPLATE_PATH)/$(RS_CFG_FILE) $(RS_INSTALL_LOCATION)/ - $(QUIET)$(SUDO) $(INSTALL) -m 400 -b $(RS_SITE_TEMPLATE_PATH)/channelfinderapi.conf $(RS_INSTALL_LOCATION)/ - $(QUIET)$(SUDO) $(INSTALL) -m 755 -b $(RS_SITE_TEMPLATE_PATH)/dropin.cache $(RS_INSTALL_LOCATION)/twisted/plugins/ - $(QUIET)$(SUDO) $(INSTALL_DATA) -b $(RS_SITE_TEMPLATE_PATH)/.versions $(RS_INSTALL_LOCATION)/ - $(QUIET)$(SUDO) chown -R $(RS_USERID):$(GROUPID) $(RS_INSTALL_LOCATION) + $(QUIET)$(SUDO) $(INSTALL) -m 400 -b $(RS_SITE_TEMPLATE_PATH)/$(RECSYNC_CONF) $(RS_INSTALL_LOCATION)/ + $(QUIET)$(SUDO) $(INSTALL) -m 400 -b $(RS_SITE_TEMPLATE_PATH)/$(CFAPI_CONF) $(RS_INSTALL_LOCATION)/ + $(QUIET)$(SUDO) $(INSTALL) -m 755 -b $(RS_SITE_TEMPLATE_PATH)/dropin.cache $(RS_INSTALL_LOCATION)/twisted/plugins/ + $(QUIET)$(SUDO) $(INSTALL_DATA) -b $(RS_SITE_TEMPLATE_PATH)/.versions $(RS_INSTALL_LOCATION)/ + $(QUIET)$(SUDO) chown -R $(RS_USERID):$(RS_GROUPID) $(RS_INSTALL_LOCATION) $(QUIET) rm -f $(RS_SITE_TEMPLATE_PATH)/.versions -src_preinst: src_versions - $(QUIET)$(SUDO) bash $(RS_SITE_TEMPLATE_PATH)/recceiver.postinst "configure" "$(RS_USERID)" "$(GROUPID)" - $(QUIET)sed -e "s:@CF_PROPERTIES@:$(CF_PROPERTIES):g" \ - -e "s/@RS_ADDR_LIST@/$(RS_ADDR_LIST)/g" \ - < $(RS_SITE_TEMPLATE_PATH)/$(RS_CFG_FILE_IN) > $(RS_SITE_TEMPLATE_PATH)/$(RS_CFG_FILE) - $(QUIET)sed -e "s|@CF_FULL_URL@|$(CF_FULL_URL)|g" \ - -e "s:@CF_USER@:$(CF_USER):g" \ - -e "s:@CF_PASSWD@:$(CF_PASSWD):g" \ - < $(RS_SITE_TEMPLATE_PATH)/channelfinderapi.conf.in > $(RS_SITE_TEMPLATE_PATH)/channelfinderapi.conf - +src_preinst: src_versions conf.rsproperties + $(QUIET)$(SUDO) bash $(RS_SITE_TEMPLATE_PATH)/recceiver.postinst "configure" "$(RS_USERID)" "$(RS_GROUPID)" src_versions: $(QUIET)echo "Timestamps : $$(date +%Y%m%d-%H%M%S)/YYYYMMDD-HHMMSS" > $(RS_SITE_TEMPLATE_PATH)/.versions @@ -79,7 +25,7 @@ src_versions: $(QUIET)echo "- SRC2 VER : $(PY_CF_SRC_TAG)" >> $(RS_SITE_TEMPLATE_PATH)/.versions src_postrm: - $(QUIET)$(SUDO) bash $(RS_SITE_TEMPLATE_PATH)/recceiver.postrm "purge" "$(RS_USERID)" + $(QUIET)$(SUDO) bash $(RS_SITE_TEMPLATE_PATH)/recceiver.postrm "purge" "$(RS_USERID)" ## Install recsync : add user/group, install all, setup and enable service install: src_install sd_install sd_enable diff --git a/configure/RULES_PROPERTIES b/configure/RULES_PROPERTIES new file mode 100644 index 0000000..87257a3 --- /dev/null +++ b/configure/RULES_PROPERTIES @@ -0,0 +1,36 @@ + +properties_RULES_NAMES:=recsync cfapi +conf_properties_RULES:=$(addprefix conf., $(properties_RULES_NAMES)) +show_properties_RULES:=$(addsuffix .show, $(conf_properties_RULES)) + +RULES_VARS+=conf.rsproperties conf.rsproperties.show + +conf.rsproperties: $(conf_properties_RULES) + +conf.rsproperties.show: $(show_properties_RULES) + +conf.recsync: $(RECSYNC_CONF).in + $(QUIET)echo ">>> Generate $(basename $<) from $<" + $(QUIET)sed -e "s|@RS_CFG_LOGLEVEL@|$(RS_CFG_LOGLEVEL)|g" \ + -e "s|@RS_ADDR_LIST@|$(RS_ADDR_LIST)|g" \ + -e "s|@RS_BIND_ADDR@|$(RS_BIND_ADDR)|g" \ + -e "s|@RS_PROCS_CHAIN@|$(RS_PROCS_CHAIN)|g" \ + -e "s|@RS_ANNOUNCE_INTERVAL@|$(RS_ANNOUNCE_INTERVAL)|g" \ + -e "s|@RS_TCPTIMEOUT@|$(RS_TCPTIMEOUT)|g" \ + -e "s|@RS_COMMIT_INTERVAL@|$(RS_COMMIT_INTERVAL)|g" \ + -e "s|@RS_MAXACTIVE@|$(RS_MAXACTIVE)|g" \ + -e "s|@RS_PROPERTIES_INFOTAGS@|$(RS_PROPERTIES_INFOTAGS)|g" \ + < $< > $(basename $<) + +conf.recsync.show: $(RECSYNC_CONF).in + cat -b $(basename $<) + +conf.cfapi: $(CFAPI_CONF).in + $(QUIET)echo ">>> Generate $(basename $<) from $<" + $(QUIET)sed -e "s|@CF_FULL_URL@|$(CF_FULL_URL)|g" \ + -e "s|@CF_USER@|$(CF_USER)|g" \ + -e "s|@CF_PASSWD@|$(CF_PASSWD)|g" \ + < $< > $(basename $<) + +conf.cfapi.show: $(CFAPI_CONF).in + cat -b $(basename $<) diff --git a/configure/RULES_SYSTEMD b/configure/RULES_SYSTEMD new file mode 100644 index 0000000..d2262d9 --- /dev/null +++ b/configure/RULES_SYSTEMD @@ -0,0 +1,76 @@ +# +# +.PHONY: sd_install sd_status sd_start sd_stop sd_restart sd_clean sd_enable sd_disable +# +# + +systemd_RULES_NAMES:=systemd0 +conf_systemd_RULES:=$(addprefix conf., $(systemd_RULES_NAMES)) +show_systemd_RULES:=$(addsuffix .show, $(conf_systemd_RULES)) +install_systemd_RULES:=$(addprefix install., $(systemd_RULES_NAMES)) +show_install_systemd_RULES:=$(addsuffix .show, $(install_systemd_RULES)) + +sd_install: conf.systemd install.systemd + $(QUIET)$(SUDO) systemctl daemon-reload + +.PHONY: conf.systemd conf.systemd.show + +conf.systemd: $(conf_systemd_RULES) + +conf.systemd.show: $(show_systemd_RULES) + +install.systemd: $(install_systemd_RULES) + +install.systemd.show: $(show_install_systemd_RULES) + +conf.systemd0: $(RS_SYSTEMD_FILENAME).in + $(QUIET)echo ">>> Generate $(basename $<) from $<" + $(QUIET)echo ">>> $(RS_SYSTEMD_SERVICES)" + $(QUIET)sed -e "s|@DOCURL1@|$(DOCURL1)|g" \ + -e "s|@DOCURL2@|$(DOCURL2)|g" \ + -e 's|@SYSTEMD_SERVICES@|$(RS_SYSTEMD_SERVICES)|g' \ + -e "s|@USERID@|$(RS_USERID)|g" \ + -e "s|@GROUPID@|$(RS_GROUPID)|g" \ + -e "s|@RS_INSTALL_LOCATION@|$(RS_INSTALL_LOCATION)|g" \ + -e "s|@TWISTD_PATH@|$(TWISTD_PATH)|g" \ + -e "s|@RECSYNC_CONF@|$(RECSYNC_CONF)|g" \ + < $< > $(basename $<) + +conf.systemd0.show: $(RS_SYSTEMD_FILENAME).in + @cat -b $(basename $<) + +install.systemd0: $(RS_SYSTEMD_FILENAME).in + $(QUIET)$(SUDO) $(INSTALL_DATA) -b $(basename $<) $(SYSTEMD_PATH)/ + +install.systemd0.show: + $(QUIET)cat -b $(SYSTEMD_PATH)/$(RS_SYSTEMD_FILENAME) +# +# +sd_status: + $(QUIET) systemctl status -l $(RS_SYSTEMD_FILENAME) | cat -b + +# +sd_start: + $(QUIET)$(SUDO) systemctl start $(RS_SYSTEMD_FILENAME) +# +# We ignore its error +sd_stop: + -$(QUIET)$(SUDO) systemctl stop $(RS_SYSTEMD_FILENAME) +# +# +sd_restart: + $(QUIET)$(SUDO) systemctl restart $(RS_SYSTEMD_FILENAME) +# +# We ignore its error +sd_clean: + $(if $(wildcard $(SYSTEMD_PATH)/$(RS_SYSTEMD_FILENAME)), $(QUIET)$(SUDO) rm -f $(SYSTEMD_PATH)/$(RS_SYSTEMD_FILENAME)) +# +# +sd_enable: + $(if $(wildcard $(SYSTEMD_PATH)/$(RS_SYSTEMD_FILENAME)), $(SUDO) systemctl enable $(RS_SYSTEMD_FILENAME)) +# +# +sd_disable: + $(if $(wildcard $(SYSTEMD_PATH)/$(RS_SYSTEMD_FILENAME)), $(SUDO) systemctl disable $(RS_SYSTEMD_FILENAME)) +# +# diff --git a/configure/RULES_VARS b/configure/RULES_VARS index 47bbc81..009d85c 100644 --- a/configure/RULES_VARS +++ b/configure/RULES_VARS @@ -1,9 +1,16 @@ +RULES_VARS+=$(foreach v, $(filter %_RULES,$(.VARIABLES)), $(v)) +RULES_VARS+=$(foreach v, $(filter %_RULES_NAMES,$(.VARIABLES)), $(v)) + VARS_EXCLUDES+=.SHELLSTATUS -VARS_EXCLUDES+=$(filter INIT_SRC%, $(.VARIABLES)) -VARS_EXCLUDES+=$(filter SRC%_URL, $(.VARIABLES)) -VARS_EXCLUDES+=$(filter SRC%_NAME, $(.VARIABLES)) -VARS_EXCLUDES+=SITE_TEMPLATE_PATH -#VARS_EXCLUDES+=CF_% +VARS_EXCLUDES+=INIT_SRC +VARS_EXCLUDES+=FILTER +VARS_EXCLUDES+=LEVEL +VARS_EXCLUDES+=$(filter JAR_%, $(.VARIABLES)) +VARS_EXCLUDES+=$(RULES_VARS) +VARS_EXCLUDES+=%_RULES_VARS +VARS_EXCLUDES+=RULES_VARS +VARS_EXCLUDES+=a_service_BUIDER buildrules_BUILDER + VARS_EXCLUDES+=AS_% VARS_EXCLUDES+=OG_% VARS_EXCLUDES+=PS_% @@ -15,11 +22,15 @@ VARS_EXCLUDES+=CF_USER VARS_EXCLUDES+=CF_SRC_URL VARS_EXCLUDES+=CF_PRTO VARS_EXCLUDES+=CF_URL -VARS_EXCLUDES+=CF_FULL_URL +VARS_EXCLUDES+=LSOPTS -LEVEL?=1 +.PHONY: $(RULES_VARS) + +LEVEL?=1 FILTER?=1 +LSOPTS?="-lta" + ifeq "$(FILTER)" "1" SRC_VARIABLES:=$(sort $(filter-out $(VARS_EXCLUDES) VARS_EXCLUDES,$(.VARIABLES))) @@ -27,8 +38,6 @@ else SRC_VARIABLES:=$(filter $(FILTER)%, $(sort $(filter-out $(VARS_EXCLUDES) VARS_EXCLUDES,$(.VARIABLES)))) endif -SRC_VARIABLES+=CF_PROPERTIES - .PHONY : env vars header env: vars @@ -52,13 +61,24 @@ print-%: $(QUIET)echo $* = $($*) $(QUIET)echo $*\'s origin is $(origin $*) +ls.%: + $(QUIET) ls $(LSOPTS) $($*) + +tree.%: + $(QUIET) tree -aL $(LEVEL) $($*) + +cat.%: + $(QUIET) cat -b $($*) + FORCE: +.PHONY : exist + exist: ifeq (, $(shell which tree)) - $(if $(wildcard $(RS_INSTALL_LOCATION)), @ ls -d $(RS_INSTALL_LOCATION) && find $(RS_INSTALL_LOCATION)/ -maxdepth $(LEVEL) | sed -e "s/[^-][^\/]*\// |/g" -e "s/|\([^ ]\)/:---\1/") + $(if $(wildcard $(CF_INSTALL_LOCATION)), @ ls -d $(CF_INSTALL_LOCATION) && find $(CF_INSTALL_LOCATION)/ -maxdepth $(LEVEL) | sed -e "s/[^-][^\/]*\// |/g" -e "s/|\([^ ]\)/:---\1/") else - $(if $(wildcard $(RS_INSTALL_LOCATION)), tree -aL $(LEVEL) $(RS_INSTALL_LOCATION), $(QUIET)echo "No $(RS_INSTALL_LOCATION)") + $(if $(wildcard $(CF_INSTALL_LOCATION)), tree -pugaL $(LEVEL) $(CF_INSTALL_LOCATION), $(QUIET)echo "No $(CF_INSTALL_LOCATION)") endif @@ -66,4 +86,3 @@ endif .NOTPARALLEL: -VARS_EXCLUDES+=FILTER diff --git a/site-template/recsync.conf.in b/site-template/recsync.conf.in index c4248c2..250e179 100644 --- a/site-template/recsync.conf.in +++ b/site-template/recsync.conf.in @@ -1,7 +1,7 @@ [recceiver] # Logging detail level. Use python logging level name. -loglevel = WARN +loglevel = @RS_CFG_LOGLEVEL@ # list of broadcast address:port with comma ',' seperated. # a broadcast address in the same subnet where RecCeiver runs : 127.255.255.255 @@ -21,31 +21,31 @@ addrList = @RS_ADDR_LIST@ # Default uses wildcard address and a random port. # 45722 is the randomly selected port # -bind = 0.0.0.0:45722 +bind = @RS_BIND_ADDR@ # Processing chain -procs = cf +procs = @RS_PROCS_CHAIN@ # Time interval for sending recceiver advertisments -# announceInterval = 15.0 +announceInterval = @RS_ANNOUNCE_INTERVAL@ # Idle Timeout for TCP connections. -# tcptimeout = 15.0 +tcptimeout = @RS_TCPTIMEOUT@ # Time to wait before commiting updates # Doesn't effect IOC clients -# commitInterval = 5.0 +commitInterval = @RS_COMMIT_INTERVAL@ # Maximum concurrent "active" clients # to allow. -#maxActive = 20 +maxActive = @RS_MAXACTIVE@ # The channelFinder client is configuration information is # stored in channelfinderapi.conf as described in the client [cf] # a space-separated list of infotags to set as CF Properties -infotags = @CF_PROPERTIES@ +infotags = @RS_PROPERTIES_INFOTAGS@ alias = on # EOF diff --git a/site-template/rs.service.in b/site-template/recsync.service.in similarity index 58% rename from site-template/rs.service.in rename to site-template/recsync.service.in index dccc545..2863b62 100644 --- a/site-template/rs.service.in +++ b/site-template/recsync.service.in @@ -1,20 +1,19 @@ [Unit] Description=RecSync Service -Documentation=https://github.com/ChannelFinder/recsync/tree/master/server -Documentation=https://github.com/ChannelFinder/pyCFClient -After=network.target channelfinder.service -Requires=channelfinder.service +Documentation=@DOCURL1@ +Documentation=@DOCURL2@ +After=network.target @SYSTEMD_SERVICES@ +Requires=@SYSTEMD_SERVICES@ [Service] - # # Twistd also has the options, but we use the systemd one instead. # -User=_USERID_ -Group=_GROUPID_ +User=@USERID@ +Group=@GROUPID@ # Everything in a local, so we have to tell where PYTHONPATH is -Environment="PYTHONPATH=_PYTHONPATH_" +Environment="PYTHONPATH=@RS_INSTALL_LOCATION@" # Due to User/Group permission, we cannot generate the recsync.log # in /var/log/ folder. So we put in into the recsync installation @@ -22,11 +21,11 @@ Environment="PYTHONPATH=_PYTHONPATH_" # generated. However, we don't need it, since systemd service will # take care of this. # -ExecStart=_TWISDPATH_/twistd --logfile=_PYTHONPATH_/recsync.log \ - --rundir _PYTHONPATH_ \ +ExecStart=@TWISTD_PATH@/twistd --logfile=@RS_INSTALL_LOCATION@/recsync.log \ + --rundir @RS_INSTALL_LOCATION@ \ --pidfile= \ --reactor=poll \ - --nodaemon recceiver -f _PYTHONPATH_/_CONFIGFILE_ + --nodaemon recceiver -f @RS_INSTALL_LOCATION@/@RECSYNC_CONF@ Restart=always RestartSec=10s From c960caedab5b05a4d76afad8873c0d5cbe2b7d86 Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Sun, 18 Sep 2022 23:02:42 -0700 Subject: [PATCH 12/39] test debian 11 github action --- .github/workflows/debian11.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/debian11.yml b/.github/workflows/debian11.yml index 5c1ace1..ef43927 100644 --- a/.github/workflows/debian11.yml +++ b/.github/workflows/debian11.yml @@ -29,7 +29,6 @@ jobs: - name: Install required packages run: | apt update -y - apt install -y python-twisted python-requests python-simplejson python-urllib3 - name: Check PYTHON environment run: | which python From 3d805ff83c5e58bce1bf93cf6d2b7de5a4ec1f41 Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Sun, 18 Sep 2022 23:52:44 -0700 Subject: [PATCH 13/39] debian11 github --- .github/workflows/debian11.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/debian11.yml b/.github/workflows/debian11.yml index ef43927..465b1e2 100644 --- a/.github/workflows/debian11.yml +++ b/.github/workflows/debian11.yml @@ -4,6 +4,8 @@ name: Debian 11 on: push: branches: [ master ] + paths: + - '.github/workflows/debian11.yml' paths-ignores: - '*.md' - 'docker/**' @@ -23,17 +25,18 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: '3.10' - name: Install required packages run: | apt update -y + apt install -y python3-twisted python3-requests python3-simplejson python3-urllib3 + update-alternatives --install /usr/bin/python python /usr/bin/python3 1 + update-alternatives --install /usr/bin/twistd twistd /usr/bin/twistd3 1 - name: Check PYTHON environment run: | which python - which twisted python --version + which twistd + twistd --version - name: Configuration run: | make init From ce8fbc916608cae9686258c0a4a3d584abef15d0 Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Sun, 18 Sep 2022 23:55:09 -0700 Subject: [PATCH 14/39] add make for debian11 github action --- .github/workflows/debian11.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/debian11.yml b/.github/workflows/debian11.yml index 465b1e2..c33ec71 100644 --- a/.github/workflows/debian11.yml +++ b/.github/workflows/debian11.yml @@ -28,6 +28,7 @@ jobs: - name: Install required packages run: | apt update -y + apt install -y git make sudo tree which apt install -y python3-twisted python3-requests python3-simplejson python3-urllib3 update-alternatives --install /usr/bin/python python /usr/bin/python3 1 update-alternatives --install /usr/bin/twistd twistd /usr/bin/twistd3 1 From 60c6521832d3fbaf81d70405c743a0058741df9e Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Sun, 18 Sep 2022 23:55:50 -0700 Subject: [PATCH 15/39] add make for debian11 github action --- .github/workflows/debian11.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/debian11.yml b/.github/workflows/debian11.yml index c33ec71..def4fdf 100644 --- a/.github/workflows/debian11.yml +++ b/.github/workflows/debian11.yml @@ -28,7 +28,7 @@ jobs: - name: Install required packages run: | apt update -y - apt install -y git make sudo tree which + apt install -y git make sudo tree apt install -y python3-twisted python3-requests python3-simplejson python3-urllib3 update-alternatives --install /usr/bin/python python /usr/bin/python3 1 update-alternatives --install /usr/bin/twistd twistd /usr/bin/twistd3 1 From a28a1ce8e2d25f546cbb2d9a1daeca6011b69bff Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Sun, 18 Sep 2022 23:59:31 -0700 Subject: [PATCH 16/39] fixed the make exist, and update ubuntu action --- .github/workflows/ubuntu.yml | 13 +++++++------ configure/RULES_VARS | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 387268e..51c8f07 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -22,25 +22,26 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: '3.10' - name: Install required packages run: | apt update -y - apt install -y python-twisted python-requests python-simplejson python-urllib3 + apt install -y git make sudo tree + apt install -y python3-twisted python3-requests python3-simplejson python3-urllib3 + update-alternatives --install /usr/bin/python python /usr/bin/python3 1 + update-alternatives --install /usr/bin/twistd twistd /usr/bin/twistd3 1 - name: Check PYTHON environment run: | which python - which twisted python --version + which twistd + twistd --version - name: Configuration run: | make init make vars - name: Build run: | - make src_install + make install - name: Environment Check run: make exist diff --git a/configure/RULES_VARS b/configure/RULES_VARS index 009d85c..85b4ca3 100644 --- a/configure/RULES_VARS +++ b/configure/RULES_VARS @@ -76,9 +76,9 @@ FORCE: exist: ifeq (, $(shell which tree)) - $(if $(wildcard $(CF_INSTALL_LOCATION)), @ ls -d $(CF_INSTALL_LOCATION) && find $(CF_INSTALL_LOCATION)/ -maxdepth $(LEVEL) | sed -e "s/[^-][^\/]*\// |/g" -e "s/|\([^ ]\)/:---\1/") + $(if $(wildcard $(RS_INSTALL_LOCATION)), @ ls -d $(RS_INSTALL_LOCATION) && find $(RS_INSTALL_LOCATION)/ -maxdepth $(LEVEL) | sed -e "s/[^-][^\/]*\// |/g" -e "s/|\([^ ]\)/:---\1/") else - $(if $(wildcard $(CF_INSTALL_LOCATION)), tree -pugaL $(LEVEL) $(CF_INSTALL_LOCATION), $(QUIET)echo "No $(CF_INSTALL_LOCATION)") + $(if $(wildcard $(RS_INSTALL_LOCATION)), tree -pugaL $(LEVEL) $(RS_INSTALL_LOCATION), $(QUIET)echo "No $(RS_INSTALL_LOCATION)") endif From f2a2cebc90e86e0ee3e1fdae1751ebf6048474ff Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Mon, 19 Sep 2022 00:01:11 -0700 Subject: [PATCH 17/39] update ubuntu action --- .github/workflows/ubuntu.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 51c8f07..99bbd56 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -24,11 +24,11 @@ jobs: - uses: actions/checkout@v3 - name: Install required packages run: | - apt update -y - apt install -y git make sudo tree - apt install -y python3-twisted python3-requests python3-simplejson python3-urllib3 - update-alternatives --install /usr/bin/python python /usr/bin/python3 1 - update-alternatives --install /usr/bin/twistd twistd /usr/bin/twistd3 1 + sudo apt update -y + sudo apt install -y git make tree + sudo apt install -y python3-twisted python3-requests python3-simplejson python3-urllib3 + sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1 + sudo update-alternatives --install /usr/bin/twistd twistd /usr/bin/twistd3 1 - name: Check PYTHON environment run: | which python @@ -41,7 +41,7 @@ jobs: make vars - name: Build run: | - make install + sudo make install - name: Environment Check run: make exist From b2026a44e327c802773c266f6fd24859c9b6ae18 Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Mon, 19 Sep 2022 00:12:13 -0700 Subject: [PATCH 18/39] add rocky8 action --- .github/workflows/rocky8.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/rocky8.yml b/.github/workflows/rocky8.yml index c7b04a4..f57e0cc 100644 --- a/.github/workflows/rocky8.yml +++ b/.github/workflows/rocky8.yml @@ -24,18 +24,23 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: '3.10' - name: Install required packages run: | + dnf -y install dnf-plugins-core dnf update -y - dnf install -y git make sudo which python3-twisted python-requests python3-simplejson python3-urllib3 + dnf config-manager --set-enabled powertools + dnf update -y + dnf -y install "epel-release" + dnf update -y + dnf install -y git make sudo tree which + dnf install -y python3-twisted python3-requests python3-simplejson python3-urllib3 + alternatives --set python /usr/bin/python3 - name: Check PYTHON environment run: | which python - which twisted python --version + which twistd + twistd --version - name: Configuration run: | make init From ba2d57493baeea19a0d5398443c3fc518fc5a585 Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Mon, 19 Sep 2022 00:49:52 -0700 Subject: [PATCH 19/39] Update README.md --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9e6693d..eabdddc 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ # RecSync-env - -![RecSync-env installation test](https://github.com/ChannelFinder/RecSync-env/workflows/RecSync-env%20installation%20test/badge.svg) -![Docker Image CI](https://github.com/ChannelFinder/RecSync-env/workflows/Docker%20Image%20CI/badge.svg) -![Linter Run](https://github.com/ChannelFinder/RecSync-env/workflows/Linter%20Run/badge.svg) +[![Debian 11](https://github.com/jeonghanlee/RecSync-env/actions/workflows/debian11.yml/badge.svg)](https://github.com/jeonghanlee/RecSync-env/actions/workflows/debian11.yml) +[![Ubuntu latest](https://github.com/jeonghanlee/RecSync-env/actions/workflows/ubuntu.yml/badge.svg)](https://github.com/jeonghanlee/RecSync-env/actions/workflows/ubuntu.yml) +[![Rocky8](https://github.com/jeonghanlee/RecSync-env/actions/workflows/rocky8.yml/badge.svg)](https://github.com/jeonghanlee/RecSync-env/actions/workflows/rocky8.yml) Configuration Environment for the recsync server (aka. RecCeiver) at From 811e46027bbcaa995d8d5049480f1190b773223b Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Thu, 22 Sep 2022 13:33:10 -0700 Subject: [PATCH 20/39] update readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9e6693d..3bbbc4e 100644 --- a/README.md +++ b/README.md @@ -22,10 +22,10 @@ In order to download, install, setup all relevant components, one should do many Note that `sqlite3` may not be necessary if one would like to test it with ChannelFinder directly. -* Debian 10 +* Debian 11 ```bash -sudo apt install sqlite3 python-twisted python-requests python-simplejson python-urllib3 +sudo apt install sqlite3 python3-twisted python3-requests python3-simplejson python3-urllib3 ``` * CentOS 7 From 6cd995e30f9474e821bf7fad0bf79d311e0761ba Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Thu, 22 Sep 2022 21:07:02 -0700 Subject: [PATCH 21/39] Initial local running on macOS --- .github/workflows/docker.yml | 4 +- .github/workflows/linter.yml | 22 ++++ .gitignore | 2 + README.md | 106 +++--------------- configure/CONFIG_SITE | 7 +- configure/RULES | 3 + configure/RULES_CI | 18 +++ configure/RULES_INSTALL | 47 ++++---- configure/RULES_PROPERTIES | 25 ++++- configure/RULES_REQ | 27 +++++ configure/RULES_RUN | 17 +++ site-template/recsync.conf.in | 15 ++- .../{ => systemd}/recsync.service.in | 2 +- 13 files changed, 175 insertions(+), 120 deletions(-) create mode 100644 .github/workflows/linter.yml create mode 100644 configure/RULES_CI create mode 100644 configure/RULES_REQ create mode 100644 configure/RULES_RUN rename site-template/{ => systemd}/recsync.service.in (95%) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 4cb6630..4c18c36 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,5 +1,5 @@ # 0. change name -name: Record Syn +name: Docker # change path name on: push: @@ -19,7 +19,7 @@ jobs: DOCKER_FILE: docker/Dockerfile DOCKER_ACCOUNT: alscontrols DOCKER_REPO: recsync - DOCKER_TAG: latest + DOCKER_TAG: v2.0.0-pre steps: - diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 0000000..fbd5f9e --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,22 @@ +name: Linter Run + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + build: + name: Lint Code Base + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v3 + - name: Lint Code Base + uses: docker://github/super-linter:v4.9.5 + env: + VALIDATE_MD: true + VALIDATE_BASH: true + diff --git a/.gitignore b/.gitignore index 6e0510f..66a635d 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,5 @@ site-template/recsync.conf /modules/Makefile.local /*Top/configure/*.local *.swp +.rs_local_pid +*.local diff --git a/README.md b/README.md index c28929c..5a50a0d 100644 --- a/README.md +++ b/README.md @@ -5,105 +5,41 @@ Configuration Environment for the recsync server (aka. RecCeiver) at -## Role +## Pre-required Packages -In order to download, install, setup all relevant components, one should do many steps manually. This repository was designed for the easy-to-reproducible environment for recsync server (aka RecCeiver). - -## Requirements - -* ChannelFinder : Please check it -* systemd service : this repository has its own systemd configuration. -* `SUDO` permission -* Few system packages : Please see below. We **will** use the system default python packages and system package manager (e.g., apt for Debian) instead of `conda`, `pip`, or whatever python tools, because we would like to install `RecCeiver` in a specific local directory instead of any Python related paths. This approach gives users, who may not be familiar with many Python environments, to focus only `RecCeiver`. I am sure that users should learn million different and continuous evolving Python environments later if one would like to use it within them. -* pyCFClient : In order to integrate `RecCeiver` with ChannelFinder, pyCFClient Python application [1] or package is required. The repository [1] was already integrated into the current repository. Thus one doesn't need to care about it. - -### system packages - -Note that `sqlite3` may not be necessary if one would like to test it with ChannelFinder directly. - -* Debian 11 - -```bash -sudo apt install sqlite3 python3-twisted python3-requests python3-simplejson python3-urllib3 ``` - -* CentOS 7 - -```bash -sudo yum install sqlite python-twisted-web python-requests python2-simplejson python-urllib3 +git make sudo tree ``` -* CentOS 8 +## macOS -```bash -sudo dnf install sqlite python3-twisted python-requests-futures python3-simplejson python3-urllib3 -sudo update-alternatives --set python /usr/bin/python3 -``` +We only support macOS for testing and developing purposes, so we don't have launchd configuration. We localize the recsync service within a local folder, and define several simple Makefile rules to maintain them. +To use the following rules, one need to setup `homebrew` first. -* Fedora 31 +* Install Python3 and its required packages through `pip3` ```bash -sudo dnf install sqlite python3-twisted python-requests-futures python3-simplejson python3-urllib3 +make install.p3mac ``` -### Python - -* Debian 10 +* Installation and running procedures -```bash -Python 2.7.16 (default, Oct 10 2019, 22:02:15) -[GCC 8.3.0] on linux2 ``` - -* Fedora 31 - -```bash -$ python -Python 3.8.2 (default, Feb 28 2020, 00:00:00) -[GCC 10.0.1 20200216 (Red Hat 10.0.1-0.8)] on linux +make init +make conf +make conf.show +make local.install +make exist +make local.run +make local.stop ``` -## Few Makefile Rules - -### `make` - -* Print out selected rules with a little explanation +The log file will be located in `RS_INSTALL_LOCATION`, e.g., `$(TOP)/recsync.local` folder. -### `make init` -* Download recsync [2] and pyCFClient [1] -* Switch to specific versions defined as `$(SRC1_TAG)` for recsync and `$(SRC2_TAG)` for pyCFClinet in `configure/RELEASE` - -### `make install` - -* `sudo` permission is required. -* Add a user `recceiver` and a group id `65534` into a host system. Note that `nogroup` is valid only for Debian. -* Copy all files in `recsync/server` and `pyCFClient` into defined a local installation path `INSTALL_LOCATION` in `configure/RELEASE` -* Setup and enable systemd service - -### `make distclean` - -* Remove the downloaded recsync [2] and pyCFClient [1] source files. - -### `make vars` - -* Print out interesting variables -* One can use `make PRINT.VARIABLE_NAME` to print out them. For example, `make PRINT.INSTALL_LOCATION`. - -## A typical example to configure the ChannelFinder service - -Note that this example has the assumption which ES service is running. - -```bash -make init -make install -sudo systemctl start recsync.service -systemctl status recsync.service ``` - -## Customize site-specific configuration - -Please consult two files in `configure` path, such as `RELEASE` and `CONFIG_SITE`. There are few comments on there. If you are familiar with the standard EPICS building system [3], it should be easy to understand them, because we mimic that concept into this repository. +make local.rm +``` ## Docker Image @@ -119,12 +55,6 @@ sudo systemctl start recsync.service systemctl status recsync.service ``` -## Notice - -* If one installs this at the first time, or reinstall from scratch, for example, `make restart`, one has to start its systemd service one more time, because of the issue mentioned in . - -* There are two important configuration files, which are configured carefully. One is `site-template/recsync.conf.in` and the other is `site-template/channelfinderapi.conf`. Especially, one should use the same and correct information in `channelfinderapi.conf` in order to match with its ChannelFinder configuration. For example, user name and its password should be matched with . - ## Reference [1] diff --git a/configure/CONFIG_SITE b/configure/CONFIG_SITE index 10d6f9a..928390b 100644 --- a/configure/CONFIG_SITE +++ b/configure/CONFIG_SITE @@ -10,7 +10,6 @@ RS_INSTALL_LOCATION=$(RS_INSTALL_PATH)/recsync RECSYNC_CONF:=recsync.conf # ### CF Properties for DB info tag -RS_PROPERTIES_INFOTAGS:=archive elemName elemType elemField devName handle area sector RS_CFG_LOGLEVEL=WARN RS_BIND_ADDR=0.0.0.0:45722 RS_PROCS_CHAIN=cf @@ -18,6 +17,12 @@ RS_ANNOUNCE_INTERVAL=15 RS_TCPTIMEOUT=15.0 RS_COMMIT_INTERVAL=5 RS_MAXACTIVE=20 +RS_CONF_INFOTAGS:=archive elemName elemType elemField devName handle area sector +# Do not forget to enclose them with " ". +RS_CONF_ENV_VARS:="ENGINEER:Engineer,EPICS_BASE:EpicsVersion,PWD:WorkingDirectory" +RS_CONF_ALIAS:=on +RS_CONF_RECORDTYPE:=on +RS_CONF_RECORDDESC:=on # # ### Default TWISTD path and its options diff --git a/configure/RULES b/configure/RULES index d1e5eb6..c75a7dc 100644 --- a/configure/RULES +++ b/configure/RULES @@ -5,11 +5,14 @@ vpath %.services $(RS_SITE_TEMPLATE_PATH)/systemd # include $(TOP)/configure/RULES_FUNC +include $(TOP)/configure/RULES_REQ include $(TOP)/configure/RULES_SRC include $(TOP)/configure/RULES_INSTALL +include $(TOP)/configure/RULES_RUN include $(TOP)/configure/RULES_SYSTEMD include $(TOP)/configure/RULES_DOCKER include $(TOP)/configure/RULES_PROPERTIES +include $(TOP)/configure/RULES_CI include $(TOP)/configure/RULES_VARS # diff --git a/configure/RULES_CI b/configure/RULES_CI new file mode 100644 index 0000000..1b7cc6d --- /dev/null +++ b/configure/RULES_CI @@ -0,0 +1,18 @@ +.PHONY: conf.macos conf.macbrew + + +conf.macos: conf.macbrew +conf.macos.show: conf.macbrew + + +conf.macbrew: + $(QUIET)echo ">>> Generating $(TOP)/configure/CONFIG_SITE.local" + $(QUIET)echo "TWISTD_PATH=/opt/homebrew/bin" > $(TOP)/configure/CONFIG_SITE.local + $(QUIET)echo "RS_INSTALL_LOCATION:=$(TOP)/recsync.local" >> $(TOP)/configure/CONFIG_SITE.local + $(QUIET)echo "RS_USERID:=${USER}" >> $(TOP)/configure/CONFIG_SITE.local + $(QUIET)echo "RS_GROUPID:=admin" >> $(TOP)/configure/CONFIG_SITE.local + $(QUIET)cat -b $(TOP)/configure/CONFIG_SITE.local + +conf.macbrew.show: + cat -b $(TOP)/configure/CONFIG_SITE.local + diff --git a/configure/RULES_INSTALL b/configure/RULES_INSTALL index 71ed92a..a676973 100644 --- a/configure/RULES_INSTALL +++ b/configure/RULES_INSTALL @@ -1,47 +1,48 @@ # # -.PHONY: src_install src_preinst src_versions src_postrm install uninstall restart +.PHONY: rs_status rs_start rs_stop rs_restart rs_install src_install rs_preinst rs_postrm install uninstall restart -src_install: src_preinst - $(QUIET)$(SUDO) $(INSTALL) --owner=$(RS_USERID) --group=$(RS_GROUPID) -d $(RS_INSTALL_LOCATION) - $(QUIET)$(SUDO) cp -r $(RS_SRC_PATH)/server/recceiver/ $(RS_INSTALL_LOCATION)/ - $(QUIET)$(SUDO) cp -r $(RS_SRC_PATH)/server/twisted/ $(RS_INSTALL_LOCATION)/ - $(QUIET)$(SUDO) cp -r $(PY_CF_SRC_PATH)/channelfinder/ $(RS_INSTALL_LOCATION)/ +rs_status: sd_status + +rs_start: sd_start + +rs_stop: sd_stop + +rs_restart: sd_restart + +: +rs_install: conf + $(QUIET)$(SUDO) $(INSTALL) -d $(RS_INSTALL_LOCATION) -o $(RS_USERID) -g $(RS_GROUPID) + $(QUIET)$(SUDO) cp -r $(RS_SRC_PATH)/server/recceiver $(RS_INSTALL_LOCATION)/ + $(QUIET)$(SUDO) cp -r $(RS_SRC_PATH)/server/twisted $(RS_INSTALL_LOCATION)/ + $(QUIET)$(SUDO) cp -r $(PY_CF_SRC_PATH)/channelfinder $(RS_INSTALL_LOCATION)/ $(QUIET)$(SUDO) $(INSTALL) -m 400 -b $(RS_SITE_TEMPLATE_PATH)/$(RECSYNC_CONF) $(RS_INSTALL_LOCATION)/ $(QUIET)$(SUDO) $(INSTALL) -m 400 -b $(RS_SITE_TEMPLATE_PATH)/$(CFAPI_CONF) $(RS_INSTALL_LOCATION)/ $(QUIET)$(SUDO) $(INSTALL) -m 755 -b $(RS_SITE_TEMPLATE_PATH)/dropin.cache $(RS_INSTALL_LOCATION)/twisted/plugins/ $(QUIET)$(SUDO) $(INSTALL_DATA) -b $(RS_SITE_TEMPLATE_PATH)/.versions $(RS_INSTALL_LOCATION)/ $(QUIET)$(SUDO) chown -R $(RS_USERID):$(RS_GROUPID) $(RS_INSTALL_LOCATION) - $(QUIET) rm -f $(RS_SITE_TEMPLATE_PATH)/.versions -src_preinst: src_versions conf.rsproperties - $(QUIET)$(SUDO) bash $(RS_SITE_TEMPLATE_PATH)/recceiver.postinst "configure" "$(RS_USERID)" "$(RS_GROUPID)" +src_install: rs_install -src_versions: - $(QUIET)echo "Timestamps : $$(date +%Y%m%d-%H%M%S)/YYYYMMDD-HHMMSS" > $(RS_SITE_TEMPLATE_PATH)/.versions - $(QUIET)echo "- SRC1 URL : $(RS_SRC_GITURL)" >> $(RS_SITE_TEMPLATE_PATH)/.versions - $(QUIET)echo "- SRC1 VER : $(RS_SRC_TAG)" >> $(RS_SITE_TEMPLATE_PATH)/.versions - $(QUIET)echo "- SRC2 URL : $(PY_CF_SRC_GITURL)" >> $(RS_SITE_TEMPLATE_PATH)/.versions - $(QUIET)echo "- SRC2 VER : $(PY_CF_SRC_TAG)" >> $(RS_SITE_TEMPLATE_PATH)/.versions +rs_preinst: + $(QUIET)$(SUDO) bash $(RS_SITE_TEMPLATE_PATH)/recceiver.postinst "configure" "$(RS_USERID)" "$(RS_GROUPID)" -src_postrm: +rs_postrm: $(QUIET)$(SUDO) bash $(RS_SITE_TEMPLATE_PATH)/recceiver.postrm "purge" "$(RS_USERID)" ## Install recsync : add user/group, install all, setup and enable service -install: src_install sd_install sd_enable +install: rs_preinst rs_install sd_install sd_enable $(QUIET)echo "----- Note that one should start it and check its status via " $(QUIET)echo "----- sudo systemctl start $(RS_SYSTEMD_FILENAME) or make sd_start" $(QUIET)echo "----- systemctl status $(RS_SYSTEMD_FILENAME) or make sd_status" ## Uninstall RecSync : remove user/group, stop, clean service, remove all -uninstall: sd_stop sd_disable sd_clean src_postrm +uninstall: sd_stop sd_disable sd_clean rs_postrm $(QUIET)$(SUDO) rm -rf $(RS_INSTALL_LOCATION) -reinstall: install +reinstall: conf install ## Restart all from scratch. -restart: uninstall reinstall sd_start sd_status - $(QUIET)echo "----- Note that one should start it again and check its status via " - $(QUIET)echo "----- sudo systemctl start $(RS_SYSTEMD_FILENAME) or make sd_start" - $(QUIET)echo "----- systemctl status $(RS_SYSTEMD_FILENAME) or make sd_status" +restart: uninstall reinstall rs_start rs_status + diff --git a/configure/RULES_PROPERTIES b/configure/RULES_PROPERTIES index 87257a3..baa48a8 100644 --- a/configure/RULES_PROPERTIES +++ b/configure/RULES_PROPERTIES @@ -1,10 +1,17 @@ -properties_RULES_NAMES:=recsync cfapi +properties_RULES_NAMES:=recsync cfapi versions conf_properties_RULES:=$(addprefix conf., $(properties_RULES_NAMES)) show_properties_RULES:=$(addsuffix .show, $(conf_properties_RULES)) RULES_VARS+=conf.rsproperties conf.rsproperties.show +.PHONY: conf conf.rsproperties + +conf: conf.rsproperties conf.versions + +conf.show: conf.rsproperties.show conf.versions.show + + conf.rsproperties: $(conf_properties_RULES) conf.rsproperties.show: $(show_properties_RULES) @@ -19,7 +26,11 @@ conf.recsync: $(RECSYNC_CONF).in -e "s|@RS_TCPTIMEOUT@|$(RS_TCPTIMEOUT)|g" \ -e "s|@RS_COMMIT_INTERVAL@|$(RS_COMMIT_INTERVAL)|g" \ -e "s|@RS_MAXACTIVE@|$(RS_MAXACTIVE)|g" \ - -e "s|@RS_PROPERTIES_INFOTAGS@|$(RS_PROPERTIES_INFOTAGS)|g" \ + -e "s|@RS_CONF_INFOTAGS@|$(RS_CONF_INFOTAGS)|g" \ + -e "s|@RS_CONF_ENV_VARS@|$(RS_CONF_ENV_ARS)|g" \ + -e "s|@RS_CONF_ALIAS@|$(RS_CONF_ALIAS)|g" \ + -e "s|@RS_CONF_RECORDTYPE@|$(RS_CONF_RECORDTYPE)|g" \ + -e "s|@RS_CONF_RECORDDESC@|$(RS_CONF_RECORDDESC)|g" \ < $< > $(basename $<) conf.recsync.show: $(RECSYNC_CONF).in @@ -34,3 +45,13 @@ conf.cfapi: $(CFAPI_CONF).in conf.cfapi.show: $(CFAPI_CONF).in cat -b $(basename $<) + +conf.versions: + $(QUIET)echo "Timestamps : $$(date +%Y%m%d-%H%M%S)/YYYYMMDD-HHMMSS" > $(RS_SITE_TEMPLATE_PATH)/.versions + $(QUIET)echo "- SRC1 URL : $(RS_SRC_GITURL)" >> $(RS_SITE_TEMPLATE_PATH)/.versions + $(QUIET)echo "- SRC1 VER : $(RS_SRC_TAG)" >> $(RS_SITE_TEMPLATE_PATH)/.versions + $(QUIET)echo "- SRC2 URL : $(PY_CF_SRC_GITURL)" >> $(RS_SITE_TEMPLATE_PATH)/.versions + $(QUIET)echo "- SRC2 VER : $(PY_CF_SRC_TAG)" >> $(RS_SITE_TEMPLATE_PATH)/.versions + +conf.versions.show: + cat -b $(RS_SITE_TEMPLATE_PATH)/.versions diff --git a/configure/RULES_REQ b/configure/RULES_REQ new file mode 100644 index 0000000..bfd5844 --- /dev/null +++ b/configure/RULES_REQ @@ -0,0 +1,27 @@ + + +rs_RULES_NAMES:=p3mac +install_rs_RULES:=$(addprefix install., $(es_RULES_NAMES)) +setup_rs_RULES:=$(addprefix setup., $(es_RULES_NAMES)) +remove_rs_RULES:=$(addprefix remove., $(es_RULES_NAMES)) +show_rs_RULES:=$(addprefix show., $(es_RULES_NAMES)) + +.PHONY: + +#https://www.elastic.co/guide/en/elasticsearch/reference/current/release-notes-8.2.0.html + + +# Debian 11 + +setup.p3mac: install.p3mac + + +# macOS aarch64 +install.p3mac: + $(QUIET) brew install python@3.10 + $(QUIET) /opt/homebrew/bin/pip3 install twisted simplejson urllib3 requests + +show.p3mac: + $(QUIET) brew info python@3.10 + + diff --git a/configure/RULES_RUN b/configure/RULES_RUN new file mode 100644 index 0000000..f341311 --- /dev/null +++ b/configure/RULES_RUN @@ -0,0 +1,17 @@ +# +.PHONY: local.install local.run local.stop local.rm + + +RS_PID_LOCAL:=$(TOP)/.rs_local_pid + + +local.install: rs_install + +local.run: + $(QUIET) PYTHONPATH=$(RS_INSTALL_LOCATION) $(TWISTD_PATH)/twistd --logfile=$(RS_INSTALL_LOCATION)/recsync.log --rundir=$(RS_INSTALL_LOCATION) --pidfile=$(RS_PID_LOCAL) --reactor=poll recceiver -f $(RS_INSTALL_LOCATION)/$(RECSYNC_CONF) + +local.stop: + $(QUIET) pkill -F $(RS_PID_LOCAL) + +local.rm: + $(QUIET)-rm -rf $(RS_INSTALL_LOCATION) diff --git a/site-template/recsync.conf.in b/site-template/recsync.conf.in index 250e179..d5603d1 100644 --- a/site-template/recsync.conf.in +++ b/site-template/recsync.conf.in @@ -45,7 +45,16 @@ maxActive = @RS_MAXACTIVE@ [cf] # a space-separated list of infotags to set as CF Properties -infotags = @RS_PROPERTIES_INFOTAGS@ -alias = on - +infotags = @RS_CONF_INFOTAGS@ +# List environment variables that should be written as channel finder properties +# +# Comma-separated list of VARIABLE:PropertyName, +# specifying which environment VARIABLEs to pass on to the channel finder +# and defining the corresponding PropertyName +# environment_vars=ENGINEER:Engineer,EPICS_BASE:EpicsVersion,PWD:WorkingDirectory +# Turn on optional alias and recordType properties +environment_vars=@RS_CONF_ENV_VARS@ +alias = @RS_CONF_ALIAS@ +recordType = @RS_CONF_RECORDTYPE@ +recordDesc = @RS_CONF_RECORDDESC@ # EOF diff --git a/site-template/recsync.service.in b/site-template/systemd/recsync.service.in similarity index 95% rename from site-template/recsync.service.in rename to site-template/systemd/recsync.service.in index 2863b62..60e7876 100644 --- a/site-template/recsync.service.in +++ b/site-template/systemd/recsync.service.in @@ -22,7 +22,7 @@ Environment="PYTHONPATH=@RS_INSTALL_LOCATION@" # take care of this. # ExecStart=@TWISTD_PATH@/twistd --logfile=@RS_INSTALL_LOCATION@/recsync.log \ - --rundir @RS_INSTALL_LOCATION@ \ + --rundir=@RS_INSTALL_LOCATION@ \ --pidfile= \ --reactor=poll \ --nodaemon recceiver -f @RS_INSTALL_LOCATION@/@RECSYNC_CONF@ From 9342597fe684f2713a5e895b105300e831dbce99 Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Thu, 22 Sep 2022 21:11:50 -0700 Subject: [PATCH 22/39] active debian11 github --- .github/workflows/debian11.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/debian11.yml b/.github/workflows/debian11.yml index def4fdf..a023b83 100644 --- a/.github/workflows/debian11.yml +++ b/.github/workflows/debian11.yml @@ -4,8 +4,6 @@ name: Debian 11 on: push: branches: [ master ] - paths: - - '.github/workflows/debian11.yml' paths-ignores: - '*.md' - 'docker/**' From 52e3eaf71cf2b5373e10c934dc93332b9bcd704e Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Thu, 22 Sep 2022 21:14:08 -0700 Subject: [PATCH 23/39] fix the shellcheck in recceiver.post shell scripts --- site-template/recceiver.postinst | 2 +- site-template/recceiver.postrm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/site-template/recceiver.postinst b/site-template/recceiver.postinst index 7876158..988cd2d 100644 --- a/site-template/recceiver.postinst +++ b/site-template/recceiver.postinst @@ -25,7 +25,7 @@ if [ "$1" = "configure" ]; then fi echo "Adding user ${USERID} with ${GROUPID}." useradd --system --home-dir / -g ${GROUPID} \ - --no-create-home --shell /usr/sbin/nologin ${USERID} > /dev/null 2>&1 + --no-create-home --shell /usr/sbin/nologin "${USERID}" > /dev/null 2>&1 else echo "${USERID} exists." fi diff --git a/site-template/recceiver.postrm b/site-template/recceiver.postrm index aebbf11..e14625d 100644 --- a/site-template/recceiver.postrm +++ b/site-template/recceiver.postrm @@ -16,7 +16,7 @@ if [ "$1" = "purge" ]; then USERID="$2" if grep -q "^${USERID}:" /etc/passwd; then echo "Removing user ${USERID} ... " - userdel ${USERID} || echo "WARNING: problem removing user ${USERID}" + userdel "${USERID}" || echo "WARNING: problem removing user ${USERID}" else echo "${USERID} doesn't exist" fi From 155e10456814a32d4f5de770fa8c70a701f4d57b Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Thu, 22 Sep 2022 21:25:16 -0700 Subject: [PATCH 24/39] define clearly rs_install and src_install --- configure/RULES_INSTALL | 14 +++++++++++--- configure/RULES_RUN | 3 +-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/configure/RULES_INSTALL b/configure/RULES_INSTALL index a676973..b2896c3 100644 --- a/configure/RULES_INSTALL +++ b/configure/RULES_INSTALL @@ -1,6 +1,6 @@ # # -.PHONY: rs_status rs_start rs_stop rs_restart rs_install src_install rs_preinst rs_postrm install uninstall restart +.PHONY: rs_status rs_start rs_stop rs_restart rs_install rs_uninstall rs_preinst rs_postrm src_install src_uninstall install uninstall restart rs_status: sd_status @@ -10,7 +10,7 @@ rs_stop: sd_stop rs_restart: sd_restart -: +# Pure source file installation, USRID/GROUPID must be defined rs_install: conf $(QUIET)$(SUDO) $(INSTALL) -d $(RS_INSTALL_LOCATION) -o $(RS_USERID) -g $(RS_GROUPID) $(QUIET)$(SUDO) cp -r $(RS_SRC_PATH)/server/recceiver $(RS_INSTALL_LOCATION)/ @@ -22,7 +22,15 @@ rs_install: conf $(QUIET)$(SUDO) $(INSTALL_DATA) -b $(RS_SITE_TEMPLATE_PATH)/.versions $(RS_INSTALL_LOCATION)/ $(QUIET)$(SUDO) chown -R $(RS_USERID):$(RS_GROUPID) $(RS_INSTALL_LOCATION) -src_install: rs_install + +rs_uninstall: + $(QUIET)$(SUDO) rm -rf $(RS_INSTALL_LOCATION) + +# Linux Default USERID/GROUPID configure first, and call rs_install +src_install: rs_preinst rs_install + +src_uninstall: rs_uninstall rs_postrm + rs_preinst: $(QUIET)$(SUDO) bash $(RS_SITE_TEMPLATE_PATH)/recceiver.postinst "configure" "$(RS_USERID)" "$(RS_GROUPID)" diff --git a/configure/RULES_RUN b/configure/RULES_RUN index f341311..4dc2b93 100644 --- a/configure/RULES_RUN +++ b/configure/RULES_RUN @@ -13,5 +13,4 @@ local.run: local.stop: $(QUIET) pkill -F $(RS_PID_LOCAL) -local.rm: - $(QUIET)-rm -rf $(RS_INSTALL_LOCATION) +local.rm: rs_uninstall From 35e1ce6f18afb32fd064776c3ba24d51d3614fc3 Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Thu, 22 Sep 2022 21:26:31 -0700 Subject: [PATCH 25/39] add badges to README --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5a50a0d..717f14d 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ [![Debian 11](https://github.com/jeonghanlee/RecSync-env/actions/workflows/debian11.yml/badge.svg)](https://github.com/jeonghanlee/RecSync-env/actions/workflows/debian11.yml) [![Ubuntu latest](https://github.com/jeonghanlee/RecSync-env/actions/workflows/ubuntu.yml/badge.svg)](https://github.com/jeonghanlee/RecSync-env/actions/workflows/ubuntu.yml) [![Rocky8](https://github.com/jeonghanlee/RecSync-env/actions/workflows/rocky8.yml/badge.svg)](https://github.com/jeonghanlee/RecSync-env/actions/workflows/rocky8.yml) - +[![Linter Run](https://github.com/jeonghanlee/RecSync-env/actions/workflows/linter.yml/badge.svg)](https://github.com/jeonghanlee/RecSync-env/actions/workflows/linter.yml) +[![Docker](https://github.com/jeonghanlee/RecSync-env/actions/workflows/docker.yml/badge.svg)](https://github.com/jeonghanlee/RecSync-env/actions/workflows/docker.yml) Configuration Environment for the recsync server (aka. RecCeiver) at ## Pre-required Packages From d10db26e0c830aa747e0e40246af33f3174d8bba Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Thu, 22 Sep 2022 21:27:07 -0700 Subject: [PATCH 26/39] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 717f14d..d7b330c 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ [![Rocky8](https://github.com/jeonghanlee/RecSync-env/actions/workflows/rocky8.yml/badge.svg)](https://github.com/jeonghanlee/RecSync-env/actions/workflows/rocky8.yml) [![Linter Run](https://github.com/jeonghanlee/RecSync-env/actions/workflows/linter.yml/badge.svg)](https://github.com/jeonghanlee/RecSync-env/actions/workflows/linter.yml) [![Docker](https://github.com/jeonghanlee/RecSync-env/actions/workflows/docker.yml/badge.svg)](https://github.com/jeonghanlee/RecSync-env/actions/workflows/docker.yml) + Configuration Environment for the recsync server (aka. RecCeiver) at ## Pre-required Packages From aec5799becadbacce449938a6c2c0c59bab2961b Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Thu, 22 Sep 2022 21:49:26 -0700 Subject: [PATCH 27/39] update Dockerfile to use the latest alpine --- configure/RULES_DOCKER | 29 +++++++++-------------------- docker/Dockerfile | 16 ++++++++-------- 2 files changed, 17 insertions(+), 28 deletions(-) diff --git a/configure/RULES_DOCKER b/configure/RULES_DOCKER index d73a442..2094841 100644 --- a/configure/RULES_DOCKER +++ b/configure/RULES_DOCKER @@ -1,29 +1,18 @@ -.PHONY: install.docker docker.src_preinst build.docker prune.docker +.PHONY: install.docker build.docker prune.docker # Docker internal install rule # twisted will be installed later, so we have to keep dropin.cache in $(RS_INSTALL_LOCATION) first # we will move it later within Dockfile # -install.docker: docker.src_preinst +install.docker: conf $(QUIET)$(INSTALL) -d $(RS_INSTALL_LOCATION) - $(QUIET)cp -r $(RS_SRC_PATH)/server/recceiver/ $(RS_INSTALL_LOCATION)/ - $(QUIET)cp -r $(RS_SRC_PATH)/server/twisted/ $(RS_INSTALL_LOCATION)/ - $(QUIET)cp -r $(PY_CF_SRC_PATH)/channelfinder/ $(RS_INSTALL_LOCATION)/ - $(QUIET)$(INSTALL) -m 400 -b $(RS_SITE_TEMPLATE_PATH)/$(RS_CFG_FILE) $(RS_INSTALL_LOCATION)/ - $(QUIET)$(INSTALL) -m 400 -b $(RS_SITE_TEMPLATE_PATH)/channelfinderapi.conf $(RS_INSTALL_LOCATION)/ - $(QUIET)$(INSTALL) -m 755 -b $(RS_SITE_TEMPLATE_PATH)/dropin.cache $(RS_INSTALL_LOCATION)/ - $(QUIET)$(INSTALL_DATA) -b $(RS_SITE_TEMPLATE_PATH)/.versions $(RS_INSTALL_LOCATION)/ -# $(QUIET)chown -R $(RS_USERID):$(GROUPID) $(RS_INSTALL_LOCATION) - -docker.src_preinst: src_versions -# $(QUIET)bash $(RS_SITE_TEMPLATE_PATH)/recceiver.postinst "configure" "$(RS_USERID)" "$(GROUPID)" - $(QUIET)sed -e "s:@CF_PROPERTIES@:$(CF_PROPERTIES):g" \ - -e "s/@RS_ADDR_LIST@/$(RS_ADDR_LIST)/g" \ - < $(RS_SITE_TEMPLATE_PATH)/$(RS_CFG_FILE_IN) > $(RS_SITE_TEMPLATE_PATH)/$(RS_CFG_FILE) - $(QUIET)sed -e "s|@CF_FULL_URL@|$(CF_FULL_URL)|g" \ - -e "s:@CF_USER@:$(CF_USER):g" \ - -e "s:@CF_PASSWD@:$(CF_PASSWD):g" \ - < $(RS_SITE_TEMPLATE_PATH)/channelfinderapi.conf.in > $(RS_SITE_TEMPLATE_PATH)/channelfinderapi.conf + $(QUIET)cp -r $(RS_SRC_PATH)/server/recceiver $(RS_INSTALL_LOCATION)/ + $(QUIET)cp -r $(RS_SRC_PATH)/server/twisted $(RS_INSTALL_LOCATION)/ + $(QUIET)cp -r $(PY_CF_SRC_PATH)/channelfinder $(RS_INSTALL_LOCATION)/ + $(QUIET)$(INSTALL) -m 400 -b $(RS_SITE_TEMPLATE_PATH)/$(RECSYNC_CONF) $(RS_INSTALL_LOCATION)/ + $(QUIET)$(INSTALL) -m 400 -b $(RS_SITE_TEMPLATE_PATH)/$(CFAPI_CONF) $(RS_INSTALL_LOCATION)/ + $(QUIET)$(INSTALL) -m 755 -b $(RS_SITE_TEMPLATE_PATH)/dropin.cache $(RS_INSTALL_LOCATION)/ + $(QUIET)$(INSTALL_DATA) -b $(RS_SITE_TEMPLATE_PATH)/.versions $(RS_INSTALL_LOCATION)/ build.docker: distclean $(QUIET) bash $(TOP)/docker/scripts/docker_builder.bash -a "RS_INSTALL_LOCATION=$(RS_INSTALL_LOCATION)" -a "CF_PORT_HTTP=$(CF_PORT)" diff --git a/docker/Dockerfile b/docker/Dockerfile index e1be617..a7fb41a 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,20 +1,20 @@ # # author : Jeong Han Lee # email : jeonghan.lee@gmail.com -# date : Wednesday, July 1 15:39:00 PDT 2020 -# version : 0.0.2 +# date : Thu Sep 22 21:40:08 PDT 2022 +# version : 0.0.3 ## builder : 28.4MB -FROM alpine:3.12 AS builder -ENV WorkPath /home/RecSyn-env - +FROM alpine:3.16 AS builder +ENV WorkPath /home/RecSync-env ARG RS_SERVER_PORT=5075 ARG RS_PORT_BROADCAST=5076 ARG RS_INSTALL_LOCATION=/opt/recsync ARG CF_PORT_HTTP=8080 ARG RS_BIND_PORT=45722 -RUN apk --no-cache add bash git make +# We can check the package availbilities through docker run -t -i --entrypoint /bin/sh alpine:3.16 +RUN iapt update && apk --no-cache add bash git make tree WORKDIR $WorkPath COPY . . @@ -25,7 +25,7 @@ RUN make distclean && \ make install.docker ## Multi-Stages build : 124MB (buster-slim : 166MB) -FROM alpine:3.12 +FROM alpine:3.16 LABEL maintainer="Jeong Han Lee " ARG BUILD_DATE @@ -64,7 +64,7 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone ## imcompatiblities in py3-requests ## RUN apk add --no-cache bash py3-twisted py3-simplejson py3-urllib3 py3-setuptools py3-requests ### Even if Python2, apk install a lot of Python3 packages, so we reduce the size only 43MB -RUN apk add --no-cache bash py-twisted py-simplejson py-urllib3 py2-setuptools py-requests tzdata +RUN apk add --no-cache bash py3-twisted py3-simplejson py3-urllib3 py3-requests py3-setuptools tzdata WORKDIR ${RS_INSTALL_LOCATION} COPY --from=builder $RS_INSTALL_LOCATION . From abc691d228e481f35fd909f4637998f95b1c2a62 Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Thu, 22 Sep 2022 21:50:54 -0700 Subject: [PATCH 28/39] fix Dockerfile --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index a7fb41a..eb3580d 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -14,7 +14,7 @@ ARG CF_PORT_HTTP=8080 ARG RS_BIND_PORT=45722 # We can check the package availbilities through docker run -t -i --entrypoint /bin/sh alpine:3.16 -RUN iapt update && apk --no-cache add bash git make tree +RUN apk --no-cache add bash git make tree WORKDIR $WorkPath COPY . . From d40817501d6ec4a43ddbfa5871c888aea291daff Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Thu, 22 Sep 2022 21:54:35 -0700 Subject: [PATCH 29/39] remove run entrypoint in Dockerfile --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index eb3580d..12c55bd 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -85,5 +85,5 @@ EXPOSE $RS_BIND_PORT/udp COPY ./docker/scripts/entrypoint.sh /entrypoint.sh # First run is necessary, because of the following error # /usr/bin/twistd: The specified reactor cannot be used, failed with error: reactor already installed. -RUN /entrypoint.sh +# The latest version do not need this. RUN /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] From 2b1e355a43f2ddb2ed3564ba96b2305c681ccbc4 Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Thu, 22 Sep 2022 21:56:46 -0700 Subject: [PATCH 30/39] add docker hub url into README --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d7b330c..f7e8a5c 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,8 @@ make local.rm ## Docker Image -See [docs/Docker.md](docs/Docker.md) :whale: +* The Docker image is hosted at https://hub.docker.com/orgs/alscontrols. +* See [docs/Docker.md](docs/Docker.md) :whale: ## While evaluating its configuration From 18c710cb552d8621964e912791b3be5dd74a8152 Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Sun, 25 Sep 2022 00:11:32 -0700 Subject: [PATCH 31/39] Debian 11, local and systemd --- README.md | 29 +++++++++++++++++++++++++++++ configure/CONFIG_COMMON | 2 +- configure/CONFIG_SITE | 4 ++-- configure/RULES_PROPERTIES | 10 +++++++++- configure/RULES_REQ | 12 +++++++++++- 5 files changed, 52 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f7e8a5c..4dbe9ec 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,35 @@ Configuration Environment for the recsync server (aka. RecCeiver) at $(TOP)/configure/CONFIG_SITE.local + $(QUIET)echo "RS_USERID:=${USER}" >> $(TOP)/configure/CONFIG_SITE.local + $(QUIET)echo "RS_GROUPID:=1000" >> $(TOP)/configure/CONFIG_SITE.local + +conf.local.show: + cat -b $(TOP)/configure/CONFIG_SITE.local + conf.rsproperties: $(conf_properties_RULES) conf.rsproperties.show: $(show_properties_RULES) @@ -27,7 +35,7 @@ conf.recsync: $(RECSYNC_CONF).in -e "s|@RS_COMMIT_INTERVAL@|$(RS_COMMIT_INTERVAL)|g" \ -e "s|@RS_MAXACTIVE@|$(RS_MAXACTIVE)|g" \ -e "s|@RS_CONF_INFOTAGS@|$(RS_CONF_INFOTAGS)|g" \ - -e "s|@RS_CONF_ENV_VARS@|$(RS_CONF_ENV_ARS)|g" \ + -e "s|@RS_CONF_ENV_VARS@|$(RS_CONF_ENV_VARS)|g" \ -e "s|@RS_CONF_ALIAS@|$(RS_CONF_ALIAS)|g" \ -e "s|@RS_CONF_RECORDTYPE@|$(RS_CONF_RECORDTYPE)|g" \ -e "s|@RS_CONF_RECORDDESC@|$(RS_CONF_RECORDDESC)|g" \ diff --git a/configure/RULES_REQ b/configure/RULES_REQ index bfd5844..b24aa9a 100644 --- a/configure/RULES_REQ +++ b/configure/RULES_REQ @@ -1,6 +1,6 @@ -rs_RULES_NAMES:=p3mac +rs_RULES_NAMES:=p3mac p3deb install_rs_RULES:=$(addprefix install., $(es_RULES_NAMES)) setup_rs_RULES:=$(addprefix setup., $(es_RULES_NAMES)) remove_rs_RULES:=$(addprefix remove., $(es_RULES_NAMES)) @@ -13,6 +13,8 @@ show_rs_RULES:=$(addprefix show., $(es_RULES_NAMES)) # Debian 11 +setup.p3deb: install.p3deb + setup.p3mac: install.p3mac @@ -25,3 +27,11 @@ show.p3mac: $(QUIET) brew info python@3.10 +install.p3deb: + $(QUIET) sudo apt install -y python3 + $(QUIET) sudo pip3 install twisted simplejson urllib3 requests + +show.p3deb: + $(QUIET) apt info python3 + + From 39f0bbf5edb358c95aef54a992f0bb14dfb4f5ad Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Sun, 25 Sep 2022 00:26:36 -0700 Subject: [PATCH 32/39] add local.status, and update readme --- README.md | 7 +------ configure/RULES_RUN | 4 ++++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index f7e8a5c..1f1fc24 100644 --- a/README.md +++ b/README.md @@ -36,12 +36,7 @@ make local.run make local.stop ``` -The log file will be located in `RS_INSTALL_LOCATION`, e.g., `$(TOP)/recsync.local` folder. - - -``` -make local.rm -``` +The log file will be located in `RS_INSTALL_LOCATION`, e.g., `$(TOP)/recsync.local` folder, which can be checked through `make local.status`. And one can remove all local directory through `make local.rm` ## Docker Image diff --git a/configure/RULES_RUN b/configure/RULES_RUN index 4dc2b93..04aa105 100644 --- a/configure/RULES_RUN +++ b/configure/RULES_RUN @@ -14,3 +14,7 @@ local.stop: $(QUIET) pkill -F $(RS_PID_LOCAL) local.rm: rs_uninstall + + +local.status: + cat -b $(RS_INSTALL_LOCATION)/recsync.log From ac9fe605e64015fb32ad23f27e51dd37c7b0b16e Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Sun, 25 Sep 2022 00:28:39 -0700 Subject: [PATCH 33/39] add dep to local.run --- configure/RULES_RUN | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure/RULES_RUN b/configure/RULES_RUN index 04aa105..5356eaa 100644 --- a/configure/RULES_RUN +++ b/configure/RULES_RUN @@ -7,7 +7,7 @@ RS_PID_LOCAL:=$(TOP)/.rs_local_pid local.install: rs_install -local.run: +local.run: local.stop $(QUIET) PYTHONPATH=$(RS_INSTALL_LOCATION) $(TWISTD_PATH)/twistd --logfile=$(RS_INSTALL_LOCATION)/recsync.log --rundir=$(RS_INSTALL_LOCATION) --pidfile=$(RS_PID_LOCAL) --reactor=poll recceiver -f $(RS_INSTALL_LOCATION)/$(RECSYNC_CONF) local.stop: From 5d5cc1c222b50597163be2b2f72838fca5c4b283 Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Tue, 27 Sep 2022 17:14:54 -0700 Subject: [PATCH 34/39] add local rules --- README.md | 8 ++++---- configure/RULES_INSTALL | 1 - configure/RULES_PROPERTIES | 7 ++++--- configure/RULES_RUN | 12 +++++++----- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 81ee6aa..ac7f962 100644 --- a/README.md +++ b/README.md @@ -33,13 +33,13 @@ make sd_status ``` make init -make conf.local -make conf -make conf.show -make src_install +make local.conf +make local.conf.show +make local.install make exist make local.run make local.stop +make local.status ``` ## macOS diff --git a/configure/RULES_INSTALL b/configure/RULES_INSTALL index b2896c3..b12922f 100644 --- a/configure/RULES_INSTALL +++ b/configure/RULES_INSTALL @@ -31,7 +31,6 @@ src_install: rs_preinst rs_install src_uninstall: rs_uninstall rs_postrm - rs_preinst: $(QUIET)$(SUDO) bash $(RS_SITE_TEMPLATE_PATH)/recceiver.postinst "configure" "$(RS_USERID)" "$(RS_GROUPID)" diff --git a/configure/RULES_PROPERTIES b/configure/RULES_PROPERTIES index 6868f48..f8323b6 100644 --- a/configure/RULES_PROPERTIES +++ b/configure/RULES_PROPERTIES @@ -5,19 +5,20 @@ show_properties_RULES:=$(addsuffix .show, $(conf_properties_RULES)) RULES_VARS+=conf.rsproperties conf.rsproperties.show -.PHONY: conf conf.rsproperties +.PHONY: conf conf.rsproperties conf.localconf conf: conf.rsproperties conf.versions conf.show: conf.rsproperties.show conf.versions.show +conf.local: conf.localconf conf -conf.local: +conf.localconf: $(QUIET)echo "RS_INSTALL_LOCATION:=$(TOP)/recsync.local" > $(TOP)/configure/CONFIG_SITE.local $(QUIET)echo "RS_USERID:=${USER}" >> $(TOP)/configure/CONFIG_SITE.local $(QUIET)echo "RS_GROUPID:=1000" >> $(TOP)/configure/CONFIG_SITE.local -conf.local.show: +conf.local.show: conf.show cat -b $(TOP)/configure/CONFIG_SITE.local conf.rsproperties: $(conf_properties_RULES) diff --git a/configure/RULES_RUN b/configure/RULES_RUN index 5356eaa..857e715 100644 --- a/configure/RULES_RUN +++ b/configure/RULES_RUN @@ -1,20 +1,22 @@ # -.PHONY: local.install local.run local.stop local.rm - +local_RULES_NAMES:=install run stop rm status conf conf.show +local_properties_RULES:=$(addprefix local., $(local_RULES_NAMES)) RS_PID_LOCAL:=$(TOP)/.rs_local_pid +local.conf: conf.local + +local.conf.show: conf.local.show local.install: rs_install -local.run: local.stop +local.run: $(QUIET) PYTHONPATH=$(RS_INSTALL_LOCATION) $(TWISTD_PATH)/twistd --logfile=$(RS_INSTALL_LOCATION)/recsync.log --rundir=$(RS_INSTALL_LOCATION) --pidfile=$(RS_PID_LOCAL) --reactor=poll recceiver -f $(RS_INSTALL_LOCATION)/$(RECSYNC_CONF) local.stop: - $(QUIET) pkill -F $(RS_PID_LOCAL) + $(QUIET)-pkill -F $(RS_PID_LOCAL) local.rm: rs_uninstall - local.status: cat -b $(RS_INSTALL_LOCATION)/recsync.log From a32297674d32320f6bac46e84f946ab230c96507 Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Tue, 27 Sep 2022 17:18:49 -0700 Subject: [PATCH 35/39] docker v2.0.0 --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 4c18c36..24ca0f8 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -19,7 +19,7 @@ jobs: DOCKER_FILE: docker/Dockerfile DOCKER_ACCOUNT: alscontrols DOCKER_REPO: recsync - DOCKER_TAG: v2.0.0-pre + DOCKER_TAG: v2.0.0 steps: - From d8fed1e2193e7b2e1660a017703082e2da3fd0b5 Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Tue, 27 Sep 2022 17:19:19 -0700 Subject: [PATCH 36/39] docker image with latest one --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 24ca0f8..d88bb5c 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -19,7 +19,7 @@ jobs: DOCKER_FILE: docker/Dockerfile DOCKER_ACCOUNT: alscontrols DOCKER_REPO: recsync - DOCKER_TAG: v2.0.0 + DOCKER_TAG: latest steps: - From 056e4228ebccca6fee10a9f2a10802cefafb160c Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Tue, 11 Oct 2022 18:09:47 -0700 Subject: [PATCH 37/39] remove " --- configure/CONFIG_SITE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure/CONFIG_SITE b/configure/CONFIG_SITE index 5ed1037..224fe52 100644 --- a/configure/CONFIG_SITE +++ b/configure/CONFIG_SITE @@ -19,7 +19,7 @@ RS_COMMIT_INTERVAL=5 RS_MAXACTIVE=20 RS_CONF_INFOTAGS:=archive elemName elemType elemField devName handle area sector # Do not forget to enclose them with " ". -RS_CONF_ENV_VARS:=\"ENGINEER:Engineer,EPICS_BASE:EpicsVersion,PWD:WorkingDirectory\" +RS_CONF_ENV_VARS:=ENGINEER:Engineer,EPICS_BASE:EpicsVersion,PWD:WorkingDirectory RS_CONF_ALIAS:=on RS_CONF_RECORDTYPE:=on RS_CONF_RECORDDESC:=on From ec502deb512fa05fdd69f000209520c9d73d35ed Mon Sep 17 00:00:00 2001 From: Tynan Ford Date: Mon, 17 Oct 2022 13:12:31 -0700 Subject: [PATCH 38/39] Allow PyCF git URL be different than CF github --- configure/CONFIG_VARS | 2 +- configure/RELEASE | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/configure/CONFIG_VARS b/configure/CONFIG_VARS index 7358a1a..2e2214a 100644 --- a/configure/CONFIG_VARS +++ b/configure/CONFIG_VARS @@ -13,7 +13,7 @@ RS_SRC_PATH:=$(RS_SRC_NAME)-src DOCURL1:=$(RS_SRC_GITURL) # -PY_CF_SRC_GITURL:=$(CF_SRC_URL)/$(PY_CF_SRC_NAME) +PY_CF_SRC_GITURL:=$(PY_CF_SRC_URL)/$(PY_CF_SRC_NAME) ### SRC_PATH used for a local directory which is a clone git repository PY_CF_SRC_PATH:=$(PY_CF_SRC_NAME)-src # diff --git a/configure/RELEASE b/configure/RELEASE index 00c320e..8e560f7 100644 --- a/configure/RELEASE +++ b/configure/RELEASE @@ -11,6 +11,7 @@ RS_SRC_VERSION:=$(RS_SRC_TAG) # # ### Where the Source repository SRC2_URL/SRC2_NAME +PY_CF_SRC_URL:=$(CF_SRC_URL) PY_CF_SRC_NAME:=pyCFClient ### Which the source tag / branch / hash id would like to use # 2019-03-04 From 51c3f3b13649d9739ae1b4632f938af49d88a641 Mon Sep 17 00:00:00 2001 From: Tynan Ford Date: Thu, 14 Sep 2023 14:22:02 -0700 Subject: [PATCH 39/39] Add ability to run systemd service as user --- configure/CONFIG_SITE | 4 ++++ configure/CONFIG_SRC | 6 ++++++ configure/RULES_SYSTEMD | 14 +++++++------- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/configure/CONFIG_SITE b/configure/CONFIG_SITE index 224fe52..2d78695 100644 --- a/configure/CONFIG_SITE +++ b/configure/CONFIG_SITE @@ -60,6 +60,10 @@ RS_SITE_TEMPLATE_PATH=$(TOP)/site-template # Each service need one space between them, and backslash must be double backslash RS_SYSTEMD_SERVICES:=channelfinder.service +# If you want to run this as a user level systemd service +# You can set this to: --user +RS_SYSTEMD_USER:= + # These allow developers to override the CONFIG_SITE variable # settings without having to modify the configure/CONFIG_SITE # file itself. diff --git a/configure/CONFIG_SRC b/configure/CONFIG_SRC index 85d5ec6..c0db56c 100644 --- a/configure/CONFIG_SRC +++ b/configure/CONFIG_SRC @@ -33,3 +33,9 @@ VARS_EXCLUDES+=INSTALL_PROGRAM VARS_EXCLUDES+=INSTALL_DATA # # + +# These allow developers to override the CONFIG_SRC variable +# settings without having to modify the configure/CONFIG_SRC +# file itself. +-include $(TOP)/../CONFIG_SRC.local +-include $(TOP)/configure/CONFIG_SRC.local diff --git a/configure/RULES_SYSTEMD b/configure/RULES_SYSTEMD index d2262d9..17d303b 100644 --- a/configure/RULES_SYSTEMD +++ b/configure/RULES_SYSTEMD @@ -11,7 +11,7 @@ install_systemd_RULES:=$(addprefix install., $(systemd_RULES_NAMES)) show_install_systemd_RULES:=$(addsuffix .show, $(install_systemd_RULES)) sd_install: conf.systemd install.systemd - $(QUIET)$(SUDO) systemctl daemon-reload + $(QUIET)$(SUDO) systemctl $(RS_SYSTEMD_USER) daemon-reload .PHONY: conf.systemd conf.systemd.show @@ -47,19 +47,19 @@ install.systemd0.show: # # sd_status: - $(QUIET) systemctl status -l $(RS_SYSTEMD_FILENAME) | cat -b + $(QUIET) systemctl status $(RS_SYSTEMD_USER) -l $(RS_SYSTEMD_FILENAME) | cat -b # sd_start: - $(QUIET)$(SUDO) systemctl start $(RS_SYSTEMD_FILENAME) + $(QUIET)$(SUDO) systemctl start $(RS_SYSTEMD_USER) $(RS_SYSTEMD_FILENAME) # # We ignore its error sd_stop: - -$(QUIET)$(SUDO) systemctl stop $(RS_SYSTEMD_FILENAME) + -$(QUIET)$(SUDO) systemctl stop $(RS_SYSTEMD_USER) $(RS_SYSTEMD_FILENAME) # # sd_restart: - $(QUIET)$(SUDO) systemctl restart $(RS_SYSTEMD_FILENAME) + $(QUIET)$(SUDO) systemctl restart $(RS_SYSTEMD_USER) $(RS_SYSTEMD_FILENAME) # # We ignore its error sd_clean: @@ -67,10 +67,10 @@ sd_clean: # # sd_enable: - $(if $(wildcard $(SYSTEMD_PATH)/$(RS_SYSTEMD_FILENAME)), $(SUDO) systemctl enable $(RS_SYSTEMD_FILENAME)) + $(if $(wildcard $(SYSTEMD_PATH)/$(RS_SYSTEMD_FILENAME)), $(SUDO) systemctl enable $(RS_SYSTEMD_USER) $(RS_SYSTEMD_FILENAME)) # # sd_disable: - $(if $(wildcard $(SYSTEMD_PATH)/$(RS_SYSTEMD_FILENAME)), $(SUDO) systemctl disable $(RS_SYSTEMD_FILENAME)) + $(if $(wildcard $(SYSTEMD_PATH)/$(RS_SYSTEMD_FILENAME)), $(SUDO) systemctl disable $(RS_SYSTEMD_USER) $(RS_SYSTEMD_FILENAME)) # #