This repository has been archived by the owner on Mar 30, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added docker-compose and updated README (#37)
* Added docker-compose and updated README
- Loading branch information
Showing
6 changed files
with
177 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
COMPOSE_PROJECT_NAME=sciencebeam | ||
IMAGE_TAG=develop | ||
SCIENCEBEAM_GYM_COMMIT=851eb577398d47189dff748d36a735dcc84f3adb | ||
GROBID_TAG=0.5.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# ScienceBeam API | ||
|
||
## /api/convert | ||
|
||
The currently the only API is _/api/convert_ | ||
e.g. [http://localhost:8075/api/convert](http://localhost:8075/api/convert). | ||
|
||
It supports three modes of use. | ||
|
||
### GET | ||
|
||
A GET request will show a very simple submission form that allows the user to select a file which will be submitted to the API. | ||
|
||
### POST PDF as data | ||
|
||
The PDF can be posted as data to the API. The API will respond with the JATS XML. | ||
|
||
e.g. | ||
|
||
```bash | ||
curl -X POST --show-error -H "Content-Type: application/pdf" \ | ||
--data-binary @test.pdf \ | ||
http://localhost:8075/api/convert?filename=test.pdf | ||
``` | ||
|
||
The _filename_ parameter is optional. | ||
|
||
### POST PDF as a file | ||
|
||
The PDF can also be posted as a file. The effect will be the same as posting it as data. | ||
|
||
e.g. | ||
|
||
```bash | ||
curl -X POST --show-error --form \ | ||
"file=@test.pdf;filename=test.pdf" \ | ||
http://localhost:8075/api/convert | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# ScienceBeam Docker Containers | ||
|
||
This section details using or building the docker images. You will need [Docker](https://www.docker.com/) and [Docker Compose](https://docs.docker.com/compose/). | ||
|
||
## Run Latest Docker Container | ||
|
||
Clone this repository and run: | ||
|
||
```bash | ||
docker-compose -f docker-compose.latest.yml up | ||
``` | ||
|
||
That will start GROBID and ScienceBeam docker containers. The [ScienceBeam API](API.md) will be available on port _8075_. | ||
|
||
Alternatively run: | ||
|
||
```bash | ||
docker run --rm -p 8070:8070 lfoppiano/grobid:0.5.1 | ||
``` | ||
|
||
and: | ||
|
||
```bash | ||
docker run --rm -i -t -p 8075:8075 elifesciences/sciencebeam \ | ||
./server.sh --host=0.0.0.0 --port=8075 --grobid-url http://localhost:8070/api | ||
``` | ||
|
||
## Build and Run Docker Container with Docker Compose | ||
|
||
```bash | ||
docker-compose -f docker-compose.yml build | ||
``` | ||
|
||
```bash | ||
docker-compose -f docker-compose.yml up | ||
``` | ||
|
||
That will start GROBID and ScienceBeam docker containers. The [ScienceBeam API](API.md) will be available on port _8075_. | ||
|
||
## Build Docker Container Only | ||
|
||
```bash | ||
./build_container.sh | ||
``` | ||
|
||
## GROBID and Crossref Consolidation | ||
|
||
GROBID is optionally using Crossref consolidation to make the results more useful for archiving. | ||
|
||
For this project, the preference is not to enable it and the _docker-compose.yml*_ files explictly use a local network to prevent that. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
version: '3' | ||
|
||
services: | ||
sciencebeam: | ||
image: elifesciences/sciencebeam:latest | ||
command: ./server.sh \ | ||
--host=0.0.0.0 --port=8075 \ | ||
--grobid-url http://grobid:8070/api | ||
ports: | ||
- "8075:8075" | ||
networks: | ||
- default | ||
- grobid | ||
depends_on: | ||
- grobid | ||
grobid: | ||
image: lfoppiano/grobid:${GROBID_TAG} | ||
environment: | ||
- JAVA_OPTS=-Xmx1g | ||
ports: | ||
- "8070:8070" | ||
networks: | ||
- grobid | ||
|
||
networks: | ||
default: | ||
internal: false | ||
grobid: | ||
internal: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
version: '3' | ||
|
||
services: | ||
sciencebeam: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
args: | ||
sciencebeam_gym_commit: ${SCIENCEBEAM_GYM_COMMIT} | ||
image: elifesciences/sciencebeam:${IMAGE_TAG} | ||
command: ./server.sh \ | ||
--host=0.0.0.0 --port=8075 \ | ||
--grobid-url http://grobid:8070/api | ||
ports: | ||
- "8075:8075" | ||
networks: | ||
- default | ||
- grobid | ||
depends_on: | ||
- grobid | ||
grobid: | ||
image: lfoppiano/grobid:${GROBID_TAG} | ||
environment: | ||
- JAVA_OPTS=-Xmx1g | ||
ports: | ||
- "8070:8070" | ||
networks: | ||
- grobid | ||
|
||
networks: | ||
default: | ||
internal: false | ||
grobid: | ||
internal: true |