Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation, productization & open sourcing #3

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
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
8 changes: 8 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
The MIT License (MIT)
Copyright (c) 2016 The Guides and Scouts of Finland

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# JIRA mobile client

The JIRA mobile client is a tiny web app that allows viewing, commenting and tracking progress of issues. It was originally made for the 2016 Finnjamboree, Roihu.

Users log into the app using their JIRA username and password and the app displays the issues assigned to them. Issues are grouped under three tabs: To Do, In Progress or Done based on their status in JIRA.

## Configuration

The app can be configured using the environment variables. For development use you may not need to set any environment variables at all. The application supports the following configuration options (environment variables):

- HOST: The JIRA hostname and protocol. Defaults to http://jira.partio.fi.
- DATABASE_URL: If given, the app will use database sessions instead of flat file. Needed for the app to work in environments with an ephemeral file system, such as Heroku.
- SECRET: Secret used for signing the session cookie. **Must be set in production to keep your app safe.**
- NODE_ENV: When set to "production" the app will force SSL and set "trust proxy" flag so the correct client IP will be used. This is useful in production, obviously.
- PORT: Set automatically e.g. on Heroku, dictates the port the app will use. Defaults to 3000.

## Developing

In development, make sure you have a working JIRA installation set in the HOST env var or you are using the default http://jira.partio.fi as the backend. Then you can simply:

npm install
npm start

Navigate to http://localhost:3000 and log in using your JIRA username and password.

To have the app automatically restart when you make code changes you can install [Supervisor](https://github.com/petruisfan/node-supervisor) and run:

supervisor index.js

There are no tests in the app because it's so simple and depends heavily on JIRA.

## Deploying to Heroku

After cloning the repository:

# Create the app with the url https://my-jira-client.herokuapp.com
heroku create my-jira-client
# Set the JIRA host to be used as backend
heroku config:set HOST=https://jira.example.org
# Set the secret to prevent tampering with your session cookies
heroku config:set SECRET=<keyboard cat>
# Add a database for storing sessions - flat file sessions don't work on Heroku.
heroku addons:create heroku-postgresql:hobby-dev
# Wait for creation to complete
heroku pg:wait
# Push code to Heroku
git push heroku master

You should now have a working installation of the app available at https://my-jira-client.herokuapp.com.

Heroku automatically sets NODE_ENV to "production" and PORT to the correct value. Adding the database automatically sets the DATABASE_URL to the correct value.
5 changes: 0 additions & 5 deletions circle.yml

This file was deleted.

5 changes: 3 additions & 2 deletions jira.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
var request = require('superagent');
var _ = require('lodash');
var filesize = require('filesize');
var baseUrl = 'https://jira.roihu2016.fi/rest/';
var host = process.env.HOST || 'http://jira.partio.fi';
var baseUrl = host + '/rest/';
var moment = require('moment');

function validateLogin(username, password, cb) {
Expand Down Expand Up @@ -106,7 +107,7 @@ function getAttachmentThumb(attachmentId, username, password, cb) {
}

request
.get('https://jira.roihu2016.fi/secure/thumbnail/' + attachmentId + '/')
.get(host + '/secure/thumbnail/' + attachmentId + '/')
.auth(username, password)
.end(function (err, res) {
cb(null, res);
Expand Down