Skip to content
This repository was archived by the owner on Sep 2, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 123 additions & 0 deletions README-vagrant.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# Badgekit Suite Easy-Deploy Dev En

```

# Included:

* Ubuntu 12.04 Precise, 64-bit OS
* Mysql 5.5 Server, Client
* Node.js 0.10.28
* Other various utilities/non-vanilla software includes screen, git, python, g++, wget, g++, wget, make, openjdk-7-jre-headless ruby rubygems

**NOTE**
*This is intended to also be the Badgekit front end server, alongside this, the API for Badgekit. For the .env file and any other badgekit, see https://github.com/mozilla/openbadges-badgekit and that README*

```

# Prerequisites

* A 64-bit operating system (Macbook Air is great, Windows untested)
* vagrant ([Link](http://www.vagrantup.com/))
* The Vagrantfile in this directory copied to your workstation where you want to run the vagrant instance for BadgekitSuite from

```

# How to Use This Vagrant Easy Deploy Setup

* First, while in Terminal in the directory in the same dir as the Vagrantfile.

* mkdir vagrant

* Start Vagrant (Note, this may take some time, if you have not already downloaded the base box file)

* vagrant up

* After that finishes,run the following commands on your local workstation

* cd ./vagrant

* git clone https://github.com/mozilla/openbadges-badgekit.git

* git clone https://github.com/mozilla/badgekit-api.git
* Make a .env file in each of those dirs for the env variables, copied from the sample.env files in each the badgekit-api and openbadges-badgekit repos

* cp ./badgekit.env ./openbadges-badgekit/.env

* cp ./badgekitapi.env ./badgekit-api/.env

* Now, vagrant ssh into your running instance

* vagrant ssh

* Login as root (avoids complications)

* sudo -sH

* Then, npm install it all

* cd /vagrant/badgekit && npm install

* cd /vagrant/openbadges-badgekit && npm install

# **STARTING THE APPS**

* If you aren't already root, login as root (avoids complications)

* sudo -sH

* I recommend using screen. http://www.rackaid.com/blog/linux-screen-tutorial-and-how-to/

* Then, use the screen command by itself to open a new screen

* cd /vagrant/badgekit

* foreman start web

* To exit the badgekit screen, hit the following keyboard keys (including CAPS as noted)

* Ctrl-A, Ctrl-D

* You will be back in your original "session" on the vagrant box

* You can now repeat the same process using the following commands

* screen

* **ONCE IN NEW SCREEN**

* cd /vagrant/badgekitapi

* foreman run web

* Then, Ctrl-A,Ctrl-D will take you back out of that screen

* To resume, you will want to first find the screen #'s, then resume them

* screen -ls # This will list the screens.

* The output of screen -ls looks like this:

* 2759.pts-0.precise64 (06/05/2014 07:21:47 PM) (Detached)

* 2701.pts-0.precise64 (06/05/2014 07:21:36 PM) (Detached)

* To resume the first screen, #2759, use this command

* screen -r 2759

# ACCESSING THROUGH YOUR LOCAL BROWSER DEFAULTS

* http://localhost:3000 - badgekit.org clone

* http://localhost:3500 - api.badgekit.org clone

# ACCESSING UTILITIES FROM LOCAL MACHINE

* MySQL host: localhost:3306

* MySQL user: root / nopassword (blank)

* MySQL user: badgekit PW: badgekit

* MySQL user: badgekitapi PW: badgekitapi

8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ API calls should be signed with a JWT token generated using the secret for your

## Installation

To install the BadgeKit API:
To install the BadgeKit API:
* clone the repo
* set up a database
* set your environment configs.
Expand All @@ -49,3 +49,9 @@ The BadgeKit API currently uses the following configuration details:
* `DB_USER`: User who has full access to the `DB_NAME` table.
* `DB_PASSWORD`: Password for the `DB_USER`.
* `MASTER_SECRET`: The master secret used to sign global-access JWT tokens. This should not be shared widely – probably only with one front-end, e.g. `badgekit`.

## Running all Badgekit apps on vagrant

Please see the README.vagrant.md file for a detailed walk through to setup a fast local dev environment using [Vagrant](http://www.vagrantup.com/)

This provides a mostly-prebuilt Ubuntu server, complete with MySQL and Node.JS at the correct versions.
38 changes: 38 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.

# Every Vagrant virtual environment requires a box to build off of, specified already in the Vagrantfile

# This Vagrantfile is Node.js, MySQL setup for badgekit
# As of 1/17/14, this is in rough draft, please submit
# bugs via webmaker :: devops, or email jp@mozillafoundation.org
config.vm.box = "badgekitsuite"

# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
config.vm.box_url = "http://stuff.webmaker.org/devtools/mofo_vagrant_baseboxes/badgekitsuite.box"

# Create forwarded port mappings
# Webmaker apps have the following port assignments/urls
# which are opened up to your local workstation by the
# following stanzas

# Configure mongo and elasticsearch port forwards

config.vm.network :forwarded_port, guest: 3000, host: 3000
config.vm.network :forwarded_port, guest: 3500, host: 3500
config.vm.network :forwarded_port, guest: 3600, host: 3600

# Be sure you make this directory wherever you want this
# vagrant instance to run from.
config.vm.synced_folder "./vagrant", "/vagrant"

end
9 changes: 9 additions & 0 deletions sample.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export PORT=3500
export PERSONA_AUDIENCE=http://localhost:3500
export COOKIE_SECRET=blah
export DB_HOST=localhost
export DB_PORT=3306
export DB_NAME=badgekitapi
export DB_USER=badgekitapi
export DB_PASSWORD=badgekitapi
export MASTER_SECRET=blah