Skip to content

Latest commit

 

History

History
92 lines (69 loc) · 3.33 KB

README.md

File metadata and controls

92 lines (69 loc) · 3.33 KB

sorcerer-flow

Sorcerer

A Slackbot for Deploying microservices to GKE Cluster.

Prerequisites

Optionals(For GKE Cluster)

Usage(Local Environment)

  1. Add .lein-env to root folder(Examples below).
{:sorcerer-slack-token "[SLACK_TOKEN]"
 :sorcerer-github-oauth-token "[GITHUB_OAUTH_TOKEN]"
 :sorcerer-aws-access-key "[AWS_ACCESS_KEY]"
 :sorcerer-aws-secret-key "[AWS_SECRET_KEY]"
 :sorcerer-dynamodb-endpoint "http://localhost:8000"
 :sorcerer-pubsub-subscription-name "sorcerer-cloud-builds-dev"
 :sorcerer-k8s-endpoint "http://localhost:8001"
 :sorcerer-k8s-ingress-name "[YOUR_K8S_INGRESS_NAME]"
 :sorcerer-k8s-namespace "[YOUR_K8S_NAMESPACE]"
 :sorcerer-k8s-domain "[YOUR_DOMAIN_NAME]"
 :sorcerer-dns-zone "[YOUR_CLOUD_DNS_ZONE]"}
  1. lein repl
  2. (go)

Deploy to your GKE cluster

  1. Add Integration with Google Cloud Container Builder to your GitHub repository.
  2. Add Kubernetes Engine IAM role.(quoted from Official Document)
    1. visit IAM menu.
    2. From the list of service accounts, click the Roles drop-down menu beside the Container Builder [YOUR-PROJECT-ID]@cloudbuild.gserviceaccount.com service account.
    3. Click Kubernetes Engine, then click Kubernetes Engine Admin.
    4. Click Save.
apiVersion: v1
kind: Secret
metadata:
  name: sorcerer
type: Opaque
data:
  slack-token: <echo -n "[SLACK_TOKEN]" | base64> # for slack
  github-oauth-token: <echo -n "[GITHUB_OAUTH_TOKEN]" | base64> # for github
  aws-access-key: <echo -n "[AWS_ACCESS_KEY]" | base64> # for dynamodb
  aws-secret-key: <echo -n "[AWS_SECRET_KEY]" | base64> # for dynamodb
  dynamodb-endpoint: <echo -n "http://localhost:8001" | base64> # for dynamodb
  pubsub-subscription-name: <echo -n "sorcerer-cloud-builds" | base64> # for cloud pubsub
  k8s-domain: <echo -n "[YOUR_DOMAIN_NAME]" | base64>
  k8s-ingress-name: <echo -n "[YOUR_K8S_INGRESS_NAME]" | base64>
  dns-zone: <echo -n "[YOUR_CLOUD_DNS_ZONE]" | base64> # for cloud dns
  1. Just git push commits.

Usage

  1. Create your mirror repository from github to Google Source Repository.
  2. Add puppet.edn to repository root folder(Examples below).
;; for more information: https://cloud.google.com/container-builder/docs/build-config#build_steps
{:steps [{:name "gcr.io/cloud-builders/docker"
          :args ["build", "-t", "asia.gcr.io/$PROJECT_ID/sample-app:$COMMIT_SHA", "."]}]
 :images {:sample-app "asia.gcr.io/$PROJECT_ID/sample-app:$COMMIT_SHA"}
 :k8s {:deployment "k8s/deployment.yml"
       :service "k8s/service.yml"}}
  1. Send mention to sorcerer @<your-bot-name> deploy <repository-user-name> <repository-name> <branch-name>

License

Copyright © 2018 boxp

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

Thanks