Skip to content
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.

Commit

Permalink
Add scaffolding (#56)
Browse files Browse the repository at this point in the history
* Add scaffolding

* add templates

* add github action to build arch

* rename image

* rename

* add screenshot

* add screenshot
  • Loading branch information
osterman authored Jun 14, 2020
1 parent f6637e2 commit e9d6d93
Show file tree
Hide file tree
Showing 17 changed files with 404 additions and 3 deletions.
17 changes: 17 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.git
.gitignore
.editorconfig

# Compiled files
**/.terraform/*
**/.terragrunt-cache/*
*.tfstate
*.tfstate.*

# Module directory
.terraform
**/.idea
**/*.iml

**/.build-harness
**/build-harness
14 changes: 14 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Use this file to define individuals or teams that are responsible for code in a repository.
# Read more: <https://help.github.com/articles/about-codeowners/>
#
# Order is important: the last matching pattern takes the most precedence

# These owners will be the default owners for everything
* @cloudposse/engineering @cloudposse/contributors

# Cloud Posse must review any changes to Makefiles
**/Makefile @cloudposse/engineering
**/Makefile.* @cloudposse/engineering

# Cloud Posse must review any changes to GitHub actions
.github/* @cloudposse/engineering
37 changes: 37 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: 'bug'
assignees: ''

---

Found a bug? Maybe our [Slack Community](https://slack.cloudposse.com) can help.

[![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com)

## Describe the Bug
A clear and concise description of what the bug is.

## Expected Behavior
A clear and concise description of what you expected to happen.

## Steps to Reproduce
Steps to reproduce the behavior:
1. Go to '...'
2. Run '....'
3. Enter '....'
4. See error

## Screenshots
If applicable, add screenshots or logs to help explain your problem.

## Environment (please complete the following information):

Anything that will help us triage the bug will help. Here are some ideas:
- OS: [e.g. Linux, OSX, WSL, etc]
- Version [e.g. 10.15]

## Additional Context
Add any other context about the problem here.
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
blank_issues_enabled: false

contact_links:

- name: Community Slack Team
url: https://cloudposse.com/slack/
about: |-
Please ask and answer questions here.
- name: Office Hours
url: https://cloudposse.com/office-hours/
about: |-
Join us every Wednesday for FREE Office Hours (lunch & learn).
- name: DevOps Accelerator Program
url: https://cloudposse.com/accelerate/
about: |-
Own your infrastructure in record time. We build it. You drive it.
36 changes: 36 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: Feature Request
about: Suggest an idea for this project
title: ''
labels: 'feature request'
assignees: ''

---

Have a question? Please checkout our [Slack Community](https://slack.cloudposse.com) or visit our [Slack Archive](https://archive.sweetops.com/).

[![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com)

## Describe the Feature

A clear and concise description of what the bug is.

## Expected Behavior

A clear and concise description of what you expected to happen.

## Use Case

Is your feature request related to a problem/challenge you are trying to solve? Please provide some additional context of why this feature or capability will be valuable.

## Describe Ideal Solution

A clear and concise description of what you want to happen. If you don't know, that's okay.

## Alternatives Considered

Explain what alternative solutions or features you've considered.

## Additional Context

Add any other context or screenshots about the feature request here.
Empty file.
13 changes: 13 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## what
* Describe high-level what changed as a result of these commits (i.e. in plain-english, what do these changes mean?)
* Use bullet points to be concise and to the point.

## why
* Provide the justifications for the changes (e.g. business case).
* Describe why these changes were made (e.g. why do these commits fix the problem?)
* Use bullet points to be concise and to the point.

## references
* Link to any supporting github issues or helpful documentation to add some context (e.g. stackoverflow).
* Use `closes #123`, if this PR closes a GitHub issue `#123`

23 changes: 23 additions & 0 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: docker
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]

jobs:
update:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v1
- name: docker/build-and-push
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: ${{ github.repository }}
registry: registry-1.docker.io
tag_with_ref: true
tag_with_sha: true
49 changes: 49 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
FROM cloudposse/geodesic:0.132.1

# Geodesic message of the Day
ENV MOTD_URL="https://geodesic.sh/motd"

# Some configuration options for Geodesic
ENV AWS_SAML2AWS_ENABLED=true
ENV AWS_VAULT_ENABLED=false
ENV GEODESIC_TERRAFORM_WORKSPACE_PROMPT_ENABLED=true
ENV DIRENV_ENABLED=false

ENV DOCKER_IMAGE="cloudposse/reference-architectures"
ENV DOCKER_TAG="latest"
ENV NAMESPACE="eg"

# Geodesic banner message
ENV BANNER="sweet ops"

# Pin kubectl to version 1.15
RUN apk add kubectl-1.15@cloudposse

# Install terraform
RUN apk add terraform@cloudposse

# Install helmfile
RUN apk add helmfile@cloudposse

# Install saml2aws
# https://github.com/Versent/saml2aws#linux
RUN apk add saml2aws@cloudposse

# Install assume-role
RUN apk add assume-role@cloudposse

# Install variant2 overwriting variant
RUN apk add variant2@cloudposse

# Install the "docker" command to interact with the host's Docker daemon
RUN apk add -u docker-cli

# Limit Makefile searches set up by Geodesic
# Allow a single Makefile to serve all child directories
ENV MAKE_INCLUDES="Makefile.settings ../Makefile.parent Makefile"

COPY rootfs/ /

COPY projects/ /projects/

WORKDIR /projects/
37 changes: 34 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,38 @@
# Import the cloudposse/build-harness
include $(shell curl -sSL -o .build-harness "https://git.io/build-harness"; echo .build-harness)
-include tasks/Makefile.*
export DOCKER_ORG ?= cloudposse
export DOCKER_IMAGE ?= $(DOCKER_ORG)/reference-architectures
export DOCKER_TAG ?= latest
export DOCKER_IMAGE_NAME ?= $(DOCKER_IMAGE):$(DOCKER_TAG)
export APP_NAME ?= geodesic.sh
GEODESIC_INSTALL_PATH ?= /usr/local/bin
export INSTALL_PATH ?= $(GEODESIC_INSTALL_PATH)
export SCRIPT = $(INSTALL_PATH)/$(APP_NAME)

# The target called when calling `make` with no arguments
export DEFAULT_HELP_TARGET = help/short

# Import the cloudposse/build-harness
-include $(shell curl -sSL -o .build-harness "https://git.io/build-harness"; echo .build-harness)

## Initialize build-harness, install deps, build docker container, install wrapper script and run shell
all: init deps build install run
@exit 0

## Install dependencies (if any)
deps:
@exit 0

## Build docker image
build:
@make --no-print-directory docker/build

## Push docker image to registry
push:
docker push $(DOCKER_IMAGE)

## Install wrapper script from geodesic container
install:
@docker run --rm $(DOCKER_IMAGE_NAME) | bash -s $(DOCKER_TAG) || (echo "Try: sudo make install"; exit 1)

## Start the geodesic shell by calling wrapper script
run:
$(SCRIPT)
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ It's 100% Open Source and licensed under the [APACHE2](LICENSE).



## Screenshots


![demo](docs/screenshot.png)
*Example of using the `geodesic` shell as a build a docker image built from the `cloudposse/reference-architectures`*


## Introduction

Expand Down
6 changes: 6 additions & 0 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ introduction: |-
The master account owns the top-level DNS zone and then delegates NS authority to each member account.
# Screenshots
screenshots:
- name: "demo"
description: "Example of using the `geodesic` shell as a build a docker image built from the `cloudposse/reference-architectures`"
url: "docs/screenshot.png"

quickstart: |-
### Assumptions
Expand Down
Binary file added docs/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
70 changes: 70 additions & 0 deletions projects/Makefile.parent
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
init: .terraform/terraform.tfstate

workspace/% %.workspace: conf/%.tfvars .terraform/terraform.tfstate
@terraform workspace select $* || terraform workspace new $*

plan:
@if [[ -n $${WORKSPACE:=$$(cat .terraform/environment 2>/dev/null)} ]]; then \
echo terraform plan -var-file conf/$${WORKSPACE}.tfvars -out $${WORKSPACE}.planfile; \
terraform plan -var-file conf/$${WORKSPACE}.tfvars -out $${WORKSPACE}.planfile; \
else \
echo You must first select a workspace with "'make workspace/...'" >&2; exit 4; \
fi

apply:
@if [[ -n $${WORKSPACE:=$$(cat .terraform/environment 2>/dev/null)} ]]; then \
if [[ -s $${WORKSPACE}.planfile ]]; then \
echo terraform apply $${WORKSPACE}.planfile; \
terraform apply $${WORKSPACE}.planfile && rm $${WORKSPACE}.planfile; \
else \
echo "You must first 'make plan'" >&2; exit 3; \
fi; \
else \
echo You must first select a workspace with "'make workspace/...'" >&2; exit 4; \
fi

clean:
rm -rf .terraform *.planfile

# refresh the terraform state & outputs
refresh:
@if [[ -n $${WORKSPACE:=$$(cat .terraform/environment 2>/dev/null)} ]]; then \
echo terraform refresh -var-file conf/$${WORKSPACE}.tfvars; \
terraform refresh -var-file conf/$${WORKSPACE}.tfvars; \
else \
echo You must first select a workspace with "'make workspace/...'" >&2; exit 4; \
fi

.terraform/terraform.tfstate:
terraform init

## make <wsp>.plan will always run "terraform plan" to create a planfile for workspace "<wsp>"
## make <wsp>.planfile will run "terraform plan" to create a planfile for workspace "<wsp>" if it is
## out of date with respect to source files
%.plan %.planfile: conf/%.tfvars *.tf workspace/%
terraform plan -var-file conf/$*.tfvars -out $*.planfile

## make <wsp>.apply will run "terraform apply" using an existing "<wsp>.planfile" file for workspace "<wsp>"
%.apply: workspace/%
@if [[ -s $*.planfile ]]; then \
echo terraform apply $*.planfile; \
terraform apply $*.planfile && rm $*.planfile; \
else \
echo "You must first 'make $*.planfile'" >&2; exit 3; \
fi; \

## make <wsp>.sync will run "terraform plan" then "terraform apply" for workspace "<wsp>"
%.sync: conf/%.tfvars workspace/% %.planfile
terraform apply $*.planfile && rm $*.planfile

# refresh the terraform state & outputs
%.refresh: workspace/%
terraform refresh -var-file conf/$*.tfvars

# output the terraform state outputs
%.output: workspace/%
@ terraform output

.PHONY: init plan apply clean sync refresh output

.SECONDARY:
Loading

0 comments on commit e9d6d93

Please sign in to comment.