Source Code for the Home Server setup. This includes the git server hosting this repository as well. #terraform #docker https://git.captnemo.in/nemo/nebula/

traefik.tf 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. resource "docker_container" "traefik" {
  2. name = "traefik"
  3. image = "${docker_image.traefik17.latest}"
  4. # Admin Backend
  5. ports {
  6. internal = 1111
  7. external = 1111
  8. ip = "${var.ips["eth0"]}"
  9. }
  10. ports {
  11. internal = 1111
  12. external = 1111
  13. ip = "${var.ips["tun0"]}"
  14. }
  15. # Local Web Server
  16. ports {
  17. internal = 80
  18. external = 80
  19. ip = "${var.ips["eth0"]}"
  20. }
  21. # Local Web Server (HTTPS)
  22. ports {
  23. internal = 443
  24. external = 443
  25. ip = "${var.ips["eth0"]}"
  26. }
  27. # Proxied via sydney.captnemo.in
  28. ports {
  29. internal = 443
  30. external = 443
  31. ip = "${var.ips["tun0"]}"
  32. }
  33. ports {
  34. internal = 80
  35. external = 80
  36. ip = "${var.ips["tun0"]}"
  37. }
  38. upload {
  39. content = "${file("${path.module}/conf/traefik.toml")}"
  40. file = "/etc/traefik/traefik.toml"
  41. }
  42. upload {
  43. content = "${file("/home/nemo/projects/personal/certs/git.captnemo.in/fullchain.pem")}"
  44. file = "/etc/traefik/git.captnemo.in.crt"
  45. }
  46. upload {
  47. content = "${file("/home/nemo/projects/personal/certs/git.captnemo.in/privkey.pem")}"
  48. file = "/etc/traefik/git.captnemo.in.key"
  49. }
  50. upload {
  51. content = "${file("/home/nemo/projects/personal/certs/rss.captnemo.in/fullchain.pem")}"
  52. file = "/etc/traefik/rss.captnemo.in.crt"
  53. }
  54. upload {
  55. content = "${file("/home/nemo/projects/personal/certs/rss.captnemo.in/privkey.pem")}"
  56. file = "/etc/traefik/rss.captnemo.in.key"
  57. }
  58. volumes {
  59. host_path = "/var/run/docker.sock"
  60. container_path = "/var/run/docker.sock"
  61. read_only = true
  62. }
  63. volumes {
  64. host_path = "/mnt/xwing/config/acme"
  65. container_path = "/acme"
  66. }
  67. memory = 256
  68. restart = "unless-stopped"
  69. destroy_grace_seconds = 10
  70. must_run = true
  71. // `bridge` is auto-connected for now
  72. // https://github.com/terraform-providers/terraform-provider-docker/issues/10
  73. networks = [
  74. "${docker_network.traefik.id}",
  75. ]
  76. env = [
  77. "CLOUDFLARE_EMAIL=${var.cloudflare_email}",
  78. "CLOUDFLARE_API_KEY=${var.cloudflare_key}",
  79. ]
  80. }