Skip to content

Commit 7c228f6

Browse files
Turker TekeTurker Teke
authored andcommitted
update node to 14, update cog postprocessing step
1 parent 2b6652e commit 7c228f6

2 files changed

Lines changed: 58 additions & 60 deletions

File tree

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ USER root
88
RUN printf "deb http://old-releases.ubuntu.com/ubuntu/ hirsute main restricted\ndeb http://old-releases.ubuntu.com/ubuntu/ hirsute-updates main restricted\ndeb http://old-releases.ubuntu.com/ubuntu/ hirsute universe\ndeb http://old-releases.ubuntu.com/ubuntu/ hirsute-updates universe\ndeb http://old-releases.ubuntu.com/ubuntu/ hirsute multiverse\ndeb http://old-releases.ubuntu.com/ubuntu/ hirsute-updates multiverse\ndeb http://old-releases.ubuntu.com/ubuntu/ hirsute-backports main restricted universe multiverse" > /etc/apt/sources.list
99

1010
RUN apt-get update && apt-get install -y curl gpg-agent
11-
RUN curl --silent --location https://deb.nodesource.com/setup_10.x | bash -
12-
RUN apt-get install -y nodejs npm unzip p7zip-full && npm install -g nodemon && \
11+
RUN curl --silent --location https://deb.nodesource.com/setup_14.x | bash -
12+
RUN apt-get install -y nodejs unzip p7zip-full && npm install -g nodemon && \
1313
ln -s /code/SuperBuild/install/bin/untwine /usr/bin/untwine && \
1414
ln -s /code/SuperBuild/install/bin/entwine /usr/bin/entwine && \
1515
ln -s /code/SuperBuild/install/bin/pdal /usr/bin/pdal
@@ -20,6 +20,6 @@ RUN mkdir /var/www
2020
WORKDIR "/var/www"
2121
COPY . /var/www
2222

23-
RUN npm install && mkdir tmp
23+
RUN npm install --production && mkdir tmp
2424

2525
ENTRYPOINT ["/usr/bin/node", "/var/www/index.js"]

libs/processRunner.js

Lines changed: 55 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ let logger = require('./logger');
2525
let utils = require('./utils');
2626

2727

