What I'm Thinking
Consider the following nginx config blocks
location / { proxy_pass http://127.0.0.1:8080; } and
location / { proxy_pass http://127.0.0.1:8080/; } They are both same in terms of final result. You if call /abc/def on the main server it passes the request to http://127.0.0.1:8080/abc/def
But as soon as you have a location block with a non-root path like below
location /app { proxy_pass http://127.0.0.1:8080; } The above config is not same as below
... Read More
Selenium allows creating a custom profile for firefox and launching the browser with the same. Below is a sample code on how to change the download folder of the browser launched
from selenium import webdriver profile = webdriver.FirefoxProfile() profile.set_preference("browser.download.folderList", 2) profile.set_preference("browser.download.manager.showWhenStarting", False) profile.set_preference("browser.download.dir", '/Users/tarunlalwani/Downloads/') profile.set_preference("browser.helperApps.neverAsk.saveToDisk", "application/x-gzip") driver = webdriver.Firefox(firefox_profile=profile) This is good when you know the download folder while starting the browser or you are NOT interested in changing the download folder after the browser has starting.
... Read More
Docker Compose scale with Dynamic Configuration - Part 1
11 September 2017
TL;DR;
Docker-compose allows scaling specific services from the composition. Assume we have a server and worker model. Consider the below compose file for the same
version: '3' services: server: image: alpine command: sh -c "echo Launching server && exec tail -f /dev/null" worker: image: alpine command: sh -c "echo Launching worker >> /data/worker.log && exec tail -f /dev/null" volumes: - ./data:/data Now if we do docker-compose up the server will echo Launching server and worker will print Launching worker to the /data/worker.
... Read More
How To Debug Nginx Reverse Proxy Issues
2 September 2017
I love Nginx for its revery proxy capabilities and ease of configuration. A simple proxy_pass can allow you to connect to any of the backends GoLang, php-fpm, NodeJS, another nginx, tomcat, apache, gunicorn, uwsgi, flask, django, a external CDN and many more
When proxying a request to another server, you may or may not have access to log of the server. So it is important to be able to debug, where the problem lies when an issue occurs.
... Read More
AWS Docker Swarm - Deploying a Selenium grid
6 July 2017
Selenium Grid helps us to group multiple machines as worker nodes to provide browsers for our tests. To run multiple tests in parallel grid is a must.
With Docker Swarm it becomes easy to create dynamic grid, which can be scaled on need. This article will walk you through setting up a Grid on AWS using 3 machines (1 manager, 2 worker node). The minimum recommeded setup is of 5 machines at least (3 manager, 2 worker nodes).
... Read More
Docker container cleanup made easy with Docker 17.05
26 June 2017
Earlier docker container and images would keep on occupying spaces until unless manually cleaned up. The clean command included piped commands.
For example to clean all exited contained
$ docker ps -a -q -f status=exited | xargs docker rm -v And to delete volumes or images different commands had to be used. But with Docker 17.05 now out. This is a simple command
$ docker system prune If you don’t want any confirmation, then add the -f flag at the end
... Read More
Re-using existing browser session with Selenium Grid
21 June 2017
In our previous articles we discussed about re-using Browser session in Selenium for local browsers. We spoke about saving the Session ID and the Executor URL for re-creating the sessions. Now let’s us have re-look at the approach when we use Selenium Grid
Launching the Grid I am using brew to install selenium-server-standalone on my Mac. But if you are using something else, then download the latest version from here
... Read More
Enumerating running Firefox browsers in Selenium
20 June 2017
This is another article in our “Re-use selenium session” series. This article is specific to Firefox browser ran on a local system using Selenium
Consider the below python code
from selenium import webdriver driver = webdriver.Firefox() This opens up a firefox browser on your machine. We know that Selenium uses geckodriver for communicating with the firefox. So let’s check the process
$ ps aux | grep geckodriver tarun.lalwani 11982 0.
... Read More
Enumerating running Chrome browsers in Selenium
19 June 2017
This is another article in our “Re-use selenium session” series. This article is specific to Chrome browser run on a local system using Selenium
Consider the below python code
from selenium import webdriver driver = webdriver.Chrome() This opens up a chrome browser on your machine. We know that Selenium uses chromewebdriver for communicating with the chrome. So let’s check the process
$ ps aux | grep chromedriver tarun.lalwani 8805 0.
... Read More
Self-signed SSL certificates and how to trust them
17 June 2017
SSL certificates allow us to secure communication between the server and user. Unfortunately SSL certificates are a bit costly and are not prefered to be bought for development environments. This is where self-signed certificates come into picture.
Creating a Self-signed certificate We can create a self-signed certificate using the openssl command
$ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout selfsigned.key -out selfsigned.crt Generating a 2048 bit RSA private key .
... Read More