mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Update README.md
This commit is contained in:
parent
bad5fd20a8
commit
e7be75a4b7
1 changed files with 44 additions and 25 deletions
|
@ -5,7 +5,7 @@ A web api for compiling LaTeX documents in the cloud
|
||||||
|
|
||||||
The Common LaTeX Service Interface (CLSI) provides a RESTful interface to traditional LaTeX tools (or, more generally, any command line tool for composing marked-up documents into a display format such as PDF or HTML). The CLSI listens on the following ports by default:
|
The Common LaTeX Service Interface (CLSI) provides a RESTful interface to traditional LaTeX tools (or, more generally, any command line tool for composing marked-up documents into a display format such as PDF or HTML). The CLSI listens on the following ports by default:
|
||||||
|
|
||||||
* TCP/3009 - the RESTful interface
|
* TCP/3013 - the RESTful interface
|
||||||
* TCP/3048 - reports load information
|
* TCP/3048 - reports load information
|
||||||
* TCP/3049 - HTTP interface to control the CLSI service
|
* TCP/3049 - HTTP interface to control the CLSI service
|
||||||
|
|
||||||
|
@ -38,20 +38,36 @@ Then install the require npm modules:
|
||||||
|
|
||||||
$ npm install
|
$ npm install
|
||||||
|
|
||||||
Then compile the coffee script source files:
|
Then build the Docker image:
|
||||||
|
|
||||||
$ grunt install
|
$ docker build . -t overleaf/clsi
|
||||||
|
|
||||||
Finally, (after configuring your local database - see the Config section), run the CLSI service:
|
Then pull the TeXLive image:
|
||||||
|
|
||||||
$ grunt run
|
$ docker pull texlive/texlive
|
||||||
|
|
||||||
The CLSI should then be running at http://localhost:3013.
|
Then start the Docker container:
|
||||||
|
|
||||||
|
$ docker run --rm \
|
||||||
|
-p 127.0.0.1:3013:3013 \
|
||||||
|
-e LISTEN_ADDRESS=0.0.0.0 \
|
||||||
|
-e DOCKER_RUNNER=true \
|
||||||
|
-e TEXLIVE_IMAGE=texlive/texlive \
|
||||||
|
-e TEXLIVE_IMAGE_USER=root \
|
||||||
|
-e COMPILES_HOST_DIR="$PWD/compiles" \
|
||||||
|
-v "$PWD/compiles:/app/compiles" \
|
||||||
|
-v "$PWD/cache:/app/cache" \
|
||||||
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||||
|
overleaf/clsi
|
||||||
|
|
||||||
|
Note: if you're running the CLSI in macOS you may need to use `-v /var/run/docker.sock.raw:/var/run/docker.sock` instead.
|
||||||
|
|
||||||
|
The CLSI should then be running at <http://localhost:3013>
|
||||||
|
|
||||||
Config
|
Config
|
||||||
------
|
------
|
||||||
|
|
||||||
You will need to set up a database in mysql to use with the CLSI, and then fill in the database name, username and password in the config file at `config/settings.development.coffee`.
|
The CLSI will use a SQLite database by default, but you can optionally set up a MySQL database and then fill in the database name, username and password in the config file at `config/settings.development.coffee`.
|
||||||
|
|
||||||
API
|
API
|
||||||
---
|
---
|
||||||
|
@ -64,7 +80,7 @@ The CLSI is based on a JSON API.
|
||||||
|
|
||||||
POST /project/<project-id>/compile
|
POST /project/<project-id>/compile
|
||||||
|
|
||||||
```javascript
|
```json5
|
||||||
{
|
{
|
||||||
"compile": {
|
"compile": {
|
||||||
"options": {
|
"options": {
|
||||||
|
@ -77,22 +93,25 @@ The CLSI is based on a JSON API.
|
||||||
"rootResourcePath": "main.tex",
|
"rootResourcePath": "main.tex",
|
||||||
// An array of files to include in the compilation. May have either the content
|
// An array of files to include in the compilation. May have either the content
|
||||||
// passed directly, or a URL where it can be downloaded.
|
// passed directly, or a URL where it can be downloaded.
|
||||||
"resources": [{
|
"resources": [
|
||||||
|
{
|
||||||
"path": "main.tex",
|
"path": "main.tex",
|
||||||
"content": "\\documentclass{article}\n\\begin{document}\nHello World\n\\end{document}"
|
"content": "\\documentclass{article}\n\\begin{document}\nHello World\n\\end{document}"
|
||||||
}, {
|
}
|
||||||
"path": "image.png",
|
// ,{
|
||||||
"url": "www.example.com/image.png",
|
// "path": "image.png",
|
||||||
"modified": 123456789 // Unix time since epoch
|
// "url": "www.example.com/image.png",
|
||||||
}]
|
// "modified": 123456789 // Unix time since epoch
|
||||||
|
// }
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
With `curl`, if you place the above json in a file called `data.json`, the request would look like this:
|
With `curl`, if you place the above JSON in a file called `data.json`, the request would look like this:
|
||||||
|
|
||||||
``` shell
|
``` shell
|
||||||
$ curl -X POST -d @data.json localhost:3013/project/<id>/compile
|
$ curl -X POST -H 'Content-Type: application/json' -d @data.json http://localhost:3013/project/<id>/compile
|
||||||
```
|
```
|
||||||
|
|
||||||
You can specify any project-id in the URL, and the files and LaTeX environment will be persisted between requests.
|
You can specify any project-id in the URL, and the files and LaTeX environment will be persisted between requests.
|
||||||
|
@ -100,7 +119,7 @@ URLs will be downloaded and cached until provided with a more recent modified da
|
||||||
|
|
||||||
#### Example Response
|
#### Example Response
|
||||||
|
|
||||||
```javascript
|
```json
|
||||||
{
|
{
|
||||||
"compile": {
|
"compile": {
|
||||||
"status": "success",
|
"status": "success",
|
||||||
|
@ -120,4 +139,4 @@ License
|
||||||
|
|
||||||
The code in this repository is released under the GNU AFFERO GENERAL PUBLIC LICENSE, version 3. A copy can be found in the `LICENSE` file.
|
The code in this repository is released under the GNU AFFERO GENERAL PUBLIC LICENSE, version 3. A copy can be found in the `LICENSE` file.
|
||||||
|
|
||||||
Copyright (c) Overleaf, 2014-2019.
|
Copyright (c) Overleaf, 2014-2021.
|
||||||
|
|
Loading…
Reference in a new issue