This guide is for people who deal with software: programmers, sysadmins, etc.
package main | |
import ( | |
"context" | |
"log" | |
"os" | |
worker "github.com/contribsys/faktory_worker_go" | |
) |
#!/usr/bin/env python3 | |
import json | |
import os | |
import subprocess | |
import sys | |
from subprocess import PIPE | |
def bw_status(): | |
result = subprocess.run(['bw', 'status'], env=os.environ, stdout=PIPE, check=True) |
Config attributes (the IP addresses, the names, the values) belong in databases, and git is a bad database.
I like the traditional config management system approach to this. You can start by checking in your infra attributes in git (perhaps in an inventory file), but as you scale, you outgrow this approach and move to querying APIs: from your cloud provider or a config database.
As for secrets, a database is way better for management and security. And yeah, I know you can encrypt and check things into git, but that just moves the ball. Where do you store the encryption keys? You need a centralized solution.
If a git-style interface was a good database for this kind of data, we all would have switched years ago.
Technically, gitops "solves" all these problems, because if (big if here) someone has written a custom controller that does what you need it to do, you can check in a zillion lines of yaml to solve your problem.
apiVersion: batch/v1beta1 | |
kind: CronJob | |
metadata: | |
name: update-checker | |
namespace: apis | |
annotations: | |
fluxcd.io/automated: "true" | |
fluxcd.io/tag.update-checker: glob:sha-* | |
spec: | |
# Every 6 hours |
A runbook is a precise list of steps for doing routine tasks, or debugging a system.
Good candidates for runbooks:
- procedures with a relatively precise begin state and end state
- lists of commands for launching a kubernetes cluster
- lists of commands for tearing down a kubernetes cluster
- links to dashboards for troubleshooting problems with a particular system,
func randomIPFromRange(cidr string) (net.IP, error) { | |
GENERATE: | |
ip, ipnet, err := net.ParseCIDR(cidr) | |
if err != nil { | |
return nil, err | |
} |
abstract class Vpc { | |
static VpcAlias: string; | |
// Static getters require a default implementation, so we provide one | |
// that throws an error. This enforces our subclass overriding. | |
static get PublicSubnets(): string[] { Vpc.unimplemented("PublicSubnets"); return [""] }; | |
static get PrivateSubnets(): string[] { Vpc.unimplemented("PrivateSubnets"); return [""] }; | |
public static get Subnets(): string[] { | |
return [...Vpc.PublicSubnets, ...Vpc.PrivateSubnets]; | |
} |
#!/usr/bin/env -S deno run --allow-read --allow-net --allow-run | |
/* | |
This script prints out a list of VPCs, subnets, and route tables. | |
The output will be different depending on which AWS account you are | |
connected to. | |
*/ | |
const {stdout, copy} = Deno; | |
import iro, { | |
bold, red, dim, yellow, white, blue, cyan, green |
From 8/4/2020, 3:32:06 PM to 8/4/2020, 3:35:28 PM | |
2020-08-04T19:32:06.139381959Z | |
2020-08-04T19:32:06.139431798Z > novelcovid-api@1.0.1 start:scraper /home/container | |
2020-08-04T19:32:06.139436761Z > node serverScraper.js | |
2020-08-04T19:32:06.139439244Z | |
2020-08-04T19:32:06.85437932Z { | |
2020-08-04T19:32:06.854403359Z message: '[2020-08-04T19:32:06.851Z] ERROR: Failed to load environment variables', | |
2020-08-04T19:32:06.854407177Z error: "ENOENT: no such file or directory, open '/home/container/.env'", | |
2020-08-04T19:32:06.854409963Z stack: "Error: ENOENT: no such file or directory, open '/home/container/.env'\n" + | |
2020-08-04T19:32:06.854413012Z ' at Object.openSync (fs.js:465:3)\n' + |