Skip to content
Snippets Groups Projects
Commit 2803148f authored by echicken's avatar echicken :chicken:
Browse files

errors & cron

parent f71216f1
No related branches found
No related tags found
No related merge requests found
...@@ -16,9 +16,9 @@ RUN apt-get update \ ...@@ -16,9 +16,9 @@ RUN apt-get update \
WORKDIR /app WORKDIR /app
COPY . /app/ COPY . /app/
COPY cron /etc/cron.d/tasks_cronjob
RUN npm install RUN npm install
RUN npm run build RUN npm run build
RUN sh -c 'echo "0 4 * * 0 cd /app && npm run ingest >> /var/log/binary-bob-ingest.log 2>&1" > /etc/cron/tasks_cronjob'
# CMD ["npm", "start"] # CMD ["npm", "start"]
CMD ["/bin/bash", "-c", "chmod 644 /etc/cron.d/tasks_cronjob && cron && cd /app && npm start"] CMD ["/bin/bash", "-c", "chmod 644 /etc/cron.d/tasks_cronjob && cron && cd /app && npm start"]
\ No newline at end of file
services: services:
qdrant: qdrant:
# image: qdrant/qdrant
build: build:
context: . context: .
dockerfile_inline: | dockerfile_inline: |
...@@ -12,6 +11,7 @@ services: ...@@ -12,6 +11,7 @@ services:
- ./data/qdrant/storage:/qdrant/storage - ./data/qdrant/storage:/qdrant/storage
- ./data/qdrant/snapshots:/qdrant/snapshots - ./data/qdrant/snapshots:/qdrant/snapshots
- ./conf/qdrant/config.yaml:/qdrant/config/config.yaml - ./conf/qdrant/config.yaml:/qdrant/config/config.yaml
restart: unless-stopped
healthcheck: healthcheck:
test: curl -s http://localhost:6333/healthz | grep -q 'healthz check passed' || exit 1 test: curl -s http://localhost:6333/healthz | grep -q 'healthz check passed' || exit 1
interval: 1m interval: 1m
...@@ -28,4 +28,5 @@ services: ...@@ -28,4 +28,5 @@ services:
- ./data/binary-bob:/app/data - ./data/binary-bob:/app/data
ports: ports:
- 3000:3000 - 3000:3000
restart: unless-stopped
\ No newline at end of file
0 4 * * 0 cd /app && npm run ingest
\ No newline at end of file
...@@ -8,12 +8,16 @@ app.use(bodyParser.urlencoded({ extended: false })); ...@@ -8,12 +8,16 @@ app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json()); app.use(bodyParser.json());
app.get('/query/:query', async (req: Request, res: Response) => { app.get('/query/:query', async (req: Request, res: Response) => {
try {
const answer = await queryAgent({ query: req.params.query }); const answer = await queryAgent({ query: req.params.query });
if (answer === undefined) { if (answer === undefined) {
res.sendStatus(404); res.sendStatus(404);
} else { } else {
res.json(answer); res.json(answer);
} }
} catch (err) {
console.error('Error on query', req.params.query, err);
}
}); });
app.get('/', (req: Request, res: Response) => { app.get('/', (req: Request, res: Response) => {
......
...@@ -12,5 +12,7 @@ async function ingest(): Promise<void> { ...@@ -12,5 +12,7 @@ async function ingest(): Promise<void> {
} }
(async () => { (async () => {
console.info('Starting ingest');
await ingest(); await ingest();
console.info('Ingest complete');
})(); })();
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment