├── Procfile ├── Aptfile ├── .gitignore ├── demo-connector.json ├── LICENSE ├── setup_certs ├── start-ksql ├── make-connector ├── start-distributed └── README.md /Procfile: -------------------------------------------------------------------------------- 1 | web: ./start-distributed dyno-connect-distributed.properties 2 | # web: ./start-ksql ksql-server.properties 3 | -------------------------------------------------------------------------------- /Aptfile: -------------------------------------------------------------------------------- 1 | :repo:deb [arch=amd64] http://packages.confluent.io/deb/4.0 stable main 2 | confluent-kafka-2.11 3 | confluent-schema-registry 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.jar 15 | *.war 16 | *.ear 17 | *.zip 18 | *.tar.gz 19 | *.rar 20 | 21 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 22 | hs_err_pid* 23 | -------------------------------------------------------------------------------- /demo-connector.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "demo-connector", 3 | "config": { 4 | "connector.class": "io.debezium.connector.postgresql.PostgresConnector", 5 | "tasks.max": "1", 6 | "database.hostname": "postgres", 7 | "database.port": "", 8 | "database.user": "", 9 | "database.password": "", 10 | "database.dbname" : "postgres", 11 | "database.server.name": "postgresql-jchao-perpendicular-77247", 12 | "database.whitelist": "demo", 13 | "database.history.kafka.bootstrap.servers": "", 14 | "database.history.kafka.topic": "schema-changes.demo" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Jeff Chao 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /setup_certs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | addon="$1" 6 | 7 | [ -z $addon ] && { 8 | echo "addon is missing" >&2 9 | exit 1 10 | } 11 | 12 | client_key="$(echo $addon)_CLIENT_CERT_KEY" 13 | client_cert="$(echo $addon)_CLIENT_CERT" 14 | trusted_cert="$(echo $addon)_TRUSTED_CERT" 15 | 16 | [ -z $TRUSTSTORE_PASSWORD ] && { 17 | echo "TRUSTSTORE_PASSWORD is missing" >&2 18 | exit 1 19 | } 20 | 21 | [ -z $KEYSTORE_PASSWORD ] && { 22 | echo "KEYSTORE_PASSWORD is missing" >&2 23 | exit 1 24 | } 25 | 26 | rm -f .{keystore,truststore}.{pem,pkcs12,jks} 27 | rm -f .cacerts 28 | 29 | #cp /etc/ssl/certs/java/cacerts ./.cacerts 30 | 31 | echo -n "${!client_key}" >> .keystore.pem 32 | echo -n "${!client_cert}" >> .keystore.pem 33 | echo -n "${!trusted_cert}" > .truststore.pem 34 | 35 | keytool -importcert -file .truststore.pem -keystore .truststore.jks -deststorepass $TRUSTSTORE_PASSWORD -noprompt 36 | 37 | openssl pkcs12 -export -in .keystore.pem -out .keystore.pkcs12 -password pass:$KEYSTORE_PASSWORD 38 | keytool -importkeystore -srcstoretype PKCS12 \ 39 | -destkeystore .keystore.jks -deststorepass $KEYSTORE_PASSWORD \ 40 | -srckeystore .keystore.pkcs12 -srcstorepass $KEYSTORE_PASSWORD 41 | 42 | rm -f .{keystore,truststore}.{pem,pkcs12} 43 | -------------------------------------------------------------------------------- /start-ksql: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | KSQL_PROPERTIES_FILE="ksql-server.properties" 4 | KSQL_URL="https://github.com/confluentinc/ksql/releases/download/v0.4/ksql-0.4.tgz" 5 | 6 | ./setup_certs HEROKU_KAFKA_JCHAO 7 | 8 | cat > $KSQL_PROPERTIES_FILE <&2 14 | usage 15 | exit 1 16 | } 17 | 18 | [ -z $table_name ] && { 19 | echo "TABLE_NAME is missing" >&2 20 | usage 21 | exit 1 22 | } 23 | 24 | eval $(heroku config:get -s DATABASE_URL KAFKA_URL -a "$app_name") 25 | 26 | url_re='^postgres://([[:alnum:]]+):([[:alnum:]]+)@([-\.[:alnum:]]+):([[:digit:]]+)/([[:alnum:]]+)' 27 | if [[ $DATABASE_URL =~ $url_re ]]; then 28 | user=${BASH_REMATCH[1]} 29 | pass=${BASH_REMATCH[2]} 30 | host=${BASH_REMATCH[3]} 31 | port=${BASH_REMATCH[4]} 32 | database=${BASH_REMATCH[5]} 33 | fi 34 | 35 | # cat < $DYNO_CONNECT_DISTRIBUTED_PROPERTIES_FILE <