Commit 3e1f74d9 authored by David Haynes's avatar David Haynes 🙆

Merge branch '102-readmeUpdates' into '2.2-dev'

Resolve "README Updates"

See merge request !64
parents 06afa04e ddc7ba96
Pipeline #738 passed with stage
in 1 minute and 25 seconds
## Summary
Here you should include two to three sentences explaining the thought process
Here you should include two to three sentences explaining the thought process
about the current issue. Maybe a picture? Some details that could best help someone,
especially someone new, understand the goal of the issue and how they should best
especially someone new, understand the goal of the issue and how they should best
approach the problem.
## Helpful Links
Here you should include a bullet point list of links to documentation, stack overflow,
whatever, that could help guide someone on what it is they are trying to do. Point
them in the right direction per sey.
whatever, that could help guide someone on what it is they are trying to do.
Essentially, a list of links to point them in the right direction.
## On Contributing
<legend></legend>
# On Contributing
### Working on Issues
First take a look at [github flow](https://guides.github.com/introduction/flow/) as this is how Go handles version control.
## git
First take a look at [github flow](https://guides.github.com/introduction/flow/)
as this page gives a good starting point on understanding how to work with `git`
in an open source repo.
If you decide on taking on an already listed issue for Go you will need to work in a branch off of master.
### Branches
This can be done with:
Each branch off of the development branch serves one and only one purpose: to
add, modify, or remove features/bugs from Go. Our list of tasks can be found on
the issues page.
`git branch issue##`
If you decide to take on an issue for Go you will need to work in a branch off
of the current development branch (ie. `2.2-dev` with 2.2 being the version in
development).
NOTE: replace "##" with the issue number that you are working on. (ie. issue42)
This can be done with the following chain of `git` commands within `go/`:
and then you need to checkout that branch in order to write code in it.
git pull
git checkout 2.2-dev
git checkout -B ##-shortdescription
`git checkout issue##`
If you are working on something that does not have an issue please open a new issue before creating your branch.
**Note:**
Replace `##` with the issue number that you are working on, and replace
`shortdescription` with a few words (<=4) that in brief describe what the branch
does.
**Example:**
git pull
git checkout 2.2-dev
git checkout -B 102-readmeUpdates
If you are working on something that does not have an issue please open a new
issue before creating your branch.
### Commits & Their Messages
It is important to commit more often than not such that if we run into issues we can narrow down which commit started to cause issues.
It is important to commit more often than not such that if we run into issues we
can narrow down which commit started to cause issues.
Commit messages should follow the format:
#### Title -
Should fill in the blank: "This commit ______"
Additionally if you are closing an issue include:
Should fill in the blank:
This commit ______
Additionally, if you are closing an issue include:
(Closes #issue_number_here)
(Closes #issue_number_here)
Example commit title:
Complete the about page + TOS (Closes #36)
ex. "Complete the about page + TOS (Closes #36)"
#### Description -
Bullet points of some highlights from the commit.
They don't have to be super serious (see any of my commits) though just a tad bit of info is nice.
ex.
- mostly talk about how great SRCT (and :dhaynes:) is
- plus a short blurb on how we can ban you
Example commit description:
- mostly talk about how great SRCT (and :dhaynes:) is
- plus a short blurb on how we can ban you
[Example full commit](https://git.gmu.edu/srct/go/commit/db89af2e4ffd06a6044d3301a3f7a45ced74799a)
### Merging to the current development branch
Once you've finished work in a branch open a [pull request](https://git.gmu.edu/srct/go/merge_requests/new)
to start the process of getting your code into the repo. Your code wil be reviewed
by another member before being merged. Your code must pass our tests and include
in the description:
[Reference](https://git.gmu.edu/srct/go/commit/db89af2e4ffd06a6044d3301a3f7a45ced74799a)
### Merging to Master
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.
Closes #issue_number_here
[Reference](https://git.gmu.edu/srct/go/merge_requests/25)
[Example pull request](https://git.gmu.edu/srct/go/merge_requests/25)
# Go (URL Shortener) [![build status](https://git.gmu.edu/srct/go/badges/master/build.svg)](https://git.gmu.edu/srct/go/commits/master) [![coverage report](https://git.gmu.edu/srct/go/badges/2.2-dev/coverage.svg)](https://git.gmu.edu/srct/go/commits/2.2-dev)
# Go
A project of [GMU SRCT](http://srct.gmu.edu).
[![build status](https://git.gmu.edu/srct/go/badges/master/build.svg)](https://git.gmu.edu/srct/go/commits/master) [![coverage report](https://git.gmu.edu/srct/go/badges/master/coverage.svg)](https://git.gmu.edu/srct/go/commits/master) [![python version](https://img.shields.io/badge/python-2.7-blue.svg)]() [![Django version](https://img.shields.io/badge/Django-1.10-brightgreen.svg)]() [![SemVer version](https://img.shields.io/badge/SemVer Version-2.1-yellowgreen.svg)]()
Go is a drop-in URL shortening service. It aims to provide an easily
branded service for institutions that wish to widely disseminate
information without unnecessarily outsourcing branding.
#### A project of [GMU SRCT](http://srct.gmu.edu).
I encourage you to join the #go channel in SRCT's [Slack Group](http://srct.slack.com) if you have any questions on setup or would like to contribute.
Go is a drop-in URL shortening service. This project aims to provide an easy to use
URL branding service for institutions that wish to widely disseminate information
without unnecessarily outsourcing branding.
## Package Installation
<legend></legend>
Go is currently a `Python 2.7` project written in the `Django` web framework, with
`MySQL` as our backend database.
### Prerequisities
First, install python and git on your system.
* Python is the programming language used for Django, the web framework used by Go.
* Git is the version control system used for SRCT projects.
# Setup instructions for local development
Go currently supports developers on Linux, macOS and Windows platforms through
both the Docker and Vagrant virtualization platforms. You may use either one
though we have included instructions for manual setup as well. Here's our walk-through
of steps we will take:
1. Install `git` on your system.
2. Clone the Go codebase.
3. Get Go up and running with the method of your choice.
## 1) Install `git` on your system.
`git` is the version control system used for SRCT projects.
### On Linux Based Systems
**with apt:**
Open a terminal and run the following command:
`$ sudo apt-get update`
sudo apt update
This retrieves links to the most up-to-date and secure versions of your packages.
Next, with:
`$ sudo apt-get install python python-dev python-pip git`
sudo apt install git
you install `git` onto your system.
### On macOS
We recommend that you use 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.
To get homebrew, run the following command in a terminal:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)
**Note**: You do NOT need to use `sudo` when running any Homebrew commands, and
it likely won't work if you do.
Next, to make sure Homebrew is up to date, run:
brew update
Finally we can install git with:
brew install git
### On Windows
Instructions on how to setup git on Windows goes here.
## 2) Clone 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 with SSH.
you install python and git.
**a)** Configure your ssh keys by following the directions at:
**macOS (Formerly OS X)**
[git.gmu.edu/help/ssh/README](http://git.gmu.edu/help/ssh/README).
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).
# Some words about deploying Go.
Check out our admin guide:
### Cron
https://git.gmu.edu/srct/go/wikis/administration-guide
In order to expire links, you need to set up a cron job to run the manage.py
expirelinks command regularly. A sample cron script is available in the
......@@ -137,6 +218,7 @@ repository and is named go-cleanlinks.cron. Drop this in cron.hourly and
change the paths so that they point to the virtualenv activate script and
manage.py.
---
**Note:**
### Note
Link by Viktor Vorobyev from the Noun Project.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment