Add Caddy Service
This commit is contained in:
		
							parent
							
								
									c5346ef2ed
								
							
						
					
					
						commit
						94b8e0694c
					
				
							
								
								
									
										44
									
								
								nomad_jobs/services/caddy/caddy.nomad.hcl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								nomad_jobs/services/caddy/caddy.nomad.hcl
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,44 @@
 | 
				
			|||||||
 | 
					job "caddy" {
 | 
				
			||||||
 | 
					  datacenters = ["dc1"]
 | 
				
			||||||
 | 
					  type = "service"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  group "caddy" {
 | 
				
			||||||
 | 
					    count = 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    network {
 | 
				
			||||||
 | 
					      port "http" {
 | 
				
			||||||
 | 
					        to = 80
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    service {
 | 
				
			||||||
 | 
					      name = "caddy"
 | 
				
			||||||
 | 
					      provider = "consul"
 | 
				
			||||||
 | 
					      port = "http"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      tags = [
 | 
				
			||||||
 | 
					        "traefik.enable=true", 
 | 
				
			||||||
 | 
					        "traefik.http.routers.caddy.tls=true",
 | 
				
			||||||
 | 
					        "traefik.http.routers.caddy.entrypoints=websecure",
 | 
				
			||||||
 | 
					        "traefik.http.routers.caddy.rule=Host(`example.local`)"
 | 
				
			||||||
 | 
					        ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      check {
 | 
				
			||||||
 | 
					        type = "http"
 | 
				
			||||||
 | 
					        path = "/"
 | 
				
			||||||
 | 
					        interval = "10s"
 | 
				
			||||||
 | 
					        timeout = "2s"
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    task "caddy" {
 | 
				
			||||||
 | 
					      driver = "docker"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      config {
 | 
				
			||||||
 | 
					        image = "caddy:alpine"
 | 
				
			||||||
 | 
					        ports = ["http"]
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										16
									
								
								nomad_jobs/services/caddy/readme.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								nomad_jobs/services/caddy/readme.md
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,16 @@
 | 
				
			|||||||
 | 
					# Caddy Web Server
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Caddy is a simple and performant web server / reverse proxy written in Go. It is designed to be easy to use and configure. It is great to test network connectivity and routing similar to how someone might use nginx just to make sure the host can be reached and server content. 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					While you can absolutely use Caddy as a reverse proxy, Traefik easily integrates with consul for service discovery so that is what is used for the reverse proxy and this nomad job spec is placed behind Traefik.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Nomad Job for Caddy
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					There are no caddy configurations configured for this job spec. If you run it, it will register with consul and be available to Traefik for routing. If the domain name is configured correctly, you should be able to reach the Caddy welcome page.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## TODO
 | 
				
			||||||
 | 
					If you want to deploy this, you will need to update the domain name in the job spec.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					| Line | Default | Adjustment |
 | 
				
			||||||
 | 
					| --- | --- | --- |
 | 
				
			||||||
 | 
					| 23 | `"traefik.http.routers.caddy.rule=Host('example.com')"` | Change `example.com` to your domain name |
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user