Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions deployment/Caddyfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
${DOMAIN:localhost} {
{$DOMAIN} {
handle /api/* {
reverse_proxy http://localhost:${NODE_PORT:8080}
reverse_proxy http://node-server:80
}

handle {
reverse_proxy http://localhost:${FRONTEND_PORT:3000}

reverse_proxy http://frontend:80
}
}
2 changes: 0 additions & 2 deletions deployment/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ services:
- caddy_data:/data
- caddy_config:/config
environment:
- FRONTEND_PORT=${FRONTEND_PORT}
- NODE_PORT=${NODE_PORT}
- DOMAIN=${DOMAIN}

volumes:
Expand Down
4 changes: 2 additions & 2 deletions deployment/compose_cpu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ services:
- SESSION_TOKEN_BYTES=${SESSION_TOKEN_BYTES}
- SESSION_LENGTH_SEC=${SESSION_LENGTH_SEC}
ports:
- ${NODE_PORT}:80
- "80"
restart: unless-stopped

frontend:
Expand All @@ -39,6 +39,6 @@ services:
node-server:
condition: service_healthy
ports:
- ${FRONTEND_PORT}:80
- "80"
image: scribear/frontend:master
restart: unless-stopped
4 changes: 2 additions & 2 deletions deployment/compose_cuda.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ services:
- SESSION_TOKEN_BYTES=${SESSION_TOKEN_BYTES}
- SESSION_LENGTH_SEC=${SESSION_LENGTH_SEC}
ports:
- ${NODE_PORT}:80
- "80"
restart: unless-stopped

frontend:
Expand All @@ -49,6 +49,6 @@ services:
node-server:
condition: service_healthy
ports:
- ${FRONTEND_PORT}:80
- "80"
image: scribear/frontend:master
restart: unless-stopped
12 changes: 3 additions & 9 deletions deployment/docker-autostart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,14 @@ else
sudo docker compose -f compose.yaml -f ./compose_cpu.yaml up -d
fi

until [ "$(curl --max-time 1 -s -w '%{http_code}' -o /dev/null "${SCRIBEAR_URL}")" -eq 200 ]
until [ "$(curl --max-time 1 -s -w '%{http_code}' -o /dev/null "${DOMAIN}")" -eq 200 ]
do
echo "Can't reach frontend at ${SCRIBEAR_URL}. Waiting for frontend to be ready..."
sleep 1
done

until [ "$(curl --max-time 1 -s -w '%{http_code}' -o /dev/null "http://127.0.0.1:${FRONTEND_PORT}")" -eq 200 ]
do
echo "Can't reach frontend at http://127.0.0.1:${FRONTEND_PORT}. Waiting for frontend to be ready..."
echo "Can't reach frontend at ${DOMAIN}. Waiting for frontend to be ready..."
sleep 1
done

echo "Launching Chrome"
google-chrome "http://127.0.0.1:${FRONTEND_PORT}/?mode=kiosk&kioskServerAddress=localhost:${NODE_PORT}&sourceToken=${SOURCE_TOKEN}&scribearURL=${SCRIBEAR_URL}" --start-fullscreen
google-chrome "${DOMAIN}/?mode=kiosk&kioskServerAddress=localhost:${NODE_PORT}&sourceToken=${SOURCE_TOKEN}&scribearURL=${SCRIBEAR_URL}" --start-fullscreen

stop_services() {
if [ $WHISPER_SERVICE_CUDA = 'true' ]; then
Expand Down
15 changes: 7 additions & 8 deletions node-server/src/server/create_server.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Fastify, { type FastifyInstance } from 'fastify';
import Fastify, {type FastifyInstance} from 'fastify';
import fastifyCors from '@fastify/cors';
import type { ConfigType } from '../shared/config/config_schema.js';
import type { Logger } from '../shared/logger/logger.js';
import type {ConfigType} from '../shared/config/config_schema.js';
import type {Logger} from '../shared/logger/logger.js';
import TranscriptionEngine from './services/transcription_engine.js';
import fastifyWebsocket from '@fastify/websocket';
import websocketHandler from './routes/websocket_handler.js';
Expand Down Expand Up @@ -30,7 +30,7 @@ declare module 'fastify' {
* @returns created fastify server
*/
export default function createServer(config: ConfigType, logger: Logger) {
const fastify = Fastify({ loggerInstance: logger }) as unknown as FastifyInstance;
const fastify = Fastify({loggerInstance: logger}) as unknown as FastifyInstance;

fastify.register(fastifyWebsocket);

Expand All @@ -50,13 +50,12 @@ export default function createServer(config: ConfigType, logger: Logger) {
fastify.decorate('authenticationService', new AuthenticationService(config, fastify.tokenService));

fastify.register(
async (api, _options) => {
api.register(websocketHandler,);
async api => {
api.register(websocketHandler);
api.register(accessTokenHandler);
api.register(healthcheckHandler);

},
{ prefix: "/api" },
{prefix: '/api'},
);

return fastify;
Expand Down
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading