|
@@ -1,22 +1,32 @@
|
|
-# Installation, Configuration and Run
|
|
|
|
|
|
+# Installation
|
|
|
|
|
|
-## Installation
|
|
|
|
-1. Clone the taipy rest repository
|
|
|
|
|
|
+The latest stable version of _taipy-rest_ is available through _pip_:
|
|
|
|
+```bash
|
|
|
|
+pip install taipy-rest
|
|
```
|
|
```
|
|
-$ git clone https://github.com/Avaiga/taipy-rest
|
|
|
|
-```
|
|
|
|
-2. Enter taipy rest directory
|
|
|
|
|
|
|
|
-```
|
|
|
|
-$ cd taipy-rest
|
|
|
|
-```
|
|
|
|
|
|
+## Development version
|
|
|
|
|
|
-3. Install dependencies
|
|
|
|
|
|
+You can install the development version of _taipy-rest_ with _pip_ and _git_ via the taipy repository:
|
|
|
|
+```bash
|
|
|
|
+$ pip install git+https://git@github.com/Avaiga/taipy
|
|
```
|
|
```
|
|
-$ pip install pipenv && pipenv install
|
|
|
|
|
|
+
|
|
|
|
+This command installs the development version of _taipy_ package in the Python environment with all
|
|
|
|
+its dependencies, including the _taipy-rest_ package.
|
|
|
|
+
|
|
|
|
+If you need the source code for _taipy-rest_ on your system so you can see how things are done or
|
|
|
|
+maybe participate in the improvement of the packages, you can clone the GitHub repository:
|
|
|
|
+
|
|
|
|
+```bash
|
|
|
|
+$ git clone https://github.com/Avaiga/taipy.git
|
|
```
|
|
```
|
|
|
|
|
|
-## Configuration
|
|
|
|
|
|
+This creates the 'taipy' directory holding all the package's source code, and the 'taipy-rest'
|
|
|
|
+source code is in the 'taipy/rest' directory.
|
|
|
|
+
|
|
|
|
+# Configuration
|
|
|
|
+
|
|
Before running, we need to define some variables. Taipy rest APIs depend on pre-configuration of taipy config objects,
|
|
Before running, we need to define some variables. Taipy rest APIs depend on pre-configuration of taipy config objects,
|
|
i.e, is mandatory to define all configuration of DataNodes, Tasks, Sequences, etc. The file containing this
|
|
i.e, is mandatory to define all configuration of DataNodes, Tasks, Sequences, etc. The file containing this
|
|
configuration needs to be passed to the application at runtime. The following variable needs to be defined:
|
|
configuration needs to be passed to the application at runtime. The following variable needs to be defined:
|
|
@@ -25,25 +35,36 @@ configuration needs to be passed to the application at runtime. The following va
|
|
If using Docker, the folder containing the file needs to be mapped as a volume for it to be accessible to the
|
|
If using Docker, the folder containing the file needs to be mapped as a volume for it to be accessible to the
|
|
application.
|
|
application.
|
|
|
|
|
|
-## Running
|
|
|
|
-To run the application you can either run locally with:
|
|
|
|
|
|
+# Running
|
|
|
|
+
|
|
|
|
+To run taipy-rest, you need to install the required development packages.
|
|
|
|
+We recommend using [Pipenv](https://pipenv.pypa.io/en/latest/) to create a virtual environment
|
|
|
|
+and install the development packages.
|
|
|
|
+
|
|
|
|
+```bash
|
|
|
|
+$ pip install pipenv
|
|
|
|
+$ pipenv install --dev
|
|
```
|
|
```
|
|
|
|
+
|
|
|
|
+To run the application you can either run locally with:
|
|
|
|
+```bash
|
|
$ flask run
|
|
$ flask run
|
|
```
|
|
```
|
|
|
|
|
|
or it can be run inside Docker with:
|
|
or it can be run inside Docker with:
|
|
-```
|
|
|
|
|
|
+```bash
|
|
$ docker-compose up
|
|
$ docker-compose up
|
|
```
|
|
```
|
|
|
|
|
|
You can also run with a Gunicorn or wsgi server.
|
|
You can also run with a Gunicorn or wsgi server.
|
|
|
|
|
|
-### Running with Gunicorn
|
|
|
|
|
|
+## Running with Gunicorn
|
|
|
|
+
|
|
This project provide a simple wsgi entry point to run gunicorn or uwsgi for example.
|
|
This project provide a simple wsgi entry point to run gunicorn or uwsgi for example.
|
|
|
|
|
|
For gunicorn you only need to run the following commands
|
|
For gunicorn you only need to run the following commands
|
|
|
|
|
|
-```
|
|
|
|
|
|
+```bash
|
|
$ pip install gunicorn
|
|
$ pip install gunicorn
|
|
|
|
|
|
$ gunicorn myapi.wsgi:app
|
|
$ gunicorn myapi.wsgi:app
|
|
@@ -52,10 +73,11 @@ And that's it ! Gunicorn is running on port 8000
|
|
|
|
|
|
If you chose gunicorn as your wsgi server, the proper commands should be in your docker-compose file.
|
|
If you chose gunicorn as your wsgi server, the proper commands should be in your docker-compose file.
|
|
|
|
|
|
-### Running with uwsgi
|
|
|
|
|
|
+## Running with uwsgi
|
|
|
|
+
|
|
Pretty much the same as gunicorn here
|
|
Pretty much the same as gunicorn here
|
|
|
|
|
|
-```
|
|
|
|
|
|
+```bash
|
|
$ pip install uwsgi
|
|
$ pip install uwsgi
|
|
$ uwsgi --http 127.0.0.1:5000 --module myapi.wsgi:app
|
|
$ uwsgi --http 127.0.0.1:5000 --module myapi.wsgi:app
|
|
```
|
|
```
|
|
@@ -64,33 +86,34 @@ And that's it ! Uwsgi is running on port 5000
|
|
|
|
|
|
If you chose uwsgi as your wsgi server, the proper commands should be in your docker-compose file.
|
|
If you chose uwsgi as your wsgi server, the proper commands should be in your docker-compose file.
|
|
|
|
|
|
-### Deploying on Heroku
|
|
|
|
|
|
+## Deploying on Heroku
|
|
|
|
+
|
|
Make sure you have a working Docker installation (e.g. docker ps) and that you’re logged in to Heroku (heroku login).
|
|
Make sure you have a working Docker installation (e.g. docker ps) and that you’re logged in to Heroku (heroku login).
|
|
|
|
|
|
Log in to Container Registry:
|
|
Log in to Container Registry:
|
|
|
|
|
|
-```
|
|
|
|
|
|
+```bash
|
|
$ heroku container:login
|
|
$ heroku container:login
|
|
```
|
|
```
|
|
|
|
|
|
Create a heroku app
|
|
Create a heroku app
|
|
-```
|
|
|
|
|
|
+```bash
|
|
$ heroku create
|
|
$ heroku create
|
|
```
|
|
```
|
|
|
|
|
|
Build the image and push to Container Registry:
|
|
Build the image and push to Container Registry:
|
|
-```
|
|
|
|
|
|
+```bash
|
|
$ heroku container:push web
|
|
$ heroku container:push web
|
|
```
|
|
```
|
|
|
|
|
|
Then release the image:
|
|
Then release the image:
|
|
-```
|
|
|
|
|
|
+```bash
|
|
$ heroku container:release web
|
|
$ heroku container:release web
|
|
```
|
|
```
|
|
|
|
|
|
You can now access **taipy rest** on the URL that was returned on the `heroku create` command.
|
|
You can now access **taipy rest** on the URL that was returned on the `heroku create` command.
|
|
|
|
|
|
-## Documentation
|
|
|
|
|
|
+# Documentation
|
|
|
|
|
|
All the API Documentation can be found, after running the application in the following URL:
|
|
All the API Documentation can be found, after running the application in the following URL:
|
|
- ```/redoc-ui``` ReDoc UI configured to hit OpenAPI yaml file
|
|
- ```/redoc-ui``` ReDoc UI configured to hit OpenAPI yaml file
|