New Contributors
Welcome, New Contributors!
This section is all about helping you get started with open source and Athens.
Let’s get started with learning how to use git
This section is all about helping you get started with open source and Athens.
Let’s get started with learning how to use git
Git is a free and open source distributed version control system. What does that really mean? It is a way to track changes to files on your computer. This is like keeping a detailed log of every time you change a file, what lines and characters were changed. So you could look at the log and see what changed, or undo those changes if you wanted or if you are working with others you can merge your changes together.
It’s a lot to take in, so don’t worry if you aren’t following yet.
If you want a more detailed walk through than we provide here, have a look at the Git Book.
Let’s start by getting git installed on you machine. You can check if it’s
already installed by running git --version
from the command line.
Follow your operating system specific instructions in Chapter 1.5 of the Git Book.
There is a great interactive tutorial, for free, available at Code Academy. Take some time to play with it and try out some of the commands.
Contributing to docs is just as important, if not more important than, writing code. We use GoHugo to run this website. So if you’d like to improve it, here’s how you can run it locally:
cd ./docs && hugo server
The Hugo server will run on http://localhost:1313 and it will automatically watch your files and update the website every time you make a change.
Alternatively you can run our custom docker image as outlined here
We use GitHub to host the remote copy of our repository and both track our issues and manage our pull requests. If you haven’t signed up before, take a minute to go do that now. We’ll be right here when you get back.
On GitHub we use the concept of an issue to record every change needed in our code base. This means ideas, bugs, features, support, even just discussions.
Never hesitate to open an issue if you have question about the code or think you may have found a bug. Sometimes people will find part of the documentation or instructions difficult to follow, let us know if this happens.
In particular for our project on GitHub, we have a template for Bug Reports and Feature Requests with one for Proposals .. proposed. When you click on ‘New Issue’ you will be given a choice of which template to start with, if they do not seem to fit your need there is an option to ‘Open a regular issue’ - which is blank.
In order to keep things a bit tidy in our main repository, we all do work on what is called a fork before creating a pull request. A fork is essentially a copy of a repository that is owned by your GitHub account. You can create as many branches as you like there and don’t be shy with creating commits. We will squash them all into one before we merge, more on that below.
But first take a minute to read this awesome post on creating and maintaining a fork of the project. It even goes into adding other collaborators forks as remotes which you will find useful as you start working more and more with other contributors.
Brian Ketelsen created an awesome video on making your first open source pull request, for an overview of the process go watch that now. There’s also a great video series on contributing to an Open Source project by Kent C. Dodds.
When we receive a new pull request, it may take time for a maintainer or other contributor to get to it, but when we do a few things will happen.
You can expect at least a few comments, don’t let them discourage you though. We are all trying to help one another write the best code and documentation possible, all criticism should be considered constructive.
If you feel like it is not, please do not hesitate to reach out to one of the maintainers. We take our code of conduct very seriously.
Most likely one or more contributors and maintainers will leave a review on your
pull request. You can discuss the changes requested in the pull request itself,
or if you need help with something in particular you can reach out to us in the
#athens
channel on Gophers Slack.
After all requested changes are resolved a maintainer will give it a final look and as long as our continuous integration passed they will merge it with the main
branch.
Let’s just go over a quick general guideline on contributing to Athens.
When you see an issue you would like to work on, if no one else has expressed interest please comment on the issue with something like:
This let’s other contributors know someone is working on it, we all know free time is hard to get and don’t want anyone wasting theirs.
If you don’t see an issue for your bug or feature, please open one to discuss with the community. Some things may not be in the best interest of the project, or may have already been discussed.
If your issue is something very small, like a typo or broken link, you may skip straight the pull request.
After you have created a branch on your fork, and made the changes. Please make
sure all tests still pass, see DEVELOPMENT.md for details. Then after you push all changes
up to your fork, head over to Athens to open a pull request. Usually,
right after you have pushed a new branch and you visit the original repository,
GitHub will prompt you to open a new pull request. Otherwise you can do so from
the Pull Requests
tab on the repository.
The proxy is written in idiomatic Go and uses standard tools. If you know Go, you’ll be able to read the code and run the server.
Athens uses Go Modules for dependency management. You will need Go v1.12+ to get started on Athens.
See our Contributing Guide for tips on how to submit a pull request when you are ready.
Athens is developed on Go v1.12+.
To point Athens to a different version of Go set the following environment variable
GO_BINARY_PATH=go1.12.X
# or whichever binary you want to use with athens
If you’re inside GOPATH, make sure GO111MODULE=on
, if you’re outside GOPATH, then Go Modules are on by default.
The main package is inside cmd/proxy
and is run like any go project as follows:
cd cmd/proxy
go build
./proxy
After the server starts, you’ll see some console output like:
Starting application at 127.0.0.1:3000
Athens relies on several services (i.e. databases, etc…) to function properly. We use Docker images to configure and run those services. However, Athens does not require any storage dependencies by default. The default storage is in memory, you can opt-in to using the fs
which would also require no dependencies. But if you’d like to test out Athens against a real storage backend (such as MongoDB, Minio, S3 etc), continue reading this section:
If you’re not familiar with Docker, that’s ok. We’ve tried to make it easy to get up and running:
make dev
from the root of this repositoryThat’s it! After the make dev
command is done, everything will be up and running and you can move
on to the next step.
If you want to stop everything at any time, run make down
.
Note that make dev
only runs the minimum amount of dependencies needed for things to work. If you’d like to run all the possible dependencies run make alldeps
or directly the services available in the docker-compose.yml
file. Keep in mind, though, that make alldeps
does not start up Athens or Oympus, but only their dependencies.
In order to run unit tests, services they depend on must be running first:
make alldeps
then you can run the unit tests:
make test-unit
To get started with developing the docs we provide a docker image, which runs Hugo to render the docs. Using the docker image, we mount the /docs
directory into the container. To get it up and running, from the project root run:
make docs
docker run -it --rm \
--name hugo-server \
-p 1313:1313 \
-v ${PWD}/docs:/src:cached \
gomods/hugo
Then open http://localhost:1313.
In our CI/CD pass, we use govet, so feel free to run it locally beforehand:
go vet ./...