Created
          July 25, 2021 21:41 
        
      - 
      
- 
        Save gthieleb/dfb4264e501b4671ddc0164fb917eb0f to your computer and use it in GitHub Desktop. 
    Nomad jobfile for selenium hub nodes using consul
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | job "selenium-hub" { | |
| region = "global" | |
| datacenters = ["dc1"] | |
| type = "service" | |
| priority = 50 | |
| update { | |
| stagger = "10s" | |
| max_parallel = 1 | |
| } | |
| group "selenium-hub" { | |
| count = 1 | |
| restart { | |
| attempts = 10 | |
| interval = "5m" | |
| delay = "25s" | |
| mode = "delay" | |
| } | |
| network { | |
| port "selenium_hub" { | |
| to = 4444 | |
| static = 4444 | |
| } | |
| } | |
| task "selenium-hub" { | |
| driver = "docker" | |
| config { | |
| image = "selenium/hub" | |
| ports = ["selenium_hub"] | |
| } | |
| env { | |
| GRID_TIMEOUT = 300 | |
| GRID_MAX_SESSION = 10 | |
| GRID_BROWSER_TIMEOUT=600 | |
| } | |
| service { | |
| name = "selenium-hub" | |
| tags = ["hub", "selenium"] | |
| port = "selenium_hub" | |
| check { | |
| name = "alive" | |
| type = "tcp" | |
| interval = "10s" | |
| timeout = "2s" | |
| } | |
| } | |
| resources { | |
| cpu = 300 | |
| memory = 512 | |
| } | |
| logs { | |
| max_files = 10 | |
| max_file_size = 15 | |
| } | |
| kill_timeout = "20s" | |
| } | |
| } | |
| group "selenium-chrome-nodes" { | |
| count = 3 | |
| restart { | |
| attempts = 10 | |
| interval = "5m" | |
| delay = "25s" | |
| mode = "delay" | |
| } | |
| network { | |
| port "selenium_node" {} | |
| } | |
| task "selenium-chrome" { | |
| driver = "docker" | |
| template { | |
| data = <<EOH | |
| REMOTE_HOST="http://{{ env "NOMAD_IP_selenium_node" }}:{{ env "NOMAD_PORT_selenium_node" }}" | |
| HUB_PORT_4444_TCP_ADDR={{ with service "selenium-hub" }}{{ with index . 0 }}{{ .Address }}{{ end }}{{ end }} | |
| HUB_PORT_4444_TCP_PORT={{ with service "selenium-hub" }}{{ with index . 0 }}{{ .Port }}{{ end }}{{ end }} | |
| NODE_PORT="{{ env "NOMAD_PORT_selenium_node" }}" | |
| NODE_MAX_SESSION=10 | |
| NODE_MAX_INSTANCES=10 | |
| EOH | |
| destination = "local/file.env" | |
| env = true | |
| } | |
| config { | |
| shm_size = 2097152 | |
| ports = ["selenium_node"] | |
| image = "selenium/node-chrome" | |
| volumes = ["/dev/shm:/dev/shm"] | |
| } | |
| service { | |
| name = "selenium-node-chrome" | |
| tags = ["node", "selenium", "selenium-chrome"] | |
| port = "selenium_node" | |
| check { | |
| name = "alive" | |
| type = "tcp" | |
| interval = "10s" | |
| timeout = "2s" | |
| } | |
| } | |
| resources { | |
| cpu = 1000 | |
| memory = 2048 | |
| } | |
| logs { | |
| max_files = 10 | |
| max_file_size = 15 | |
| } | |
| kill_timeout = "20s" | |
| } | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment