From 3d2f28b46a797c64609a322600fbca6b88f8c848 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Sun, 13 Aug 2023 13:26:45 -0600 Subject: [PATCH] Add server --- .env.sample | 6 ++++++ Dockerfile | 8 ++++---- apps/hello-world/hello-world.star | 3 ++- apps/hello-world/pixbyt.yml | 2 +- plugins/plugins.meltano.yml | 24 +++++++++++++++++++++++- 5 files changed, 36 insertions(+), 7 deletions(-) diff --git a/.env.sample b/.env.sample index 6c24727..1cb25bb 100644 --- a/.env.sample +++ b/.env.sample @@ -2,6 +2,12 @@ # This is used by many apps that show the (relative) date and time. TZ="America/Mexico_City" +## TODO: pixbyt-server +SERVER_PORT="1234" +# SERVER_USERNAME="" +# SERVER_PASSWORD="" +# SERVER_RUN_SCHEDULER="false" + ## target-tidbyt # Find your Device ID and API Token in the Tidbyt mobile app under Settings > General > Get API Key. TIDBYT_DEVICE_ID="" diff --git a/Dockerfile b/Dockerfile index 379ecc0..d877c40 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ RUN apt-get update RUN apt-get install -y curl # TODO: Make this work # RUN export PIXLET_VERSION=$(curl https://raw.githubusercontent.com/tidbyt/community/main/PIXLET_VERSION | sed 's/v//') -ARG PIXLET_VERSION=0.27.2 +ARG PIXLET_VERSION=0.28.0 RUN echo $PIXLET_VERSION RUN curl -L -o pixlet.tar.gz https://github.com/tidbyt/pixlet/releases/download/v${PIXLET_VERSION}/pixlet_${PIXLET_VERSION}_${TARGETOS}_${TARGETARCH}.tar.gz RUN tar -xvf pixlet.tar.gz @@ -26,11 +26,11 @@ COPY ./meltano.yml . COPY ./plugins/utilities/ ./plugins/utilities/ COPY ./plugins/plugins.meltano.yml ./plugins/plugins.meltano.yml -# Prod: Install loaders and Airflow +# Prod: Install loaders, server, and Airflow FROM base as prod-preinstall RUN meltano --log-level=debug install -# Dev: Only install loaders, not Airflow +# Dev: Only install loaders, not server and Airflow FROM base as dev-preinstall RUN meltano --log-level=debug install loaders @@ -53,4 +53,4 @@ COPY . . ENV MELTANO_PROJECT_READONLY 1 ENTRYPOINT ["meltano"] -CMD ["invoke", "airflow", "scheduler"] +CMD ["invoke", "server"] diff --git a/apps/hello-world/hello-world.star b/apps/hello-world/hello-world.star index 2a81093..aa3cada 100644 --- a/apps/hello-world/hello-world.star +++ b/apps/hello-world/hello-world.star @@ -1,9 +1,10 @@ load("render.star", "render") load("pixlib/const.star", "const") +load("pixlib/input.star", "input") load("./client.star", "client") def main(config): - NAME = config.get("name") or "world" + NAME = input.json().get("name") orconfig.get("name") or "world" image = client.get_image() text = client.get_response(NAME) diff --git a/apps/hello-world/pixbyt.yml b/apps/hello-world/pixbyt.yml index 973b49e..21d40b1 100644 --- a/apps/hello-world/pixbyt.yml +++ b/apps/hello-world/pixbyt.yml @@ -10,7 +10,7 @@ plugins: extractors: - name: tap-pixlet--hello-world inherit_from: tap-pixlet - pip_url: git+https://github.com/DouweM/tap-pixlet.git -r apps/hello-world/requirements.txt + pip_url: git+https://github.com/DouweM/tap-pixlet.git@input -r apps/hello-world/requirements.txt # TODO: Drop @input config: path: apps/hello-world app_config: diff --git a/plugins/plugins.meltano.yml b/plugins/plugins.meltano.yml index 6a69b29..0bffad3 100644 --- a/plugins/plugins.meltano.yml +++ b/plugins/plugins.meltano.yml @@ -2,7 +2,7 @@ plugins: extractors: - name: tap-pixlet namespace: tap_pixlet - pip_url: git+https://github.com/DouweM/tap-pixlet.git + pip_url: git+https://github.com/DouweM/tap-pixlet.git@input # TODO: Drop @input settings: - name: path - name: installation_id @@ -30,6 +30,28 @@ plugins: pip_url: git+https://github.com/DouweM/target-webp.git utilities: + - name: server + namespace: pixbyt_server + pip_url: git+https://github.com/DouweM/pixbyt-server.git + executable: pixbyt-server + settings: + - name: port + kind: integer + value: 1234 + env: SERVER_PORT + - name: auth + kind: object + - name: auth.username + kind: string + env: SERVER_USERNAME + - name: auth.password + kind: password + env: SERVER_PASSWORD + - name: run_scheduler + kind: boolean + value: true + env: SERVER_RUN_SCHEDULER + - name: airflow variant: apache pip_url: git+https://github.com/meltano/airflow-ext.git@main apache-airflow==2.3.4 psycopg2-binary