ConfigLMM 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.yardopts +4 -0
  4. data/CHANGELOG.md +5 -0
  5. data/Examples/Android.mm.yaml +8 -0
  6. data/Examples/Apps/Blog.mm.yaml +7 -0
  7. data/Examples/Apps/Jellyfin.mm.yaml +3 -0
  8. data/Examples/Implemented.mm.yaml +155 -0
  9. data/Examples/Keys.ini +7 -0
  10. data/Examples/Linux.mm.yaml +16 -0
  11. data/Examples/Windows.mm.yaml +11 -0
  12. data/Examples/configlmmAuth.sh +26 -0
  13. data/Plugins/Apps/ArchiSteamFarm/ArchiSteamFarm.conf.erb +38 -0
  14. data/Plugins/Apps/ArchiSteamFarm/ArchiSteamFarm.lmm.rb +19 -0
  15. data/Plugins/Apps/IPFS/IPFS.conf.erb +44 -0
  16. data/Plugins/Apps/IPFS/IPFS.lmm.rb +23 -0
  17. data/Plugins/Apps/InfluxDB/InfluxDB.conf.erb +34 -0
  18. data/Plugins/Apps/InfluxDB/InfluxDB.lmm.rb +19 -0
  19. data/Plugins/Apps/Jackett/Jackett.conf.erb +38 -0
  20. data/Plugins/Apps/Jackett/Jackett.lmm.rb +19 -0
  21. data/Plugins/Apps/Jellyfin/Jellyfin.conf.erb +59 -0
  22. data/Plugins/Apps/Jellyfin/Jellyfin.lmm.rb +23 -0
  23. data/Plugins/Apps/Mastodon/Mastodon.conf.erb +81 -0
  24. data/Plugins/Apps/Mastodon/Mastodon.lmm.rb +23 -0
  25. data/Plugins/Apps/Matrix/Matrix.conf.erb +36 -0
  26. data/Plugins/Apps/Matrix/Matrix.lmm.rb +23 -0
  27. data/Plugins/Apps/Netdata/Netdata.conf.erb +37 -0
  28. data/Plugins/Apps/Netdata/Netdata.lmm.rb +23 -0
  29. data/Plugins/Apps/Nextcloud/Nextcloud.conf.erb +165 -0
  30. data/Plugins/Apps/Nextcloud/Nextcloud.lmm.rb +23 -0
  31. data/Plugins/Apps/Nginx/config-lmm/errors.conf +31 -0
  32. data/Plugins/Apps/Nginx/config-lmm/private.conf +6 -0
  33. data/Plugins/Apps/Nginx/config-lmm/proxy.conf +15 -0
  34. data/Plugins/Apps/Nginx/config-lmm/public.conf +3 -0
  35. data/Plugins/Apps/Nginx/config-lmm/ssl.conf +18 -0
  36. data/Plugins/Apps/Nginx/main.conf +30 -0
  37. data/Plugins/Apps/Nginx/nginx.conf +90 -0
  38. data/Plugins/Apps/Nginx/nginx.lmm.rb +62 -0
  39. data/Plugins/Apps/Nginx/proxy.conf.erb +31 -0
  40. data/Plugins/Apps/Odoo/Odoo.conf.erb +44 -0
  41. data/Plugins/Apps/Odoo/Odoo.lmm.rb +23 -0
  42. data/Plugins/Apps/Pterodactyl/Pterodactyl.conf.erb +50 -0
  43. data/Plugins/Apps/Pterodactyl/Pterodactyl.lmm.rb +30 -0
  44. data/Plugins/Apps/Pterodactyl/Wings.conf.erb +38 -0
  45. data/Plugins/Apps/Sunshine/Sunshine.conf.erb +31 -0
  46. data/Plugins/Apps/Sunshine/Sunshine.lmm.rb +21 -0
  47. data/Plugins/Apps/Vaultwarden/Vaultwarden.conf.erb +48 -0
  48. data/Plugins/Apps/Vaultwarden/Vaultwarden.lmm.rb +25 -0
  49. data/Plugins/Apps/bitmagnet/bitmagnet.conf.erb +35 -0
  50. data/Plugins/Apps/bitmagnet/bitmagnet.lmm.rb +19 -0
  51. data/Plugins/Apps/gollum/config.ru +11 -0
  52. data/Plugins/Apps/gollum/gollum.conf.erb +41 -0
  53. data/Plugins/Apps/gollum/gollum.lmm.rb +52 -0
  54. data/Plugins/OS/Linux.lmm.rb +64 -0
  55. data/Plugins/OS/Routers/Aruba/ArubaInstant.lmm.rb +144 -0
  56. data/Plugins/Platforms/GitHub.lmm.rb +57 -0
  57. data/Plugins/Platforms/GoDaddy/GoDaddy.lmm.rb +83 -0
  58. data/Plugins/Platforms/GoDaddy/zone.txt.erb +13 -0
  59. data/Plugins/Platforms/porkbun.lmm.rb +129 -0
  60. data/Plugins/Platforms/porkbun_spec.rb +110 -0
  61. data/Plugins/Services/DNS/AmberBit.lmm.rb +14 -0
  62. data/Plugins/Services/DNS/ArubaItDNS.lmm.rb +14 -0
  63. data/Plugins/Services/DNS/NICLV.lmm.rb +18 -0
  64. data/Plugins/Services/DNS/PowerDNS.lmm.rb +261 -0
  65. data/Plugins/Services/DNS/tonic.lmm.rb +126 -0
  66. data/README.md +337 -0
  67. data/Rakefile +15 -0
  68. data/UNLICENSE +24 -0
  69. data/bin/configlmm +7 -0
  70. data/bin/console +11 -0
  71. data/bin/setup +8 -0
  72. data/lib/ConfigLMM/Framework/plugins/dns.rb +63 -0
  73. data/lib/ConfigLMM/Framework/plugins/errors.rb +23 -0
  74. data/lib/ConfigLMM/Framework/plugins/nginxApp.rb +55 -0
  75. data/lib/ConfigLMM/Framework/plugins/plugin.rb +167 -0
  76. data/lib/ConfigLMM/Framework/plugins/ssh.rb +37 -0
  77. data/lib/ConfigLMM/Framework/plugins/store.rb +57 -0
  78. data/lib/ConfigLMM/Framework/plugins.rb +5 -0
  79. data/lib/ConfigLMM/Framework/registrator.rb +32 -0
  80. data/lib/ConfigLMM/Framework.rb +9 -0
  81. data/lib/ConfigLMM/LMM/plugins.rb +5 -0
  82. data/lib/ConfigLMM/LMM.rb +8 -0
  83. data/lib/ConfigLMM/cli.rb +161 -0
  84. data/lib/ConfigLMM/command.rb +53 -0
  85. data/lib/ConfigLMM/commands/build.rb +41 -0
  86. data/lib/ConfigLMM/commands/cleanup.rb +30 -0
  87. data/lib/ConfigLMM/commands/configsCommand.rb +167 -0
  88. data/lib/ConfigLMM/commands/deploy.rb +39 -0
  89. data/lib/ConfigLMM/commands/diff.rb +45 -0
  90. data/lib/ConfigLMM/commands/list.rb +15 -0
  91. data/lib/ConfigLMM/commands/refresh.rb +46 -0
  92. data/lib/ConfigLMM/commands/types.rb +35 -0
  93. data/lib/ConfigLMM/commands/validate.rb +49 -0
  94. data/lib/ConfigLMM/context.rb +52 -0
  95. data/lib/ConfigLMM/io/configList.rb +98 -0
  96. data/lib/ConfigLMM/io/path.rb +48 -0
  97. data/lib/ConfigLMM/io/source.rb +47 -0
  98. data/lib/ConfigLMM/io.rb +2 -0
  99. data/lib/ConfigLMM/state.rb +78 -0
  100. data/lib/ConfigLMM/utils/filters.rb +126 -0
  101. data/lib/ConfigLMM/version.rb +5 -0
  102. data/lib/ConfigLMM.rb +6 -0
  103. data/sig/ConfigLMM.rbs +4 -0
  104. metadata +485 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8e1dcd8d8d61d199700f39e2298c45ffaedfcb12822a833ebd16423120c4526c
