Skip to content
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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
server/config.json filter=git-crypt diff=git-crypt
1 change: 1 addition & 0 deletions server/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
2 changes: 2 additions & 0 deletions server/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Ember FastBoot Server for Google Cloud

## Installation

1. Install [git-crypt]: `brew install git-crypt`
3 changes: 0 additions & 3 deletions server/app.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
runtime: custom
env: flex
api_version: 1
env_variables:
FASTBOOT_GCS_BUCKET: contributor-days-assets
FASTBOOT_GCS_KEY: fastboot-release.json
health_check:
enable_health_check: False
Binary file added server/config.json
Binary file not shown.
8 changes: 5 additions & 3 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scripts": {
"start": "node server.js",
"test": "echo \"Error: no test specified\" && exit 1",
"deploy": "gcloud --project=<%= dasherizedModuleName ?> app deploy"
"deploy": "gcloud --project=contributor-days app deploy"
},
"engines": {
"node": "~5.3"
Expand All @@ -20,6 +20,8 @@
"@google/cloud-debug": "0.8.1",
"fastboot-app-server": "^1.0.0-rc.5",
"fastboot-gcloud-storage-downloader": "^0.1.0",
"fastboot-gcloud-storage-notifier": "^0.1.0"
"fastboot-gcloud-storage-notifier": "^0.1.0",
"fastboot-redis-cache": "taras/fastboot-redis-cache#add-password-option",
"nconf": "0.8.4"
}
}
}
23 changes: 20 additions & 3 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@
const GCloudStorageDownloader = require('fastboot-gcloud-storage-downloader');
const GCloudStorageNotifier = require('fastboot-gcloud-storage-notifier');
const FastBootAppServer = require('fastboot-app-server');
const RedisCache = require('fastboot-redis-cache');
const nconf = require('nconf');

const GCS_BUCKET = process.env.FASTBOOT_GCS_BUCKET;
const GCS_KEY = process.env.FASTBOOT_GCS_KEY;
nconf.file({ file: 'config.json' });

const GCS_BUCKET = nconf.get('bucket');
const GCS_KEY = nconf.get('key');
const FASTBOOT_REDIS_HOST = nconf.get('redisHost');
const FASTBOOT_REDIS_PORT = nconf.get('redisPort');
const FASTBOOT_REDIS_PASSWORD = nconf.get('redisPassword');

let downloader = new GCloudStorageDownloader({
bucket: GCS_BUCKET,
Expand All @@ -17,9 +24,19 @@ let notifier = new GCloudStorageNotifier({
key: GCS_KEY
});

let cache = new RedisCache({
host: FASTBOOT_REDIS_HOST,
port: FASTBOOT_REDIS_PORT,
password: FASTBOOT_REDIS_PASSWORD,
cacheKey(path) {
return `contributor-days-${path}`;
}
});

let server = new FastBootAppServer({
downloader,
notifier
notifier,
cache
});

server.start();