Skip to content

Commit

Permalink
Revert "[Experiment] [Novo] Check performance when extracting stuff f…
Browse files Browse the repository at this point in the history
…rom old shell "
  • Loading branch information
damassi committed Nov 11, 2020
1 parent c7e83f2 commit 796e448
Show file tree
Hide file tree
Showing 48 changed files with 584 additions and 1,422 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ dump.rdb
lib-cov
logs
manifest.json
manifest-novo.json
npm-debug.log
pids
results
Expand Down
35 changes: 11 additions & 24 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ WORKDIR /app

# Install system dependencies
RUN apk --no-cache --quiet add \
bash \
build-base \
curl \
git \
python
bash \
build-base \
curl \
git \
python

# ---------------------------------------------------------
# Yarn base
Expand Down Expand Up @@ -126,14 +126,7 @@ COPY .env.oss \
FROM builder-src as builder-assets

# Build application
RUN yarn build:assets

# ---------------------------------------------------------
# Compile novo assets
# ---------------------------------------------------------
FROM builder-src as builder-assets-novo

RUN yarn build:assets:novo
RUN yarn assets

# ---------------------------------------------------------
# Compile server
Expand All @@ -156,10 +149,6 @@ COPY --from=builder-assets /app/manifest.json .
COPY --from=builder-assets /app/public ./public
COPY --from=builder-assets /app/src ./src

# Client (Novo) assets
COPY --from=builder-assets-novo /app/manifest-novo.json .
COPY --from=builder-assets-novo /app/public ./public

# Server assets
COPY --from=builder-server /app/server.dist.js .
COPY --from=builder-server /app/server.dist.js.map .
Expand Down Expand Up @@ -208,9 +197,6 @@ RUN chown deploy:deploy $(pwd)

USER deploy

# Production node modules.
COPY --chown=deploy:deploy --from=yarn-deps /opt/node_modules.prod ./node_modules

# Base code
COPY --chown=deploy:deploy --from=builder /app/data ./data
COPY --chown=deploy:deploy --from=builder /app/package.json .
Expand All @@ -220,15 +206,16 @@ COPY --chown=deploy:deploy --from=builder /app/yarn.lock .

# Client assets
COPY --chown=deploy:deploy --from=builder /app/manifest.json .
COPY --chown=deploy:deploy --from=builder /app/manifest-novo.json .
COPY --chown=deploy:deploy --from=builder /app/public ./public
COPY --chown=deploy:deploy --from=builder /app/src ./src

# Server assets
COPY --chown=deploy:deploy --from=builder /app/server.dist.js .
COPY --chown=deploy:deploy --from=builder /app/server.dist.js.map .

ENTRYPOINT ["/usr/bin/dumb-init", "--"]

# TODO: Reduce production memory, this is not a concern
CMD ["node", "--max_old_space_size=3072", "./server.dist.js"]
# Production node modules.
COPY --chown=deploy:deploy --from=yarn-deps /opt/node_modules.prod ./node_modules

ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["yarn", "start"]
3 changes: 0 additions & 3 deletions hokusai/production.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
Expand Down Expand Up @@ -104,7 +103,6 @@ spec:
layer: application
component: web
type: ClusterIP

---
apiVersion: extensions/v1beta1
kind: Ingress
Expand All @@ -121,4 +119,3 @@ spec:
backend:
serviceName: force-web-internal
servicePort: force-http

4 changes: 0 additions & 4 deletions hokusai/staging.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
Expand Down Expand Up @@ -72,7 +71,6 @@ spec:
operator: In
values:
- foreground

---
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
Expand All @@ -87,7 +85,6 @@ spec:
minReplicas: 2
maxReplicas: 3
targetCPUUtilizationPercentage: 70

---
apiVersion: v1
kind: Service
Expand All @@ -109,7 +106,6 @@ spec:
layer: application
component: web
type: ClusterIP

