README.md 3 KB
Newer Older
1
# Go (URL Shortener)
Jean Michel Rouly's avatar
Jean Michel Rouly committed
2 3 4

A project of [GMU SRCT](http://srct.gmu.edu).

5 6 7 8
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.

David Haynes's avatar
David Haynes committed
9 10
I encourage you to join the #go channel in SRCT's [Slack Group](srct.slack.com) if you have any questions on setup or would like to contribute.

David Haynes's avatar
David Haynes committed
11
## Package Installation
12 13
<legend>
### Prerequisities
14 15 16 17 18 19 20 21 22 23 24 25
First, install python, pip, 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.

Open a terminal and run the following command:

`$ sudo apt-get update`

This retrieves links to the most up-to-date and secure versions of your packages.

Next, with:

David Haynes's avatar
David Haynes committed
26
`$ sudo apt-get install python git`
27 28 29

you install python and git.

30 31
### 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.
32

33
Configure your ssh keys by following the directions at [git.gmu.edu/help/ssh/README](git.gmu.edu/help/ssh/README).
34 35 36 37 38

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

`$ git clone git@git.gmu.edu:srct/go.git`

39 40

### Required Packages
41
Finally, install these packages from the standard repositories:
David Haynes's avatar
David Haynes committed
42 43 44 45 46 47 48 49 50
 - VirtualBox

    `$ sudo apt-get install virtualbox`
 - Vagrant

    `$ sudo apt-get install vagrant`
 - Ansible

    `$ sudo easy_install pip && sudo pip install ansible`
51 52

## Developing with Vagrant
David Haynes's avatar
David Haynes committed
53 54 55 56 57 58 59 60 61
<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:

`$ vagrant up`

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.
62

David Haynes's avatar
David Haynes committed
63
And that's it! Navigate to [localhost](http://127.0.0.1:8000) in your web browser to view the website.
David Haynes's avatar
David Haynes committed
64 65

### Additional Notes
David Haynes's avatar
David Haynes committed
66 67 68

The authentication service used for Go is CAS however in local development all you need to do to sign in is pass your CAS username in both the username and password fields when prompted. 

David Haynes's avatar
David Haynes committed
69 70 71 72 73 74
If you make any changes to _models.py_ you will need to re-provision the vm:

`$ vagrant provision`

Please note that this will refresh the database.

David Haynes's avatar
David Haynes committed
75
It is also good practice to shutdown your vm when you are done:
David Haynes's avatar
David Haynes committed
76

David Haynes's avatar
David Haynes committed
77
`$ vagrant halt`
David Haynes's avatar
David Haynes committed
78 79 80

and to restart with:

David Haynes's avatar
David Haynes committed
81
`$ vagrant up`
Jean Michel Rouly's avatar
Jean Michel Rouly committed
82

David Haynes's avatar
David Haynes committed
83
## On Deployemnt
84
<legend>
David Haynes's avatar
David Haynes committed
85 86 87
### Deploying with Vagrant
TODO

88 89 90 91 92 93 94
### Cron

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
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.