Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM alpine:3.10.0

RUN apk add build-base postgresql-dev python3 python3-dev --no-cache

COPY . /app
WORKDIR /app
RUN pip3 install -e .

ENV BULK_SIZE 2000
ENV MAX_WORKERS 4

ENTRYPOINT ["hive2elastic_post"]
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
REPO_SLUG=steemit/hive2elastic #TODO: Make this shell out to git remove -v | grep blah
VERSION=$(shell cat VERSION)

build:
docker build -t ${REPO_SLUG}:${VERSION} .
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0.2
21 changes: 21 additions & 0 deletions prepare_postgres.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
CREATE TABLE __h2e_posts
(
post_id INTEGER PRIMARY KEY
);

INSERT INTO __h2e_posts (post_id) SELECT post_id FROM hive_posts_cache;

CREATE OR REPLACE FUNCTION __fn_h2e_posts()
RETURNS TRIGGER AS
$func$
BEGIN
IF NOT EXISTS (SELECT post_id FROM __h2e_posts WHERE post_id = NEW.post_id) THEN
INSERT INTO __h2e_posts (post_id) VALUES (NEW.post_id);
END IF;
RETURN NEW;
END
$func$ LANGUAGE plpgsql;

CREATE TRIGGER __trg_h2e_posts
AFTER INSERT OR UPDATE ON hive_posts_cache
FOR EACH ROW EXECUTE PROCEDURE __fn_h2e_posts();
9 changes: 7 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
# coding=utf-8
import sys
import sys, os

from setuptools import find_packages
from setuptools import setup

assert sys.version_info[0] == 3 and sys.version_info[1] >= 5, "hive2elastic requires Python 3.5 or newer"

# Get version from the VERSION file
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'VERSION'), encoding='utf-8') as f:
version = f.read()

setup(
name='hive2elastic',
version='0.0.1',
version=version,
description='hive to elastic exporter',
long_description=open('README.md').read(),
packages=find_packages(),
Expand Down