Skip to content

Commit

Permalink
Create subrepo README files
Browse files Browse the repository at this point in the history
  • Loading branch information
hellais committed Mar 15, 2024
1 parent 64d04fc commit 705c200
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 52 deletions.
25 changes: 25 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
DOCS_ROOT=dist/docs/
REPO_NAME="ooni/backend"
COMMIT_HASH=$(git rev-parse --short HEAD)

mkdir -p $DOCS_ROOT

strip_title() {
# Since the title is already present in the frontmatter, we need to remove
# it to avoid duplicate titles
local infile="$1"
cat $infile | awk 'BEGIN{p=1} /^#/{if(p){p=0; next}} {print}'
}

cat <<EOF>$DOCS_ROOT/00-index.md
---
# Do not edit! This file is automatically generated
# to edit go to: https://github.com/$REPO_NAME/edit/master/README.md
# version: $REPO_NAME:$COMMIT_HASH
title: My Documentation Title
description: My Documentation Description
slug: mydocs
---
EOF
strip_title README.md >> $DOCS_ROOT/00-index.md
52 changes: 0 additions & 52 deletions Readme.md

This file was deleted.

3 changes: 3 additions & 0 deletions ansible/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Quickstart

- Install [ansible](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html)
25 changes: 25 additions & 0 deletions scripts/build-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
DOCS_ROOT=dist/docs/
REPO_NAME="ooni/devops"
COMMIT_HASH=$(git rev-parse --short HEAD)

mkdir -p $DOCS_ROOT

strip_title() {
# Since the title is already present in the frontmatter, we need to remove
# it to avoid duplicate titles
local infile="$1"
cat $infile | awk 'BEGIN{p=1} /^#/{if(p){p=0; next}} {print}'
}

cat <<EOF>$DOCS_ROOT/00-index.md
---
# Do not edit! This file is automatically generated
# to edit go to: https://github.com/$REPO_NAME/edit/master/README.md
# version: $REPO_NAME:$COMMIT_HASH
title: OONI Devops
description: OONI Devops
slug: devops
---
EOF
strip_title README.md >> $DOCS_ROOT/00-index.md
35 changes: 35 additions & 0 deletions tf/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Terraform

Terraform is used for managing the OONI infrastructure as code.

## Quickstart

1. Install [terraform](https://developer.hashicorp.com/terraform/install)
2. Setup AWS credentials by making your ~/.aws/credentials look like this:

```
[oonidevops_user]
aws_access_key_id = XXXX
aws_secret_access_key = YYYY
role_arn = arn:aws:iam::OONI_ORG_ID:role/oonidevops
```

Where you replace OONI_ORG_ID with the ID of the ORG you are deploying to (dev,
test or prod).

3. Run `terrafrom plan` to check the plan
4. Run `terraform apply` to apply the plan

Once you have applied a plan the changes to the terraform config should be
pushed to the `main` branch immediately so that we minimize the change of other
people applying stale configurations.

### Notes

https://www.terraform-best-practices.com/naming

Sometimes it's useful to specify a target like this:

```
terraform apply -target=module.ooniapi_frontend.aws_lb_listener_rule.oonidataapi_rule
```

0 comments on commit 705c200

Please sign in to comment.