28-
function makeRunner(command, args, requiredOptions = [], outputTestFile = null, skipOnTest = true){
29-
return function(options, done, outputReceived){
30-
for (let requiredOption of requiredOptions){
28+
function makeRunner(command, args, requiredOptions = [], outputTestFile = null, skipOnTest = true) {
29+
return function(options, done, outputReceived) {
30+
for (let requiredOption of requiredOptions) {
3131
assert(options[requiredOption] !== undefined, `${requiredOption} must be defined`);
3232
}
3333

@@ -37,24 +37,24 @@ function makeRunner(command, args, requiredOptions = [], outputTestFile = null,
3737
logger.info(`About to run: ${command} ${commandArgs.join(" ")}`);
3838
if (outputReceived !== undefined) outputReceived(`About to run: ${command} ${commandArgs.join(" ")}`);
3939

40-
if (config.test && skipOnTest){
40+
if (config.test && skipOnTest) {
4141
logger.info("Test mode is on, command will not execute");
4242

43-
if (outputTestFile){
43+
if (outputTestFile) {
4444
fs.readFile(path.resolve(__dirname, outputTestFile), 'utf8', (err, text) => {
45-
if (!err){
46-
if (outputReceived !== undefined){
45+
if (!err) {
46+
if (outputReceived !== undefined) {
4747
let lines = text.split("\n");
4848
lines.forEach(line => outputReceived(line));
4949
}
50-
50+
5151
done(null, 0, null);
52-
}else{
52+
} else {
5353
logger.warn(`Error: ${err.message}`);
5454
done(err);
5555
}
5656
});
57-
}else{
57+
} else {
5858
done(null, 0, null);
5959
}
6060

@@ -64,7 +64,7 @@ function makeRunner(command, args, requiredOptions = [], outputTestFile = null,
6464
// Launch
6565
const env = utils.clone(process.env);
6666
env.LD_LIBRARY_PATH = path.join(config.odm_path, "SuperBuild", "install", "lib");
67-
67+
6868
let cwd = undefined;
6969
if (options.cwd) cwd = options.cwd;
7070

@@ -74,12 +74,12 @@ function makeRunner(command, args, requiredOptions = [], outputTestFile = null,
7474
.on('exit', (code, signal) => done(null, code, signal))
7575
.on('error', done);
7676

77-
if (outputReceived !== undefined){
77+
if (outputReceived !== undefined) {
7878
childProcess.stdout.on('data', chunk => outputReceived(chunk.toString()));
7979
childProcess.stderr.on('data', chunk => outputReceived(chunk.toString()));
80-
}else{
81-
childProcess.stdout.on('data', () => {});
82-
childProcess.stderr.on('data', () => {});
80+
} else {
81+
childProcess.stdout.on('data', () => { });
82+
childProcess.stderr.on('data', () => { });
8383
}
8484

8585
return childProcess;
@@ -88,66 +88,64 @@ function makeRunner(command, args, requiredOptions = [], outputTestFile = null,
8888

8989
module.exports = {
9090
runPostProcessingScript: makeRunner(path.join(__dirname, "..", "scripts", "postprocess.sh"),
91-
function(options){
92-
return [options.projectFolderPath];
93-
},
94-
["projectFolderPath"]),
95-
96-
sevenZip: makeRunner("7z", function(options){
97-
return ["a", "-mx=0", "-y", "-r", "-bd", options.destination].concat(options.pathsToArchive);
91+
function(options) {
92+
return [options.projectFolderPath];
9893
},
94+
["projectFolderPath"]),
95+
96+
sevenZip: makeRunner("7z", function(options) {
97+
return ["a", "-mx=0", "-y", "-r", "-bd", options.destination].concat(options.pathsToArchive);
98+
},
9999
["destination", "pathsToArchive", "cwd"],
100100
null,
101101
false),
102102

103-
sevenUnzip: makeRunner("7z", function(options){
104-
let cmd = "x"; // eXtract files with full paths
105-
if (options.noDirectories) cmd = "e"; //Extract files from archive (without using directory names)
103+
sevenUnzip: makeRunner("7z", function(options) {
104+
let cmd = "x"; // eXtract files with full paths
105+
if (options.noDirectories) cmd = "e"; //Extract files from archive (without using directory names)
106106

107-
return [cmd, "-aoa", "-bd", "-y", `-o${options.destination}`, options.file];
108-
},
107+
return [cmd, "-aoa", "-bd", "-y", `-o${options.destination}`, options.file];
108+
},
109109
["destination", "file"],
110110
null,
111111
false),
112112

113-
unzip: makeRunner("unzip", function(options){
114-
const opts = options.noDirectories ? ["-j"] : [];
115-
return opts.concat(["-qq", "-o", options.file, "-d", options.destination]);
116-
},
113+
unzip: makeRunner("unzip", function(options) {
114+
const opts = options.noDirectories ? ["-j"] : [];
115+
return opts.concat(["-qq", "-o", options.file, "-d", options.destination]);
116+
},
117117
["destination", "file"],
118118
null,
119119
false),
120120

121-
runPotreeConverter: makeRunner("PotreeConverter", function (options) {
121+
runPotreeConverter: makeRunner("PotreeConverter", function(options) {
122122
return [options.input, "-o", options.outDir];
123123
}, ["input", "outDir"],
124124
null,
125125
false),
126126

127-
runGenerateCog: makeRunner("gdal_translate", function (options) {
127+
runGenerateCog: makeRunner("rio", function(options) {
128128
const params = [
129-
options.inputPath,
130-
options.outputPath,
131-
"-of", "COG",
132-
"-co", "BLOCKSIZE=256",
133-
"-co", "COMPRESS=DEFLATE",
134-
"-co", "BIGTIFF=IF_SAFER",
135-
"-co", "RESAMPLING=NEAREST",
136-
"-co", "TILING_SCHEME=GoogleMapsCompatible"
129+
"cogeo",
130+
"create",
131+
"--blocksize", "256",
132+
"--web-optimized",
133+
options.inputPath,
134+
options.outputPath,
137135
];
138136

139137
return params;
140138
}, ["inputPath", "outputPath"],
141-
null,
142-
false),
139+
null,
140+
false),
143141

144-
runIfcConverter: makeRunner("IfcConvert", function (options) {
142+
runIfcConverter: makeRunner("IfcConvert", function(options) {
145143
return [options.inputFile, options.outputFile];
146-
}, ["inputFile", "outputFile"],
147-
null,
148-
false),
144+
}, ["inputFile", "outputFile"],
145+
null,
146+
false),
149147

150-
runNxsBuild: makeRunner("nxsbuild", function (options) {
148+
runNxsBuild: makeRunner("nxsbuild", function(options) {
151149
return [
152150
options.inputOBJFile,
153151
"-m",
@@ -156,17 +154,17 @@ module.exports = {
156154
options.outputFile,
157155
"-c",
158156
];
159-
}, ["inputOBJFile", "inputMTLFile", "outputFile"],
160-
null,
161-
false),
157+
}, ["inputOBJFile", "inputMTLFile", "outputFile"],
158+
null,
159+
false),
162160

163-
runNxsCompress: makeRunner("nxscompress", function (options) {
161+
runNxsCompress: makeRunner("nxscompress", function(options) {
164162
return [options.inputFile, "-o", options.outputFile];
165-
}, ["inputFile", "outputFile"],
166-
null,
167-
false),
163+
}, ["inputFile", "outputFile"],
164+
null,
165+
false),
168166

169-
runFixBB: makeRunner("lasinfo", function (options) {
167+
runFixBB: makeRunner("lasinfo", function(options) {
170168
return ['-i', options.inputFile, '-repair_bb'];
171169
}, ['inputFile'],
172170
null,
@@ -176,7 +174,7 @@ module.exports = {
176174
return ['translate', '-i', options.inputFile, '-o', options.inputFile, 'smrf', 'range', '--filters.range.limits=Classification[2:2]'];
177175
}, ['inputFile'],
178176
null,
179-
false),
177+
false),
180178

181179
runFindSrs: makeRunner('/usr/bin/node', options => {
182180
return [path.join(__dirname, "..", "scripts", "findSrs.js"), options.inputFile, options.outputFile];

0 commit comments

Comments
 (0)