Skip to content

Commit 47c5d4b

Browse files
committed
Merge branch 'master' into feat/vadc_sprint24
2 parents f05c530 + 58b8322 commit 47c5d4b

File tree

17 files changed

+104
-615
lines changed

17 files changed

+104
-615
lines changed

.github/workflows/ci.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ jobs:
2121
ci:
2222
name: Build Image and Push
2323
uses: uc-cdis/.github/.github/workflows/image_build_push.yaml@master
24+
with:
25+
BUILD_PLATFORMS: "linux/amd64"
2426
secrets:
2527
ECR_AWS_ACCESS_KEY_ID: ${{ secrets.ECR_AWS_ACCESS_KEY_ID }}
2628
ECR_AWS_SECRET_ACCESS_KEY: ${{ secrets.ECR_AWS_SECRET_ACCESS_KEY }}

.storybook/main.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ module.exports = {
33
"../src/**/*.stories.mdx",
44
"../src/**/*.stories.@(js|jsx|ts|tsx)"
55
],
6-
"addons": [
7-
"@storybook/addon-links",
8-
"@storybook/addon-essentials",
9-
"@storybook/addon-interactions"
10-
],
6+
"addons": [],
117
"framework": "@storybook/react"
128
}

Dockerfile

+30-34
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,45 @@
11
# To run: docker run -d --name=dataportal -p 80:80 quay.io/cdis/data-portal
22
# To check running container: docker exec -it dataportal /bin/bash
33

4-
FROM quay.io/cdis/ubuntu:20.04
4+
FROM quay.io/cdis/nodejs-base:master
55

6-
ENV DEBIAN_FRONTEND=noninteractive
76
ENV REACT_APP_PROJECT_ID=search
87

