From 02bf42ab991784bb1bcdb11f21d169a529a4fac4 Mon Sep 17 00:00:00 2001 From: aaron Date: Wed, 24 Nov 2021 00:59:44 +0100 Subject: [PATCH] pass url by env var --- Dockerfile | 1 + README.md | 30 +++++++++++++++++++++++------- deploy_browsers.sh | 2 +- startapp.sh | 2 +- 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index dc5f24b..d82182f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,6 +7,7 @@ ENV APP_NAME="Tor Browser ${TOR_VERSION}" \ TOR_SIGNATURE=https://www.torproject.org/dist/torbrowser/${TOR_VERSION}/tor-browser-linux64-${TOR_VERSION}_en-US.tar.xz.asc \ TOR_FINGERPRINT=0xEF6E286DDA85EA2A4BA7DE684E2C6E8793298290 \ DEBIAN_FRONTEND=noninteractive +ENV TARGET_URL="https://0x29a.ch" # Add wget and Tor browser dependencies RUN apt-get update && \ diff --git a/README.md b/README.md index 3d9e2db..8579b20 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,41 @@ -# Dockerized test for the interdiscount waiting queue +# Dockerized automated tor-browser ## Whut? -- This container simulates user accesses via the tor network. +- This container simulates user accesses via the tor browser and network. - A web-ui is available on the containers exposed port. +- The URL is passed on to the container using env vars ## How to build and run? +- Simply use the deploy script or the follwing lines. + ```bash $ git clone $repo -$ docker build $repo -t lasttest +$ docker build $repo -t browser_test # start some browsers for i in $(seq 1 100): - docker run -d -p 5800 lasttest -# Or simply use the deploy script. + docker run -d -p 5800 -e "TARGET_URL='https://google.com'" browser_test +``` + +- Or use the following docker-compose file + +```yaml +version: '3' + +services: + torbrowser: + image: browser_test:latest + ports: + - 5800:5800 + environment: + - TARGET_URL="https://google.com" + restart: never ``` ## Oh no, now I have xyz randomly named containers running - how to stop them? ```bash -$ docker rm --force $(docker ps --filter="ancestor=lasttest" ---format="{{.ID}}") +$ docker rm --force $(docker ps --filter="ancestor=browser_test" --format="{{.ID}}") ``` diff --git a/deploy_browsers.sh b/deploy_browsers.sh index d515a53..682382f 100755 --- a/deploy_browsers.sh +++ b/deploy_browsers.sh @@ -3,5 +3,5 @@ for i in $(seq 1 20); do echo $i - docker run -d -p 5800 lasttest + docker run -d -p 5800 -e "TARGET_URL=https://www.google.com" lasttest done diff --git a/startapp.sh b/startapp.sh index 5e4de70..7e57c92 100644 --- a/startapp.sh +++ b/startapp.sh @@ -13,6 +13,6 @@ fi echo "Starting Tor browser" cd /app -./Browser/start-tor-browser https://waitingroom.interdiscount.ch/de/sbb-halbtax +./Browser/start-tor-browser "$TARGET_URL" echo "Tor browser exited"