* Play with docker without installing it: https://labs.play-with-docker.com/
* windows machine on the cloud is the same as our Windows laptop accessed through mstsc.
* AWS contains remote machines >> remote machine contains docker >> docker contains Containers of chrome, firefox and edge browsers
CREATE AWS ACCOUNT:
https://signin.aws.amazon.com/ >> root user email / pass>> personal >> credit card info >> account created >> Search VPC ( virtual privat cloud ) >> your vpc >> on Top right side ACTION >> create default VPC >>
Top left SERVICES >> EC2 >> EC2 DashBoard >> top right Launch Instance >> Select "Free Tier eligible" AmazonLinux 2 AMI (HVM) image >> select "Free tier eligible " >> Configure instance details (keep as it is)
>> next : Add Storage >> next : add Tags >> next: Configure security group >> Review and Launch >> Launch >> create a new key pair >> select RSA radio button >> enter any keypair name "myLinuxMachineGridSetup" >> download keypair >> Launch Instance >> view Instance >> wait for Instance state "Running" >> click "Instance ID" Link >> copy public IPv4 >> Security >> Security Group >> launch wizard link >> Edit Inbound Rule >> Add Rule >> Type = Custome TCP >> Protocol = TCP >> Port Range = 4444 >> Source = anywhere >> Description = selenium-grid >> save rules >> Instance from left navigation >> Instance Id link >> Connect >>
for linux { SSH clinet} >> open location of downloaded keypair in cmd >> c:\downloads\ .pem file will be downloaded > open the file path in terminal
$ chomd 400 selenium-grid ?
$ chomd 400 myLinuxMachineGridSetup.pem
$ ssh -i myLinuxMachineGridSetup.pem ec2-user@111.222.333.444 , here 111.222.333.444 is your public ipv4
$ Are you sure you want to continue connecting? YES
$sudo su ==> login as root user
# yum update -y ==> package manager to install everything
# yum remove java -y ==> to remove old java
# yum install java-1.8.0-openjdk -y ==> Install java
# yu install maven ==> install maven
# mvn --version ==> check installed maven version
# yum install docker ==> to install docker
# docker --version
# docker-compose -v ==> check docker compose version
# touch docker-compose.yml ==> create file
# vi docker-compose.yml ==> paste below code in the file
# To execute this docker-compose yml file use `docker-compose -f docker-compose-v3.yml up`
# Add the `-d` flag at the end for detached execution
# To stop the execution, hit Ctrl+C, and then `docker-compose -f docker-compose-v3.yml down`
version: "3"
services:
chrome:
image: selenium/node-chrome:4.11.0-20230801
shm_size: 2gb
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
edge:
image: selenium/node-edge:4.11.0-20230801
shm_size: 2gb
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
firefox:
image: selenium/node-firefox:4.11.0-20230801
shm_size: 2gb
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
selenium-hub:
image: selenium/hub:4.11.0-20230801
container_name: selenium-hub
ports:
- "4442:4442"
- "4443:4443"
- "4444:4444"
volumes:
- ./Hub/example-config.toml:/opt/selenium/config.toml
esc ctrl+q to close the document
# systemctl start docker ==> start docker
# systemctl enable docker ==> enable docker
# systemctl restart docker ==> restart docker
# docker ps -a ==> tells how many docker containers are running "Process Status"
# docker stop <containerid> ==> stops the particular container
# docker rm <Container id> ==> removes the particular docker container, However, image will still be there to create a container from that image
# docker container prune ==> this will remove all the stopped containers
# docker images ==> shows the docker images available
# docker run -d -p 4444:4444 -p 7900:7900 --shm-size="2g" selenium/standalone-firefox:4.11.0-20230801 ==> run a docker container with firefox from the image, if not available downloads image also
# docker run -d -p 4444:4444 --shm-size="2g" selenium/standalone-firefox:4.11.0-20230801
# docker run -d -p 4444:4444 --shm-size="2g" selenium/standalone-chrome:4.11.0-20230801
# docker run -d -p 4444:4444 --shm-size="2g" selenium/standalone-edge:4.11.0-20230801
open browser >> yourpublic ipv4 : 4444 in this case 111.222.333.444
No comments:
Post a Comment