Skip to content

Commit ae70bee

Browse files
author
gondzo
committed
Merge branch 'herokuDeployment' into dev
# Conflicts: # src/components/Header/Header.jsx # src/routes/DroneDetails/components/FeedbackItem/index.js # src/routes/Home/components/LoginModal/LoginModal.jsx # src/routes/Home/components/LoginModal/index.js # src/routes/Home/containers/LoginModalContainer.js # src/routes/MyDrone/components/MyDronesTable/MyDronesTable.jsx # src/routes/MyDrone/modules/MyDrone.js # src/routes/MyServices/components/MyServicesTable/MyServicesTable.jsx # src/routes/MyServices/modules/MyServices.js
2 parents a967b9d + d08f40e commit ae70bee

File tree

8 files changed

+83
-4
lines changed

8 files changed

+83
-4
lines changed

Procfile

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: npm run start

README.md

+21
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,24 @@ See Guild https://github.com/lorenwest/node-config/wiki/Configuration-Files
3434
|`lint:fix`|Lint and fix all `.js` files. [Read more on this](http://eslint.org/docs/user-guide/command-line-interface.html#fix).|
3535
|`test`|Run tests using [mocha-webpack](https://github.com/webpack/mocha-loader) for all `*.spec.(js|jsx)` files in the `src` dir.|
3636

37+
## Local deploy
38+
NODE_ENV=production npm run build
39+
NODE_ENV=production npm run start
40+
41+
## Heroku deploy
42+
43+
### Prerequisites
44+
- Heroku CLI
45+
46+
### set up
47+
npm run heroku:[ENV]:init
48+
npm run heroku:[ENV]:deploy
49+
50+
### update
51+
npm run heroku:[ENV]:deploy
52+
53+
`npm run heroku:[ENV]:init` will create a new git remote in current git repository and a new app in remote server.
54+
55+
`npm run heroku:[ENV]:deploy` line will push current branch to corresponding remote environment.
56+
57+
`ENV` can be 'prod', 'dev', 'staging', 'test'.

config/development.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* eslint-disable import/no-commonjs */
2+
/**
3+
* Main config file
4+
*/
5+
module.exports = {
6+
// below env variables are NOT visible in frontend
7+
PORT: process.env.PORT || 3000,
8+
9+
// below env variables are visible in frontend
10+
GOOGLE_API_KEY: process.env.GOOGLE_API_KEY || 'AIzaSyCrL-O319wNJK8kk8J_JAYsWgu6yo5YsDI',
11+
API_BASE_PATH: process.env.API_BASE_PATH || 'https://kb-dsp-server-dev.herokuapp.com',
12+
};

config/production.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* eslint-disable import/no-commonjs */
2+
/**
3+
* config file for production environment
4+
*/
5+
module.exports = {
6+
// below env variables are NOT visible in frontend
7+
PORT: process.env.PORT || 3000,
8+
9+
// below env variables are visible in frontend
10+
GOOGLE_API_KEY: process.env.GOOGLE_API_KEY || 'AIzaSyCrL-O319wNJK8kk8J_JAYsWgu6yo5YsDI',
11+
API_BASE_PATH: process.env.API_BASE_PATH || 'https://kb-dsp-server-dev.herokuapp.com',
12+
};

config/staging.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* eslint-disable import/no-commonjs */
2+
/**
3+
* Main config file
4+
*/
5+
module.exports = {
6+
// below env variables are NOT visible in frontend
7+
PORT: process.env.PORT || 3000,
8+
9+
// below env variables are visible in frontend
10+
GOOGLE_API_KEY: process.env.GOOGLE_API_KEY || 'AIzaSyCrL-O319wNJK8kk8J_JAYsWgu6yo5YsDI',
11+
API_BASE_PATH: process.env.API_BASE_PATH || 'https://kb-dsp-server-dev.herokuapp.com',
12+
};

config/test.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* eslint-disable import/no-commonjs */
2+
/**
3+
* Main config file
4+
*/
5+
module.exports = {
6+
// below env variables are NOT visible in frontend
7+
PORT: process.env.PORT || 3000,
8+
9+
// below env variables are visible in frontend
10+
GOOGLE_API_KEY: process.env.GOOGLE_API_KEY || 'AIzaSyCrL-O319wNJK8kk8J_JAYsWgu6yo5YsDI',
11+
API_BASE_PATH: process.env.API_BASE_PATH || 'https://kb-dsp-server-dev.herokuapp.com',
12+
};

package.json

+12-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,20 @@
55
"main": "index.js",
66
"scripts": {
77
"dev": "cross-env NODE_ENV=development nodemon server",
8-
"start": "cross-env NODE_ENV=production node server",
9-
"build": "cross-env NODE_ENV=production webpack --bail --progress --build --tc",
8+
"start": "node --max-old-space-size=512 server",
9+
"build": "node --max-old-space-size=512 ./node_modules/webpack/bin/webpack --bail --progress --build --tc",
1010
"lint": "eslint --ext jsx --ext js .",
1111
"lint:fix": "npm run lint -- --fix",
12-
"test": "mocha-webpack --require setup-test.js --webpack-config webpack.config-test.js \"src/**/*.spec.(jsx|js)\""
12+
"test": "mocha-webpack --require setup-test.js --webpack-config webpack.config-test.js \"src/**/*.spec.(jsx|js)\"",
13+
"postinstall":"npm run build",
14+
"heroku:prod:init":"git remote remove production && heroku create --remote production && heroku config:set NODE_ENV=production --remote production",
15+
"heroku:dev:init": "git remote remove dev && heroku create --remote dev && heroku config:set NODE_ENV=development NPM_CONFIG_PRODUCTION=false --remote dev",
16+
"heroku:staging:init": "git remote remove staging && heroku create --remote staging && heroku config:set NODE_ENV=staging --remote staging",
17+
"heroku:test:init": "git remote remove test && heroku create --remote test && heroku config:set NODE_ENV=test --remote test",
18+
"heroku:prod:deploy":"git push production master",
19+
"heroku:dev:deploy":"git push dev master",
20+
"heroku:staging:deploy":"git push staging master",
21+
"heroku:test:deploy":"git push test master"
1322
},
1423
"author": "",
1524
"license": "MIT",

webpack.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ module.exports = {
9292
output: {
9393
filename: '[name].[hash].js',
9494
path: path.join(__dirname, './dist'),
95-
publicPath: __DEV__ ? `http://${ip.address()}:${process.env.PORT || 3000}/` : '/',
95+
publicPath: '/',
9696
},
9797
plugins: [
9898
new webpack.DefinePlugin({

0 commit comments

Comments
 (0)