Skip to content

Commit

Permalink
Merge pull request #666 from TerriaJS/small-improvements
Browse files Browse the repository at this point in the history
De-duplicate code in gulpfile and fixup helm files
  • Loading branch information
tephenavies authored Apr 18, 2024
2 parents 95f3905 + 6cac4fa commit f5f00f6
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 69 deletions.
3 changes: 0 additions & 3 deletions deploy/helm/docker-registry.yml

This file was deleted.

2 changes: 1 addition & 1 deletion deploy/helm/example-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ global:
rollingUpdate:
maxUnavailable: 1
image:
tag: "0.0.6"
tag: "0.1.1"
4 changes: 0 additions & 4 deletions deploy/helm/kube-registry-proxy.yml

This file was deleted.

10 changes: 6 additions & 4 deletions deploy/helm/terria/charts/terriamap/values.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
nodePort:
image:
#repository: ghcr.io/terriajs
#tag: latest
#full: terrimap:0.0.6
# By default this pulls ghcr.io/terriajs/terrimap:latest
# Set "full" to specify a custom terriamap image to be used
# Or you can set "repository" or "tag" if required
# full: "ghcr.io/terriajs/terriamap:0.1.1"
# repository: ghcr.io/terriajs
# tag: latest
pullPolicy: Always
clientConfig:
initializationUrls:
- helm
- terria
parameters:
bingMapsKey: AkaOmRFtjAb71cXgLwAGtLbj2RpkPKtVqAIroFQsocfurCBILxIeAWPkil7hhRy_
disclaimer:
text: "Disclaimer: This map must not be used for navigation or precise spatial analysis"
url: "http://google.com"
Expand Down
59 changes: 2 additions & 57 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ var fs = require("fs");
var gulp = require("gulp");
var path = require("path");
var PluginError = require("plugin-error");
var terriajsServerGulpTask = require("terriajs/buildprocess/terriajsServerGulpTask");

var watchOptions = {
interval: 1000
Expand Down Expand Up @@ -284,63 +285,7 @@ function checkForDuplicateCesium() {
}
}

gulp.task("terriajs-server", function (done) {
// E.g. gulp terriajs-server --terriajsServerArg port=4000 --terriajsServerArg verbose=true
// or gulp dev --terriajsServerArg port=3000
const { spawn } = require("child_process");
const minimist = require("minimist");
// Arguments written in skewer-case can cause problems (unsure why), so stick to camelCase
const options = minimist(process.argv.slice(2), {
string: ["terriajsServerArg"],
default: { terriajsServerArg: [] }
});

const logFile = fs.openSync("./terriajs-server.log", "w");
const serverArgs = Array.isArray(options.terriajsServerArg)
? options.terriajsServerArg
: [options.terriajsServerArg];
const child = spawn(
"node",
[
require.resolve("terriajs-server/terriajs-server.js"),
...serverArgs.map((arg) => `--${arg}`)
],
{ detached: true, stdio: ["ignore", logFile, logFile] }
);
child.on("exit", (exitCode, signal) => {
done(
new Error(
"terriajs-server quit" +
(exitCode !== null ? ` with exit code: ${exitCode}` : "") +
(signal ? ` from signal: ${signal}` : "") +
"\nCheck terriajs-server.log for more information."
)
);
});
child.on("spawn", () => {
console.log("terriajs-server started - see terriajs-server.log for logs");
});
// Intercept SIGINT, SIGTERM and SIGHUP, cleanup terriajs-server and re-send signal
// May fail to catch some relevant signals on Windows
// SIGINT: ctrl+c
// SIGTERM: kill <pid>
// SIGHUP: terminal closed
process.once("SIGINT", () => {
child.kill("SIGTERM");
process.kill(process.pid, "SIGINT");
});
process.once("SIGTERM", () => {
child.kill("SIGTERM");
process.kill(process.pid, "SIGTERM");
});
process.once("SIGHUP", () => {
child.kill("SIGTERM");
process.kill(process.pid, "SIGHUP");
});
process.on("exit", () => {
child.kill("SIGTERM");
});
});
gulp.task("terriajs-server", terriajsServerGulpTask(3001));

gulp.task("build", gulp.series("copy-terriajs-assets", "build-app"));
gulp.task("release", gulp.series("copy-terriajs-assets", "release-app"));
Expand Down

0 comments on commit f5f00f6

Please sign in to comment.