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