Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

as much of the rpm install as possible right now, finish the rest on linux

Mike McGann1ca32c24f438
diff --git a/package.json b/package.json
index d4eaab527..9de625cf6 100644
--- a/package.json
+++ b/package.json
@@ -27,15 +27,15 @@
},
"scripts": {
"browserstack": "node e2e/browserstack.js -c e2e/browserstack.conf.js -e browserstack ",
- "build": "npm run build:config && npm run build:js && npm run build:css",
+ "build": "run-s clean getcapabilities build:config build:js build:css",
"build:css": "node ./tasks/buildCSS",
"build:config": "bash -c 'tasks/buildOptions.sh ${1}' 0 && node ./tasks/config.js",
"docker:build": "docker build -t worldview rpm",
- "docker:shell": "docker run --rm --name worldview --mount type=bind,source=\"$(pwd)\",target=/build -p 3333:3000 -it worldview /bin/bash && true",
+ "docker:shell": "docker run --rm --name worldview --mount type=bind,source=\"$(pwd)\",target=/build -p 3333:80 -it worldview /bin/bash ; true",
"build:js": "node ./tasks/buildJS",
"build:tests": "node ./tasks/buildJS --tests",
"clean": "node ./tasks/clean.js",
- "dist": "npm run clean && NODE_ENV=production npm run build && node ./tasks/dist.js",
+ "dist": "NODE_ENV=production npm run build && node ./tasks/dist.js",
"distclean": "npm run clean && node ./tasks/distclean.js",
"e2e": "run-s --continue-on-error --silent e2e:*",
"e2e:chrome": "nightwatch -e chrome",
@@ -50,8 +50,8 @@
"python": "virtualenv .python && run-script-os",
"python:darwin:linux": "PATH=.python/bin:${PATH} pip install -r requirements.txt",
"python:win32": "bash -c 'PATH=.python/Scripts:${PATH} pip install -r requirements.txt'",
- "rebuild": "npm run clean && npm run getcapabilities && npm run build",
"report": "node e2e/create-report.js",
+ "rpm": "npm run docker:build && npm run distclean && docker run --rm --name worldview --mount type=bind,source=\"$(pwd)\",target=/build -it worldview /bin/bash -c 'cd /build ; npm install ; node rpm/buildRPM.js'",
"start": "node ./tasks/start.js",
"test": "npm run lint && run-p test:server test:run",
"test:server": "buster-server -c",
diff --git a/rpm/Dockerfile b/rpm/Dockerfile
index 8ac61b7ca..2ce9e0c4d 100644
--- a/rpm/Dockerfile
+++ b/rpm/Dockerfile
@@ -4,6 +4,7 @@ RUN yum install -y epel-release && \
yum install -y https://centos6.iuscommunity.org/ius-release.rpm && \
yum install -y \
"@Development Tools" \
+ httpd \
python27 \
python27-virtualenv \
git \
@@ -21,3 +22,5 @@ RUN cd /usr/local/stow && \
RUN npm install run-script-os -g
RUN ln -s /usr/bin/virtualenv-2.7 /usr/bin/virtualenv
+
+EXPOSE 80
diff --git a/rpm/buildRPM.js b/rpm/buildRPM.js
index 138370db3..e562c9633 100755
--- a/rpm/buildRPM.js
+++ b/rpm/buildRPM.js
@@ -5,20 +5,26 @@ const pkg = require('../package.json');
const moment = require('moment');
let buildNumber = moment.utc().format('YYMMDDHHmmss');
+const homedir = require('os').homedir();
+
+// https://github.com/docker/for-mac/issues/2296
+
+shell.exec('npm run dist');
console.log('Preparing RPM build');
-shell.mkdir('-p', 'build/rpm/SOURCES');
-shell.cp('dist/worldview.tar.gz', 'build/rpm/SOURCES');
-shell.cp('rpm/httpd.conf', 'build/rpm/SOURCES');
-shell.mkdir('-p', 'build/rpm/SPECS');
-shell.cp('rpm/worldview.spec', 'build/rpm/SPECS');
+shell.rm('-rf', `${homedir}/rpmbuild`);
+shell.mkdir('-p', `${homedir}/rpmbuild/SOURCES`);
+shell.cp('dist/worldview.tar.gz', `${homedir}/rpmbuild/SOURCES`);
+shell.cp('rpm/httpd.conf', `${homedir}/rpmbuild/SOURCES`);
+shell.mkdir('-p', `${homedir}/rpmbuild/SPECS`);
+shell.cp('rpm/worldview.spec', `${homedir}/rpmbuild/SPECS`);
console.log('Branding');
-let applyTo = 'build/rpm/SPECS/worldview.spec';
+let applyTo = `${homedir}/rpmbuild/SPECS/worldview.spec`;
shell.sed('-i', /@WORLDVIEW@/g, 'worldview', applyTo);
shell.sed('-i', /@BUILD_VERSION@/g, pkg.version, applyTo);
shell.sed('-i', /@BUILD_NUMBER@/g, buildNumber, applyTo);
console.log('Building RPM');
-let pwd = process.env.PWD;
-shell.exec(`rpmbuild --define \\"_topdir ${pwd}/build/rpm\\" -ba build/rpm/SPECS/worldview.spec`);
+shell.exec(`rpmbuild -ba ${homedir}/rpmbuild/SPECS/worldview.spec`);
+shell.cp(`${homedir}/rpmbuild/RPMS/noarch/*`, 'dist');
diff --git a/rpm/worldview.spec b/rpm/worldview.spec
index e03a8872b..f1e48afd4 100644
--- a/rpm/worldview.spec
+++ b/rpm/worldview.spec
@@ -49,11 +49,6 @@ rm -rf %{buildroot}
%{_datadir}/@WORLDVIEW@
%config(noreplace) %{httpdconfdir}/@[email protected]
-
-%files debug
-%{_datadir}/@WORLDVIEW@-debug
-%config(noreplace) %{httpdconfdir}/@[email protected]
-
%post
if [ $1 -gt 0 ] ; then
if /sbin/service httpd status >/dev/null ; then
@@ -61,23 +56,9 @@ if [ $1 -gt 0 ] ; then
fi
fi
-%post debug
-if [ $1 -gt 0 ] ; then
- if /sbin/service httpd status >/dev/null ; then
- /sbin/service httpd reload
- fi
-fi
-
%postun
if [ $1 -eq 0 ] ; then
if /sbin/service httpd status >/dev/null ; then
/sbin/service httpd reload
fi
fi
-
-%postun debug
-if [ $1 -eq 0 ] ; then
- if /sbin/service httpd status >/dev/null ; then
- /sbin/service httpd reload
- fi
-fi
diff --git a/tasks/buildRPM.sh b/tasks/buildRPM.sh
deleted file mode 100755
index f1015e164..000000000
--- a/tasks/buildRPM.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/bash
-
-# Prepare rpm sources
-mkdir -p build/rpm/{SOURCES,SPECS}
-cp worldview.spec build/rpm/SPECS
-cp dist/*.tar.bz2 build/rpm/SOURCES
-cp *.conf build/rpm/SOURCES
-
-# Replace placeholders in rpm spec
-npx grunt rpm-placeholders
-
-# Build rpm
-rpmbuild --define "_topdir $PWD/build/rpm" -ba build/rpm/SPECS/worldview.spec
diff --git a/tasks/clean.js b/tasks/clean.js
index 5f23e0bcd..e3c2ef978 100755
--- a/tasks/clean.js
+++ b/tasks/clean.js
@@ -2,8 +2,15 @@
const shell = require('shelljs');
-shell.rm('-rf', 'build');
-shell.rm('-rf', 'dist');
-shell.rm('-rf', 'web/brand');
-shell.rm('-rf', 'web/build');
-shell.rm('-rf', 'web/config');
+let dirs = [
+ 'build',
+ 'dist',
+ 'web/brand',
+ 'web/build',
+ 'web/config'
+];
+
+dirs.forEach((dir) => {
+ console.log('Removing', dir);
+ shell.rm('-rf', dir);
+});
diff --git a/tasks/distclean.js b/tasks/distclean.js
index 7965c0fab..e666a3ec6 100644
--- a/tasks/distclean.js
+++ b/tasks/distclean.js
@@ -2,5 +2,12 @@
const shell = require('shelljs');
-shell.rm('-rf', 'node_modules');
-shell.rm('-rf', '.python');
+let dirs = [
+ 'node_modules',
+ '.python',
+];
+
+dirs.forEach((dir) => {
+ console.log('Removing', dir);
+ shell.rm('-rf', dir);
+});