Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add magda-backed build #290

Open
wants to merge 41 commits into
base: terriajs7
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
c6b103a
Experiment with config and catalog files via http requests.
mwu2018 Jan 16, 2019
3460bcc
Get config data from magda gateway.
mwu2018 Jan 23, 2019
741aaa9
Revised README.md.
mwu2018 Jan 23, 2019
345dc1a
Revised README.md.
mwu2018 Jan 23, 2019
451e9d8
Removed unwanted files.
mwu2018 Jan 23, 2019
860b833
Removed obsolete code.
mwu2018 Jan 23, 2019
12050d8
Updated comment.
mwu2018 Jan 23, 2019
79f0dd9
Removed unwanted files.
mwu2018 Jan 23, 2019
8041143
Refactored to use default terria tenant record in Magda.
mwu2018 Jan 23, 2019
5f2f492
Accept tenant id from query parameter.
mwu2018 Jan 23, 2019
9791cd1
Use domain name as registry record id.
mwu2018 Jan 24, 2019
710c1b2
Use .env to control the building of TerriaMap. Build TerriaMap withou…
mwu2018 Jan 25, 2019
da07af9
Added a missing dependency.
mwu2018 Jan 25, 2019
195e4f8
minor bug fix
mwu2018 Jan 25, 2019
bf93605
Minor changes.
mwu2018 Jan 25, 2019
4b47429
Revised README.md.
mwu2018 Jan 25, 2019
5cac93a
Added links in README.md.
mwu2018 Jan 25, 2019
07862b8
Revised README.md.
mwu2018 Jan 25, 2019
b5be6ae
Revised README.md.
mwu2018 Jan 29, 2019
84d0fa2
Revised README.md.
mwu2018 Jan 29, 2019
d483bea
Let Magda gateway proxy the Terria Map server.
mwu2018 Jan 30, 2019
29c9ec2
Corrected typo.
mwu2018 Jan 30, 2019
73d5c33
Fixed a broken link.
mwu2018 Jan 30, 2019
16ceb27
Added a new magda config json file.
mwu2018 Jan 30, 2019
078d20f
cosmetic change
mwu2018 Jan 30, 2019
bfa5ec8
Revised README.md.
mwu2018 Jan 30, 2019
05530e6
Refactored and added customised about page for each tenant.
mwu2018 Jan 31, 2019
2521d16
bug fixes: uri path should be relative.
mwu2018 Feb 1, 2019
13a59a6
Using generic record id "terria_map".
mwu2018 Feb 20, 2019
1199b12
Revised README.md.
mwu2018 Feb 20, 2019
602e44c
Updated README.md.
mwu2018 Feb 27, 2019
cfa213d
Merge branch 'master' into withMagda
mwu2018 Mar 21, 2019
8f424df
Added magda-terria-minikube.yml.
mwu2018 Mar 26, 2019
703a4b4
Minor revision.
mwu2018 Mar 26, 2019
774e1d0
Updated README.md.
mwu2018 Mar 28, 2019
e676707
Updated README.md.
mwu2018 Mar 28, 2019
c4f7781
Updated README.md.
mwu2018 Apr 2, 2019
59dc9f2
Added a missing file.
mwu2018 Apr 2, 2019
f2bdeb8
Updated README.md.
mwu2018 Apr 4, 2019
3043a77
Updated README.md and some sample json files.
mwu2018 May 2, 2019
96454b5
Merged branch 'master' into withMagda and resolved conflicts:
mwu2018 May 2, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ wwwroot/privateconfig.json
deploy/packages/
deploy/work/
packages/
.env
25 changes: 25 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Server",
"args": [
"${workspaceFolder}/node_modules/terriajs-server/lib/app.js",
"--config-file", "devserverconfig.json",
"--public", "false"
]
},
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:3001",
"webRoot": "${workspaceFolder}"
}
]
}
344 changes: 344 additions & 0 deletions README.md

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions buildprocess/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
'use strict';

/*global require*/
var webpack = require('webpack');
const Dotenv = require('dotenv-webpack');

var configureWebpackForTerriaJS = require('terriajs/buildprocess/configureWebpack');
var MiniCssExtractPlugin = require('mini-css-extract-plugin');
var path = require('path');
Expand Down Expand Up @@ -100,7 +103,15 @@ module.exports = function(devMode, hot) {
]
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': devMode ? '"development"' : '"production"'
}
}),

