Skip to content

Commit

Permalink
use /var/run/noteable instead of /etc/noteable for connection file path
Browse files Browse the repository at this point in the history
  • Loading branch information
shouples committed Oct 17, 2023
1 parent b300632 commit 36c81d3
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 5 deletions.
18 changes: 17 additions & 1 deletion deno/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@ set -x

echo "Local time: $(date)"

connection_file=/tmp/connection_file.json
VAR_RUN_FILE="/var/run/noteable/connections/connection_file.json"
ETC_FILE="/etc/noteable/connections/connection_file.json"

# This is a temporary change while we migrate from /etc/noteable to /var/run/noteable.
# Check if the /var/run file exists, and if it does, copy it to the destination
if [[ -f ${VAR_RUN_FILE} ]]; then
cp ${VAR_RUN_FILE} ${connection_file}
# If the /var/run file doesn't exist, check for the /etc file and copy it if it exists
elif [[ -f ${ETC_FILE} ]]; then
cp ${ETC_FILE} ${connection_file}
else
echo "Error: Neither ${VAR_RUN_FILE} nor ${ETC_FILE} exists."
exit 1
fi

set +x
echo "Injecting Secrets into environment, echoing is turned off"
# shellcheck disable=SC1091
Expand All @@ -17,5 +33,5 @@ set -x
echo "Starting Deno kernel"
exec deno --unstable \
jupyter \
--conn /etc/noteable/connections/connection_file.json \
--conn ${connection_file} \
--kernel
15 changes: 14 additions & 1 deletion python/base-gpu/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,20 @@ echo "Local time: $(date)"
set -x

connection_file=/tmp/connection_file.json
cp /etc/noteable/connections/connection_file.json ${connection_file}
VAR_RUN_FILE="/var/run/noteable/connections/connection_file.json"
ETC_FILE="/etc/noteable/connections/connection_file.json"

# This is a temporary change while we migrate from /etc/noteable to /var/run/noteable.
# Check if the /var/run file exists, and if it does, copy it to the destination
if [[ -f ${VAR_RUN_FILE} ]]; then
cp ${VAR_RUN_FILE} ${connection_file}
# If the /var/run file doesn't exist, check for the /etc file and copy it if it exists
elif [[ -f ${ETC_FILE} ]]; then
cp ${ETC_FILE} ${connection_file}
else
echo "Error: Neither ${VAR_RUN_FILE} nor ${ETC_FILE} exists."
exit 1
fi

# Inject Secrets into environment (see script docstring for more info)
# set +x to avoid echoing the Secrets in plaintext to logs
Expand Down
15 changes: 14 additions & 1 deletion python/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,20 @@ echo "Local time: $(date)"
set -x

connection_file=/tmp/connection_file.json
cp /etc/noteable/connections/connection_file.json ${connection_file}
VAR_RUN_FILE="/var/run/noteable/connections/connection_file.json"
ETC_FILE="/etc/noteable/connections/connection_file.json"

# This is a temporary change while we migrate from /etc/noteable to /var/run/noteable.
# Check if the /var/run file exists, and if it does, copy it to the destination
if [[ -f ${VAR_RUN_FILE} ]]; then
cp ${VAR_RUN_FILE} ${connection_file}
# If the /var/run file doesn't exist, check for the /etc file and copy it if it exists
elif [[ -f ${ETC_FILE} ]]; then
cp ${ETC_FILE} ${connection_file}
else
echo "Error: Neither ${VAR_RUN_FILE} nor ${ETC_FILE} exists."
exit 1
fi

# Inject Secrets into environment (see script docstring for more info)
# set +x to avoid echoing the Secrets in plaintext to logs
Expand Down
15 changes: 14 additions & 1 deletion r/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,20 @@ set -x
echo "Local time: $(date)"

connection_file=/tmp/connection_file.json
cp /etc/noteable/connections/connection_file.json ${connection_file}
VAR_RUN_FILE="/var/run/noteable/connections/connection_file.json"
ETC_FILE="/etc/noteable/connections/connection_file.json"

# This is a temporary change while we migrate from /etc/noteable to /var/run/noteable.
# Check if the /var/run file exists, and if it does, copy it to the destination
if [[ -f ${VAR_RUN_FILE} ]]; then
cp ${VAR_RUN_FILE} ${connection_file}
# If the /var/run file doesn't exist, check for the /etc file and copy it if it exists
elif [[ -f ${ETC_FILE} ]]; then
cp ${ETC_FILE} ${connection_file}
else
echo "Error: Neither ${VAR_RUN_FILE} nor ${ETC_FILE} exists."
exit 1
fi

# Inject Secrets into environment (see script docstring for more info)
# set +x to avoid echoing the Secrets in plaintext to logs
Expand Down
18 changes: 17 additions & 1 deletion rust/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@ set -x

echo "Local time: $(date)"

connection_file=/tmp/connection_file.json
VAR_RUN_FILE="/var/run/noteable/connections/connection_file.json"
ETC_FILE="/etc/noteable/connections/connection_file.json"

# This is a temporary change while we migrate from /etc/noteable to /var/run/noteable.
# Check if the /var/run file exists, and if it does, copy it to the destination
if [[ -f ${VAR_RUN_FILE} ]]; then
cp ${VAR_RUN_FILE} ${connection_file}
# If the /var/run file doesn't exist, check for the /etc file and copy it if it exists
elif [[ -f ${ETC_FILE} ]]; then
cp ${ETC_FILE} ${connection_file}
else
echo "Error: Neither ${VAR_RUN_FILE} nor ${ETC_FILE} exists."
exit 1
fi

set +x
echo "Injecting Secrets into environment, echoing is turned off"
# shellcheck disable=SC1091
Expand All @@ -17,4 +33,4 @@ set -x

echo "Starting Rust kernel"

exec evcxr_jupyter --control_file /etc/noteable/connections/connection_file.json
exec evcxr_jupyter --control_file ${connection_file}

0 comments on commit 36c81d3

Please sign in to comment.