Skip to content

Commit

Permalink
chore: wider cors + helm updates (fix ports + load balancer)
Browse files Browse the repository at this point in the history
  • Loading branch information
samjcombs committed Dec 18, 2024
1 parent 38931d9 commit 59f62ea
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 17 deletions.
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "backend",
"version": "1.0.0-beta.4.1",
"version": "1.0.0-beta.4.3",
"main": "dist/server.js",
"scripts": {
"build": "rm -rf dist/ && npx tsc && npm run copy-graphql",
Expand Down
10 changes: 1 addition & 9 deletions backend/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,7 @@ const initializeApp = async () => {
app.use(express.urlencoded({limit: '50mb', extended: true}));
app.use(
cors({
origin: (origin, callback) => {
const allowedOrigins = [getWebsiteDomain()];
const regex =
/^(https:\/\/[a-zA-Z0-9-]+\.narrative\.tech|https?:\/\/localhost(:\d+)?|https:\/\/[a-zA-Z0-9-]+\.xspecs\.io)$/;

if (!origin || allowedOrigins.includes(origin) || regex.test(origin))
callback(null, true);
else callback(new Error('Not allowed by CORS'));
},
origin: '*',
allowedHeaders: [
'content-type',
...supertokens.getAllCORSHeaders(),
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "frontend",
"version": "1.0.0-beta.4.1",
"version": "1.0.0-beta.4.3",
"private": true,
"dependencies": {
"@apollo/explorer": "^3.7.0",
Expand Down
2 changes: 1 addition & 1 deletion helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ apiVersion: v2
name: instantmock
description: A Helm chart for deploying InstantMock
version: 0.2.0
appVersion: "1.0.0-beta.4.1"
appVersion: '1.0.0-beta.4.3'
5 changes: 4 additions & 1 deletion helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ spec:
- name: backend
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
ports:
- containerPort: 3007
- containerPort: 3033
env:
- name: NODE_ENV
value: "production"
volumeMounts:
- mountPath: /app/backend/data
name: sqlite-storage
Expand Down
18 changes: 18 additions & 0 deletions helm/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Release.Name }}-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- host: example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ .Release.Name }}-backend
port:
number: {{ .Values.service.port }}
11 changes: 11 additions & 0 deletions helm/templates/pv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: instant-mock-pv
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
hostPath:
path: /mnt/data
2 changes: 1 addition & 1 deletion helm/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: 3007
targetPort: 3033
selector:
app: {{ .Release.Name }}-backend
4 changes: 2 additions & 2 deletions helm/values.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
replicaCount: 1
image:
repository: xolvio/instant-mock
tag: 1.0.0-beta.4.1
tag: 1.0.0-beta.4.3
pullPolicy: Always
service:
type: ClusterIP
type: LoadBalancer
port: 80
resources: {}
persistence:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "instant-mock",
"version": "1.0.0-beta.4.1",
"version": "1.0.0-beta.4.3",
"description": "![instant-mock-screen-cap-final](https://github.com/user-attachments/assets/de0f50d4-5a71-4e5a-b479-37c6cfa0481d)",
"main": "index.js",
"module": "true",
Expand Down

0 comments on commit 59f62ea

Please sign in to comment.