9-
# disable npm 7's brand new update notifier to prevent Portal from stuck at starting up
10-
# see https://github.com/npm/cli/issues/3163
11-
ENV NPM_CONFIG_UPDATE_NOTIFIER=false
12-
13-
RUN apt-get update && apt-get install -y --no-install-recommends \
14-
build-essential \
15-
libssl1.1 \
16-
libgnutls30 \
17-
ca-certificates \
18-
curl \
19-
git \
20-
nginx \
21-
python3 \
22-
time \
23-
vim \
24-
&& curl -sL https://deb.nodesource.com/setup_16.x | bash - \
25-
&& apt-get install -y --no-install-recommends nodejs \
26-
&& apt-get clean \
27-
&& rm -rf /var/lib/apt/lists/* \
28-
&& ln -sf /dev/stdout /var/log/nginx/access.log \
29-
&& ln -sf /dev/stderr /var/log/nginx/error.log \
30-
&& npm install -g npm@8.5
8+
# Install nginx
9+
RUN yum install nginx -y && \
10+
# allows nginx to run on port 80 without being root user
11+
setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx && \
12+
chown -R gen3:gen3 /var/log/nginx && \
13+
# pipe nginx logs to stdout/stderr
14+
ln -sf /dev/stdout /var/log/nginx/access.log && \
15+
ln -sf /dev/stderr /var/log/nginx/error.log && \
16+
mkdir -p /var/lib/nginx/tmp/client_body && \
17+
chown -R gen3:gen3 /var/lib/nginx/ && \
18+
mkdir -p /var/cache/nginx && \
19+
chown -R gen3:gen3 /var/cache/nginx \
20+
&& touch /var/run/nginx.pid \
21+
&& chown -R gen3:gen3 /var/run/nginx.pid
3122

3223
ARG APP=dev
3324
ARG BASENAME
3425

3526
RUN mkdir -p /data-portal
3627
COPY . /data-portal
28+
RUN cp /data-portal/nginx.conf /etc/nginx/conf.d/nginx.conf \
29+
&& chown -R gen3:gen3 /etc/nginx/conf.d \
30+
&& chown -R gen3:gen3 /data-portal
31+
32+
# In standard prod these will be overwritten by volume mounts
33+
# Provided here for ease of use in development and
34+
# non-standard deployment environments
35+
36+
RUN mkdir /mnt/ssl \
37+
&& openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /mnt/ssl/nginx.key -out /mnt/ssl/nginx.crt -subj '/countryName=US/stateOrProvinceName=Illinois/localityName=Chicago/organizationName=CDIS/organizationalUnitName=PlanX/commonName=localhost/emailAddress=ops@cdis.org' \
38+
&& chmod 755 /mnt/ssl/nginx.crt \
39+
&& chmod 755 /mnt/ssl/nginx.key
40+
3741
WORKDIR /data-portal
42+
USER gen3
3843
RUN COMMIT=`git rev-parse HEAD` && echo "export const portalCommit = \"${COMMIT}\";" >src/versions.js \
3944
&& VERSION=`git describe --always --tags` && echo "export const portalVersion =\"${VERSION}\";" >>src/versions.js \
4045
&& /bin/rm -rf .git \
@@ -44,15 +49,6 @@ RUN npm config set unsafe-perm=true \
4449
&& npm run relay \
4550
&& npm run params
4651
# see https://stackoverflow.com/questions/48387040/nodejs-recommended-max-old-space-size
47-
RUN NODE_OPTIONS=--max-old-space-size=3584 NODE_ENV=production time npx webpack build
48-
RUN cp nginx.conf /etc/nginx/conf.d/nginx.conf \
49-
&& rm /etc/nginx/sites-enabled/default
50-
51-
# In standard prod these will be overwritten by volume mounts
52-
# Provided here for ease of use in development and
53-
# non-standard deployment environments
54-
55-
RUN mkdir /mnt/ssl \
56-
&& openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /mnt/ssl/nginx.key -out /mnt/ssl/nginx.crt -subj '/countryName=US/stateOrProvinceName=Illinois/localityName=Chicago/organizationName=CDIS/organizationalUnitName=PlanX/commonName=localhost/emailAddress=ops@cdis.org'
52+
RUN NODE_OPTIONS=--max-old-space-size=3584 NODE_ENV=production npx webpack build
5753

5854
CMD [ "bash", "./dockerStart.sh" ]

data/config/default.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
"explorer": true,
188188
"analysis": false
189189
},
190-
"dataExplorerConfig": {
190+
"explorerConfig": [{
191191
"charts": {
192192
"project": {
193193
"chartType": "count",
@@ -277,7 +277,7 @@
277277
"file_format"
278278
]
279279
}
280-
},
280+
}],
281281
"useArboristUI": false,
282282
"showArboristAuthzOnProfile": false,
283283
"showFenceAuthzOnProfile": true,

data/getTexts.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ function doStringify(value, variables, indent = 0, spaces = 0) {
6565
const objs = value.map(
6666
(item) => `${insertSpace(indent + spaces)}${doStringify(item, variables, indent + spaces, spaces)}`,
6767
).join(`,${ending}`);
68+
// console.log(doWrapping(objs, '[', ']', indent, spaces));
6869
return doWrapping(objs, '[', ']', indent, spaces);
6970
}
7071
if (typeof value === 'string') {
@@ -102,15 +103,23 @@ function buildConfig(appIn, data) {
102103
const app = appIn || process.env.APP || 'default';
103104
const appConfig = data[app] || {};
104105
const defaultConfig = data.default || {};
106+
// don't copy 'explorerConfig' over from default config since that is a non-working example
107+
delete defaultConfig.explorerConfig;
105108
const result = { ...defaultConfig, ...appConfig };
106109
delete result.components;
107110
Object.keys(result).forEach(
108111
(k) => {
109112
if (typeof result[k] === 'object') {
110113
const defaultVal = defaultConfig[k];
111114
const appVal = appConfig[k];
112-
if (defaultVal && appVal && typeof defaultVal === 'object' && typeof appVal === 'object') {
113-
result[k] = { ...defaultVal, ...appVal };
115+
if (defaultVal && appVal) {
116+
if (typeof defaultVal === 'object' && typeof appVal === 'object') {
117+
if (Array.isArray(defaultVal) && Array.isArray(appVal)) {
118+
result[k] = defaultVal.concat(appVal);
119+
} else if (!Array.isArray(defaultVal) && !Array.isArray(appVal)) {
120+
result[k] = { ...defaultVal, ...appVal };
121+
}
122+
}
114123
}
115124
}
116125
},

0 commit comments

Comments
 (0)