new Dotenv(),
new MiniCssExtractPlugin({filename: "TerriaMap.css", disable: hot, ignoreOrder: true, allChunks: true})

],
resolve: {
alias: {},
Expand Down
16 changes: 15 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,25 @@ if (process.env.NODE_ENV !== "production" && module.hot) {
document.styleSheets[0].disabled = true;
}


var theConfig = 'config.json';
if (process.env.MAGDA_GATEWAY) {
var webDomainName = window.location.hostname;
console.debug(`webDomainName = ${webDomainName}`);
theConfig = `api/v0/registry/records/terria_map/aspects/terria-config`;
}

console.debug(`theConfig = ${theConfig}`);

module.exports = terria.start({

// If you don't want the user to be able to control catalog loading via the URL, remove the applicationUrl property below
// as well as the call to "updateApplicationOnHashChange" further down.
applicationUrl: window.location,
configUrl: 'config.json',

// If it is a pure file name, e.g. 'config.json', it is assumed to be located at TerriaMap under the
// directory of wwwwroot, e.g. wwwroot/config.json
configUrl: theConfig,
shareDataService: new ShareDataService({
terria: terria
})
Expand Down
12 changes: 10 additions & 2 deletions lib/Views/AboutButton.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import React from 'react';

import MenuButton from 'terriajs/lib/ReactViews/Map/MenuButton';

export default function AboutButton() { return (<MenuButton caption="About" href="about.html"/>)};
export default function AboutButton() {
let theLink = "about.html";
if (process.env.MAGDA_GATEWAY) {
const webDomainName = window.location.hostname;
theLink = "api/v0/content/" + webDomainName + "/about.html";
console.debug("about ref = " + theLink);
}

return (<MenuButton caption="About" href={theLink} />)
};
3 changes: 2 additions & 1 deletion lib/Views/UserInterface.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import MenuItem from 'terriajs/lib/ReactViews/StandardUserInterface/customizable
import PropTypes from 'prop-types';
import React from 'react';
import RelatedMaps from './RelatedMaps';
import AboutButton from './AboutButton';
import SplitPoint from 'terriajs/lib/ReactViews/SplitPoint';
import StandardUserInterface from 'terriajs/lib/ReactViews/StandardUserInterface/StandardUserInterface.jsx';
import version from '../../version';
Expand All @@ -26,7 +27,7 @@ export default function UserInterface(props) {
<StandardUserInterface {... props} version={version}>
<Menu>
<RelatedMaps viewState={props.viewState} />
<MenuItem caption="About" href="about.html" key="about-link"/>
<AboutButton viewState={props.viewState} />
</Menu>
<Nav>
<MeasureTool terria={props.viewState.terria} key="measure-tool"/>
Expand Down
53 changes: 53 additions & 0 deletions magda/deploy/magda-terria-minikube.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
global:
externalUrl: http://admin-withterria.dev.magda.io.local:30100
rollingUpdate:
maxUnavailable: 1
exposeNodePorts: true
image:
repository: "localhost:5000/data61"
tag: "latest"
pullPolicy: Always
noDbAuth: true
useCloudSql: false
useCombinedDb: true
enablePriorityClass: false

tags:
all: false
gateway: true
registry-api: true
combined-db: true
authorization-api: true
registry-db: true
authorization-db: true
session-db: true

registry-api:
skipAuthorization: true

gateway:
ckanRedirectionDomain: "ckan.data.gov.au"
ckanRedirectionPath: ""
enableCkanRedirection: true
enableAuthEndpoint: true
cors:
credentials: true
origin: true
auth:
facebookClientId: "173073926555600"
googleClientId: "275237095477-f7ej2gsvbl2alb8bcqcn7r5jk0ur719p.apps.googleusercontent.com"
ckanAuthenticationUrl: https://data.gov.au/data
enableMultiTenants: true
magdaAdminPortalName: admin-withterria.dev.magda.io.local
web: http://terria-map:3001
csp:
directives:
scriptSrc:
- "''self''"
- "''unsafe-inline''"
- "*.dev.magda.io.local"
- "https://cdn.polyfill.io"
- "https://dev.virtualearth.net"
- browser-update.org
objectSrc:
- "''none''"
100 changes: 100 additions & 0 deletions magda/deploy/preview-terria-map.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
global:
rollingUpdate:
maxUnavailable: 1000
image:
imagePullSecret: "regcred"
pullPolicy: Always
exposeNodePorts: false
enablePriorityClass: false

tags:
all: true
ingress: true
priorities: false

ingress:
ingressClass: nginx
enableTls: true
useDefaultCertificate: true

registry-api:
skipAuthorization: false

gateway:
ckanRedirectionDomain: "ckan.data.gov.au"
ckanRedirectionPath: ""
enableCkanRedirection: true
enableAuthEndpoint: true
enableHttpsRedirection: true
auth:
facebookClientId: "173073926555600"
googleClientId: "275237095477-f7ej2gsvbl2alb8bcqcn7r5jk0ur719p.apps.googleusercontent.com"
ckanAuthenticationUrl: https://data.gov.au/data
autoscaler:
enabled: false
enableMultiTenants: true
magdaAdminPortalName: admin-withterria.dev.magda.io
web: http://terria-map:3001
helmet:
frameguard: false
cors:
credentials: true
origin: true
csp:
directives:
scriptSrc:
- "''self''"
- "''unsafe-inline''"
- "*.dev.magda.io"
- "https://cdn.polyfill.io"
- "https://dev.virtualearth.net"
- browser-update.org
objectSrc:
- "''none''"
reportUri: https://sdga.report-uri.com/r/d/csp/enforce

combined-db:
waleBackup:
method: WAL
readOnly: "TRUE"
recoveryMode: "immediate"
gsPrefix: "gs://magda-postgres-backups-asia/dev"
googleApplicationCreds:
secretName: storage-account-credentials
fileName: db-service-account-private-key.json
data:
storage: 250Gi
resources:
limits:
cpu: 2000m

elasticsearch:
data:
heapSize: 500m
pluginsInstall: "repository-gcs"
backup:
googleApplicationCreds:
secretName: storage-account-credentials
fileName: db-service-account-private-key.json
indexer:
resources:
requests:
cpu: 100m
memory: 0
readSnapshots: false
makeSnapshots: false
elasticsearch:
useGcsSnapshots: true
gcsSnapshotBucket: "magda-es-snapshots-dev"
gcsSnapshotClient: "default"

web-server:
fallbackUrl: "https://data.gov.au"
featureFlags:
cataloguing: true

correspondence-api:
defaultRecipient: "[email protected]"
alwaysSendToDefaultRecipient: true
smtpHostname: "smtp.mailgun.org"
smtpPort: 2525
31 changes: 31 additions & 0 deletions magda/registry/aspects/terria-catalog.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"id": "terria-catalog.json",
"tenantId": "1",
"name": "schema for terria catalog",
"jsonSchema": {
"type": "object",
"title": "Aspect for a terria caltalog record",
"$schema": "http://json-schema.org/schema#",
"homeCamera": {
"type": "object",
"north": {
"type": "double"
},
"east": {
"type": "double"
},
"south": {
"type": "double"
},
"west": {
"type": "double"
}
},
"catalog": {
"type": "array",
"items": {
"type": "object"
}
}
}
}
54 changes: 54 additions & 0 deletions magda/registry/aspects/terria-config.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"id": "terria-config",
"tenantId": "1",
"name": "config for terria",
"jsonSchema": {
"type": "object",
"title": "Aspect for a config record for terria map",
"$schema": "http://json-schema.org/schema#",
"parameters": {
"type": "object",
"title": "parameters for a config",
"disclaimer": {
"type": "object",
"text": {
"type": "string"
},
"url": {
"type": "string"
}
},
"appName": {
"type": "string"
},
"brandBarElements": {
"type": "array",
"items": {
"type": "string"
}
},
"supportEmail": {
"type": "string"
},
"proj4ServiceBaseUrl": {
"type": "string"
},
"feedbackUrl": {
"type": "string"
},
"mobileDefaultViewerMode": {
"type": "string"
},
"experimentalFeatures": {
"type": "boolean"
}
},
"initializationUrls": {
"type": "array",
"title": "Intial catalog files to be loaded by default.",
"items": {
"type": "string"
}
}
}
}
Loading