Skip to content

Commit

Permalink
Deploy storybook (#4258)
Browse files Browse the repository at this point in the history
* Deploy storybook
  • Loading branch information
Alex Page committed Jun 11, 2021
1 parent 053b68d commit 2c6e842
Show file tree
Hide file tree
Showing 14 changed files with 332 additions and 70 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
name: CI

on:
pull_request:
branches:
- '**'
push:
branches:
- 'main'
on: push

jobs:
test:
Expand Down
11 changes: 11 additions & 0 deletions .shopify-build/polaris-react.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
containers:
production:
environment: production
build:
from: ubuntu-latest
run:
- yarn build
- yarn storybook:build

steps:
- build: production
10 changes: 10 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const path = require('path');
const spawn = require('child_process').spawn;
const CreateFileWebpack = require('create-file-webpack');

const postcssShopify = require('@shopify/postcss-plugin');

Expand Down Expand Up @@ -71,6 +72,15 @@ module.exports = {
},
];

config.plugins.push(
new CreateFileWebpack({
path: './build/storybook/static/services/',
fileName: 'ping.html',
content:
'<!DOCTYPE html><html lang="en"><head></head><body>OK</body></html>',
}),
);

config.module.rules = [
// Strip out existing rules that apply to md files
...config.module.rules.filter(
Expand Down
4 changes: 0 additions & 4 deletions .storybook/serve.json

This file was deleted.

1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: npm run start
6 changes: 6 additions & 0 deletions config/secrets.production.ejson
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"_public_key": "f63e73fbf778d8f5b92a3fa44799260d7d81bd6c700f76f2d312e286816dae29",
"environment": {
"SECRET_KEY_BASE": "EJ[1:+cU3KIIWBzkrJI3ibAYa6q6uOYLaCPC7CHEXcrtzOEE=:pNbSr/8NCLPtaMTCbUvnm04zEcxH1tdh:bj0FeILvtYd/NdnMnYqTCPED35mr02IrlgN2+6aHmtREiSqXWdu+Sre1jnpQ+W2+iCBGX4xdr+JZUoviIrDxS+IDuIMNxoIQF4i59V/38YMFMyqSsCakwZH+SOPgHOtSvHulgRQiTmmfSI1HHwHlgmmPWKrqCoJNhbRcQHGkJk8GLjpDRm2SyHqd/wsELUZu]"
}
}
1 change: 1 addition & 0 deletions dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ commands:
# For a list of Common Commands in Projects, check out:
# https://development.shopify.io/tools/dev/getting_started/Common-Commands-in-Projects
build: yarn run build
start: yarn run start
server: yarn run dev
style: yarn run lint
test: yarn run test
Expand Down
20 changes: 20 additions & 0 deletions infrastructure/runtimes/production-unrestricted-4b2e/manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
kind: RuntimeManifest
apiVersion: platform.shopify.io/v1alpha1
metadata:
name: production-unrestricted-4b2e
runtimeInfo:
appName: polaris-react
env: production
appImage: gcr.io/shopify-docker-images/apps/production/polaris-react
domains:
- polaris-react.shopifycloud.com
defaultBaseSource: github:Shopify/k8s_base/components
components:
- name: web
basePath: web/v10
resources:
- base: ingress.yaml
- base: certificate.yaml
- base: service.yaml
- base: deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
# THIS FILE IS AUTO-GENERATED. DO NOT MODIFY IT MANUALLY.
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
labels:
name: web
env: production
app: polaris-react
runtime-component: web
annotations:
platform.shopify.io/app-containers: web
shipit.shopify.io/restart: "true"
spec:
replicas: 3
selector:
matchLabels:
name: web
template:
metadata:
labels:
name: web
env: production
app: polaris-react
annotations:
seccomp.security.alpha.kubernetes.io/pod: runtime/default
spec:
automountServiceAccountToken: true
containers:
- name: web
image: gcr.io/shopify-docker-images/apps/production/polaris-react
args:
- web
ports:
- name: http
containerPort: 8000
envFrom:
- configMapRef:
name: application-state
env:
- name: ENV
value: production
- name: APP_ENV
value: production
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: NODE_IP
valueFrom:
fieldRef:
fieldPath: status.hostIP
- name: TRACE_PROXY_ADDR
value: http://$(NODE_IP):8096/
- name: STATSD_ADDR
value: 127.0.0.1:8125
- name: STATSD_IMPLEMENTATION
value: datadog
- name: PORT
value: "8000"
- name: IDENTITY_CLIENT_ID
valueFrom:
secretKeyRef:
name: identity-config
key: clientId
optional: true
- name: IDENTITY_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: identity-config
key: clientSecret
optional: true
- name: KAFKA_CLIENT_CERT
value: /ssl/kafka-client/tls.crt
- name: KAFKA_CLIENT_KEY
value: /ssl/kafka-client/tls.key
- name: KAFKA_CLOUD_AGGREGATE_CLIENT_CERT
value: /ssl/kafka-client/tls.crt
- name: KAFKA_CLOUD_AGGREGATE_CLIENT_KEY
value: /ssl/kafka-client/tls.key
- name: KAFKA_AGGREGATE_BROKERS
valueFrom:
configMapKeyRef:
name: kafka-clusters
key: cloud-aggregate
- name: KAFKA_REGIONAL_BROKERS
valueFrom:
configMapKeyRef:
name: kafka-clusters
key: local
- name: KAFKA_CLIENT_ID
valueFrom:
fieldRef:
fieldPath: metadata.namespace
resources:
limits:
cpu: 1000m
memory: 1Gi
requests:
cpu: 200m
memory: 512Mi
volumeMounts:
- name: ejson-keys
readOnly: true
mountPath: /key
- name: kafka-client
readOnly: true
mountPath: /ssl/kafka-client
readinessProbe:
httpGet:
port: 8000
httpHeaders:
- name: X-Forwarded-Proto
value: https
path: /services/ping
initialDelaySeconds: 20
timeoutSeconds: 3
securityContext:
allowPrivilegeEscalation: false
capabilities:
add:
- CHOWN
- DAC_OVERRIDE
- KILL
- SETGID
- SETUID
drop:
- ALL
privileged: false
volumes:
- name: kafka-client
secret:
secretName: kafka-client
- name: ejson-keys
secret:
secretName: ejson-keys
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
progressDeadlineSeconds: 120
---
apiVersion: certmanager.k8s.io/v1alpha1
kind: Certificate
metadata:
name: web
labels:
env: production
app: polaris-react
runtime-component: web
spec:
acme:
config:
- domains:
- polaris-react.shopifycloud.com
http01:
ingressClass: nginx
dnsNames:
- polaris-react.shopifycloud.com
issuerRef:
name: letsencrypt-issuer
kind: ClusterIssuer
secretName: polaris-react-shopifycloud-com
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: web
labels:
name: web
env: production
app: polaris-react
runtime-component: web
annotations:
ingress.shopify.io/tls-secretbuddy: "false"
kubernetes.io/ingress.class: nginx
kubernetes.io/tls-acme: "false"
security.shopify.io/auth: oauth2
spec:
rules:
- host: polaris-react.shopifycloud.com
http:
paths:
- backend:
serviceName: web
servicePort: 80
tls:
- hosts:
- polaris-react.shopifycloud.com
secretName: polaris-react-shopifycloud-com
---
apiVersion: v1
kind: Service
metadata:
name: web
labels:
name: web
env: production
app: polaris-react
runtime-component: web
spec:
selector:
name: web
env: production
app: polaris-react
ports:
- name: http
port: 80
targetPort: 8000
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@
"copy-polaris-tokens": "rimraf ./src/styles/polaris-tokens && shx cp -r ./node_modules/@shopify/polaris-tokens/dist ./src/styles/polaris-tokens",
"prepublishOnly": "yarn run build",
"dev": "npm-run-all copy-polaris-tokens storybook",
"start": "serve -l ${PORT} -c .storybook/serve.json",
"heroku-postbuild": "yarn run storybook:build",
"start": "serve ./build/storybook/static -l ${PORT:=6006}",
"readme-update-version": "node ./scripts/readme-update-version",
"version": "yarn run readme-update-version",
"storybook": "start-storybook -p 6006 --quiet",
Expand All @@ -84,7 +83,8 @@
"@types/react-transition-group": "^4.4.0",
"focus-visible": "^5.2.0",
"lodash": "^4.17.4",
"react-transition-group": "^4.4.1"
"react-transition-group": "^4.4.1",
"serve": "^12.0.0"
},
"peerDependencies": {
"react": "^16.9.0",
Expand Down Expand Up @@ -124,6 +124,7 @@
"commander": "^4.1.0",
"copyfiles": "^2.1.1",
"core-js": "^3.6.5",
"create-file-webpack": "^1.0.2",
"downlevel-dts": "^0.6.0",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.14.0",
Expand All @@ -147,7 +148,6 @@
"sass-loader": "^8.0.0",
"scss-parser": "^1.0.3",
"semver": "^6.3.0",
"serve": "^11.1.0",
"shelljs": "^0.8.3",
"shx": "^0.3.2",
"size-limit": "^4.10.2",
Expand Down
4 changes: 2 additions & 2 deletions service.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
slack_channels:
- polaris
production:
classification: tier4
npm:
classification: library
slack_channels:
- polaris
url: https://polaris-react.shopifycloud.com
oncall_url: https://shopify.pagerduty.com/services/PQNFXB1
security:
Expand Down
12 changes: 12 additions & 0 deletions shipit.npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ci:
require:
- 'Test'
- 'Accessibility test'

merge:
require:
- 'Test'
- 'Accessibility test'

deploy:
max_commits: false
15 changes: 5 additions & 10 deletions shipit.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
production_platform:
application: polaris-react
runtime_ids:
- production-unrestricted-4b2e
ci:
require:
- 'Test'
- 'Accessibility test'

merge:
require:
- 'Test'
- 'Accessibility test'

deploy:
max_commits: false
- buildkite/polaris-react-production-builder
Loading

0 comments on commit 2c6e842

Please sign in to comment.