-1

Problem description : We are using "runit /etc/service/" where, this path "/etc/service" contains "/etc/service/acme/run"...we are using in docker image (meant for K8s deployment), in this "/etc/service/acme/run", we have a piece of the wrapper script set in dockerFile as shown below

COPY --link=true --chmod=755 scripts/acme_server.sh /etc/service/acme/run

And this "acme_server.sh" contains this below example

#!/bin/bash
set -x 
exec 2>&1
export PATH="/opt/app_venv/bin:${PATH}"

EV_ACME_REPOSITORY=`echo $ACME_REPOSITORY`
if [[  -z "$EV_ACME_REPOSITORY" ]]
then
    ln -s /app/ACME_repository /ACME
fi
iACME_PATH=${EV_ACME_REPOSITORY:-"/app/acme_repository"}
/opt/unicornserver/bin/unicornserver --exit-on-error=false --acme-repository="${iACME_PATH}"

The k8s deployment does have this line

          env:
            - name: ACME_REPOSITORY
              value: "/var/www/acme/repository"

And even logged into the pod, i can see the value when i run "env" or "printenv" or "echo $ACME_REPOSITORY". But as the docker image contains the line "runit /etc/service" , this is not picking up the value of the environment variable "$ACME_REPOSITORY" eventually defaulting to wrong path. Below is the log :

2023-05-15_04:45:09.65401 + EV_ACME_REPOSITORY=
2023-05-15_04:45:09.65401 + [[ -z '' ]]
2023-05-15_04:45:09.65402 + ln -s /app/ACME_repository /ACME
2023-05-15_04:45:09.65409 + iACME_PATH=/app/ACME_repository
2023-05-15_04:45:09.65410 + /opt/unicornserver/bin/unicornserver --exit-on-error=false --acme-repository=/app/ACME_repository

Is there any correct way for runit to pick up the value from environment variable ?

hare krshn
  • 176
  • 1
  • 4
  • 16

1 Answers1

0

Never mind, after googling a lot, replacing "runit" with "runsvdir" helped to fix.

hare krshn
  • 176
  • 1
  • 4
  • 16