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