aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorterminaldweller <thabogre@gmail.com>2021-11-12 04:35:56 +0000
committerterminaldweller <thabogre@gmail.com>2021-11-12 04:35:56 +0000
commitd8beed8d574a42a2e6eab5632e40f235f1408277 (patch)
tree1d0b3926c0b320690231782860b84f8420ed6bf3
parentWIP (diff)
downloaddevourer-d8beed8d574a42a2e6eab5632e40f235f1408277.tar.gz
devourer-d8beed8d574a42a2e6eab5632e40f235f1408277.zip
the server is up and running now. the things that worked before work now
-rw-r--r--Dockerfile1
-rw-r--r--devourer.py6
-rw-r--r--docker-compose-test.yaml10
-rw-r--r--docker-compose.yaml8
-rwxr-xr-xdocker-entrypoint.sh4
-rw-r--r--pyproject.toml1
-rwxr-xr-xtests.sh4
7 files changed, 18 insertions, 16 deletions
diff --git a/Dockerfile b/Dockerfile
index 3cf3409..9ca872e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -25,7 +25,6 @@ WORKDIR /certs
RUN openssl req -nodes -new -x509 -subj="/C=US/ST=Denial/L=springfield/O=Dis/CN=localhost" -keyout server.key -out server.cert
FROM python-base as production
-RUN pip3 install uvicorn
COPY --from=certbuilder /certs/ /certs
ENV FASTAPI_ENV=production
COPY --from=builder-base $VENV_PATH $VENV_PATH
diff --git a/devourer.py b/devourer.py
index cc25206..4fb8532 100644
--- a/devourer.py
+++ b/devourer.py
@@ -215,9 +215,7 @@ def summarizeLinkToAudio(url, summary) -> str:
result = article.text
else:
print("invalid option for summary type.")
- result = None
except Exception as e:
- result = None
logging.exception(e)
finally:
return result
@@ -256,8 +254,8 @@ def searchWikipedia(search_term: str) -> str:
}
res = getWithParams(os.environ["WIKI_SEARCH_URL"], searchParmas)
# FIXME-handle wiki redirects/disambiguations
- # argparser.args.source = res[3][0]
- print(res)
+ source = res[3][0]
+ result = summarizeLinkToAudio(source, "none")
except Exception as e:
logging.exception(e)
finally:
diff --git a/docker-compose-test.yaml b/docker-compose-test.yaml
index fea638b..d937bd3 100644
--- a/docker-compose-test.yaml
+++ b/docker-compose-test.yaml
@@ -8,17 +8,17 @@ services:
depends_on:
- tika
ports:
- - "9009:80"
+ - "19019:80"
environment:
- - TIKA_SERVER_ENDPOINT="tika:9998"
- - AUDIO_DUMP_DIR="/tmp"
- - WIKI_SEARCH_URL="https://en.wikipedia.org/w/api.php"
+ - TIKA_SERVER_ENDPOINT=tika:9998
+ - AUDIO_DUMP_DIR=/tmp
+ - WIKI_SEARCH_URL=https://en.wikipedia.org/w/api.php
- SERVER_DEPLOYMENT_TYPE=test
cap_drop:
- ALL
entrypoint: ["/docker-entrypoint.sh"]
tika:
- image: apache/tike:2.0.0
+ image: apache/tika:2.0.0
networks:
- tikanet
cap_drop:
diff --git a/docker-compose.yaml b/docker-compose.yaml
index 5a2bccf..a68e7fe 100644
--- a/docker-compose.yaml
+++ b/docker-compose.yaml
@@ -10,15 +10,15 @@ services:
ports:
- "9009:80"
environment:
- - TIKA_SERVER_ENDPOINT="tika:9998"
- - AUDIO_DUMP_DIR="/tmp"
- - WIKI_SEARCH_URL="https://en.wikipedia.org/w/api.php"
+ - TIKA_SERVER_ENDPOINT=tika:9998
+ - AUDIO_DUMP_DIR=/tmp
+ - WIKI_SEARCH_URL=https://en.wikipedia.org/w/api.php
- SERVER_DEPLOYMENT_TYPE=deployment
cap_drop:
- ALL
entrypoint: ["/docker-entrypoint.sh"]
tika:
- image: apache/tike:2.0.0
+ image: apache/tika:2.0.0
networks:
- tikanet
cap_drop:
diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh
index 58d63ce..92e2537 100755
--- a/docker-entrypoint.sh
+++ b/docker-entrypoint.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env sh
if [ "$SERVER_DEPLOYMENT_TYPE" = "deployment" ]; then
- uvicorn main:app --host 0.0.0.0 --port 80 --ssl-certfile /certs/server.cert --ssl-keyfile /certs/server.key
+ uvicorn devourer:app --host 0.0.0.0 --port 80 --ssl-certfile /certs/server.cert --ssl-keyfile /certs/server.key
elif [ "$SERVER_DEPLOYMENT_TYPE" = "test" ]; then
- uvicorn main:app --host 0.0.0.0 --port 80 --ssl-certfile /certs/server.cert --ssl-keyfile /certs/server.key
+ uvicorn devourer:app --host 0.0.0.0 --port 80 --ssl-certfile /certs/server.cert --ssl-keyfile /certs/server.key
fi
diff --git a/pyproject.toml b/pyproject.toml
index 1c677c6..95b9f5d 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -17,6 +17,7 @@ tensorflow = "^2.6.0"
torch = "^1.9.1"
transformers = "^4.11.2"
fastapi = "^0.70.0"
+uvicorn = "^0.15.0"
[tool.poetry.dev-dependencies]
diff --git a/tests.sh b/tests.sh
new file mode 100755
index 0000000..c88fb90
--- /dev/null
+++ b/tests.sh
@@ -0,0 +1,4 @@
+#!/usr/bin/env sh
+
+curl -k -X GET https://localhost:19019/summ?url=https://dilipkumar.medium.com/standalone-mongodb-on-kubernetes-cluster-19e7b5896b27&summary=none&audio=false
+curl -k -X GET https://localhost:19019/wiki?term=iommu