mirror of
https://github.com/outline/outline.git
synced 2026-12-01 09:22:14 +03:00
Merge branch 'main' into collaborative-editing
This commit is contained in:
commit
26835cb7c4
5 files changed
+27
-4
No files matched your search
Vendored
+3
@@ -3,6 +3,9 @@ declare var process: {
|
||||
exit: (code?: number) => void,
|
||||
cwd: () => string,
|
||||
argv: Array<string>,
|
||||
on: (event: string, listener: Function) => void,
|
||||
once: (event: string, listener: Function) => void,
|
||||
off: (event: string, listener: Function) => void,
|
||||
env: {
|
||||
[string]: string,
|
||||
},
|
||||
|
||||
@@ -162,6 +162,7 @@
|
||||
"socket.io": "^2.4.0",
|
||||
"socket.io-redis": "^5.4.0",
|
||||
"socketio-auth": "^0.1.1",
|
||||
"stoppable": "^1.1.0",
|
||||
"string-replace-to-array": "^1.0.3",
|
||||
"styled-components": "^5.2.3",
|
||||
"styled-components-breakpoint": "^2.1.1",
|
||||
|
||||
+18
-2
@@ -7,7 +7,9 @@ import compress from "koa-compress";
|
||||
import helmet from "koa-helmet";
|
||||
import logger from "koa-logger";
|
||||
import onerror from "koa-onerror";
|
||||
import Router from "koa-router";
|
||||
import { uniq } from "lodash";
|
||||
import stoppable from "stoppable";
|
||||
import throng from "throng";
|
||||
import services from "./services";
|
||||
import { initTracing } from "./tracing";
|
||||
@@ -35,12 +37,14 @@ const serviceNames = uniq(
|
||||
.map((service) => service.trim())
|
||||
);
|
||||
|
||||
async function start() {
|
||||
async function start(id, disconnect) {
|
||||
const app = new Koa();
|
||||
const server = http.createServer(app.callback());
|
||||
const server = stoppable(http.createServer(app.callback()));
|
||||
const httpLogger = debug("http");
|
||||
const log = debug("server");
|
||||
const router = new Router();
|
||||
|
||||
// install basic middleware shared by all services
|
||||
app.use(logger((str, args) => httpLogger(str)));
|
||||
app.use(compress());
|
||||
app.use(helmet());
|
||||
@@ -69,6 +73,10 @@ async function start() {
|
||||
await init(app, server);
|
||||
}
|
||||
|
||||
// install health check endpoint for all services
|
||||
router.get("/_health", (ctx) => (ctx.body = "OK"));
|
||||
app.use(router.routes());
|
||||
|
||||
server.on("error", (err) => {
|
||||
throw err;
|
||||
});
|
||||
@@ -79,6 +87,14 @@ async function start() {
|
||||
});
|
||||
|
||||
server.listen(normalizedPortFlag || env.PORT || "3000");
|
||||
|
||||
process.once("SIGTERM", shutdown);
|
||||
process.once("SIGINT", shutdown);
|
||||
|
||||
function shutdown() {
|
||||
console.log("\n> Stopping server");
|
||||
server.stop(disconnect);
|
||||
}
|
||||
}
|
||||
|
||||
throng({
|
||||
|
||||
@@ -93,8 +93,6 @@ koa.use(
|
||||
})
|
||||
);
|
||||
|
||||
router.get("/_health", (ctx) => (ctx.body = "OK"));
|
||||
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
router.get("/static/*", async (ctx) => {
|
||||
ctx.set({
|
||||
|
||||
@@ -13154,6 +13154,11 @@ stealthy-require@^1.1.1:
|
||||
resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b"
|
||||
integrity sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=
|
||||
|
||||
stoppable@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/stoppable/-/stoppable-1.1.0.tgz#32da568e83ea488b08e4d7ea2c3bcc9d75015d5b"
|
||||
integrity sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw==
|
||||
|
||||
stream-browserify@^2.0.1:
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-2.0.2.tgz#87521d38a44aa7ee91ce1cd2a47df0cb49dd660b"
|
||||
|
||||
Reference in new issue
Block a user