Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/infra
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 8fa317820101
Choose a base ref
...
head repository: NixOS/infra
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: fe44b523c741
Choose a head ref
  • 8 commits
  • 7 files changed
  • 3 contributors

Commits on Nov 19, 2018

  1. terraform: use less plugins

    be more specific with the plugins that we use, avoid downloading 300MiB
    of plugins
    zimbatm committed Nov 19, 2018

    Verified

    This commit was signed with the committer’s verified signature.
    zimbatm Jonas Chevalier
    Copy the full SHA
    f84dfcf View commit details
  2. terraform: run terraform fmt

    zimbatm committed Nov 19, 2018

    Verified

    This commit was signed with the committer’s verified signature.
    zimbatm Jonas Chevalier
    Copy the full SHA
    8b86fce View commit details
  3. Merge pull request #62 from NixOS/tf-cleanup

    Terraform cleanup
    edolstra authored Nov 19, 2018

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    05be36e View commit details
  4. Verified

    This commit was signed with the committer’s verified signature.
    zimbatm Jonas Chevalier
    Copy the full SHA
    f6c8d5d View commit details
  5. Verified

    This commit was signed with the committer’s verified signature.
    zimbatm Jonas Chevalier
    Copy the full SHA
    dcf91b3 View commit details

Commits on Nov 20, 2018

  1. Merge pull request #63 from zimbatm/documment-tf-workflow

    document the terraform workflow
    rbvermaa authored Nov 20, 2018

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    944163d View commit details
  2. Merge pull request #64 from zimbatm/init-readme

    README: add file with basic structure
    rbvermaa authored Nov 20, 2018

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    85b594b View commit details
  3. Copy the full SHA
    fe44b52 View commit details
Showing with 87 additions and 35 deletions.
  1. +37 −0 README.md
  2. +10 −0 terraform/README.md
  3. +12 −11 terraform/cache.tf
  4. +13 −15 terraform/nixpkgs-tarballs.tf
  5. +1 −1 terraform/providers.tf
  6. +10 −7 terraform/releases.tf
  7. +4 −1 terraform/shell.nix
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# nixos.org hardware configuration

This repository contains all the hardware configuration for the nixos project
infrastructure.

Amongs other things it contains configuration for:

* nixos.org
* cache.nixos.org
* hydra.nixos.org and all the build machines
* releases.nixos.org
* tarballs.nixos.org

Most of the infrastructure is currently managed using NixOps. Some if it is
managed using Terraform.

## Team

This is currently the list of people part of the @NixOS/nixos-infra team:

* @AmineChikhaoui
* @edolstra
* @grahamc
* @rbvermaa
* @zimbatm

The responsability of the team is to provide infrastructure for the Nix and
NixOS community.

All the members should be watching this repository for changes.

## Reporting issues

If you experience any issues with the infrastructure, please [post a new issue
to this repository][1].

