Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How run multiple instances of chrome and have one manager go rod which handle this instances #1000

Closed
Tomichi opened this issue Jan 8, 2024 · 2 comments
Labels
question Questions related to rod

Comments

@Tomichi
Copy link

Tomichi commented Jan 8, 2024

Rod Version: v0.114.5

Question

Hi, I would like to ask or point you in the right direction. I would like to run several instances of ghcr.io/go-rod/rod chrome browsers in Docker containers and have one Docker container that would manage sending requests to individual Docker instances of Google chrome something like "Load balancer" or "SeleniumGrid". I don't know how to link calls to multiple Google chrome instances in a target driving container. Can you give me some advice on how to do this?

docker-compose.yml

 chrome-01:
    container_name: chrome-01
    image: ghcr.io/go-rod/rod
    command: ["chrome", "--headless", "--disable-dev-shm-usage", "--disable-gpu", "--no-sandbox", "--remote-debugging-port=9222", "--remote-debugging-address=0.0.0.0"]
      ...
chrome-0n:
    container_name: chrome-0n
    image: ghcr.io/go-rod/rod
    command: ["chrome", "--headless", "--disable-dev-shm-usage", "--disable-gpu", "--no-sandbox", "--remote-debugging-port=9222", "--remote-debugging-address=0.0.0.0"]

and in main.go

connectURL := launcher.MustResolveURL("ws://chrome-01:9222")
browser := rod.New().ControlURL(connectURL).MustConnect()

Is there any better idea than have it counter and static array of name of docker-chrome instances? Is it possible to hide instances to one url like load balance?

@Tomichi Tomichi added the question Questions related to rod label Jan 8, 2024
@ysmood
Copy link
Member

ysmood commented Jan 8, 2024

https://go-rod.github.io/#/custom-launch?id=remotely-manage-the-launcher

@Tomichi
Copy link
Author

Tomichi commented Jan 11, 2024

Thank you

@Tomichi Tomichi closed this as completed Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Questions related to rod
Projects
None yet
Development

No branches or pull requests

2 participants