@cryptotaxi247 / infra-1 / commits / 1520ec32

terraform: add index file to nixpkgs-tarballs

copy the one on cache.nixos.org with some adaptations

zimbatm committed Dec 16, 2018 at 14:02 UTC 1520ec322ed217b807cb7f3201d7bfafe16f124d
2 files changed +67 -2
terraform/nixpkgs-tarballs.tf
+10 -2
@@ -1,5 +1,5 @@
1 resource "aws_s3_bucket" "nixpkgs-tarballs" {
2 - bucket = "nixpkgs-tarballs"
2 + bucket = "nixpkgs-tarballs"
3
4 website {
5 index_document = "index.html"
@@ -7,7 +7,7 @@ resource "aws_s3_bucket" "nixpkgs-tarballs" {
7 }
8
9 resource "aws_s3_bucket_policy" "nixpkgs-tarballs" {
10 - bucket = "${aws_s3_bucket.nixpkgs-tarballs.id}"
10 + bucket = "${aws_s3_bucket.nixpkgs-tarballs.id}"
11
12 # imported from existing
13 policy = <<EOF
@@ -15,6 +15,14 @@ resource "aws_s3_bucket_policy" "nixpkgs-tarballs" {
15 EOF
16 }
17
18 +resource "aws_s3_bucket_object" "nixpkgs-tarballs-index" {
19 + bucket = "${aws_s3_bucket.nixpkgs-tarballs.id}"
20 + content_type = "text/html"
21 + etag = "${md5(file("${path.module}/nixpkgs-tarballs/index.html"))}"
22 + key = "index.html"
23 + source = "${path.module}/nixpkgs-tarballs/index.html"
24 +}
25 +
26 resource "aws_cloudfront_distribution" "nixpkgs-tarballs" {
27 enabled = true
28 is_ipv6_enabled = true
terraform/nixpkgs-tarballs/index.html new
+57
@@ -0,0 +1,57 @@
1 +<!DOCTYPE html>
2 +<html lang="en">
3 + <head>
4 + <title>tarballs.nixos.org is up</title>
5 + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6 + <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
7 + <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8 + <link rel="stylesheet" href="https://nixos.org/bootstrap/css/bootstrap.min.css" />
9 + <link rel="stylesheet" href="https://nixos.org/bootstrap/css/bootstrap-responsive.min.css" />
10 + <style>
11 + body {
12 + padding-top: 0;
13 + margin-top: 4em;
14 + margin-bottom: 4em;
15 + }
16 + body > div {
17 + max-width: 800px;
18 + }
19 + p {
20 + text-align: center;
21 + }
22 + .cache {
23 + font-style: italic;
24 + }
25 + </style>
26 + </head>
27 + <body>
28 + <div class="container jumbotron">
29 + <div class="jumbotron">
30 + <p class="lead">
31 + <a href="https://nixos.org/nixos">
32 + <img src="https://nixos.org/logo/nixos-hires.png" width="500px" alt="logo" />
33 + </a>
34 + </p>
35 +
36 + <p class="lead">
37 + <code>https://tarballs.nixos.org/</code> provides
38 + content-addressable binaries for Nixpkgs and NixOS.
39 + Those are mainly used to bootstrap the various stdenv.
40 + </p>
41 + </p>
42 + </div>
43 + <hr />
44 + <div class="help">
45 + <p>
46 + If you are having trouble, please reach out through one of the <a href="https://nixos.org/nixos/support.html">support channels</a>
47 + with the results of <a href="https://gist.github.com/grahamc/df1bb806eb3552650d03eef7036a72ba">this diagnostics script</a>
48 + which will help us figure out where the issue lies.
49 + </p>
50 + <p>
51 + For questions, or support, <a href="https://nixos.org/nixos/support.html">
52 + the support page</a> from the NixOS website describes how to get in touch.
53 + </p>
54 + </div>
55 + </div>
56 + </body>
57 +</html>