The full project documentation can be found in the readthedocs website.
First clone the projet:
git clone https://github.com/AntaresSimulatorTeam/AntaREST.git
cd AntaREST
Install back-end dependencies
python -m pip install --upgrade pip
pip install pydantic --no-binary pydantic
pip install -r requirements.txt # use requirements-dev.txt if building a single binary with pyinstaller
Install the front-end dependencies:
cd webapp
npm install
cd ..
Then build the front-end application:
- for use with pyinstaller:
NODE_OPTIONS="--max-old-space-size=8192" ./scripts/build-front.sh
- for other uses (docker deployement, ...):
cd webapp
npm run build
cd ..
Linux system:
git log -1 HEAD --format=%H > ./resources/commit_id
pyinstaller AntaresWebLinux.spec
Windows system:
git log -1 HEAD --format=%H > .\resources\commit_id
pyinstaller AntaresWebWin.spec
You can test the build is ok using:
dist/AntaresWeb/AntaresWebServer -v # Linux based system
dist\AntaresWeb\AntaresWebServer.exe -v # Windows system
To build the docker image, use the following command:
docker build --tag antarest .
dist/AntaresWeb/AntaresWebServer -c </path/to/config.yaml> # Linux based system
dist\AntaresWeb\AntaresWebServer.exe -c </path/to/config.yaml> # Windows system
You may run the back-end with default configuration using the following command:
docker run \
-p 80:5000 \
-e GUNICORN_WORKERS=1 \
antarest
However, for a complete deployment including the front-end application, and the use of an external database and an external REDIS instance, please refer to the deployement instructions on readthedocs website
pip install -e .
python ./antarest/main.py -c resources/application.yaml
pip install -e .
export ANTAREST_CONF=resources/application.yaml
export GUNICORN_WORKERS=4
gunicorn --config conf/gunicorn.py --worker-class=uvicorn.workers.UvicornWorker antarest.wsgi:app
Once you started the server, you have access to the API. The address (the port mostly) depends of the way you started the server. If you start the server
- via python use: http://0.0.0.0:8080
- via gunicorn use: http://0.0.0.0:5000
- via docker use: http://0.0.0.0:80 (if you use the parameter -p 80:5000)
To test the server, you can list the available studies in your workspace using:
curl http://localhost:8080/v1/studies
Or data of a specific study using:
curl http://localhost:8080/v1/studies/{study_uuid}
The current API handle hundreds of html end point (get and post) to manipulate your studies. The best way to discover the API is using it's swagger documentation (see below).
The ANTARES API doc is available within the application (open your browser to http://localhost:8080
)
You can also fetch the raw open api spec :
curl http://localhost:8080/openapi.json > swagger.json