Permalink
Fetching contributors…
Cannot retrieve contributors at this time
96 lines (67 sloc) 5.29 KB

Contributing

Welcome! If you're looking to help, this document is a great place to start!

Finding things that need help

Here's a few places to get started and find out what's outstanding.

  • Read through the MDM Protocol Reference on the Apple website. Having a deeper understanding of MDM can help with designing features and uncovering bugs.
  • Follow the Quickstart guide and make edits if something doesn't look or work right.
  • If you run into a problem that you're not sure how to fix, file a bug in the issue tracker
  • Browse through the open issues in the issue tracker. We try to tag issues as beginner friendly where appropriate.
  • See something that others might benefit from? Considering updating or writing a wiki page.

Building the project

To build MicroMDM from source, you will need Go 1.10 or later installed.

# if GOPATH is unset:
# export GOPATH=${HOME}/go

# clone repo into GOPATH:
git clone git@github.com:micromdm/micromdm $GOPATH/src/github.com/micromdm/micromdm
cd $GOPATH/src/github.com/micromdm/micromdm

# download dependencies and build:
make deps
make

# run
./build/darwin/micromdm -h

Git workflow

Go requires that your repo lives in $GOPATH/src/github.com/micromdm/micromdm even if you're trying to push to your github fork. To work with a forked copy, use a git remote. Example:

# clone repo into GOPATH:
git clone git@github.com:micromdm/micromdm $GOPATH/src/github.com/micromdm/micromdm

# add your remote/upstream
git remote add groob git@github.com:groob/micromdm.git

# update from origin/master
git pull --rebase

# create a branch
git checkout -b my_feature

# push changes from my_feature to your fork.
#    -u, --set-upstream    set upstream for git pull/status
git push -u groob

If you're new to Go

Go is a bit different from other languages in its requirements for how it expects its programmers to organize Go code files in directories. First, Go requires a folder, called a workspace (you can name it anything you'd like) to exist for go source, dependencies, etc. Before Go 1.8 the path to this folder must always be set in the environment variable GOPATH (example: export GOPATH=/Users/groob/code/go). As of Go 1.8 the default GOPATH is set to $HOME/go but you can still set it to whatever you like. Your GOPATH must have thee subfolders: bin, pkg, and src. Any code you create must live inside the src folder. It's also helpful to add $GOPATH/bin to your environment's PATH as that is where go install will place go binaries that you build. This makes it so that binaries that are insalled can just be invoked by name rather than their full page.

A few helpful resources for getting started with Go:

To build MicroMDM you will need to:

  1. Download and install Go
  2. Make a workspace directory and set the GOPATH as explained above.
  3. Install dep via the command go get -u github.com/golang/dep/... Note that dep is a very new project itself. If you're running trouble with the dep ensure command, ping @groob in the #micromdm channel on Slack.
  4. mkdir -p $GOPATH/src/github.com/micromdm
  5. git clone git@github.com:micromdm/micromdm.git the project into the above folder. The repo must always be in the folder $GOPATH/src/github.com/micromdm/micromdm even if you forked the project. Add a git remote to your fork to track upstream.
  6. dep ensure The dep command will download and install all necessary dependencies for the project to compile.
  7. go build or go install
  8. File an issue or a pull request if the instructions are unclear or problems pop-up for you.

Important libraries and frameworks

MicroMDM is built using a few popular Go packages outside the standard libraries. It might be worth checking them out.

  • Go Kit is a set of Go libraries used by MicroMDM to provide logging, and abstractions for building HTTP services. Its examples page is a good place to start.
  • BoltDB is a key/value database used to provide persistant storage for many components of MicroMDM.
  • gorilla/mux is used to provide routing for http handlers.

Other resources

Also see Contributing wiki page which has some additional notes on running, troubleshooting, and developing with MicroMDM.