-
Notifications
You must be signed in to change notification settings - Fork 1
Setting up dev environment
Before you continue with the installation process you should be aware of a few prerequisites.
- Must have go installed properly
- Must be on macOS or Linux (Sorry Windows)
You must follow the entire installation process. If you have any questions feel free to jump in the Gophr slack and ask for help from @shikkic or @skeswa.
Before we begin installing all of our dependencies we'll want to clone the repo down.
$ git clone git@github.com:skeswa/gophr.git
Our environment is based around kubernetes in both production and dev. So there are a few dependencies you will need before continuing.
This provides us with the kubectl
binary that our dev environment will use to manage pod replication and cycling in our Kubernetes cluster.
Download kubectl from the Kubernetes release artifact site with the curl tool.
$ curl -O https://storage.googleapis.com/kubernetes-release/release/v1.3.4/bin/linux/amd64/kubectl
On an OS X workstation, replace linux in the URL above with darwin:
$ curl -O https://storage.googleapis.com/kubernetes-release/release/v1.3.4/bin/darwin/amd64/kubectl
After downloading the binary, ensure it is executable and move it into your PATH:
$ chmod +x kubectl
$ mv kubectl /usr/local/bin/kubectl
Minikube is what lets us actually create a Kubernetes cluster locally for dev and with ease too. It provides a minikube
binary that makes the process very simple and easy.
$ curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.9.0/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
$ curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.9.0/minikube-darwin-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
If you don't feel comfortable executing these commands listed above you can also find the official installation instructions for latest releases here
Gophrctl is an house cli for controlling our production and dev environments. We interface easily with minikube
and build images, cycle pods, create secrets, and more.
Navigate to the gophr repo you cloned earlier, and go to ../infra/gophrctl
$ cd $GOPHR_PATH/infra/gophrctl && go install
This should build and place the binary in your PATH
. You should now be able to run:
$ gophrctl
You should see something like this
NAME:
gophrctl - Manages the gophr development and deployment environment.
USAGE:
gophrctl [global options] command [command options] [arguments...]
VERSION:
0.0.1
COMMANDS:
build Updates module images
cycle Re-creates a module in kubernetes
log Logs module's container output to stdout
ssh Starts a shell session within a module's container
update Updates module kubernetes definition
secrets Deals with confidential data
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--env value gophr execution environment (default: "dev")
--repo-path value path to the gophr repository (default: "/Users/shikkic/dev/go/src/github.com/skeswa/gophr")
--help, -h show help
--version, -v print the version
Now that we have all of our dependencies installed we'll want to get our kubernetes cluster up and running.
First we need to make sure minikube is running.
$ minikube start
After minikube is up and running we can open up a dashboard and use it to manage our pods that will run.
$ minikube dashboard
You should have something that looks like this (but empty).
// TODO
Now we want to build all of images from scratch so we can cycle them into our kubernetes cluster.
$ gophrctl build
It may take a little while to build all the images at first
Now that all of our images are built we need to cycle them into our cluster.
$ gophrctl cycle
Retrieve your kuberenetes ip:
$ minikube ip
Then try hitting https://MINIKUBE_IP:30443
to get the dev web page up.
You can also try making a mock go get request your local dev by running:
$ go get --insecure https://${minikube ip}:30443/$REPO_NAME/$AUTHOR_NAME@(semver or SHA)
The @ at the end of the url is optional, you don't need to use it unless you're specifying a version
Questions, comments, concerns? Feel free to open an issue or reach out on slack @shikkic or @skeswa