forked from rust-lang/crates.io
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#1715 - kzys:enable-fastboot, r=jtgeibel
Enable FastBoot Actually, without completely removing jQuery, FastBoot seems working.
- Loading branch information
Showing
16 changed files
with
1,374 additions
and
405 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
release: bin/diesel migration run | ||
web: bin/start-nginx ./target/release/server | ||
web: bin/start-nginx npm run nf -- --procfile foreman-procfile start --raw | ||
background_worker: ./target/release/background-worker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* eslint-disable no-console */ | ||
|
||
'use strict'; | ||
|
||
const fs = require('fs'); | ||
const FastBootAppServer = require('fastboot-app-server'); | ||
|
||
// because fastboot-app-server uses cluster, but it might change in future | ||
const cluster = require('cluster'); | ||
|
||
class LoggerWithoutTimestamp { | ||
constructor() { | ||
this.prefix = cluster.isMaster ? 'master' : 'worker'; | ||
} | ||
writeLine() { | ||
this._write('info', Array.prototype.slice.apply(arguments)); | ||
} | ||
|
||
writeError() { | ||
this._write('error', Array.prototype.slice.apply(arguments)); | ||
} | ||
|
||
_write(level, args) { | ||
args[0] = `[${level}][${this.prefix}] ${args[0]}`; | ||
console.log.apply(console, args); | ||
} | ||
} | ||
|
||
function writeAppInitializedWhenReady(logger) { | ||
let timeout; | ||
|
||
timeout = setInterval(function() { | ||
logger.writeLine('waiting backend'); | ||
if (fs.existsSync('/tmp/backend-initialized')) { | ||
logger.writeLine('backend is up. let heroku know the app is ready'); | ||
fs.writeFileSync('/tmp/app-initialized', 'hello'); | ||
clearInterval(timeout); | ||
} else { | ||
logger.writeLine('backend is still not up'); | ||
} | ||
}, 1000); | ||
} | ||
|
||
var logger = new LoggerWithoutTimestamp(); | ||
|
||
let server = new FastBootAppServer({ | ||
distPath: 'dist', | ||
port: 9000, | ||
ui: logger, | ||
}); | ||
|
||
if (!cluster.isWorker) { | ||
writeAppInitializedWhenReady(logger); | ||
} | ||
|
||
server.start(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export default { | ||
name: 'ajax-service', | ||
initialize() { | ||
// This is to override Fastboot's initializer which prevents ember-fetch from working | ||
// https://github.com/ember-fastboot/ember-cli-fastboot/blob/master/fastboot/initializers/ajax.js | ||
// https://github.com/ember-cli/ember-fetch#ajax-service | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ember: node fastboot.js | ||
api: ./target/release/server |
Oops, something went wrong.