/valtech-shortie

Valtech URL shortener

Primary LanguageTypeScriptMIT LicenseMIT

Valtech Shortie - valte.ch

Valtech URL shortening service.

TL;DR

Technical stuff

This list isn't exhaustive, but should give you an idea of the overall architecture.

Languages/tools/frameworks

General

Frontend

Backend

Test frameworks

Admin

Go to /admin and login using Valtech IDP. You can administer existing URLs and add new ones.

API

TODO. Will require an "application key + secret". POST, PUT and DELETE. JSON data.

Deployment

Valtech Shortie is deployed with our internal TeamCity instance: http://bob.valtech.se.

  • Branch master is automatically deployed to production.
  • Branch develop is automatically deployed to stage.

If TeamCity does not trigger a build for a branch (e.g. after merge to master), trigger one yourself (by pressing the ... next to "Run" and then choosing branch).

The application is deployed to Azure.

The MongoDB databases are located at MongoHQ. Ask IT for access.

Dev

Creating a local environment with Vagrant

This project is setup with Vagrant, to make it easy to get up and running. To create a VM with a local development environment using Vagrant, you need the following software installed on your host machine:

Create, provision and bootstrap the Vagrant box like this:

vagrant up
vagrant ssh

You are now inside a VM setup for development, and can skip the manual install steps.

Manual install

For all platforms

  • Node.js: http://nodejs.org/ (use official installer)
  • Grunt: npm install -g grunt grunt-cli
  • MongoDB
    • Mac OS X: brew install mongodb and run it with mongod
    • Windows: Download, unzip somewhere (e.g. C:\mongodb), and run from a terminal with something like C:\mongodb\bin\mongod.exe --dbpath C:\mongodb\data --rest

For Windows development with Visual Studio

Authentication

By default Valtech Shortie will not require any authentication, and /admin will be accessible for all. To enable authentication through Valtech IDP, set the environment variables:

AUTH_MODE=idp
IDP_CLIENT_ID=valtech.shortie.local
IDP_CLIENT_SECRET=<FETCH FROM IDP STAGE ADMIN>

You can do this by creating adding the above lines to a file .env in the root folder.

Running

First time

Done automatically as part of the Vagrant bootstrap process.

This will install all required Node modules.

npm install

From CLI

grunt
node server.js

With grunt watch and node-supervisor

Tab A:

grunt default watch

Tab B:

supervisor server.js

Debugging with node-inspector

grunt
node-debug server.js

Running (and debugging) with Visual Studio 2013

Run Grunt tasks.

Press F5. :-)