hongbo-miao/hongbomiao.com

View on GitHub
data-processing/flink/applications/stream-tweets/Makefile

Summary

Maintainability
Test Coverage
# Maven
maven-install:
    mvn install
maven-compile:
    mvn compile
maven-test:
    mvn test
maven-verify:
    mvn verify
maven-package:
    mvn clean package

# Flink Local
flink-local-start:
    /usr/local/Cellar/apache-flink/1.13.1/libexec/bin/start-cluster.sh
flink-local-stop:
    /usr/local/Cellar/apache-flink/1.13.1/libexec/bin/stop-cluster.sh

# Flink Session Mode
# https://ci.apache.org/projects/flink/flink-docs-release-1.13/docs/deployment/config/
flink-session-start:
    /usr/local/Cellar/apache-flink/1.13.1/libexec/bin/kubernetes-session.sh \
        -Dkubernetes.namespace=hm-flink \
        -Dkubernetes.cluster-id=hm-flink-cluster \
        -Dkubernetes.container.image=flink:1.13.2-scala_2.12-java11 \
        -Dkubernetes.jobmanager.service-account=flink-serviceaccount \
        -Dkubernetes.taskmanager.cpu=2 \
        -Dtaskmanager.numberOfTaskSlots=4 \
        -Dtaskmanager.memory.process.size=4096m
flink-session-submit-job:
    flink run \
        --target kubernetes-session \
        -Dkubernetes.cluster-id=hm-flink-cluster \
        -Dkubernetes.jobmanager.service-account=flink-serviceaccount \
        ./target/streaming-0.1.jar

# Flink Application Mode
set-secret-base64-in-github:
    cd src/main/resources && \
    base64 --input=application-production.properties --output=application-production.properties.base64 && \
    gh secret set HM_STEAMING_APPLICATION_PROPERTIES_BASE64 < application-production.properties.base64 && \
    rm -f application-production.properties.base64
docker-build:
    cd ../../../.. && \
    docker build --file=data-processing/flink/applications/stream-tweetsDockerfile --tag=ghcr.io/hongbo-miao/hm-streaming:latest .
docker-push:
    docker push ghcr.io/hongbo-miao/hm-streaming:latest
flink-application-init:
    cd .. && \
    kubectl apply --filename=kubernetes/manifests/flink
flink-application-start:
    cd .. && \
    kubectl apply --filename=kubernetes/manifests/flink/hm-flink-namespace.yaml && \
    flink run-application \
        --target kubernetes-application \
        -Dkubernetes.namespace=hm-flink \
        -Dkubernetes.cluster-id=hm-flink-cluster \
        -Dkubernetes.container.image=ghcr.io/hongbo-miao/hm-streaming:latest \
        -Dkubernetes.container.image.pull-policy=Always \
        -Dkubernetes.jobmanager.service-account=flink-serviceaccount \
        local:///opt/flink/usrlib/streaming-0.1.jar
flink-application-delete:
    kubectl delete deployment/hm-flink-cluster --namespace=hm-flink

# TimescaleDB
timescaledb-start:
    docker run \
        --detach \
        --name=timescaledb \
        --publish=16863:5432 \
        --env=POSTGRES_DB=postgres \
        --env=POSTGRES_USER=admin \
        --env=POSTGRES_PASSWORD=passw0rd \
        timescale/timescaledb:latest-pg15
timescaledb-migrate:
    cd ../../../.. && \
    sh data-processing/flink/applications/stream-tweets/bin/migrate_timescaledb_twitter_db.sh

# Redis
redis-cli:
    redis-cli -h localhost -p 6379 --pass passw0rd