---
apiVersion: extensions/v1beta1
kind: Ingress
Expand Down
33 changes: 14 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@
"yarn": "1.x.x"
},
"scripts": {
"build": "yarn build:assets && yarn build:assets:novo && yarn build:server",
"build:assets": "NODE_ENV=production BUILD_CLIENT=true yarn webpack",
"build:assets:novo": "NODE_ENV=production BUILD_NOVO_CLIENT=true yarn webpack",
"build:dev": "yarn clean && yarn relay && NODE_ENV=development BUILD_CLIENT=true yarn webpack",
"build:server": "NODE_ENV=production BUILD_SERVER=true yarn webpack",
"bundle-report:assets": "NODE_ENV=production WEBPACK_ANALYZE=true yarn build:assets",
"bundle-report:assets:novo": "NODE_ENV=production WEBPACK_ANALYZE=true yarn build:assets:novo",
"bundle-report:server": "NODE_ENV=production WEBPACK_ANALYZE=true yarn build:server",
"clean": "rm -rf .cache && rm -f manifest.json && rm -f manifest-novo.json && rm -rf public/assets && rm -rf public/assets-novo && echo '[Force] Cleaned build directory'",
"assets": "NODE_ENV=production yarn build",
"build:server": "BUILD_SERVER=true NODE_ENV=production yarn webpack",
"build": "yarn clean && yarn relay && BUILD_CLIENT=true yarn webpack",
"bundle-report": "NODE_ENV=production WEBPACK_ANALYZE=true yarn build",
"bundle-report:dev": "NODE_ENV=development WEBPACK_ANALYZE=true yarn build",
"bundle-report:server": "NODE_ENV=production BUILD_SERVER=true WEBPACK_ANALYZE=true yarn webpack",
"clean": "rm -rf .cache && rm -f manifest.json && rm -rf public/assets && mkdir -p public/assets && echo '[Force] Cleaned build directory'",
"compile": "babel src/v2 --out-dir dist/v2 -s --source-map --extensions '.js,.jsx,.ts,.tsx' --ignore src/v2/**/__tests__",
"cypress:run": "./node_modules/.bin/cypress run",
"cypress": "./node_modules/.bin/cypress open",
Expand All @@ -27,20 +25,18 @@
"prepare": "patch-package",
"prettier-project": "yarn run prettier-write 'src/**/*.{ts,tsx,js,jsx}'",
"prettier-write": "yarn run prettier --write",
"publish-assets:local": "yarn assets && yarn publish-assets",
"publish-assets": "node scripts/uploadToS3.js",
"publish-assets:local": "yarn clean && yarn build:assets && yarn publish-assets",
"relay": "relay-compiler",
"sentry": "scripts/sentry.sh",
"start": "scripts/start.sh",
"start:dev": "concurrently 'yarn start:dev:relay' 'yarn start:dev:server'",
"start:dev:server": "NODE_ENV=development BUILD_CLIENT=true node --inspect --max_old_space_size=3072 -r dotenv/config ./src/index.dev.js",
"start:dev:relay": "NODE_ENV=development yarn relay --watch",
"start:prod": "yarn build:assets && yarn build:server && NODE_ENV=production yarn start",
"start:dev": "NODE_ENV=development BUILD_CLIENT=true node --inspect --max_old_space_size=3072 -r dotenv/config ./src",
"start:prod:local": "NODE_ENV=production node --inspect --max_old_space_size=3072 -r dotenv/config ./server.dist.js",
"start:prod": "yarn assets && yarn build:server && NODE_ENV=production yarn start",
"start": "scripts/start.sh",
"sync-schema": "scripts/sync-schema-pull.sh",
"test": "concurrently 'yarn test:ci:jest:v1' 'yarn test:ci:jest:v2' 'yarn test:ci:mocha'",
"test:acceptance": "scripts/acceptance.sh src/test/acceptance/*.js",
"test:smoke": "scripts/smoke_test.sh",
"test": "concurrently 'yarn test:ci:jest:v1' 'yarn test:ci:jest:v2' 'yarn test:ci:mocha'",
"test:ci:jest:v1": "scripts/jest.sh v1",
"test:ci:jest:v2": "scripts/jest.sh v2",
"test:ci:mocha": "yarn mocha $(find src -name '*.test.js')",
Expand All @@ -56,7 +52,6 @@
"graceful-fs": "4.2.3",
"graphql": "14.5.8",
"htmlparser2": "3.10.1",
"lodash": "4.17.13",
"moment": "2.22.2",
"react": "16.8.6",
"react-dom": "16.8.6",
Expand Down Expand Up @@ -84,6 +79,7 @@
"analytics-node": "2.4.1",
"artsy-eigen-web-association": "git:https://github.com/artsy/artsy-eigen-web-association.git",
"artsy-ezel-components": "artsy/artsy-ezel-components",
"artsy-morgan": "artsy/artsy-morgan",
"async": "3.2.0",
"backbone": "1.3.3",
"backbone-pageable": "1.4.8",
Expand Down Expand Up @@ -128,6 +124,7 @@
"glob": "7.1.3",
"graceful-fs": "4.1.15",
"graphql": "14.5.8",
"heapdump": "0.3.15",
"helmet": "2.3.0",
"history": "4.7.2",
"http-proxy": "1.18.1",
Expand All @@ -154,7 +151,6 @@
"moment": "2.22.2",
"moment-timezone": "0.5.25",
"moment-twitter": "0.2.0",
"morgan": "^1.10.0",
"nib": "1.1.2",
"nock": "9.0.13",
"node-uuid": "1.4.8",
Expand Down Expand Up @@ -252,7 +248,6 @@
"@types/loadable__component": "5.10.0",
"@types/lodash": "4.14.111",
"@types/memoize-one": "3.1.1",
"@types/morgan": "^1.9.2",
"@types/node": "10.12.24",
"@types/prop-types": "15.7.1",
"@types/qrcode.react": "1.0.0",
Expand Down
11 changes: 6 additions & 5 deletions scripts/acceptance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

set -ex

export NODE_ENV=production

if [ ! -f server.dist.js ]; then
yarn build:assets
yarn build:assets:novo
# Build the client assets for testing
export BUILD_CLIENT=true

# CSS is only compiled during a development build?
export NODE_ENV=production

# TODO: We don't need the server to be built here, these tests only rely on assets.
yarn assets
yarn build:server
fi

Expand Down
3 changes: 2 additions & 1 deletion scripts/smoke_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ fi

# # prepare a production build
if [ ! -f server.dist.js ]; then
yarn build:all
yarn assets
yarn build:server
fi

# start server in the background in production mode
Expand Down
2 changes: 1 addition & 1 deletion scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if [ "${NODE_ENV}" != "production" ]; then
OPT+=(--inspect)
fi

yarn relay --watch & BUILD_CLIENT=true exec node "${OPT[@]}" ./src/index.dev.js
yarn relay --watch & BUILD_CLIENT=true exec node "${OPT[@]}" ./src
else
exec node "${OPT[@]}" ./server.dist.js
fi
104 changes: 0 additions & 104 deletions src/common-app.js

This file was deleted.

Loading

0 comments on commit 796e448

Please sign in to comment.