@cryptotaxi247 / infra / commits / e5911d14

Move TWiki into a container

Eelco Dolstra committed Oct 3, 2017 at 19:00 UTC e5911d14c64de18f90ccbaebeeebb50971c21520
2 files changed +106 -63
delft/delft-webserver.nix
+26 -63
@@ -4,22 +4,21 @@ with pkgs.lib;
4
5 let
6
7 - strategoxtVHostConfig =
8 - { hostName = "strategoxt.org";
9 - servedFiles = [
10 - { urlPath = "/freenode.ver";
11 - file = "/data/pt-wiki/pub/freenode.ver";
12 - }
13 - ];
14 - extraSubservices = [
15 - { function = import /etc/nixos/services/twiki;
16 - startWeb = "Stratego/WebHome";
17 - dataDir = "/data/pt-wiki/data";
18 - pubDir = "/data/pt-wiki/pub";
19 - twikiName = "Stratego/XT Wiki";
20 - registrationDomain = "ewi.tudelft.nl";
21 - }
22 - ];
7 + twikiIP = "10.233.1.2";
8 +
9 + proxyConfig = hostName:
10 + { inherit hostName;
11 + extraConfig =
12 + ''
13 + <Proxy *>
14 + Order deny,allow
15 + Allow from all
16 + </Proxy>
17 +
18 + ProxyRequests Off
19 + ProxyPreserveHost On
20 + ProxyPass / http://${twikiIP}/ retry=5 disablereuse=on
21 + '';
22 };
23
24 strategoxtSSLConfig =
@@ -40,7 +39,7 @@ in
39 httpd = {
40 enable = true;
41 logPerVirtualHost = true;
43 - adminAddr = "e.dolstra@tudelft.nl";
42 + adminAddr = "edolstra@gmail.com";
43 hostName = "localhost";
44
45 extraModules = [ "deflate" ];
@@ -114,72 +113,36 @@ in
113 ];
114 }
115
117 - strategoxtVHostConfig
116 + (proxyConfig "strategoxt.org")
117 +
118 + (proxyConfig "strategoxt.org" // strategoxtSSLConfig)
119
119 - (strategoxtVHostConfig // strategoxtSSLConfig)
120 + (proxyConfig "program-transformation.org")
121 +
122 + (proxyConfig "syntax-definition.org")
123
124 { hostName = "www.strategoxt.org";
125 serverAliases = ["www.stratego-language.org"];
126 globalRedirect = "http://strategoxt.org/";
127 }
128
126 - { hostName = "svn.strategoxt.org";
127 - globalRedirect = "https://svn.strategoxt.org/";
129 + { hostName = "www.program-transformation.org";
130 + globalRedirect = "http://program-transformation.org/";
131 }
132
130 - ( strategoxtSSLConfig //
133 { hostName = "svn.strategoxt.org";
132 - extraSubservices = [
133 - /*
134 - { function = import /etc/nixos/services/subversion;
135 - id = "strategoxt";
136 - urlPrefix = "";
137 - dataDir = "/data/subversion-strategoxt";
138 - notificationSender = "svn@svn.strategoxt.org";
139 - organisation = {
140 - name = "Stratego/XT";
141 - url = http://strategoxt.org/;
142 - logo = http://strategoxt.org/pub/Stratego/StrategoLogo/StrategoLogoTextlessWhite-100px.png;
143 - };
144 - }
145 - */
146 - ];
147 - })
148 -
149 - { hostName = "program-transformation.org";
150 - serverAliases = ["www.program-transformation.org"];
151 - extraSubservices = [
152 - { function = import /etc/nixos/services/twiki;
153 - startWeb = "Transform/WebHome";
154 - dataDir = "/data/pt-wiki/data";
155 - pubDir = "/data/pt-wiki/pub";
156 - twikiName = "Program Transformation Wiki";
157 - registrationDomain = "ewi.tudelft.nl";
158 - }
159 - ];
134 + globalRedirect = "https://svn.strategoxt.org/";
135 }
136
137 { hostName = "releases.strategoxt.org";
138 documentRoot = "/data/webserver/dist/strategoxt2";
139 }
140
166 - { hostName = "syntax-definition.org";
167 - serverAliases = ["www.syntax-definition.org"];
168 - extraSubservices = [
169 - { function = import /etc/nixos/services/twiki;
170 - startWeb = "Sdf/WebHome";
171 - dataDir = "/data/pt-wiki/data";
172 - pubDir = "/data/pt-wiki/pub";
173 - twikiName = "Syntax Definition Wiki";
174 - registrationDomain = "ewi.tudelft.nl";
175 - }
176 - ];
177 - }
178 -
141 { hostName = "planet.strategoxt.org";
142 serverAliases = ["planet.stratego.org"];
143 documentRoot = "/home/karltk/public_html/planet";
144 }
145 +
146 ];
147 };
148
delft/twiki.nix new
+80
@@ -0,0 +1,80 @@
1 +/* Configuration for the NixOS container that runs strategoxt.org,
2 + program-transformation.org and syntax-definition.org. TWiki
3 + requires an old version of Nixpkgs, so we put it into a container.
4 +
5 + The TWiki data lives in /data/pt-wiki in the container, which
6 + itself resides in /var/lib/containers/twiki.
7 +
8 + To rebuild the container (from wendy):
9 +
10 + $ NIX_PATH=nixpkgs=channel:nixos-17.03 nixos-container update twiki --config-file /etc/nixos/nixos-org-configurations/delft/twiki.nix
11 +
12 + To login to the container:
13 +
14 + $ nixos-container root-login twiki
15 +
16 +*/
17 +
18 +{ config, pkgs, ... }:
19 +
20 +{
21 +
22 + networking.firewall.allowedTCPPorts = [ 80 ];
23 +
24 + services = {
25 +
26 + httpd = {
27 + enable = true;
28 + adminAddr = "edolstra@gmail.com";
29 + hostName = "localhost";
30 +
31 + virtualHosts = [
32 +
33 + { hostName = "strategoxt.org";
34 + servedFiles = [
35 + { urlPath = "/freenode.ver";
36 + file = "/data/pt-wiki/pub/freenode.ver";
37 + }
38 + ];
39 + extraSubservices = [
40 + { function = import /etc/nixos/services/twiki;
41 + startWeb = "Stratego/WebHome";
42 + dataDir = "/data/pt-wiki/data";
43 + pubDir = "/data/pt-wiki/pub";
44 + twikiName = "Stratego/XT Wiki";
45 + registrationDomain = "ewi.tudelft.nl";
46 + }
47 + ];
48 + }
49 +
50 + { hostName = "program-transformation.org";
51 + extraSubservices = [
52 + { function = import /etc/nixos/services/twiki;
53 + startWeb = "Transform/WebHome";
54 + dataDir = "/data/pt-wiki/data";
55 + pubDir = "/data/pt-wiki/pub";
56 + twikiName = "Program Transformation Wiki";
57 + registrationDomain = "ewi.tudelft.nl";
58 + }
59 + ];
60 + }
61 +
62 + { hostName = "syntax-definition.org";
63 + extraSubservices = [
64 + { function = import /etc/nixos/services/twiki;
65 + startWeb = "Sdf/WebHome";
66 + dataDir = "/data/pt-wiki/data";
67 + pubDir = "/data/pt-wiki/pub";
68 + twikiName = "Syntax Definition Wiki";
69 + registrationDomain = "ewi.tudelft.nl";
70 + }
71 + ];
72 + }
73 +
74 + ];
75 +
76 + };
77 +
78 + };
79 +
80 +}
\ No newline at end of file