]>
Commit | Line | Data |
---|---|---|
8a964143 | 1 | { lib, pkgs, config, myconfig, ... }: |
56eba416 | 2 | let |
ddd3f845 | 3 | env = myconfig.env.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 { | |
1a718805 | 12 | secrets.keys = [{ |
ddd3f845 IB |
13 | dest = "webapps/tools-mediagoblin"; |
14 | user = "mediagoblin"; | |
15 | group = "mediagoblin"; | |
16 | permissions = "0400"; | |
17 | text = '' | |
18 | [DEFAULT] | |
996a68c2 | 19 | data_basedir = "${mcfg.dataDir}" |
ddd3f845 IB |
20 | |
21 | [mediagoblin] | |
22 | direct_remote_path = /mgoblin_static/ | |
23 | email_sender_address = "mediagoblin@tools.immae.eu" | |
24 | ||
25 | #sql_engine = sqlite:///%(data_basedir)s/mediagoblin.db | |
26 | sql_engine = ${env.psql_url} | |
27 | ||
28 | email_debug_mode = false | |
29 | allow_registration = false | |
30 | allow_reporting = true | |
31 | ||
32 | theme = airymodified | |
33 | ||
34 | user_privilege_scheme = "uploader,commenter,reporter" | |
35 | ||
36 | # We need to redefine them here since we override data_basedir | |
37 | # cf /usr/share/webapps/mediagoblin/mediagoblin/config_spec.ini | |
38 | workbench_path = %(data_basedir)s/media/workbench | |
39 | crypto_path = %(data_basedir)s/crypto | |
40 | theme_install_dir = %(data_basedir)s/themes/ | |
41 | theme_linked_assets_dir = %(data_basedir)s/theme_static/ | |
42 | plugin_linked_assets_dir = %(data_basedir)s/plugin_static/ | |
43 | ||
44 | [storage:queuestore] | |
45 | base_dir = %(data_basedir)s/media/queue | |
46 | ||
47 | [storage:publicstore] | |
48 | base_dir = %(data_basedir)s/media/public | |
49 | base_url = /mgoblin_media/ | |
50 | ||
51 | [celery] | |
52 | CELERY_RESULT_DBURI = ${env.redis_url} | |
53 | BROKER_URL = ${env.redis_url} | |
54 | CELERYD_CONCURRENCY = 1 | |
55 | ||
56 | [plugins] | |
57 | [[mediagoblin.plugins.geolocation]] | |
58 | [[mediagoblin.plugins.ldap]] | |
59 | [[[immae.eu]]] | |
60 | LDAP_SERVER_URI = 'ldaps://ldap.immae.eu:636' | |
61 | LDAP_SEARCH_BASE = 'dc=immae,dc=eu' | |
62 | LDAP_BIND_DN = 'cn=mediagoblin,ou=services,dc=immae,dc=eu' | |
63 | LDAP_BIND_PW = '${env.ldap.password}' | |
64 | LDAP_SEARCH_FILTER = '(&(memberOf=cn=users,cn=mediagoblin,ou=services,dc=immae,dc=eu)(uid={username}))' | |
65 | EMAIL_SEARCH_FIELD = 'mail' | |
66 | [[mediagoblin.plugins.basicsearch]] | |
67 | [[mediagoblin.plugins.piwigo]] | |
68 | [[mediagoblin.plugins.processing_info]] | |
69 | [[mediagoblin.media_types.image]] | |
70 | [[mediagoblin.media_types.video]] | |
71 | ''; | |
72 | }]; | |
73 | ||
996a68c2 | 74 | users.users.mediagoblin.extraGroups = [ "keys" ]; |
56eba416 | 75 | |
996a68c2 IB |
76 | services.mediagoblin = { |
77 | enable = true; | |
78 | plugins = builtins.attrValues pkgs.webapps.mediagoblin-plugins; | |
79 | configFile = "/var/secrets/webapps/tools-mediagoblin"; | |
56eba416 | 80 | }; |
17f6eae9 IB |
81 | services.filesWatcher.mediagoblin-web = { |
82 | restart = true; | |
83 | paths = [ mcfg.configFile ]; | |
84 | }; | |
85 | services.filesWatcher.mediagoblin-celeryd = { | |
86 | restart = true; | |
87 | paths = [ mcfg.configFile ]; | |
88 | }; | |
56eba416 | 89 | |
29f8cb85 | 90 | services.websites.env.tools.modules = [ |
a952acc4 | 91 | "proxy" "proxy_http" |
56eba416 IB |
92 | ]; |
93 | users.users.wwwrun.extraGroups = [ "mediagoblin" ]; | |
29f8cb85 | 94 | services.websites.env.tools.vhostConfs.mgoblin = { |
56eba416 | 95 | certName = "eldiron"; |
7df420c2 | 96 | addToCerts = true; |
56eba416 IB |
97 | hosts = ["mgoblin.immae.eu" ]; |
98 | root = null; | |
99 | extraConfig = [ '' | |
996a68c2 IB |
100 | Alias /mgoblin_media ${mcfg.dataDir}/media/public |
101 | <Directory ${mcfg.dataDir}/media/public> | |
56eba416 IB |
102 | Options -Indexes +FollowSymLinks +MultiViews +Includes |
103 | Require all granted | |
104 | </Directory> | |
105 | ||
996a68c2 IB |
106 | Alias /theme_static ${mcfg.dataDir}/theme_static |
107 | <Directory ${mcfg.dataDir}/theme_static> | |
56eba416 IB |
108 | Options -Indexes +FollowSymLinks +MultiViews +Includes |
109 | Require all granted | |
110 | </Directory> | |
111 | ||
996a68c2 IB |
112 | Alias /plugin_static ${mcfg.dataDir}/plugin_static |
113 | <Directory ${mcfg.dataDir}/plugin_static> | |
56eba416 IB |
114 | Options -Indexes +FollowSymLinks +MultiViews +Includes |
115 | Require all granted | |
116 | </Directory> | |
117 | ||
118 | ProxyPreserveHost on | |
119 | ProxyVia On | |
120 | ProxyRequests Off | |
121 | ProxyPass /mgoblin_media ! | |
122 | ProxyPass /theme_static ! | |
123 | ProxyPass /plugin_static ! | |
124 | ProxyPassMatch ^/.well-known/acme-challenge ! | |
658822fb IB |
125 | ProxyPass / unix://${mcfg.sockets.paster}|http://mgoblin.immae.eu/ |
126 | ProxyPassReverse / unix://${mcfg.sockets.paster}|http://mgoblin.immae.eu/ | |
56eba416 IB |
127 | '' ]; |
128 | }; | |
129 | }; | |
130 | } |