diff --git a/README.md b/README.md index 3f742d3..cae515e 100644 --- a/README.md +++ b/README.md @@ -30,21 +30,19 @@ cd workshop ./geopython-workshop-ctl.sh start # display URL and open in default web browser, if a browser does not open, then copy the url from the command output to your browser. ./geopython-workshop-ctl.sh url - -# NB Possibly best if we add a frontend or use docs ("home") as entrypoint +# stop workshop ./geopython-workshop-ctl.sh stop ``` -Windows (Powershell or Command Prompt): - -```bat -cd workshop - -.\win-geopython-workshop-ctl.bat start +Windows (Powershell): -.\win-geopython-workshop-ctl.bat url - -.\win-geopython-workshop-ctl.bat stop +```bash +# start workshop +bash ./geopython-workshop-ctl.sh start +# display URL and open in default web browser +bash ./geopython-workshop-ctl.sh url +# stop workshop +bash ./geopython-workshop-ctl.sh stop ``` NB [Jupyter notebook](https://en.wikipedia.org/wiki/Project_Jupyter) needs a **token**. The token is displayed in the jupyter container logs on startup: diff --git a/workshop/win-geopython-workshop-ctl.bat b/workshop/win-geopython-workshop-ctl.bat deleted file mode 100644 index 8e8e586..0000000 --- a/workshop/win-geopython-workshop-ctl.bat +++ /dev/null @@ -1,71 +0,0 @@ -@ECHO OFF - -SETLOCAL EnableDelayedExpansion - -SET "PROGRAM_NAME=%~nx0" - -SET "USAGE=Usage: %PROGRAM_NAME% ^" - -IF "%1"=="" ( - ECHO %USAGE% - ENDLOCAL - EXIT /B 1 -) -IF NOT "%2"=="" ( - ECHO %USAGE% - ENDLOCAL - EXIT /B 1 -) - -REM Sniff which Docker Compose variant is installed -REM and set an alias. -REM See https://github.com/geopython/geopython-workshop/issues/82 -docker-compose --version >NUL -IF !ERRORLEVEL! EQU 0 ( - SET DOCKERCOMPOSE=docker-compose - ECHO Using docker-compose -) ELSE ( - docker compose version >NUL - IF !ERRORLEVEL! NEQ 0 ( - ECHO Neither docker-compose nor docker compose is available - ECHO Check your Docker Installation - ENDLOCAL - EXIT /B 1 - ) - SET "DOCKERCOMPOSE=docker compose" - ECHO Using docker compose -) - -REM Test for the command -IF /I "%1"=="start" ( - %PROGRAM_NAME% stop - %DOCKERCOMPOSE% up -d -) ELSE ( IF /I "%1"=="stop" ( - %DOCKERCOMPOSE% stop - %DOCKERCOMPOSE% rm --force -) ELSE ( IF /I "%1"=="url" ( - REM try to open the Jupyter Notebook in Browser - REM Filter the URL from the log output - powershell -Command "try { $url = (docker logs geopython-workshop-jupyter 2>&1 | Select-String -Pattern 'http://127\.0\.0\.1\S+token\S+')[-1].Matches[0].Value; Write-Output ('Attempting to open ' + $url + ' in your browser on platform Windows...') 'If this fails, simply copy/paste that URL in your browser'; start $url } catch { exit 2 }" - IF !ERRORLEVEL! NEQ 0 ( - ECHO workshop not started - ECHO did you start the workshop? (i.e. %PROGRAM_NAME% start^) - ENDLOCAL - EXIT /B 2 - ) -) ELSE ( IF /I "%1"=="update" ( - docker pull geopython/geopython-workshop:latest - ECHO: - ECHO: - ECHO workshop is running the latest Docker images - ECHO If updates occured, then stop/start the workshop -) ELSE ( IF /I "%1"=="clean" ( - REM Remove all exited containers - FOR /F %%c IN ('docker ps -a -f status^=exited -q') DO docker rm %%c - REM And dangling images - FOR /F %%i IN ('docker images -f dangling^=true -q') DO docker rmi %%i -) ELSE ( - ECHO %USAGE% -) ) ) ) ) - -ENDLOCAL