Skip to content

Commit

Permalink
Merge pull request #144 from uc-cdis/chore/get-stata-license-from-sid…
Browse files Browse the repository at this point in the history
…ecar

Chore/get stata license from sidecar
  • Loading branch information
george42-ctds authored Feb 20, 2024
2 parents 7a60062 + f649e48 commit 775e2df
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
4 changes: 2 additions & 2 deletions jupyter-pystata-gen3-licensed/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM quay.io/cdis/jupyter-pystata-user-licensed:1.2.0
FROM quay.io/cdis/jupyter-pystata-user-licensed:1.2.1

USER root
RUN apt-get update
RUN apt-get install -y firefox
RUN wget https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz
RUN wget https://github.com/mozilla/geckodriver/releases/download/v0.34.0/geckodriver-v0.34.0-linux64.tar.gz
RUN tar -xvzf geckodriver*
RUN mv geckodriver /bin/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from selenium import webdriver
from selenium.webdriver import FirefoxOptions
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains


opts = Options()
opts.headless = True
opts = FirefoxOptions()
opts.add_argument('--headless')
browser = webdriver.Firefox(options=opts)

print("Checking for .lic file")
Expand Down
18 changes: 14 additions & 4 deletions jupyter-pystata-gen3-licensed/resources/wait_for_license.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
# Signal to the distributor cron job that we want a license
touch /tmp/waiting_for_license.flag
# Wait for license, start jupyter, initialize notebook, remove license

while [ ! -f /usr/local/stata17/stata.lic ]; do sleep 1; echo "Waiting for license."; done
echo "Checking for license copied by sidecar"

while [ ! -f /usr/local/stata17/stata.lic ];
do
sleep 5
echo "Checking for license"
if [ -f /data/stata.lic ]; then
echo "Found license"
mv /data/stata.lic /usr/local/stata17/stata.lic
echo "Copied license"
fi
done

echo "Received a license. Starting jupyter."

Expand All @@ -15,6 +25,6 @@ python3 /tmp/setup_licensed_notebook.py
rm geckodriver*

echo "Init script done."
rm /usr/local/stata17/stata.lic /tmp/waiting_for_license.flag
rm /usr/local/stata17/stata.lic

while true; do sleep 1; done

0 comments on commit 775e2df

Please sign in to comment.