Skip to content

Instantly share code, notes, and snippets.

View TheMagoo73's full-sized avatar
🦧
Doing Open Source stuff

John Clarke TheMagoo73

🦧
Doing Open Source stuff
View GitHub Profile
@TheMagoo73
TheMagoo73 / terraform create bucket sa sak and IAM.txt
Last active December 19, 2019 14:26
Create a storage bucket, service account, service account key and IAM binding in Terraform
// Create a regional storage bucket
resource "google_storage_bucket" "test_bucket" {
name = "a-test-bucket-for-nothing-special"
location = "europe-west2"
force_destroy = true //so it's easy to clean up, you probably DON'T want this in Prod
}
// Service Account
resource "google_service_account" "test_storage_admin" {
@TheMagoo73
TheMagoo73 / config.yml
Created November 23, 2019 21:51
Example CircleCI for Node module
version: 2.1
jobs:
build:
docker:
- image: circleci/node:10.15
working_directory: ~/repo
steps:
@TheMagoo73
TheMagoo73 / upload_mcu
Last active August 29, 2019 23:11
Cypher operations to load MCU graph from GitHub
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/TheMagoo73/neo4j-mcu/master/people.csv" AS line
CREATE (person:Person {id: toInteger(line.person_id), name: line.name})
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/TheMagoo73/neo4j-mcu/master/movies.csv" AS line
CREATE(movie:Movie {id: toInteger(line.movie_id), name: line.name, budget: toInteger(line.budget)})
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/TheMagoo73/neo4j-mcu/master/directed.csv" AS line
MATCH (person:Person {id: toInteger(line.person_id)}), (movie:Movie {id: toInteger(line.movie_id)})
CREATE (person)-[:Directed]->(movie)
@TheMagoo73
TheMagoo73 / config.yml
Last active August 19, 2019 16:22
React and Docker CircleCI config
version: 2.1
orbs:
docker: circleci/docker@0.5.13
jobs:
run_tests:
working_directory: ~/react-app
docker:
- image: circleci/node:10.16.3
@TheMagoo73
TheMagoo73 / nginx.conf
Created August 19, 2019 14:00
Example nginx conf file for running React apps
# auto detects a good number of processes to run
worker_processes auto;
#Provides the configuration file context in which the directives that affect connection processing are specified.
events {
# Sets the maximum number of simultaneous connections that can be opened by a worker process.
worker_connections 8000;
# Tells the worker to accept multiple connections at a time
multi_accept on;
}
@TheMagoo73
TheMagoo73 / dockerfile
Created August 19, 2019 13:39
Example dockerfile for React and NGINX
FROM node:11.1.0-alpine as build
WORKDIR /app
COPY package*.json /app/
RUN npm install
COPY ./ /app/
@TheMagoo73
TheMagoo73 / .dockerignore
Last active August 19, 2019 13:35
example .dockerignore file
node_modules
.gitignore
build
@TheMagoo73
TheMagoo73 / config.yml
Created August 6, 2019 14:17
CircleCI definition for a Terraform deployment
version: 2
defaults: &defaults
working_directory: ~/repo
docker:
- image: gumshoe/cci-terraform:0.0.1-alpha
environment:
TF_IN_AUTOMATION: true
GOOGLE_APPLICATION_CREDENTIALS: ~/repo/terraform-deploy.json
@TheMagoo73
TheMagoo73 / dockerfile
Created August 6, 2019 14:06
Terraform/CircleCI dockerfile
FROM alpine:3.10
RUN apk update
RUN apk add --no-cache wget openssh git bash tar gzip ca-certificates
RUN rm -rf /var/cache/apk/*
RUN wget --quiet https://releases.hashicorp.com/terraform/0.12.6/terraform_0.12.6_linux_amd64.zip \
&& unzip terraform_0.12.6_linux_amd64.zip \
@TheMagoo73
TheMagoo73 / gke-private-cluster.tf
Created August 6, 2019 13:28
Terraform definition of a GKE private cluster
terraform {
backend "gcs" {
bucket = "tf-state-laaso-cluster"
prefix = "terraform/state"
credentials = "terraform-deploy.json"
}
}
provider "google" {
version = "~> 2.12.0"