blob: f276c62f4f5d56644f08dba84f4ee56ba226100b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
{ lib, pkgs, config, mediagoblin, ... }:
let
env = config.myEnv.tools.mediagoblin;
cfg = config.myServices.websites.tools.mediagoblin;
mcfg = config.services.mediagoblin;
in {
options.myServices.websites.tools.mediagoblin = {
enable = lib.mkEnableOption "enable mediagoblin's website";
};
config = lib.mkIf cfg.enable {
myServices.dns.zones."immae.eu".subdomains.mgoblin =
with config.myServices.dns.helpers; ips servers.eldiron.ips.main;
myServices.chatonsProperties.services.mediagoblin = {
file.datetime = "2022-08-21T20:00:00";
service = {
name = "Mediagoblin";
description = "MediaGoblin is a free software media publishing platform that anyone can run";
website = "https://mgoblin.immae.eu/";
logo = "https://mgoblin.immae.eu/mgoblin_static/images/goblin.ico";
status.level = "OK";
status.description = "OK";
registration."" = ["MEMBER" "CLIENT"];
registration.load = "OPEN";
install.type = "PACKAGE";
};
software = {
name = "Mediagoblin";
website = "https://mediagoblin.org/";
license.url = "http://www.gnu.org/licenses/agpl.html";
license.name = "GNU Affero General Public License";
version = mcfg.package.version;
source.url = "https://git.savannah.gnu.org/git/mediagoblin.git";
modules = map (a: a.pluginName) mcfg.package.plugins;
};
};
secrets.keys."webapps/tools-mediagoblin" = {
user = "mediagoblin";
group = "mediagoblin";
permissions = "0400";
text =
let
psql_url = with env.postgresql; "postgresql://${user}:${password}@:${port}/${database}?host=${socket}";
redis_url = with env.redis; "redis+socket://${socket}?virtual_host=${db}";
in
''
[DEFAULT]
data_basedir = "${mcfg.dataDir}"
[mediagoblin]
direct_remote_path = /mgoblin_static/
email_sender_address = "mediagoblin@tools.immae.eu"
#sql_engine = sqlite:///%(data_basedir)s/mediagoblin.db
sql_engine = ${psql_url}
email_debug_mode = false
allow_registration = false
allow_reporting = true
theme = airymodified
user_privilege_scheme = "uploader,commenter,reporter"
# We need to redefine them here since we override data_basedir
# cf /usr/share/webapps/mediagoblin/mediagoblin/config_spec.ini
workbench_path = %(data_basedir)s/media/workbench
crypto_path = %(data_basedir)s/crypto
theme_install_dir = %(data_basedir)s/themes/
theme_linked_assets_dir = %(data_basedir)s/theme_static/
plugin_linked_assets_dir = %(data_basedir)s/plugin_static/
[storage:queuestore]
base_dir = %(data_basedir)s/media/queue
[storage:publicstore]
base_dir = %(data_basedir)s/media/public
base_url = /mgoblin_media/
[celery]
CELERY_RESULT_DBURI = ${redis_url}
BROKER_URL = ${redis_url}
CELERYD_CONCURRENCY = 1
[plugins]
[[mediagoblin.plugins.geolocation]]
[[mediagoblin.plugins.ldap]]
[[[immae.eu]]]
LDAP_SERVER_URI = 'ldaps://${env.ldap.host}:636'
LDAP_SEARCH_BASE = '${env.ldap.base}'
LDAP_BIND_DN = '${env.ldap.dn}'
LDAP_BIND_PW = '${env.ldap.password}'
LDAP_SEARCH_FILTER = '${env.ldap.filter}'
EMAIL_SEARCH_FIELD = 'mail'
[[mediagoblin.plugins.basicsearch]]
[[mediagoblin.plugins.piwigo]]
[[mediagoblin.plugins.processing_info]]
[[mediagoblin.media_types.image]]
[[mediagoblin.media_types.video]]
'';
};
users.users.mediagoblin.extraGroups = [ "keys" ];
services.mediagoblin = {
enable = true;
package = mediagoblin.withPlugins (p: [p.basicsearch]);
configFile = config.secrets.fullPaths."webapps/tools-mediagoblin";
};
services.filesWatcher.mediagoblin-web = {
restart = true;
paths = [ mcfg.configFile ];
};
services.filesWatcher.mediagoblin-celeryd = {
restart = true;
paths = [ mcfg.configFile ];
};
services.websites.env.tools.modules = [
"proxy" "proxy_http"
];
users.users.wwwrun.extraGroups = [ "mediagoblin" ];
security.acme.certs.eldiron.extraDomainNames = [ "mgoblin.immae.eu" ];
services.websites.env.tools.vhostConfs.mgoblin = {
certName = "eldiron";
hosts = ["mgoblin.immae.eu" ];
root = null;
extraConfig = [ ''
Alias /mgoblin_media ${mcfg.dataDir}/media/public
<Directory ${mcfg.dataDir}/media/public>
Options -Indexes +FollowSymLinks +MultiViews +Includes
Require all granted
</Directory>
Alias /theme_static ${mcfg.dataDir}/theme_static
<Directory ${mcfg.dataDir}/theme_static>
Options -Indexes +FollowSymLinks +MultiViews +Includes
Require all granted
</Directory>
Alias /plugin_static ${mcfg.dataDir}/plugin_static
<Directory ${mcfg.dataDir}/plugin_static>
Options -Indexes +FollowSymLinks +MultiViews +Includes
Require all granted
</Directory>
ProxyPreserveHost on
ProxyVia On
ProxyRequests Off
ProxyPass /mgoblin_media !
ProxyPass /theme_static !
ProxyPass /plugin_static !
ProxyPassMatch ^/.well-known/acme-challenge !
ProxyPass / unix://${mcfg.sockets.paster}|http://mgoblin.immae.eu/
ProxyPassReverse / unix://${mcfg.sockets.paster}|http://mgoblin.immae.eu/
'' ];
};
myServices.monitoring.fromMasterActivatedPlugins = [ "http" ];
myServices.monitoring.fromMasterObjects.service = [
{
service_description = "mediagoblin website is running on mgoblin.immae.eu";
host_name = config.hostEnv.fqdn;
use = "external-web-service";
check_command = ["check_https" "mgoblin.immae.eu" "/" "<title>GNU MediaGoblin"];
servicegroups = "webstatus-webapps";
_webstatus_name = "Mediagoblin";
_webstatus_url = "https://mgoblin.immae.eu/";
}
];
};
}
|