mirror of
https://github.com/ilri/dspace-statistics-api.git
synced 2025-05-10 15:16:02 +02:00
Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
15c3299b99
|
|||
d36be5ee50 | |||
2f45d27554 | |||
b8356f7a87 | |||
2136dc79ce | |||
ed60120cef | |||
c027f01b48 | |||
754663f062
|
|||
507699e58a
|
@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
### [0.6.0] - 2018-10-31
|
||||||
|
## Changed
|
||||||
|
- Refactor project structure (note breaking changes to API and indexing invocation, see contrib and README.md)
|
||||||
|
|
||||||
|
### [0.5.2] - 2018-10-28
|
||||||
|
## Changed
|
||||||
|
- Update library versions in requirements.txt
|
||||||
|
|
||||||
### [0.5.1] - 2018-10-24
|
### [0.5.1] - 2018-10-24
|
||||||
## Changed
|
## Changed
|
||||||
- Use Python's native json instead of ujson
|
- Use Python's native json instead of ujson
|
||||||
|
@ -24,11 +24,11 @@ Set up the environment variables for Solr and PostgreSQL:
|
|||||||
|
|
||||||
Index the Solr statistics core to populate the PostgreSQL database:
|
Index the Solr statistics core to populate the PostgreSQL database:
|
||||||
|
|
||||||
$ ./indexer.py
|
$ python -m dspace_statistics_api.indexer
|
||||||
|
|
||||||
Run the REST API:
|
Run the REST API:
|
||||||
|
|
||||||
$ gunicorn app:api
|
$ gunicorn dspace_statistics_api.app
|
||||||
|
|
||||||
Test to see if there are any statistics:
|
Test to see if there are any statistics:
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ Group=nogroup
|
|||||||
WorkingDirectory=/var/lib/dspace-statistics-api
|
WorkingDirectory=/var/lib/dspace-statistics-api
|
||||||
ExecStart=/var/lib/dspace-statistics-api/venv/bin/gunicorn \
|
ExecStart=/var/lib/dspace-statistics-api/venv/bin/gunicorn \
|
||||||
--bind 127.0.0.1:5000 \
|
--bind 127.0.0.1:5000 \
|
||||||
app:api
|
dspace_statistics_api.app
|
||||||
ExecReload=/bin/kill -s HUP $MAINPID
|
ExecReload=/bin/kill -s HUP $MAINPID
|
||||||
ExecStop=/bin/kill -s TERM $MAINPID
|
ExecStop=/bin/kill -s TERM $MAINPID
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ Environment=DATABASE_HOST=localhost
|
|||||||
User=nobody
|
User=nobody
|
||||||
Group=nogroup
|
Group=nogroup
|
||||||
WorkingDirectory=/var/lib/dspace-statistics-api
|
WorkingDirectory=/var/lib/dspace-statistics-api
|
||||||
ExecStart=/var/lib/dspace-statistics-api/venv/bin/python indexer.py
|
ExecStart=/var/lib/dspace-statistics-api/venv/bin/python -m dspace_statistics_api.indexer
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
0
dspace_statistics_api/__init__.py
Normal file
0
dspace_statistics_api/__init__.py
Normal file
@ -1,4 +1,4 @@
|
|||||||
from database import database_connection
|
from .database import database_connection
|
||||||
import falcon
|
import falcon
|
||||||
|
|
||||||
db = database_connection()
|
db = database_connection()
|
||||||
@ -63,10 +63,7 @@ class ItemResource:
|
|||||||
|
|
||||||
cursor.close()
|
cursor.close()
|
||||||
|
|
||||||
def on_exit(api):
|
api = application = falcon.API()
|
||||||
print("Shutting down DB")
|
|
||||||
|
|
||||||
api = falcon.API()
|
|
||||||
api.add_route('/items', AllItemsResource())
|
api.add_route('/items', AllItemsResource())
|
||||||
api.add_route('/item/{item_id:int}', ItemResource())
|
api.add_route('/item/{item_id:int}', ItemResource())
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
from config import DATABASE_NAME
|
from .config import DATABASE_NAME
|
||||||
from config import DATABASE_USER
|
from .config import DATABASE_USER
|
||||||
from config import DATABASE_PASS
|
from .config import DATABASE_PASS
|
||||||
from config import DATABASE_HOST
|
from .config import DATABASE_HOST
|
||||||
import psycopg2, psycopg2.extras
|
import psycopg2, psycopg2.extras
|
||||||
|
|
||||||
def database_connection():
|
def database_connection():
|
5
indexer.py → dspace_statistics_api/indexer.py
Executable file → Normal file
5
indexer.py → dspace_statistics_api/indexer.py
Executable file → Normal file
@ -1,4 +1,3 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
#
|
#
|
||||||
# indexer.py
|
# indexer.py
|
||||||
#
|
#
|
||||||
@ -30,10 +29,10 @@
|
|||||||
# See: https://solrclient.readthedocs.io/en/latest/SolrClient.html
|
# See: https://solrclient.readthedocs.io/en/latest/SolrClient.html
|
||||||
# See: https://wiki.duraspace.org/display/DSPACE/Solr
|
# See: https://wiki.duraspace.org/display/DSPACE/Solr
|
||||||
|
|
||||||
from database import database_connection
|
from .database import database_connection
|
||||||
import json
|
import json
|
||||||
import psycopg2.extras
|
import psycopg2.extras
|
||||||
from solr import solr_connection
|
from .solr import solr_connection
|
||||||
|
|
||||||
def index_views():
|
def index_views():
|
||||||
# get total number of distinct facets for items with a minimum of 1 view,
|
# get total number of distinct facets for items with a minimum of 1 view,
|
@ -1,4 +1,4 @@
|
|||||||
from config import SOLR_SERVER
|
from .config import SOLR_SERVER
|
||||||
from SolrClient import SolrClient
|
from SolrClient import SolrClient
|
||||||
|
|
||||||
def solr_connection():
|
def solr_connection():
|
@ -1,4 +1,4 @@
|
|||||||
certifi==2018.8.24
|
certifi==2018.10.15
|
||||||
chardet==3.0.4
|
chardet==3.0.4
|
||||||
falcon==1.4.1
|
falcon==1.4.1
|
||||||
gunicorn==19.9.0
|
gunicorn==19.9.0
|
||||||
@ -6,7 +6,7 @@ idna==2.7
|
|||||||
kazoo==2.5.0
|
kazoo==2.5.0
|
||||||
psycopg2-binary==2.7.5
|
psycopg2-binary==2.7.5
|
||||||
python-mimeparse==1.6.0
|
python-mimeparse==1.6.0
|
||||||
requests==2.19.1
|
requests==2.20.0
|
||||||
six==1.11.0
|
six==1.11.0
|
||||||
SolrClient==0.2.1
|
-e git://github.com/alanorth/SolrClient.git@c629e3475be37c82770b2be61748be7e29882648#egg=SolrClient
|
||||||
urllib3==1.23
|
urllib3==1.24
|
||||||
|
Reference in New Issue
Block a user