Skip to content

Commit

Permalink
Migrate back to app engine
Browse files Browse the repository at this point in the history
  • Loading branch information
dbow committed Nov 19, 2019
1 parent 9221ef3 commit 7099915
Show file tree
Hide file tree
Showing 8 changed files with 1,505 additions and 1,135 deletions.
17 changes: 17 additions & 0 deletions .gcloudignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This file specifies files that are *not* uploaded to Google Cloud Platform
# using gcloud. It follows the same syntax as .gitignore, with the addition of
# "#!include" directives (which insert the entries of the given .gitignore-style
# file at that point).
#
# For more information, run:
# $ gcloud topic gcloudignore
#
.gcloudignore
# If you would like to upload your .git directory, .gitignore file or files
# from your .gitignore file, remove the corresponding line
# below:
.git
.gitignore

# Node.js dependencies:
node_modules/
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
node_modules/
build
npm-debug.log
env.json
credentials.yaml
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

Built with [this stack](https://github.com/dbow/futureplate).

Hosted on Heroku.
Hosted on GCP.

4 changes: 4 additions & 0 deletions app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
runtime: nodejs12

includes:
- credentials.yaml
2,553 changes: 1,451 additions & 1,102 deletions package-lock.json

Large diffs are not rendered by default.

41 changes: 20 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "d-bow.com",
"version": "1.0.1",
"version": "1.0.2",
"description": "www.d-bow.com portfolio site!",
"engines": {
"node": ">=12.0.0"
"node": ">=12"
},
"repository": {
"type": "git",
Expand All @@ -20,7 +20,7 @@
"start:dev": "NODE_ENV=development node_modules/nodemon/bin/nodemon.js build/server/index.js",
"start:hot": "HMR=true npm run start:dev",
"hot": "NODE_ENV=development node webpack-dev-server.js",
"postinstall": "npm run build"
"gcp-build": "NODE_ENV=production npm run build"
},
"license": "MIT",
"author": {
Expand All @@ -29,41 +29,40 @@
"email": "[email protected]"
},
"devDependencies": {
"nodemon": "1.19.4",
"webpack-dev-server": "3.8.2"
},
"dependencies": {
"@babel/cli": "^7.6.4",
"@babel/core": "^7.6.4",
"@babel/preset-env": "^7.6.3",
"@babel/preset-react": "^7.6.3",
"autoprefixer": "9.6.5",
"babel-loader": "8.0.6",
"body-parser": "1.19.0",
"css-loader": "3.2.0",
"autoprefixer": "^9.6.5",
"babel-loader": "^8.0.6",
"css-loader": "^3.2.0",
"mini-css-extract-plugin": "^0.8.0",
"nodemon": "^1.19.4",
"null-loader": "^3.0.0",
"postcss-import": "^12.0.1",
"postcss-loader": "^3.0.0",
"rimraf": "^3.0.0",
"style-loader": "^1.0.0",
"webpack": "^4.41.2",
"webpack-cli": "^3.3.9",
"webpack-dev-server": "^3.8.2"
},
"dependencies": {
"express": "4.17.1",
"feed-read": "0.0.1",
"js-yaml": "^3.13.1",
"lodash": "4.17.15",
"mini-css-extract-plugin": "0.8.0",
"null-loader": "3.0.0",
"postcss-import": "12.0.1",
"postcss-loader": "3.0.0",
"prop-types": "15.7.2",
"pug": "2.0.4",
"react": "16.10.2",
"react-addons-update": "15.6.2",
"react-dom": "16.10.2",
"react-router": "^3.2.4",
"redial": "0.5.0",
"request": "2.88.0",
"rimraf": "3.0.0",
"serialize-javascript": "2.1.0",
"serve-favicon": "2.5.0",
"source-map-support": "0.5.13",
"style-loader": "1.0.0",
"superagent": "5.1.0",
"tumblr.js": "2.0.2",
"webpack": "4.41.2",
"webpack-cli": "3.3.9"
"tumblr.js": "2.0.2"
}
}
18 changes: 9 additions & 9 deletions src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import tumblr from 'tumblr.js';
import request from 'superagent';
import {rss} from 'feed-read';

let env;
try {
env = require('./env.json');
_.defaults(process.env, env);
} catch (error) {
if (error.code === 'MODULE_NOT_FOUND'){
console.log('No env.json found. Assuming production.');
} else {
console.log('Error loading env', error);
if (process.env.NODE_ENV === 'development') {
const yaml = require('js-yaml');
const fs = require('fs');
const path = require('path');
try {
const doc = yaml.safeLoad(fs.readFileSync(path.join(__dirname, '../credentials.yaml'), 'utf8'));
_.defaults(process.env, doc['env_variables']);
} catch (e) {
console.log(e);
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ app.use('/audio', express.static(__dirname + '/audio'));

app.use('/api', api);

process.env.API_URL = process.env.API_URL || `http://127.0.0.1:${PORT}/api/`;
process.env.API_URL = DEVELOPMENT ? `http://127.0.0.1:${PORT}/api/` :
`http://${process.env.GAE_VERSION}.${process.env.GAE_SERVICE}.${process.env.GOOGLE_CLOUD_PROJECT}.appspot.com/api/`;

// Serve up /build directory statically when not doing hot module replacement.
if (!HOT_MODULE_REPLACEMENT) {
Expand Down

0 comments on commit 7099915

Please sign in to comment.