dockerize ingestion script, with build/deploy script

master
Avraham Sakal 1 year ago
parent 77f3033a76
commit cec0171efa

11
ci.sh

@ -0,0 +1,11 @@
#!/bin/sh
IMAGE_NAME=ingest-options-aggregates-from-polygon
VERSION=v0.0.1
docker login registry.sakal.us
if [ $? -eq 0 ]
then
docker build -t "registry.sakal.us/${IMAGE_NAME}:${VERSION}" -f ingest.Dockerfile .
docker push "registry.sakal.us/${IMAGE_NAME}:${VERSION}"
fi

@ -0,0 +1,35 @@
apiVersion: v1
kind: Pod
metadata:
name: ingest-options-aggregates-from-polygon
namespace: calendar-optimizer
labels:
name: ingest-options-aggregates-from-polygon
spec:
imagePullSecrets:
- name: registry
containers:
- name: ingest-options-aggregates-from-polygon
image: registry.sakal.us/ingest-options-aggregates-from-polygon:v0.0.1
env:
- name: CLICKHOUSE_HOST
value: http://clickhouse.clickhouse.svc:8123
- name: CLICKHOUSE_USER
value: avraham
- name: CLICKHOUSE_PASS
value: buginoo
resources:
limits:
memory: "128Mi"
cpu: "500m"
---
apiVersion: v1
kind: Secret
metadata:
name: registry
namespace: calendar-optimizer
type: kubernetes.io/dockerconfigjson
data:
.dockerconfigjson: |
eyJhdXRocyI6eyJyZWdpc3RyeS5zYWthbC51cyI6eyJhdXRoIjoiWVhaeVlXaGhiVHBpZFdkcGJt
OVBNU1E9In19fQo=

@ -0,0 +1,10 @@
# adapted from example on pnpm.io
FROM node:20-slim AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
WORKDIR /app
# prod-deps
RUN pnpm add @clickhouse/client
COPY ./src /app
CMD [ "node", "ingest-options-aggregates-from-polygon.mjs" ]

@ -4,7 +4,11 @@ import { sleep, getPolygonApiKey } from './util.mjs';
//const polygonClient = PolygonClient(apiKey, "https://api.polygon.io", {pagination: false, trace: true,}); // automatically call `next_url` if there is one //const polygonClient = PolygonClient(apiKey, "https://api.polygon.io", {pagination: false, trace: true,}); // automatically call `next_url` if there is one
const clickhouse = createClickhouseClient({username:'avraham', password:'buginoo'}); const clickhouse = createClickhouseClient({
host: process.env.CLICKHOUSE_HOST || 'http://127.0.0.1:8123',
username: process.env.CLICKHOUSE_USER || 'avraham',
password: process.env.CLICKHOUSE_PASS || 'buginoo'
});
const optionAggregatesTableName = "option_aggregates"; const optionAggregatesTableName = "option_aggregates";
async function deleteClickhouseTable(){ async function deleteClickhouseTable(){

Loading…
Cancel
Save