feat(app): revert port & network changes

This commit is contained in:
ItzCrazyKns 2024-05-13 19:58:17 +05:30
parent 100872f2d9
commit 0993c5a760
No known key found for this signature in database
GPG Key ID: 8162927C7CCE3065
6 changed files with 12 additions and 21 deletions

View File

@ -2,11 +2,8 @@ FROM node:alpine
ARG NEXT_PUBLIC_WS_URL ARG NEXT_PUBLIC_WS_URL
ARG NEXT_PUBLIC_API_URL ARG NEXT_PUBLIC_API_URL
ARG PORT
ENV NEXT_PUBLIC_WS_URL=${NEXT_PUBLIC_WS_URL} ENV NEXT_PUBLIC_WS_URL=${NEXT_PUBLIC_WS_URL}
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL} ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
ENV PORT=${PORT}
WORKDIR /home/perplexica WORKDIR /home/perplexica

View File

@ -4,7 +4,7 @@ services:
volumes: volumes:
- ./searxng:/etc/searxng:rw - ./searxng:/etc/searxng:rw
ports: ports:
- 31336:8080 - 4000:8080
networks: networks:
- perplexica-network - perplexica-network
@ -17,7 +17,7 @@ services:
depends_on: depends_on:
- searxng - searxng
ports: ports:
- 31338:31338 - 3001:3001
networks: networks:
- perplexica-network - perplexica-network
@ -26,15 +26,14 @@ services:
context: . context: .
dockerfile: app.dockerfile dockerfile: app.dockerfile
args: args:
- NEXT_PUBLIC_API_URL=http://127.0.0.1:31338/api - NEXT_PUBLIC_API_URL=http://127.0.0.1:3001/api
- NEXT_PUBLIC_WS_URL=ws://127.0.0.1:31338 - NEXT_PUBLIC_WS_URL=ws://127.0.0.1:3001
- PORT=31337
depends_on: depends_on:
- perplexica-backend - perplexica-backend
ports: ports:
- 31337:31337 - 3000:3000
networks: networks:
- perplexica-network - perplexica-network
networks: networks:
perplexica-network: perplexica-network:

View File

@ -1,6 +1,5 @@
[GENERAL] [GENERAL]
PORT = 31338 # Port to run the server on PORT = 3001 # Port to run the server on
BIND_ADDRESS = "0.0.0.0"
SIMILARITY_MEASURE = "cosine" # "cosine" or "dot" SIMILARITY_MEASURE = "cosine" # "cosine" or "dot"
[API_KEYS] [API_KEYS]
@ -9,4 +8,4 @@ GROQ = "" # Groq API key - gsk_1234567890abcdef1234567890abcdef
[API_ENDPOINTS] [API_ENDPOINTS]
SEARXNG = "http://localhost:32768" # SearxNG API URL SEARXNG = "http://localhost:32768" # SearxNG API URL
OLLAMA = "" # Ollama API URL - http://host.docker.internal:11434 OLLAMA = "" # Ollama API URL - http://host.docker.internal:11434

View File

@ -3,11 +3,10 @@ import express from 'express';
import cors from 'cors'; import cors from 'cors';
import http from 'http'; import http from 'http';
import routes from './routes'; import routes from './routes';
import { getBindAddress, getPort } from './config'; import { getPort } from './config';
import logger from './utils/logger'; import logger from './utils/logger';
const port = getPort(); const port = getPort();
const bindAddress = getBindAddress();
const app = express(); const app = express();
const server = http.createServer(app); const server = http.createServer(app);
@ -24,7 +23,7 @@ app.get('/api', (_, res) => {
res.status(200).json({ status: 'ok' }); res.status(200).json({ status: 'ok' });
}); });
server.listen(port, bindAddress, () => { server.listen(port, () => {
logger.info(`Server is running on port ${port}`); logger.info(`Server is running on port ${port}`);
}); });

View File

@ -7,7 +7,6 @@ const configFileName = 'config.toml';
interface Config { interface Config {
GENERAL: { GENERAL: {
PORT: number; PORT: number;
BIND_ADDRESS: string;
SIMILARITY_MEASURE: string; SIMILARITY_MEASURE: string;
}; };
API_KEYS: { API_KEYS: {
@ -31,8 +30,6 @@ const loadConfig = () =>
export const getPort = () => loadConfig().GENERAL.PORT; export const getPort = () => loadConfig().GENERAL.PORT;
export const getBindAddress = () => loadConfig().GENERAL.BIND_ADDRESS;
export const getSimilarityMeasure = () => export const getSimilarityMeasure = () =>
loadConfig().GENERAL.SIMILARITY_MEASURE; loadConfig().GENERAL.SIMILARITY_MEASURE;

View File

@ -1,2 +1,2 @@
NEXT_PUBLIC_WS_URL=ws://localhost:31338 NEXT_PUBLIC_WS_URL=ws://localhost:3001
NEXT_PUBLIC_API_URL=http://localhost:31338/api NEXT_PUBLIC_API_URL=http://localhost:3001/api