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.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. resource "docker_container" "traefik" {
  2. name = "traefik"
  3. image = "${docker_image.traefik16.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. upload {
  59. content = "${file("/home/nemo/projects/personal/certs/emby.in.bb8.fun/privkey.pem")}"
  60. file = "/etc/traefik/emby.in.bb8.fun.key"
  61. }
  62. upload {
  63. content = "${file("/home/nemo/projects/personal/certs/emby.in.bb8.fun/fullchain.pem")}"
  64. file = "/etc/traefik/emby.in.bb8.fun.crt"
  65. }
  66. volumes {
  67. host_path = "/var/run/docker.sock"
  68. container_path = "/var/run/docker.sock"
  69. read_only = true
  70. }
  71. volumes {
  72. host_path = "/mnt/xwing/config/acme"
  73. container_path = "/acme"
  74. }
  75. memory = 256
  76. restart = "unless-stopped"
  77. destroy_grace_seconds = 10
  78. must_run = true
  79. env = [
  80. "CLOUDFLARE_EMAIL=${var.cloudflare_email}",
  81. "CLOUDFLARE_API_KEY=${var.cloudflare_key}",
  82. ]
  83. }