[1]: https://github.com/NixOS/nixos-org-configurations/issues/new
10 changes: 10 additions & 0 deletions terraform/README.md
Original file line number Diff line number Diff line change
@@ -20,3 +20,13 @@ Then run the following command to diff the changes and then apply if approved:
nix-shell --run "terraform apply"
```

## Terraform workflow

Write the Terraform code and test the changes using `terraform validate`.

Before committing run `terraform fmt`.

Once the code is ready to be deployed, create a new PR with the attached
output of `terraform plan`.

Once the PR is merged, run `terraform apply` to apply the changes.
23 changes: 12 additions & 11 deletions terraform/cache.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
resource "aws_cloudfront_distribution" "cache" {
enabled = true
is_ipv6_enabled = true
price_class = "PriceClass_All"
aliases = ["cache.nixos.org"]
enabled = true
is_ipv6_enabled = true
price_class = "PriceClass_All"
aliases = ["cache.nixos.org"]

origin {
origin_id = "S3-nix-cache"
domain_name = "nix-cache.s3.amazonaws.com"

s3_origin_config {
origin_access_identity = "origin-access-identity/cloudfront/E11I84008FX6W9"
}
@@ -32,8 +33,8 @@ resource "aws_cloudfront_distribution" "cache" {

viewer_certificate {
cloudfront_default_certificate = true
acm_certificate_arn = "${aws_acm_certificate.cache.arn}"
ssl_support_method = "sni-only"
acm_certificate_arn = "${aws_acm_certificate.cache.arn}"
ssl_support_method = "sni-only"
}

restrictions {
@@ -47,22 +48,22 @@ resource "aws_cloudfront_distribution" "cache" {
}

custom_error_response {
error_code = 403
response_page_path = "/error-pages/404"
response_code = 404
error_code = 403
response_page_path = "/error-pages/404"
response_code = 404
error_caching_min_ttl = 600
}

custom_error_response {
error_code = 500
error_code = 500
error_caching_min_ttl = 10
}

default_root_object = "index.html"
}

resource "aws_acm_certificate" "cache" {
provider = "aws.us"
provider = "aws.us"
domain_name = "cache.nixos.org"
validation_method = "DNS"

28 changes: 13 additions & 15 deletions terraform/nixpkgs-tarballs.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
resource "aws_cloudfront_distribution" "nixpkgs-tarballs" {
enabled = true
is_ipv6_enabled = true
price_class = "PriceClass_All"
aliases = ["tarballs.nixos.org"]
enabled = true
is_ipv6_enabled = true
price_class = "PriceClass_All"
aliases = ["tarballs.nixos.org"]

# Urgh, can't use an S3 origin because it's configured as a website
# (to serve HTTP redirects).
@@ -19,14 +19,14 @@ resource "aws_cloudfront_distribution" "nixpkgs-tarballs" {
origin {
origin_id = "default"
domain_name = "nixpkgs-tarballs.s3-website-eu-west-1.amazonaws.com"

custom_origin_config {
http_port = 80
https_port = 443
http_port = 80
https_port = 443
origin_protocol_policy = "http-only"
origin_ssl_protocols = ["TLSv1.2"]
origin_ssl_protocols = ["TLSv1.2"]
}
}

default_cache_behavior {
allowed_methods = ["HEAD", "GET"]
cached_methods = ["HEAD", "GET"]
@@ -44,26 +44,23 @@ resource "aws_cloudfront_distribution" "nixpkgs-tarballs" {
}
}
}

viewer_certificate {
cloudfront_default_certificate = true
acm_certificate_arn = "${aws_acm_certificate.nixpkgs-tarballs.arn}"
ssl_support_method = "sni-only"
acm_certificate_arn = "${aws_acm_certificate.nixpkgs-tarballs.arn}"
ssl_support_method = "sni-only"
}

restrictions {
geo_restriction {
restriction_type = "none"
}
}

logging_config {
bucket = "nix-cache-logs.s3.amazonaws.com"
}
}

resource "aws_acm_certificate" "nixpkgs-tarballs" {
provider = "aws.us"
provider = "aws.us"
domain_name = "tarballs.nixos.org"
validation_method = "DNS"

@@ -76,4 +73,5 @@ resource "aws_acm_certificate" "nixpkgs-tarballs" {
resource "aws_cloudfront_origin_access_identity" "nixpkgs-tarballs" {
comment = "Cloudfront identity for nixpkgs-tarballs"
}
*/
*/

2 changes: 1 addition & 1 deletion terraform/providers.tf
Original file line number Diff line number Diff line change
@@ -3,6 +3,6 @@ provider "aws" {
}

provider "aws" {
alias = "us"
alias = "us"
region = "us-east-1"
}
17 changes: 10 additions & 7 deletions terraform/releases.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
resource "aws_cloudfront_distribution" "releases" {
enabled = true
is_ipv6_enabled = true
price_class = "PriceClass_All"
aliases = ["releases.nixos.org"]
enabled = true
is_ipv6_enabled = true
price_class = "PriceClass_All"
aliases = ["releases.nixos.org"]

origin {
origin_id = "default"
domain_name = "nix-releases.s3.amazonaws.com"

s3_origin_config {
origin_access_identity = ""

#origin_access_identity = "${aws_cloudfront_origin_access_identity.releases.cloudfront_access_identity_path}"
}
}
@@ -33,8 +35,8 @@ resource "aws_cloudfront_distribution" "releases" {

viewer_certificate {
cloudfront_default_certificate = true
acm_certificate_arn = "${aws_acm_certificate.releases.arn}"
ssl_support_method = "sni-only"
acm_certificate_arn = "${aws_acm_certificate.releases.arn}"
ssl_support_method = "sni-only"
}

restrictions {
@@ -49,7 +51,7 @@ resource "aws_cloudfront_distribution" "releases" {
}

resource "aws_acm_certificate" "releases" {
provider = "aws.us"
provider = "aws.us"
domain_name = "releases.nixos.org"
validation_method = "DNS"

@@ -63,3 +65,4 @@ resource "aws_cloudfront_origin_access_identity" "releases" {
comment = "Cloudfront identity for releases"
}
*/

5 changes: 4 additions & 1 deletion terraform/shell.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
with import <nixpkgs> {};
let
my-terraform = terraform.withPlugins (p: with p; [ aws ]);
in
mkShell {
buildInputs = [ terraform-full ];
buildInputs = [ my-terraform ];
}