From c5dcf09bc20de79e5e337c8b091058320204ce4a Mon Sep 17 00:00:00 2001 From: Emil Virkki Date: Tue, 27 Sep 2016 19:14:29 +0300 Subject: [PATCH 1/7] Remove circle.yml It is no longer needed since there are no tests and the host has been taken down. --- circle.yml | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 circle.yml diff --git a/circle.yml b/circle.yml deleted file mode 100644 index fec2fe3..0000000 --- a/circle.yml +++ /dev/null @@ -1,5 +0,0 @@ -deployment: - production: - branch: master - heroku: - appname: fj16-jira-mobile From c90914981b0be4849528af829d79abc9d34061d6 Mon Sep 17 00:00:00 2001 From: Emil Virkki Date: Tue, 27 Sep 2016 19:21:23 +0300 Subject: [PATCH 2/7] Read JIRA host name from env variable instead of hardcoding --- jira.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jira.js b/jira.js index c05d878..bca0578 100644 --- a/jira.js +++ b/jira.js @@ -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 || 'https://jira.roihu2016.fi'; +var baseUrl = host + '/rest/'; var moment = require('moment'); function validateLogin(username, password, cb) { @@ -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); From 5e8a1e371633afc330b0650c1581e286ebc2d966 Mon Sep 17 00:00:00 2001 From: Emil Virkki Date: Tue, 27 Sep 2016 19:23:25 +0300 Subject: [PATCH 3/7] Add MIT license --- LICENSE | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..693ce03 --- /dev/null +++ b/LICENSE @@ -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. From 1b1b72e2358e17008b3b3599ec7f49d030c6c13c Mon Sep 17 00:00:00 2001 From: Emil Virkki Date: Tue, 27 Sep 2016 19:27:44 +0300 Subject: [PATCH 4/7] Change default host to jira.partio.fi --- jira.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jira.js b/jira.js index bca0578..b1544e9 100644 --- a/jira.js +++ b/jira.js @@ -1,7 +1,7 @@ var request = require('superagent'); var _ = require('lodash'); var filesize = require('filesize'); -var host = process.env.HOST || 'https://jira.roihu2016.fi'; +var host = process.env.HOST || 'http://jira.partio.fi'; var baseUrl = host + '/rest/'; var moment = require('moment'); From 91f5d02a961553300b45374241aa58101832c6e5 Mon Sep 17 00:00:00 2001 From: Emil Virkki Date: Tue, 27 Sep 2016 19:47:10 +0300 Subject: [PATCH 5/7] Add README.md --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..eec97c1 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# 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. From 976c43bfaa6f7cb3cef28bbcc7ea3ae4ef1fd5ad Mon Sep 17 00:00:00 2001 From: Emil Virkki Date: Tue, 27 Sep 2016 19:55:47 +0300 Subject: [PATCH 6/7] Add section about developing the app to README.md --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index eec97c1..60c43b8 100644 --- a/README.md +++ b/README.md @@ -13,3 +13,18 @@ The app can be configured using the environment variables. For development use y - 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. From b5b519ba5b300861139f22baf18b97b81764d78d Mon Sep 17 00:00:00 2001 From: Emil Virkki Date: Tue, 27 Sep 2016 20:17:57 +0300 Subject: [PATCH 7/7] Add instructions for Heroku deployment in README.md --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README.md b/README.md index 60c43b8..043dcd0 100644 --- a/README.md +++ b/README.md @@ -28,3 +28,24 @@ To have the app automatically restart when you make code changes you can install 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= + # 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.