uses k8s to run frontend, has ingress
parent
be6bae7dcf
commit
d09e5aaf53
48
Tiltfile
48
Tiltfile
|
|
@ -113,25 +113,37 @@ bh_backend_service(service="proxy-client", port_forwards=[
|
|||
port_forward(8081, 80, name="HTTP API @ localhost:8081")
|
||||
], deps=['ingress'])
|
||||
|
||||
|
||||
local_resource(
|
||||
'web-client',
|
||||
dir='./src/web-client',
|
||||
cmd='npm i',
|
||||
serve_dir='./src/web-client',
|
||||
serve_cmd='npm run dev',
|
||||
ignore=['./src/web-client/src'],
|
||||
deps=[
|
||||
'./src/web-client/package.json',
|
||||
'./src/web-client/svelte.config.js',
|
||||
'./src/web-client/vite.config.ts'
|
||||
],
|
||||
readiness_probe=probe(10, 2, 10, 1, 3, http_get=http_get_action(5173, 'localhost', 'http')),
|
||||
links=[
|
||||
link(url='http://localhost:5173', name='Web Client')
|
||||
],
|
||||
labels=['2-services']
|
||||
docker_build(
|
||||
ref='barretthousen/service-web-client',
|
||||
context='./src/web-client',
|
||||
dockerfile='./src/web-client/Dockerfile.frontend',
|
||||
target='development'
|
||||
)
|
||||
k8s_resource(
|
||||
workload='local-web-client',
|
||||
port_forwards=['8080:80'],
|
||||
labels=['2-services'],
|
||||
resource_deps=['ingress']
|
||||
)
|
||||
|
||||
# local_resource(
|
||||
# 'web-client',
|
||||
# dir='./src/web-client',
|
||||
# cmd='npm i',
|
||||
# serve_dir='./src/web-client',
|
||||
# serve_cmd='npm run dev',
|
||||
# ignore=['./src/web-client/src'],
|
||||
# deps=[
|
||||
# './src/web-client/package.json',
|
||||
# './src/web-client/svelte.config.js',
|
||||
# './src/web-client/vite.config.ts'
|
||||
# ],
|
||||
# readiness_probe=probe(10, 2, 10, 1, 3, http_get=http_get_action(8080, 'localhost', 'http')),
|
||||
# links=[
|
||||
# link(url='http://localhost:8080', name='Web Client')
|
||||
# ],
|
||||
# labels=['2-services']
|
||||
# )
|
||||
|
||||
k8s_yaml(
|
||||
kustomize("./env/local")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: web
|
||||
labels:
|
||||
name: web
|
||||
spec:
|
||||
rules:
|
||||
- host: barretthousen.com
|
||||
http:
|
||||
paths:
|
||||
- pathType: Prefix
|
||||
path: "/api"
|
||||
backend:
|
||||
service:
|
||||
name: proxy-client
|
||||
port:
|
||||
number: 80
|
||||
- pathType: ImplementationSpecific
|
||||
path: "/"
|
||||
backend:
|
||||
service:
|
||||
name: web-client
|
||||
port:
|
||||
number: 80
|
||||
|
|
@ -3,3 +3,5 @@ resources:
|
|||
- ./runner-deployment.yaml
|
||||
- ./proxy-admin-deployment.yaml
|
||||
- ./proxy-client-deployment.yaml
|
||||
- ./web-client-deployment.yaml
|
||||
- ./client-ingress.yaml
|
||||
|
|
|
|||
|
|
@ -42,25 +42,6 @@ spec:
|
|||
- port: 80
|
||||
targetPort: 80
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: proxy-client
|
||||
labels:
|
||||
name: proxy-client
|
||||
spec:
|
||||
rules:
|
||||
- host: barretthousen.com
|
||||
http:
|
||||
paths:
|
||||
- pathType: Prefix
|
||||
path: "/api"
|
||||
backend:
|
||||
service:
|
||||
name: proxy-client
|
||||
port:
|
||||
number: 80
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: web-client
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: web-client
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: web-client
|
||||
spec:
|
||||
containers:
|
||||
- name: web-client
|
||||
image: barretthousen/service-web-client
|
||||
stdin: true
|
||||
tty: true
|
||||
ports:
|
||||
- containerPort: 80
|
||||
name: http
|
||||
resources:
|
||||
limits:
|
||||
memory: "512Mi"
|
||||
cpu: "500m"
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: web-client
|
||||
spec:
|
||||
selector:
|
||||
app: web-client
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 80
|
||||
|
|
@ -20,8 +20,8 @@ patches:
|
|||
value: admin.localhost
|
||||
- target:
|
||||
kind: Ingress
|
||||
name: proxy-client
|
||||
name: web
|
||||
patch: |-
|
||||
- op: replace
|
||||
path: /spec/rules/0/host
|
||||
value: localhost
|
||||
value: bh.localhost
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ BEGIN
|
|||
INSERT INTO catalog.upcoming_auctions_fts (
|
||||
auctionid,
|
||||
title,
|
||||
description
|
||||
description,
|
||||
sourcesitename
|
||||
) VALUES ( auction_id, p_title, p_description, p_sourcesitename );
|
||||
ELSE
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
FROM node:lts AS development
|
||||
|
||||
COPY . /opt/web-client
|
||||
|
||||
WORKDIR /opt/web-client
|
||||
|
||||
RUN npm install && npm install -g vite
|
||||
|
||||
CMD vite dev --port=80 --host=0.0.0.0 --strictPort --logLevel info
|
||||
|
||||
FROM node:lts AS build
|
||||
|
||||
ARG origin=https://barretthousen.com
|
||||
|
||||
ENV ENV=production
|
||||
|
||||
ENV PROTOCOL_HEADER=x-forwarded-proto
|
||||
ENV HOST_HEADER=x-forwarded-host
|
||||
ENV ADDRESS_HEADER=True-Client-IP
|
||||
ENV ORIGIN=${origin}
|
||||
|
||||
WORKDIR /opt/web-client
|
||||
|
||||
COPY --from=development /opt/web-client .
|
||||
|
||||
RUN npm build \
|
||||
&& cp -rv /opt/web-client/package.json /opt/web-client/build \
|
||||
&& cp -rv /opt/web-client/package-lock.json /opt/web-client/build
|
||||
|
||||
FROM node:lts AS production
|
||||
|
||||
WORKDIR /opt
|
||||
|
||||
COPY --from=build /var/web-client/build/* /opt/web-client
|
||||
|
||||
ENV PORT 80
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
ENTRYPOINT ['node']
|
||||
CMD ['web-client']
|
||||
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite dev",
|
||||
"dev": "vite dev --port 8080",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"test": "playwright test",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
import { browser } from '$app/environment';
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
// TODO: change to env var
|
||||
const API_HOST = 'http://localhost:8000/api/v1';
|
||||
const API_HOST = `${browser ? '': 'http://local-proxy-client.default'}/api/v1`;
|
||||
|
||||
interface SearchPageData {
|
||||
page: number
|
||||
|
|
|
|||
|
|
@ -8,10 +8,15 @@ const config = {
|
|||
preprocess: vitePreprocess(),
|
||||
|
||||
kit: {
|
||||
env: {
|
||||
publicPrefix: 'BH_WEB_CLIENT'
|
||||
},
|
||||
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
|
||||
// If your environment is not supported or you settled on a specific environment, switch out the adapter.
|
||||
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
|
||||
adapter: adapter()
|
||||
adapter: adapter({
|
||||
precompress: true
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue