Skip to content

Adds distribution with built package #76

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

Merged
merged 1 commit into from
Mar 6, 2016
Merged
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ node_modules/
bundles/
PIG/bundles/
Parse-Dashboard/public/bundles/

Parse-Dashboard/parse-dashboard-config.json
dist/
npm-debug.log

// vim .swp
Expand Down
5 changes: 5 additions & 0 deletions Parse-Dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ app.use(express.static(path.join(__dirname,'public')));
app.get('/parse-dashboard-config.json', function(req, res) {
jsonFile(configFile)
.then(config => {
config.data.apps.forEach((app) => {
if (!app.appName) {
return res.send({ success: false, error: 'An application is misconfigured, appName is required' });
}
});
var response = {apps: config.data.apps};
var users = config.data.users;
//If they provide auth when their config has no users, ignore the auth
Expand Down
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,16 @@ If you are not familiar with Docker, ``--port 8080`` with be passed in as argume

## Deploying in production

For production deployments, it's recommended to use the npm package

1. Create a folder for your project
2. run `$ npm init`
3. Create your dashboard.json in the root ot your project
4. run `$ npm install --save parse-dashboard`
5. add a start script in your package.json `"start": "parse-dashboard --config ./dahsboard.json"` 
6. run `$ npm start`


If you're deploying to a provider like Heroku, or Google App Engine, the SSL endpoint is terminated early and handled by the provider and you may encounter this error `Parse Dashboard can only be remotely accessed via HTTPS`.

:warning: :warning: Before going further, make sure your server **cannot** be reachable via **HTTP**. See the provider documentation for force HTTPS connections to your deployment.
Expand All @@ -114,11 +124,12 @@ To start your server use:

`$ npm start`


Optionally you can use the command line arguments:

`$ npm start -- --config path/to/config.json --port 8080 --allowInsecureHTTP=1`

Or update you start script with the accoring configuration.

All paramters are optional and their default values are:


Expand Down
2 changes: 2 additions & 0 deletions bin/parse-dashboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env node
require('../dist/Parse-Dashboard');
28 changes: 28 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
var gulp = require('gulp');
var webpack = require('webpack');
var webpackConfig = require("./webpack/production.config");

var dist = './dist/Parse-Dashboard';
var bundlesDir = './production/bundles';

gulp.task('webpack', function(callback) {
// run webpack
webpack(webpackConfig, function(err, stats) {
if(err) throw new gutil.PluginError('webpack', err);
callback();
});
});

gulp.task('bundles', ['webpack'], function(){
gulp.src([bundlesDir + '/dashboard.bundle.js', bundlesDir + '/sprites.svg'])
.pipe(gulp.dest(dist + '/public/bundles/'));
})

gulp.task('static', ['bundles'], function() {
gulp.src(['./Parse-Dashboard/**/*', // all files
'!./Parse-Dashboard/*.json', // but the config
'!./Parse-Dashboard/public/bundles/*']) // but the bundles
.pipe(gulp.dest(dist));
});

gulp.task('default', ['static', 'bundles']);
21 changes: 17 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"private": true,
"name": "parse-dashboard",
"description": "The parse dashboard",
"version": "2.0.0",
"repository": {
"type": "git",
"url": "https://github.com/ParsePlatform/parse-dashboard"
},
"license": "LicenseRef-LICENSE",
"files": [
"dist"
],
"dependencies": {
"babel-runtime": "~5.8.25",
"basic-auth": "^1.0.3",
Expand All @@ -22,6 +32,7 @@
"babel-loader": "~5.3.0",
"babel-plugin-remove-proptypes": "~1.0.0",
"css-loader": "~0.18.0",
"gulp": "^3.9.1",
"http-server": "~0.8.5",
"immutable-devtools": "~0.0.4",
"jest-cli": "^0.7.1",
Expand All @@ -40,9 +51,11 @@
"build": "NODE_ENV=production webpack --config webpack/production.config.js && webpack --config webpack/PIG.config.js",
"test": "NODE_PATH=./node_modules jest",
"generate": "node scripts/generate.js",
"preinstall": "git update-index --skip-worktree Parse-Dashboard/parse-dashboard-config.json",
"prestart": "webpack --config webpack/build.config.js --progress",
"start": "node ./Parse-Dashboard/index.js"
"prepublish": "gulp",
"start": "node ./dist/Parse-Dashboard/index.js"
},
"bin": {
"parse-dashboard": "./bin/parse-dashboard"
},
"engines": {
"node": ">=4.3"
Expand Down