No auth on root route for health checks, fix suggestions request
This commit is contained in:
parent
0ac971e6b4
commit
f7c3bc2823
5 changed files with 25 additions and 6 deletions
|
@ -5,8 +5,8 @@ services:
|
||||||
dockerfile: app.dockerfile
|
dockerfile: app.dockerfile
|
||||||
args:
|
args:
|
||||||
- NEXT_PUBLIC_SUPER_SECRET_KEY=${SUPER_SECRET_KEY}
|
- NEXT_PUBLIC_SUPER_SECRET_KEY=${SUPER_SECRET_KEY}
|
||||||
- NEXT_PUBLIC_API_URL=http://${REMOTE_BACKEND_ADDRESS}/api
|
- NEXT_PUBLIC_API_URL=https://${REMOTE_BACKEND_ADDRESS}/api
|
||||||
- NEXT_PUBLIC_WS_URL=ws://${REMOTE_BACKEND_ADDRESS}
|
- NEXT_PUBLIC_WS_URL=wss://${REMOTE_BACKEND_ADDRESS}
|
||||||
expose:
|
expose:
|
||||||
- 3000
|
- 3000
|
||||||
ports:
|
ports:
|
||||||
|
|
|
@ -79,7 +79,18 @@ deploy:
|
||||||
|
|
||||||
.PHONY: teardown
|
.PHONY: teardown
|
||||||
teardown:
|
teardown:
|
||||||
terraform destroy
|
export TF_VAR_project_id=$(GCP_PROJECT_ID) \
|
||||||
|
&& export TF_VAR_cluster_name=$(CLUSTER_NAME) \
|
||||||
|
&& export TF_VAR_region=$(GCP_REGION) \
|
||||||
|
&& export TF_VAR_key_file=$(GCP_SERVICE_ACCOUNT_KEY_FILE) \
|
||||||
|
&& export TF_VAR_search_image=$(SEARCH_IMAGE_TAG) \
|
||||||
|
&& export TF_VAR_backend_image=$(BACKEND_IMAGE_TAG) \
|
||||||
|
&& export TF_VAR_app_image=$(APP_IMAGE_TAG) \
|
||||||
|
&& export TF_VAR_search_port=$(SEARCH_PORT) \
|
||||||
|
&& export TF_VAR_backend_port=$(BACKEND_PORT) \
|
||||||
|
&& export TF_VAR_open_ai=$(OPENAI) \
|
||||||
|
&& export TF_VAR_secret_key=$(SUPER_SECRET_KEY) \
|
||||||
|
&& terraform destroy
|
||||||
|
|
||||||
|
|
||||||
.PHONY: auth-kubectl
|
.PHONY: auth-kubectl
|
||||||
|
|
|
@ -75,6 +75,9 @@ resource "kubernetes_service" "searxng_service" {
|
||||||
metadata {
|
metadata {
|
||||||
name = "searxng-service"
|
name = "searxng-service"
|
||||||
namespace = "default"
|
namespace = "default"
|
||||||
|
annotations = {
|
||||||
|
"networking.gke.io/load-balancer-type" = "Internal" # Remove to create an external loadbalancer
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
spec {
|
spec {
|
||||||
|
@ -87,7 +90,7 @@ resource "kubernetes_service" "searxng_service" {
|
||||||
target_port = var.search_port
|
target_port = var.search_port
|
||||||
}
|
}
|
||||||
|
|
||||||
type = "ClusterIP"
|
type = "LoadBalancer"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,11 +20,15 @@ const corsOptions = {
|
||||||
app.use(cors(corsOptions));
|
app.use(cors(corsOptions));
|
||||||
|
|
||||||
if (getAccessKey()) {
|
if (getAccessKey()) {
|
||||||
app.all('*', requireAccessKey);
|
app.all('/api/*', requireAccessKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
|
|
||||||
|
app.get('/', (_, res) => {
|
||||||
|
res.status(200).json({ status: 'ok' });
|
||||||
|
});
|
||||||
|
|
||||||
app.use('/api', routes);
|
app.use('/api', routes);
|
||||||
app.get('/api', (_, res) => {
|
app.get('/api', (_, res) => {
|
||||||
res.status(200).json({ status: 'ok' });
|
res.status(200).json({ status: 'ok' });
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
import { Message } from '@/components/ChatWindow';
|
import { Message } from '@/components/ChatWindow';
|
||||||
|
import { clientFetch } from '@/lib/utils';
|
||||||
|
|
||||||
export const getSuggestions = async (chatHisory: Message[]) => {
|
export const getSuggestions = async (chatHisory: Message[]) => {
|
||||||
const chatModel = localStorage.getItem('chatModel');
|
const chatModel = localStorage.getItem('chatModel');
|
||||||
const chatModelProvider = localStorage.getItem('chatModelProvider');
|
const chatModelProvider = localStorage.getItem('chatModelProvider');
|
||||||
|
|
||||||
const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/suggestions`, {
|
const res = await clientFetch('/suggestions', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
|
|
Loading…
Add table
Reference in a new issue