|
173 | 173 | nixosSystem = final.nodelib.specialNixosSystem prev.nixosSystem specialArgs'; |
174 | 174 | }; |
175 | 175 | inherit (specialArgs') dns creds; |
| 176 | + gceProps = { |
| 177 | + region = "australia-southeast1"; |
| 178 | + tags = [ |
| 179 | + "iohk" |
| 180 | + "adrestia" |
| 181 | + ]; |
| 182 | + }; |
176 | 183 | in { |
177 | 184 | nixpkgs = mylib.lib.extendNixpkgs |
178 | 185 | (nixpkgs.lib.composeExtensions self.libOverlay hackNixopsLib) |
|
187 | 194 |
|
188 | 195 | defaults = { |
189 | 196 | deployment.targetEnv = "gce"; |
190 | | - deployment.gce = { |
191 | | - # credentials |
192 | | - inherit (creds.gce) project serviceAccount accessKey; |
193 | | - |
| 197 | + deployment.gce = creds.gce // { |
194 | 198 | # instance properties |
195 | | - region = "australia-southeast1-a"; |
196 | | - |
197 | | - # VPC Firewall rules are controlled by tags. |
198 | | - # gcloud compute --project=iohk-323702 firewall-rules create jitsi-videobridge --description="Allow incoming connections for jitsi-meet calls" --direction=INGRESS --priority=1000 --network=default --action=ALLOW --rules=tcp:4443,udp:10000 --source-ranges=0.0.0.0/0 --target-tags=iohk,adrestia |
199 | | - # gcloud compute --project=iohk-323702 firewall-rules create emacs-crdt --description="Allow incoming connections for crdt.el sessions." --direction=INGRESS --priority=1000 --network=default --action=ALLOW --rules=tcp:6530-6539 --source-ranges=0.0.0.0/0 --target-tags=iohk,adrestia |
200 | | - tags = [ |
201 | | - "iohk" |
202 | | - "adrestia" |
203 | | - ]; |
| 199 | + region = "${gceProps.region}-a"; |
| 200 | + inherit (gceProps) tags; |
| 201 | + # network = resources.gceNetworks.adp-net; |
204 | 202 | }; |
205 | 203 | imports = [ |
206 | 204 | self.nixosModules.gce-serial-console |
207 | 205 | ]; |
208 | 206 | nixpkgs.overlays = [(self: super: (super.prefer-remote-fetch self super))]; |
209 | 207 | }; |
210 | 208 |
|
211 | | - gce-mob-dev = { resources, ... }: { |
| 209 | + gce-adp-web = { resources, ... }: { |
212 | 210 | deployment.gce = { |
| 211 | + machineName = "n-048aa26e7caa11e58b4cda214536e17f-gce-mob-dev"; |
| 212 | + |
213 | 213 | # instance properties |
214 | | - instanceType = "e2-standard-4"; |
| 214 | + instanceType = "e2-small"; |
215 | 215 |
|
216 | 216 | # This should be plenty for the rootfs. |
217 | 217 | # /nix/store is mounted with a separate disk. |
218 | 218 | rootDiskSize = 30; |
219 | 219 |
|
220 | 220 | # VPC Firewall rules are controlled by tags. |
221 | | - # This allows HTTP(s) traffic to reach the instance. |
222 | 221 | tags = [ |
223 | | - "http-server" |
224 | | - "https-server" |
| 222 | + # This allows HTTP(s) traffic to reach the instance. |
| 223 | + "web-server" |
| 224 | + # Allow jitsi videobridge traffic |
| 225 | + # "jitsi-videobridge" |
| 226 | + # Open ports for emacs crdt.el |
| 227 | + "emacs-crdt" |
225 | 228 | ]; |
| 229 | + |
226 | 230 | scheduling.automaticRestart = true; |
227 | 231 | scheduling.onHostMaintenance = "MIGRATE"; |
228 | 232 | }; |
|
247 | 251 | }; |
248 | 252 | }; |
249 | 253 |
|
| 254 | + resources.gceNetworks.adp-net = creds.gce // { |
| 255 | + name = "default"; |
| 256 | + firewall = { |
| 257 | + web-server = { |
| 258 | + targetTags = [ "web-server" ]; |
| 259 | + allowed.tcp = [ 80 443 ]; |
| 260 | + }; |
| 261 | + |
| 262 | + # Allow incoming connections for jitsi-meet calls. |
| 263 | + jitsi-videobridge = { |
| 264 | + targetTags = [ "jitsi-videobridge" ]; |
| 265 | + allowed.tcp = [ 4443 ]; |
| 266 | + allowed.udp = [ 10000 ]; |
| 267 | + # gcloud compute --project=iohk-323702 firewall-rules create jitsi-videobridge --description="Allow incoming connections for jitsi-meet calls" --direction=INGRESS --priority=1000 --network=default --action=ALLOW --rules=tcp:4443,udp:10000 --source-ranges=0.0.0.0/0 --target-tags=iohk,adrestia |
| 268 | + }; |
| 269 | + # Allow incoming connections for crdt.el sessions. |
| 270 | + emacs-crdt = { |
| 271 | + # gcloud compute --project=iohk-323702 firewall-rules create emacs-crdt --description="Allow incoming connections for crdt.el sessions." --direction=INGRESS --priority=1000 --network=default --action=ALLOW --rules=tcp:6530-6539 --source-ranges=0.0.0.0/0 --target-tags=iohk,adrestia |
| 272 | + targetTags = [ "emacs-crdt" ]; |
| 273 | + allowed.tcp = [ "6530-6539" ]; |
| 274 | + }; |
| 275 | + }; |
| 276 | + }; |
| 277 | + resources.gceStaticIPs = { |
| 278 | + adp-web-ip = { resources, lib, ... }: creds.gce // { |
| 279 | + inherit (resources.machines.gce-mob-dev.deployment.gce) labels; |
| 280 | + inherit (gceProps) region; |
| 281 | + |
| 282 | + # name = "${namespace.machineName}-ip"; |
| 283 | + name = "adp-web"; |
| 284 | + ipAddress = "34.151.90.232"; |
| 285 | + publicIPv4 = resources.gceStaticIPs.adp-web-ip.ipAddress; |
| 286 | + }; |
| 287 | + }; |
| 288 | + |
250 | 289 | resources.route53HostedZones.${dns.zone} = { |
251 | 290 | name = "${dns.zone}."; |
252 | 291 | comment = "Adrestia dev hosted zone"; |
|
259 | 298 | ttl = 60; |
260 | 299 | # fixme: how to get config.networking.publicIPv4 from nixops-gcp? |
261 | 300 | # recordValues = [ resources.machines.gce-mob-dev.publicIpv4 ]; |
262 | | - recordValues = [ dns.ipv4.gce-mob-dev ]; |
| 301 | + # like this? |
| 302 | + recordValues = [ resources.gceStaticIPs.adp-web-ip.publicIPv4 ]; |
263 | 303 | inherit recordType domainName; |
264 | 304 | inherit (creds.aws) accessKeyId; |
265 | 305 | }; |
|
0 commit comments