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

Build on Deploy #216

Closed
wants to merge 3 commits into from
Closed
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
2 changes: 1 addition & 1 deletion Parse-Dashboard/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ packageJson('parse-dashboard', 'latest').then(latestPackage => {
}
});

module.exports = function(config) {
module.exports = function(config, allowInsecureHTTP) {
var app = express();
// Serve public files.
app.use(express.static(path.join(__dirname,'public')));
Expand Down
2 changes: 1 addition & 1 deletion Parse-Dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ p.then(config => {

const app = express();

app.use(parseDashboard(config.data));
app.use(parseDashboard(config.data, allowInsecureHTTP));
// Start the server.
app.listen(port);

Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ In order to securely deploy the dashboard without leaking your apps master key,

The deployed dashboard detects if you are using a secure connection. If you are deploying the dashboard behind a load balancer or proxy that does early SSL termination, then the app won't be able to detect that the connection is secure. In this case, you can start the dashboard with the `--allowInsecureHTTP=1` option. You will then be responsible for ensureing that your proxy or load balancer only allows HTTPS.

### Building on Deploy

In order to build the project while deploying (opposed to locally, prior to deploy), you need to set the `POST_INSTALL_BUILD` environment variable to something on the environment it's being deployed to. This will compile the appropriate assets and copy them into the right place.

Building on deploy has one major advantage, which is that you don't need to commit your built assets into your repo. It does mean, however, that everytime you deploy it will rebuild those assets, whether or not they changed.

## Run with Docker

It is easy to use it with Docker. First build the image:
Expand Down
26 changes: 15 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,25 @@
"LICENSE"
],
"dependencies": {
"basic-auth": "^1.0.3",
"commander": "^2.9.0",
"express": "^4.13.4",
"json-file-plus": "^3.2.0",
"package-json": "^2.3.1"
},
"devDependencies": {
"babel-core": "~5.8.12",
"babel-loader": "~5.3.0",
"babel-plugin-remove-proptypes": "~1.0.0",
"babel-polyfill": "^6.7.2",
"babel-runtime": "~5.8.25",
"css-loader": "~0.18.0",
"babel-runtime": "~5.8.25",
"basic-auth": "^1.0.3",
"css-loader": "~0.18.0",
"commander": "^2.9.0",
"express": "^4.13.4",
"file-loader": "^0.8.5",
"history": "~1.9.1",
"http-server": "~0.8.5",
"immutable": "~3.7.5",
"immutable-devtools": "~0.0.4",
"jest-cli": "^0.7.1",
"json-file-plus": "^3.2.0",
"js-beautify": "~1.5.0",
"marked": "^0.3.5",
"node-sass": "~3.4.2",
"package-json": "^2.3.1",
"parse": "1.6.14",
"prismjs": "~1.2.0",
"react": "^0.14.0",
Expand All @@ -62,17 +59,24 @@
"sass-loader": "~3.1.2",
"style-loader": "~0.12.3",
"svg-prep": "~1.0.0",
"transform-jest-deps": "^2.1.0",
"webpack": "~1.12.0"
},
"devDependencies": {
"history": "~1.9.1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

history should not be dev I believe

"http-server": "~0.8.5",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nor that?

"jest-cli": "^0.7.1",
"transform-jest-deps": "^2.1.0"
},
"scripts": {
"dev": "node ./Parse-Dashboard/index.js & webpack --config webpack/build.config.js --devtool eval-source-map --progress --watch",
"dashboard": "node ./Parse-Dashboard/index.js & webpack --config webpack/build.config.js --progress --watch",
"dist": "npm run build && cp -r production/bundles Parse-Dashboard/public/bundles",
"pig": "http-server ./PIG -p 4041 -s & webpack --config webpack/PIG.config.js --progress --watch",
"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",
"prepublish": "webpack --config webpack/publish.config.js --progress",
"postinstall": "if [ -n \"$POST_INSTALL_BUILD\" ]; then npm run dist; fi",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could use: "heroku-postbuild" (as described here)

"start": "node ./Parse-Dashboard/index.js"
},
"bin": {
Expand Down