goss.yaml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. file:
  2. /etc/os-release:
  3. exists: true
  4. contains:
  5. - {{getEnv "TARGET" "ubuntu"}}
  6. /home/mastodon/.bashrc:
  7. exists: true
  8. owner: "mastodon"
  9. group: "mastodon"
  10. filetype: "file"
  11. mode: "0664"
  12. contains: ["rbenv init -", "PATH="]
  13. /usr/bin/node:
  14. exists: true
  15. filetype: "file"
  16. mode: "0755"
  17. /home/mastodon/.rbenv/plugins/ruby-build/bin/ruby-build:
  18. exists: true
  19. filetype: "file"
  20. {{- if eq (getEnv "TARGET" "ubuntu") "rhel" }}
  21. mode: "0755"
  22. {{- else }}
  23. mode: "0775"
  24. {{- end }}
  25. owner: "mastodon"
  26. /home/mastodon/live:
  27. exists: true
  28. filetype: "directory"
  29. owner: "mastodon"
  30. {{- if eq (getEnv "TARGET" "ubuntu") "rhel" -}}
  31. {{- $nginxConfigLocation := "conf.d"}}
  32. /etc/nginx/{{- $nginxConfigLocation }}/mastodon.conf:
  33. exists: true
  34. filetype: "file"
  35. {{- else -}}
  36. {{- $nginxConfigLocation := "sites-available"}}
  37. {{- $nginxConfigEnabled := "sites-enabled"}}
  38. /etc/nginx/{{- $nginxConfigLocation }}/mastodon.conf:
  39. exists: true
  40. filetype: "file"
  41. /etc/nginx/{{- $nginxConfigEnabled }}/mastodon.conf:
  42. exists: true
  43. filetype: "symlink"
  44. {{- end -}}
  45. {{range .Vars.service_files }}
  46. {{.}}:
  47. exists: true
  48. filetype: "file"
  49. {{end}}
  50. service:
  51. {{range .Vars.services }}
  52. {{.}}:
  53. enabled: true
  54. running: true
  55. {{end}}
  56. command:
  57. ruby:
  58. #Future proofing for 4.x that uses ruby 3.0.4
  59. #Apparently this is how you're supposed to use regex with goss
  60. #https://github.com/aelsabbahy/goss/blob/master/docs/manual.md#patterns
  61. exit-status: 0
  62. exec: "sudo -u mastodon -i ruby -v"
  63. stdout:
  64. - "/3.0.[3-4]/"
  65. crontab:
  66. exit-status: 0
  67. exec: "sudo crontab -l -u mastodon"
  68. stdout:
  69. - "15 1 * * * /bin/bash -c 'export PATH=\"$HOME/.rbenv/bin:$PATH\"; eval \"$(rbenv init -)\"; cd /home/mastodon/live && RAILS_ENV=production ./bin/tootctl media remove'"
  70. {{if eq .Env.TARGET "ubuntu"}}
  71. ufw:
  72. exit-status: 0
  73. exec: "ufw status"
  74. stdout:
  75. {{range .Vars.firewall_open_ports }}
  76. - "/{{.}}/tcp \\s* ALLOW \\s* Anywhere/"
  77. - "/{{.}}/tcp \\(v6\\) \\s* ALLOW \\s* Anywhere \\(v6\\)/"
  78. {{end}}
  79. {{end}}
  80. postgres:
  81. exit-status: 0
  82. exec: "PGPASSWORD=CHANGEME psql -d mastodon_instance -h 127.0.0.1 -U mastodon -c 'CREATE TABLE test (v varchar(20)); DROP TABLE test;'"
  83. http:
  84. https://mastodon.local/:
  85. status: 200
  86. allow-insecure: true
  87. no-follow-redirects: false
  88. body: [ mastodon.local ]
  89. user:
  90. mastodon:
  91. exists: true
  92. groups:
  93. - mastodon
  94. home: /home/mastodon
  95. shell: /bin/bash
  96. package:
  97. {{if eq .Env.TARGET "ubuntu"}}
  98. {{range .Vars.packages.ubuntu }}
  99. {{.}}:
  100. installed: true
  101. {{end}}
  102. {{end}}