goss.yaml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. contains: ["rbenv init -", "PATH="]
  12. /usr/bin/node:
  13. exists: true
  14. filetype: "file"
  15. mode: "0755"
  16. /etc/letsencrypt/live/mastodon.local/fullchain.pem:
  17. exists: true
  18. filetype: "symlink"
  19. mode: "0777"
  20. /etc/letsencrypt/live/mastodon.local/privkey.pem:
  21. exists: true
  22. filetype: "symlink"
  23. mode: "0777"
  24. /home/mastodon/.rbenv/plugins/ruby-build/bin/ruby-build:
  25. exists: true
  26. filetype: "file"
  27. {{- if eq (getEnv "TARGET" "ubuntu") "rhel" }}
  28. mode: "0755"
  29. {{- else }}
  30. mode: "0775"
  31. {{- end }}
  32. owner: "mastodon"
  33. /home/mastodon/live:
  34. exists: true
  35. filetype: "directory"
  36. owner: "mastodon"
  37. {{- if eq (getEnv "TARGET" "ubuntu") "rhel" -}}
  38. {{- $nginxConfigLocation := "conf.d"}}
  39. /etc/nginx/{{- $nginxConfigLocation }}/mastodon.conf:
  40. exists: true
  41. filetype: "file"
  42. {{- else -}}
  43. {{- $nginxConfigLocation := "sites-available"}}
  44. {{- $nginxConfigEnabled := "sites-enabled"}}
  45. /etc/nginx/{{- $nginxConfigLocation }}/mastodon.conf:
  46. exists: true
  47. filetype: "file"
  48. /etc/nginx/{{- $nginxConfigEnabled }}/mastodon.conf:
  49. exists: true
  50. filetype: "symlink"
  51. {{- end -}}
  52. {{range .Vars.service_files }}
  53. {{.}}:
  54. exists: true
  55. filetype: "file"
  56. {{end}}
  57. service:
  58. {{range .Vars.services }}
  59. {{.}}:
  60. enabled: true
  61. running: true
  62. {{end}}
  63. command:
  64. ruby:
  65. #Previous implementation was directly checking against a fixed version and required manual update every time mastodon updated it's ruby version
  66. #With this current implementation, we directly check against the ruby version requested by Mastodon against what eventually got installed
  67. #Also can't use True or False as stdout output because Ubuntu is doing something funny and turning the string into a boolean and it fails the test. No I don't know why.
  68. exit-status: 0
  69. exec: >-
  70. [[ "$(sudo -u mastodon -i cat /home/mastodon/live/.ruby-version)" == "$(sudo -u mastodon -i ruby -v | sed 's/^.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/')" ]] && echo "Match" || echo "No Match"
  71. stdout:
  72. - "Match"
  73. crontab:
  74. exit-status: 0
  75. exec: "sudo crontab -l -u mastodon"
  76. stdout:
  77. - "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'"
  78. {{if eq .Env.TARGET "ubuntu"}}
  79. ufw:
  80. exit-status: 0
  81. exec: "ufw status"
  82. stdout:
  83. {{range .Vars.firewall_open_ports }}
  84. - "/{{.}}/tcp \\s* ALLOW \\s* Anywhere/"
  85. - "/{{.}}/tcp \\(v6\\) \\s* ALLOW \\s* Anywhere \\(v6\\)/"
  86. {{end}}
  87. {{end}}
  88. postgres:
  89. exit-status: 0
  90. exec: "PGPASSWORD=CHANGEME psql -d mastodon_instance -h 127.0.0.1 -U mastodon -c 'CREATE TABLE test (v varchar(20)); DROP TABLE test;'"
  91. jemalloc:
  92. exit-status: 0
  93. exec: "sudo -u mastodon -i bash -c 'ldd $(rbenv which ruby) | grep -q libjemalloc'"
  94. http:
  95. https://mastodon.local/:
  96. status: 200
  97. allow-insecure: true
  98. no-follow-redirects: false
  99. body: [ mastodon.local ]
  100. user:
  101. mastodon:
  102. exists: true
  103. groups:
  104. - mastodon
  105. home: /home/mastodon
  106. shell: /bin/bash
  107. package:
  108. {{if eq .Env.TARGET "ubuntu"}}
  109. {{range .Vars.packages.ubuntu }}
  110. {{.}}:
  111. installed: true
  112. {{end}}
  113. {{end}}