4
+ data.tar.gz: ea7e2be4c9ea59a2babe325a8d63c1440aae67f147106d4b30e17839c0d6abda
5
+ SHA512:
6
+ metadata.gz: 32fcd1db26c56ce7787a4515ce1d653cf96cf9a812f56ac7bcaa94465bcad4fa0a3082f2420cf6bdea7ae7b8e6229c8d416b3be7e4157eb37d3ea11cd4c7a42c
7
+ data.tar.gz: fcd652884fe0f191739e830315da87f066507fd719e38b60bdfeb35030116de97ac9eaabf913b9e75f2e33c95a85dafc77539eba985be6968a80f136d545c186
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.yardopts ADDED
@@ -0,0 +1,4 @@
1
+ --markup markdown
2
+ bin/*.rb
3
+ -
4
+ *.md
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2024-06-06
4
+
5
+ - Initial release
@@ -0,0 +1,8 @@
1
+ Phone:
2
+ Type: Android
3
+ Settings:
4
+ HomeScreen: With App drawer
5
+ Apps:
6
+ - Duolingo
7
+ Remove:
8
+ - CandyCrush
@@ -0,0 +1,7 @@
1
+ _CONTEXT_:
2
+ Dislikes:
3
+ - Big Tech
4
+
5
+ Blog:
6
+ Type: CloudBlog
7
+ Feature: User Management
@@ -0,0 +1,3 @@
1
+ Jellyfin:
2
+ Type: Jellyfin
3
+ Domain: jellyfin.example.org
@@ -0,0 +1,155 @@
1
+
2
+ # https://porkbun.com/
3
+ Porkbun:
4
+ Type: PorkbunDNS
5
+ DNS:
6
+ example.org:
7
+ '@': A=@me # `@me` means use current hosts external IP
8
+
9
+ # https://www.tonic.to/
10
+ Tonic:
11
+ Type: TonicDNS
12
+ Domain: example.to
13
+ Nameservers:
14
+ ns.example.org: 192.168.5.5
15
+
16
+ # https://www.powerdns.com/
17
+ PowerDNS:
18
+ Type: PowerDNS
19
+ # Location: pdns://dns.example.org:8081/
20
+ # Location: ssh://server/?host=localhost&port=8081
21
+ Location: ssh://server/
22
+ Settings:
23
+ version-string: anonymous
24
+ api: yes
25
+ expand-alias: yes
26
+ resolver: 127.0.0.53
27
+ default-soa-content: ns.example.org. contact.example.org. 0 10800 3600 604800 3600
28
+ DNS:
29
+ example.org:
30
+ '@': A=@me
31
+ ns: A=192.168.5.5
32
+
33
+ # https://www.godaddy.com/
34
+ GoDaddy:
35
+ Type: GoDaddyDNS
36
+ DNS:
37
+ example.org:
38
+ '@': A=@me
39
+ Wiki: CNAME=@ # `@` means point it to the domain root (ie. example.org)
40
+ ipv6:
41
+ - AAAA=2606:2800:21f:cb07:6820:80da:af6b:8b2c
42
+ - AAAA=2606:2800:21f:cb07:6820:80da:af6b:0153
43
+
44
+ Linux:
45
+ Type: Linux
46
+ Hosts:
47
+ 127.0.0.1:
48
+ - example.org
49
+
50
+ # https://www.arubanetworks.com/
51
+ ArubaInstant:
52
+ Type: ArubaInstant
53
+ Location: user@aruba.example.org
54
+ CertificateName: Aruba
55
+
56
+ # https://github.com/JustArchiNET/ArchiSteamFarm
57
+ ArchiSteamFarm:
58
+ Type: ArchiSteamFarm
59
+ Domain: ASF.example.org
60
+
61
+ # https://bitmagnet.io/
62
+ Bitmagnet:
63
+ Type: Bitmagnet
64
+ Domain: bitmagnet.example.org
65
+
66
+ # https://github.com/gollum/gollum
67
+ Gollum:
68
+ Type: Gollum
69
+ Domain: gollum.example.org
70
+
71
+ # https://grafana.com/
72
+ Grafana:
73
+ Type: NginxProxy
74
+ Domain: grafana.example.org
75
+ Proxy: unix:/run/grafana/grafana.sock
76
+ Private: yes
77
+
78
+ # https://ipfs.tech/
79
+ IPFS:
80
+ Type: IPFS
81
+ Domain: IPFS.example.org
82
+
83
+ # https://www.influxdata.com/
84
+ InfluxDB:
85
+ Type: InfluxDB
86
+ Domain: influx.example.org
87
+
88
+ # https://github.com/Jackett/Jackett/
89
+ Jackett:
90
+ Type: Jackett
91
+ Domain: jackett.example.org
92
+
93
+ # https://jellyfin.org/
94
+ Jellyfin:
95
+ Type: Jellyfin
96
+ Domain: jellyfin.example.org
97
+
98
+ # https://github.com/mastodon/mastodon
99
+ Mastodon:
100
+ Type: Mastodon
101
+ Domain: mastodon.example.org
102
+
103
+ # https://matrix.org/
104
+ Matrix:
105
+ Type: Matrix
106
+ Domain: matrix.example.org
107
+
108
+ # https://www.netdata.cloud/
109
+ Netdata:
110
+ Type: Netdata
111
+ Domain: netdata.example.org
112
+
113
+ # https://nextcloud.com/
114
+ Nextcloud:
115
+ Type: Nextcloud
116
+ Domain: nextcloud.example.org
117
+
118
+ # https://www.odoo.com/
119
+ Odoo:
120
+ Type: Odoo
121
+ Domain: odoo.example.org
122
+
123
+ # https://pterodactyl.io/
124
+ Pterodactyl:
125
+ Type: Pterodactyl
126
+ Domain: pterodactyl.example.org
127
+
128
+ # https://pterodactyl.io/
129
+ Wings:
130
+ Type: Wings
131
+ Domain: wings.example.org
132
+
133
+ # https://www.qbittorrent.org/
134
+ qBittorrent:
135
+ Type: NginxProxy
136
+ Domain: qBittorrent.example.org
137
+ Proxy: http://127.0.0.1:7777
138
+ Private: yes
139
+
140
+ # https://github.com/AnalogJ/scrutiny
141
+ Scrutiny:
142
+ Type: NginxProxy
143
+ Domain: scrutiny.example.org
144
+ Proxy: http://127.0.0.1:7080
145
+ Private: yes
146
+
147
+ # https://app.lizardbyte.dev/Sunshine/
148
+ Sunshine:
149
+ Type: Sunshine
150
+ Domain: sunshine.example.org
151
+
152
+ # https://github.com/dani-garcia/vaultwarden
153
+ Vaultwarden:
154
+ Type: Vaultwarden
155
+ Domain: vaultwarden.example.org
data/Examples/Keys.ini ADDED
@@ -0,0 +1,7 @@
1
+ ARUBA_INSTANT_PASSWORD=
2
+ GITHUB_TOKEN=
3
+ GODADDY_SECRET=
4
+ PORKBUN_API_KEY=
5
+ PORKBUN_SECRET_API_KEY=
6
+ POWERDNS_API_KEY=
7
+ TONIC_PASSWORD=
@@ -0,0 +1,16 @@
1
+ Linux:
2
+ Type: ArchLinux
3
+ Apps:
4
+ - fish
5
+ - vim
6
+ Users:
7
+ - user1:
8
+ Admin: Yes
9
+ Shell: fish
10
+ - user2:
11
+ Admin: Yes
12
+ Shell: fish
13
+ Comment: Other user
14
+ Hosts:
15
+ 127.0.0.1:
16
+ - example.org
@@ -0,0 +1,11 @@
1
+ Computer:
2
+ Type: Windows
3
+ Managed: yes
4
+ Apps:
5
+ - Steam
6
+ - Fortnite
7
+ - Roblox
8
+ - Minecraft
9
+ - Firefox
10
+ Remove:
11
+ - Chrome
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/sh
2
+
3
+ if [ "$#" -ne 3 ]; then
4
+ echo "Usage $0 <cmd> <key file> <config file>"
5
+ exit 1
6
+ fi
7
+
8
+ cmd="$1"
9
+ keysFile="$2"
10
+ configFile="$3"
11
+
12
+ if [ ! -f "$keysFile" ]; then
13
+ echo "Provided key file '$keysFile' doesn't exist!"
14
+ exit 1
15
+ fi
16
+
17
+ if [[ ${keysFile:0:2} != "./" ]]; then
18
+ keysFile="./$keysFile"
19
+ fi
20
+
21
+ export $(grep -v '^#' "$keysFile" | xargs -d '\n')
22
+
23
+ echo "Deploying..."
24
+
25
+ ruby configlmm $cmd $configFile
26
+
@@ -0,0 +1,38 @@
1
+
2
+ upstream archi_steam_farm {
3
+ server 127.0.0.1:1242;
4
+ }
5
+
6
+ server {
7
+ <% if !config['TLS'] %>
8
+ listen <%= config['Port'] %>;
9
+ listen [::]:<%= config['Port'] %>;
10
+ <% else %>
11
+ listen <%= config['Port'] %> ssl;
12
+ listen [::]:<%= config['Port'] %> ssl;
13
+ http2 on;
14
+ include config-lmm/ssl.conf;
15
+ <% end %>
16
+
17
+ server_name <%= config['Domain'] %>;
18
+
19
+ root /opt/ArchiSteamFarm-bin/www;
20
+
21
+ access_log /var/log/nginx/ArchiSteamFarm.access.log;
22
+ error_log /var/log/nginx/ArchiSteamFarm.error.log;
23
+
24
+ include config-lmm/private.conf;
25
+ include config-lmm/errors.conf;
26
+
27
+ location ~* /Api/NLog {
28
+ proxy_pass http://archi_steam_farm;
29
+
30
+ include config/proxy.conf;
31
+ }
32
+
33
+ location / {
34
+ proxy_pass http://archi_steam_farm;
35
+
36
+ include config/proxy.conf;
37
+ }
38
+ }
@@ -0,0 +1,19 @@
1
+
2
+ module ConfigLMM
3
+ module LMM
4
+ class ArchiSteamFarm < Framework::NginxApp
5
+
6
+ def actionArchiSteamFarmBuild(id, target, state, context, options)
7
+ writeNginxConfig(__dir__, 'ArchiSteamFarm', id, target, state, context, options)
8
+ end
9
+
10
+ def actionArchiSteamFarmDeploy(id, target, activeState, context, options)
11
+ if !target['Location'] || target['Location'] == '@me'
12
+ deployNginxConfig(id, target, activeState, context, options)
13
+ activeState['Location'] = '@me'
14
+ end
15
+ end
16
+
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,44 @@
1
+
2
+ upstream ipfs_api {
3
+ server 127.0.0.1:5001;
4
+ }
5
+
6
+ upstream ipfs_gateway {
7
+ server 127.0.0.1:5080;
8
+ }
9
+
10
+ server {
11
+ <% if !config['TLS'] %>
12
+ listen <%= config['Port'] %>;
13
+ listen [::]:<%= config['Port'] %>;
14
+ <% else %>
15
+ listen <%= config['Port'] %> ssl;
16
+ listen [::]:<%= config['Port'] %> ssl;
17
+ http2 on;
18
+ include config-lmm/ssl.conf;
19
+ <% end %>
20
+
21
+ server_name <%= config['Domain'] %>;
22
+
23
+ access_log /var/log/nginx/ipfs.access.log;
24
+ error_log /var/log/nginx/ipfs.error.log;
25
+
26
+ include config-lmm/private.conf;
27
+ include config-lmm/errors.conf;
28
+
29
+ rewrite ^/$ /webui/ last;
30
+
31
+ location / {
32
+ proxy_pass http://ipfs_gateway;
33
+ proxy_read_timeout 180s;
34
+
35
+ include config-lmm/proxy.conf;
36
+ }
37
+
38
+ location ~ ^/(webui|api)/ {
39
+ proxy_pass http://ipfs_api;
40
+
41
+ include config-lmm/proxy.conf;
42
+ }
43
+
44
+ }
@@ -0,0 +1,23 @@
1
+
2
+ module ConfigLMM
3
+ module LMM
4
+ class IPFS < Framework::NginxApp
5
+
6
+ def actionIPFSBuild(id, target, state, context, options)
7
+ writeNginxConfig(__dir__, 'IPFS', id, target, state, context, options)
8
+ end
9
+
10
+ def actionIPFSDiff(id, target, activeState, context, options)
11
+ # TODO
12
+ end
13
+
14
+ def actionIPFSDeploy(id, target, activeState, context, options)
15
+ if !target['Location'] || target['Location'] == '@me'
16
+ deployNginxConfig(id, target, activeState, context, options)
17
+ activeState['Location'] = '@me'
18
+ end
19
+ end
20
+
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,34 @@
1
+
2
+ upstream influxdb {
3
+ server 127.0.0.1:8086;
4
+ }
5
+
6
+ server {
7
+ <% if !config['TLS'] %>
8
+ listen <%= config['Port'] %>;
9
+ listen [::]:<%= config['Port'] %>;
10
+ <% else %>
11
+ listen <%= config['Port'] %> ssl;
12
+ listen [::]:<%= config['Port'] %> ssl;
13
+ http2 on;
14
+ include config-lmm/ssl.conf;
15
+ <% end %>
16
+
17
+ server_name <%= config['Domain'] %>;
18
+
19
+ access_log /var/log/nginx/influxdb.access.log;
20
+ error_log /var/log/nginx/influxdb.error.log;
21
+
22
+ include config-lmm/private.conf;
23
+ include config-lmm/errors.conf;
24
+
25
+ location / {
26
+ proxy_pass http://influxdb;
27
+ include config-lmm/proxy.conf;
28
+ }
29
+
30
+ location /api {
31
+ proxy_pass http://influxdb;
32
+ include config-lmm/proxy.conf;
33
+ }
34
+ }
@@ -0,0 +1,19 @@
1
+
2
+ module ConfigLMM
3
+ module LMM
4
+ class InfluxDB < Framework::NginxApp
5
+
6
+ def actionInfluxDBBuild(id, target, state, context, options)
7
+ writeNginxConfig(__dir__, 'InfluxDB', id, target, state, context, options)
8
+ end
9
+
10
+ def actionInfluxDBDeploy(id, target, activeState, context, options)
11
+ if !target['Location'] || target['Location'] == '@me'
12
+ deployNginxConfig(id, target, activeState, context, options)
13
+ activeState['Location'] = '@me'
14
+ end
15
+ end
16
+
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,38 @@
1
+
2
+ upstream jackett {
3
+ server 127.0.0.1:9117;
4
+ }
5
+
6
+ server {
7
+ <% if !config['TLS'] %>
8
+ listen <%= config['Port'] %>;
9
+ listen [::]:<%= config['Port'] %>;
10
+ <% else %>
11
+ listen <%= config['Port'] %> ssl;
12
+ listen [::]:<%= config['Port'] %> ssl;
13
+ http2 on;
14
+ include config-lmm/ssl.conf;
15
+ <% end %>
16
+
17
+ server_name <%= config['Domain'] %>;
18
+
19
+ access_log /var/log/nginx/jackett.access.log;
20
+ error_log /var/log/nginx/jackett.error.log;
21
+
22
+ include config-lmm/private.conf;
23
+ include config-lmm/errors.conf;
24
+
25
+ location / {
26
+ proxy_pass http://jackett;
27
+
28
+ include config-lmm/proxy.conf;
29
+ }
30
+
31
+ location /api/v2.0/ {
32
+ proxy_read_timeout 10m;
33
+ proxy_pass http://jackett;
34
+
35
+ include config/proxy.conf;
36
+ }
37
+
38
+ }
@@ -0,0 +1,19 @@
1
+
2
+ module ConfigLMM
3
+ module LMM
4
+ class Jackett < Framework::NginxApp
5
+
6
+ def actionJackettBuild(id, target, state, context, options)
7
+ writeNginxConfig(__dir__, 'Jackett', id, target, state, context, options)
8
+ end
9
+
10
+ def actionJackettDeploy(id, target, activeState, context, options)
11
+ if !target['Location'] || target['Location'] == '@me'
12
+ deployNginxConfig(id, target, activeState, context, options)
13
+ activeState['Location'] = '@me'
14
+ end
15
+ end
16
+
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,59 @@
1
+
2
+
3
+ upstream jellyfin {
4
+ server 127.0.0.1:8096;
5
+ }
6
+
7
+ server {
8
+ <% if !config['TLS'] %>
9
+ listen <%= config['Port'] %>;
10
+ listen [::]:<%= config['Port'] %>;
11
+ <% else %>
12
+ listen <%= config['Port'] %> ssl;
13
+ listen [::]:<%= config['Port'] %> ssl;
14
+ http2 on;
15
+ include config-lmm/ssl.conf;
16
+ <% end %>
17
+
18
+ server_name <%= config['Domain'] %>;
19
+
20
+ access_log /var/log/nginx/jellyfin.access.log;
21
+ error_log /var/log/nginx/jellyfin.error.log;
22
+
23
+ include config-lmm/errors.conf;
24
+ include config-lmm/ssl.conf;
25
+
26
+ location = / {
27
+ return 302 /web/;
28
+ }
29
+
30
+ # Don't expose this publicly
31
+ location = /Startup/ {
32
+ return 401;
33
+ }
34
+
35
+ location / {
36
+ # Proxy main Jellyfin traffic
37
+ proxy_pass http://jellyfin;
38
+
39
+ include config-lmm/proxy.conf;
40
+
41
+ # Disable buffering when the nginx proxy gets very resource heavy upon streaming
42
+ proxy_buffering off;
43
+ }
44
+
45
+ location = /web/ {
46
+ proxy_pass http://jellyfin/web/index.html;
47
+ include config-lmm/proxy.conf;
48
+ }
49
+
50
+ location /socket {
51
+ # Proxy Jellyfin Websockets traffic
52
+ proxy_pass http://jellyfin;
53
+ proxy_set_header Upgrade $http_upgrade;
54
+ proxy_set_header Connection "upgrade";
55
+
56
+ include config-lmm/proxy.conf;
57
+ }
58
+
59
+ }
@@ -0,0 +1,23 @@
1
+
2
+ module ConfigLMM
3
+ module LMM
4
+ class Jellyfin < Framework::NginxApp
5
+
6
+ def actionJellyfinBuild(id, target, state, context, options)
7
+ writeNginxConfig(__dir__, 'Jellyfin', id, target, state, context, options)
8
+ end
9
+
10
+ def actionJellyfinDiff(id, target, activeState, context, options)
11
+ # TODO
12
+ end
13
+
14
+ def actionJellyfinDeploy(id, target, activeState, context, options)
15
+ if !target['Location'] || target['Location'] == '@me'
16
+ deployNginxConfig(id, target, activeState, context, options)
17
+ activeState['Location'] = '@me'
18
+ end
19
+ end
20
+
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,81 @@
1
+
2
+ upstream mastodon {
3
+ server unix:///run/mastodon.sock fail_timeout=0;
4
+ }
5
+
6
+ upstream mastodon-streaming {
7
+ # Instruct nginx to send connections to the server with the least number of connections
8
+ # to ensure load is distributed evenly.
9
+ least_conn;
10
+
11
+ server 127.0.0.1:4000 fail_timeout=0;
12
+ # Uncomment these lines for load-balancing multiple instances of streaming for scaling,
13
+ # this assumes your running the streaming server on ports 4000, 4001, and 4002:
14
+ # server 127.0.0.1:4001 fail_timeout=0;
15
+ # server 127.0.0.1:4002 fail_timeout=0;
16
+ }
17
+
18
+ # proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=CACHE:10m inactive=7d max_size=1g;
19
+
20
+ server {
21
+ <% if !config['TLS'] %>
22
+ listen <%= config['Port'] %>;
23
+ listen [::]:<%= config['Port'] %>;
24
+ <% else %>
25
+ listen <%= config['Port'] %> ssl;
26
+ listen [::]:<%= config['Port'] %> ssl;
27
+ http2 on;
28
+ include config-lmm/ssl.conf;
29
+ <% end %>
30
+
31
+ server_name <%= config['Domain'] %>;
32
+
33
+ access_log /var/log/nginx/mastodon.access.log;
34
+ error_log /var/log/nginx/mastodon.error.log;
35
+
36
+ client_max_body_size 99M;
37
+
38
+ include config-lmm/errors.conf;
39
+
40
+ # proxy_redirect off;
41
+ # proxy_cache CACHE;
42
+ # proxy_cache_valid 200 7d;
43
+ # proxy_cache_valid 410 24h;
44
+ # proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
45
+ # add_header X-Cached $upstream_cache_status;
46
+
47
+ root /var/lib/mastodon/public;
48
+
49
+ location / {
50
+ try_files $uri @mastodon;
51
+ }
52
+
53
+ location @mastodon {
54
+ proxy_pass http://mastodon;
55
+ include config-lmm/proxy.conf;
56
+ }
57
+
58
+ location ~ ^/assets|avatars|emoji|headers|packs|shortcuts|sounds/ {
59
+
60
+ add_header Cache-Control "public, max-age=2419200, must-revalidate";
61
+ add_header Strict-Transport-Security "max-age=63072000; includeSubDomains";
62
+ try_files $uri =404;
63
+ }
64
+
65
+ location ~ ^/system/ {
66
+ add_header Cache-Control "public, max-age=2419200, immutable";
67
+ add_header Strict-Transport-Security "max-age=63072000; includeSubDomains";
68
+ #add_header X-Content-Type-Options nosniff;
69
+ add_header Content-Security-Policy "default-src 'none'; form-action 'none'";
70
+ try_files $uri =404;
71
+ }
72
+
73
+ location ^~ /api/v1/streaming {
74
+
75
+ proxy_buffering off;
76
+ proxy_cache off;
77
+ proxy_pass http://mastodon-streaming;
78
+ include config-lmm/proxy.conf;
79
+ }
80
+
81
+ }