A Slackbot for Deploying microservices to GKE Cluster.
- Leiningen(https://leiningen.org/)
- Google Cloud SDK(https://cloud.google.com/sdk/)
- Your GCP Account
- Your AWS Account
- 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]"}
lein repl
(go)
- Add Integration with Google Cloud Container Builder to your GitHub repository.
- Add Kubernetes Engine IAM role.(quoted from Official Document)
- visit IAM menu.
- From the list of service accounts, click the Roles drop-down menu beside the Container Builder [YOUR-PROJECT-ID]@cloudbuild.gserviceaccount.com service account.
- Click Kubernetes Engine, then click Kubernetes Engine Admin.
- 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
- Just
git push
commits.
- Create your mirror repository from github to Google Source Repository.
- 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"}}
- Send mention to sorcerer
@<your-bot-name> deploy <repository-user-name> <repository-name> <branch-name>
Copyright © 2018 boxp
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.