Open a [pull request](https://git.gmu.edu/srct/go/merge_requests/new) with a descriptive enough title and description and we'll take one last look at your code before merging.
This tutorial uses the third party Homebrew package manager for macOS, which allows you to install packages from your terminal just as easily as you could on a Linux based system. You could use another package manager (or not use one at all), but Homebrew is highly reccomended.
**b)** Now, on your computer, navigate to the directory in which you want to download the project (ie. perhaps one called `development/SRCT`), and run
To get homebrew, run the following command in a terminal: `/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)`
git clone git@git.gmu.edu:srct/go.git
**Note**: You do NOT need to use `sudo` when running any Homebrew commands, and it likely won't work if you do.
## 3) Get Go up and running with the method of your choice.
Next, to make sure Homebrew is up to date, run `brew update`
Now that we have `git` setup and cloned down the code you can
Finally we can install python and git with `brew install python git`
cd go/
### Cloning the Go Codebase
Now, we're going to clone down a copy of the Go codebase from [git.gmu.edu](http://git.gmu.edu/srct/go), the SRCT code respository.
and get to working on setting up a development environment!
Configure your ssh keys by following the directions at [git.gmu.edu/help/ssh/README](http://git.gmu.edu/help/ssh/README).
### Docker
Now, on your computer, navigate to the directory in which you want to download the project (perhaps one called development/ or something similar), and run
Docker is an emerging containerization platform written in Google's Go
language.
Instead of running a full VM that runs Go, we package up all the
various bits that make up Go and run that as a container (two
containers: one for Go and the other for mysql) that act as normal
processes to the OS.
`$ git clone git@git.gmu.edu:srct/go.git`
Check out [docker.com](https://www.docker.com/what-docker) for more details.
### If Using Docker
First, install Docker on your system.
* For macOS go here: https://docs.docker.com/docker-for-mac/
* For windows go here: https://docs.docker.com/docker-for-windows/
* For you specific linux disro go here: https://docs.docker.com/engine/installation/
Pros:
Additionally if you are not on Mac or Windows you will need to install docker-compose: https://docs.docker.com/compose/install/
- Lightweight
- Can be run on most machines without needing significant resources.
- SRCT members report minimal battery impact on laptops.
- Fast
- Compared to other methods, Docker is comparatively faster than
Vagrant or manual setup.
- Minimal setup
- You run one command. Really easy to get up and running once you install
Docker.
- Good cross platform support
- Runs smoothly on macOS, Linux, and Windows
- Great docs to help if you get stuck.
- Can easily destroy and rebuild the docker images
- Loads in changes to code on the fly
Next go to the directory with the docker-compose file in it and run:
Cons:
`$ docker-compose up`
- Challenging to debug problems
- Cannot interact with attached images and as a result, you cannot really
interact with the database.
If that doesn't work, try:
There are instructions on how to setup/develop with Docker at the [docker-configuration page in the Go project wiki](https://git.gmu.edu/srct/go/wikis/docker-configuration).
`$ sudo docker-compose up`
### Vagrant + Ansible
SOMETIMES if this branch is updated you might have to
You should see that the server is running by going to http://localhost:8000 in your browser.
Any changes you make to your local file system will be mirrored in the server.
Vagrant boots up a full virtual machine (VM) through VirtualBox that then runs Go. A
script written with Ansible will then run on that VM to automate the setup process
for you. It is similar in a way to running Go on a legitimate server.
### If Using Vagrant
Finally, install these packages from the standard repositories:
- VirtualBox
Pros:
On Ubuntu:
`$ sudo apt-get install virtualbox`
- Very similar to a production environment
- Can use `vagrant ssh` to "ssh" into the VM to debug things such as the
database.
- Relatively straightforward and easy setup.
- One Command.
- Can easily destroy and rebuild the VM.
- Loads in changes to code on the fly.
- Fast-ish (Initial provision takes a bit).
Cons:
You should be installing the latest VirtualBox version which as of time of writing is `5.0.24_Ubuntur108355`. You can verify the version number by running `vboxmanage --version`.
- Heavier on resources.
- It's literally a full VM.
- Occasional issues/hiccups.
- Documented fixes are in the wiki.
- Vagrant
There are instructions on how to setup with Vagrant at the [vagrant-configuration
page in the Go project wiki](https://git.gmu.edu/srct/go/wikis/vagrant-configuration).
`$ sudo apt-get install vagrant`
Additionally, there is documentation about developing with Vagrant at
the [vagrant-usage page in the Go project wiki](https://git.gmu.edu/srct/go/wikis/vagrant-usage).
You should be installing the latest vagrant version which as of time of writing is `Vagrant 1.8.1`. You can verify the version number by running `vagrant -v`.
- Ansible
### Manual Setup
`$ sudo pip install ansible`
Manual setup (or: the old fashioned way) is where you install all dependecies on
your system and run Go as a local server with Django. Granted you are technically
doing that with Vagrant and Docker except those platforms automate the steps that
are laid out in this section.
You should be installing the latest ansible version which as of time of writing is `ansible 2.1.1.0`. You can verify the version number by running `ansible --version`.
Pros:
- Experience setting up a Django project for local development
**macOS**
Cons:
- Greater potential for things to go wrong
- Way more steps
First, get VirtualBox from [VirtualBox.org](https://www.virtualbox.org/wiki/Downloads)
Head to:
Then install Vagrant and Ansible with Homebrew with `brew install Caskroom/cask/vagrant Ansible`
https://git.gmu.edu/srct/go/wikis/manual-setup
## Developing with Vagrant
<legend></legend>
Vagrant allows for the virtualization of your development enviornment and automates the setup process for Go.
### Vagrant Setup
Navigate to go/ and run:
# Some words about contributing to Go.
`$ vagrant up`
## CONTRIBUTING.md
This will setup a vm to run Go on your computer and will setup a database, install packages, etc. The first time you run `vagrant up` it may take a few minutes to setup, specifically when installing Go packages. Don't worry as progressive times it will speed up.
This document goes into detail about how to contribute to the repo, plus some
opinions about using `git`.
And that's it! Navigate to [localhost:8000](http://127.0.0.1:8000) in your web browser to view the website.
## Opening issues
### Additional Notes & Troubleshooting
There is a template for issue descriptions located on the new issue page. I will
close issues with poor descriptions or who do not follow the standard.
The authentication service used for Go is CAS. In local development however we utilize a test server. You can log in using your CAS username for both the username and password fields.
## Authentication
The default superuser is _dhaynes3_ though this can be changed in _vagrantfile_ if you wish. You can run `$ vagrant provision` to apply this change. Be sure not to include that change in your commits.
The authentication service used for Go is CAS. In local development however we
utilize a test server. You can log in with just your CAS username to simulate logging
in. By default, the Django superuser is set to `dhaynes3`.
*Note:* For a currently undetermined reason at some points if you try to navigate to [localhost](http://127.0.0.1:8000) and you see an error like: "Conenction has been reset" then:
1.`vagrant ssh`
2.`sudo /etc/init.d/networking restart` and then `exit`
3.`vagrant provision` (may need to do twice)
In order to approve yourself to be an 'approved user' you must navigate to 127.0.0.1:8000/admin and log in.
Once in the admin page go to "registered users", and create a new registered user in the top right. Be sure to
use the same username and Full Name as your main account and select "approved" in the bottom row.
This is the only temporary fix that we know exists.
## Coding style
You should adhere to the style of the repo code. Consistancy is key! PEP8 guidelines
are strongly reccomended but not enforced at the time. Please comment your code,
I will not accept commits that contain uncommented code.
If you make any changes to _models.py_ you will need to re-provision the vm's database:
## Getting Help
`$ vagrant provision`
I encourage you to join the [#go channel](https://srct.slack.com/messages/go/details/) in SRCT's [Slack Group](https://srct.slack.com)
if you have any questions on setup or would like to contribute.
Please note that this will refresh the database (as in delete everything in it).