Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graceful shutdown implemented and uwsgi removed #84

Merged
merged 2 commits into from
Sep 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion developer_docs/docker-image.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
The Docker image for this driver includes the following features:

- Installs the driver from a `whl` file created with standard Python setuptools
- Runs the `ovd` command to start the driver application with a uwsgi container (standard for Python production applications)
- Runs the `gunicorn --workers $NUM_PROCESSES --bind :$DRIVER_PORT $SSL "osvimdriver:create_wsgi_app()"` command to start the driver application with a Gunicorn based container (standard for Python production applications)
- Supports installing a development version of Ignition from a `whl` file
- Supports configuring the uWSGI container implementation used at both build and runtime (also includes configuring the number of processes and threads used by uWSGI container)

Expand Down
1 change: 0 additions & 1 deletion developer_docs/helm-chart.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ The Helm chart for this driver includes the following features:
- Number of replicas of the driver
- Property groups configured on your application (i.e. override the properties in the default_config file)
- Log level
- uWSGI container used by your application
- Pod affinity/anti-affinity
- Node affinity/anti/affinity
- NodePort
Expand Down
9 changes: 4 additions & 5 deletions developer_docs/python-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

The Python package in this driver provides a workable application running with Connexion (on top of Flask). The Ignition framework takes care of configuring the application with the APIs and Python objects to handle the requests.

This application is then wrapped by a uWSGI to provide a production ready deployment.
This application is then wrapped by Gunicorn to provide a production ready deployment.

Bin scripts are provided in the `osvimdriver` package to start the driver in development or production mode.
Gunicorn command is used to run application after deployment, it creates a central master process and worker processes which handle the application.

## Testing

Expand All @@ -28,7 +28,6 @@ This file defines the metadata of the Python package to be built, including any

This file also specifies the entry points to the application, so a user may run the driver on the command line after installation:
- `ovd-dev` for a development server
- `ovd` (`ovd-gunicorn`/`ovd-uswgi`) for a production server

To build a distributable package of your application you will need the `setuptools` and `wheel` Python modules:

Expand All @@ -48,7 +47,7 @@ This whl file can now be used to install your application with Python:
python3 -m pip install <path to whl>
```

The commands `ovd-dev`, `ovd`, `ovd-gunicorn` and `ovd-uswgi` will now be avaiable from the command line.
The command `ovd-dev` will now be avaiable from the command line.

## Configuration

Expand All @@ -59,4 +58,4 @@ Ignition loads configuration properties from any sources provided to the applica
- `/var/ovd/ovd_config.yml` - this configuration file is only used in the Helm chart installation. Ignition will search for a configuration file at this path (ignored if not found)
- `OVD_CONFIG` - set this environment variable to a file path and Ignition will load the configuration file (ignored if the environment variable is not set)

This allows the user flexibility in how to configure the application. When running with Python (using `ovd-dev` or `ovd`) the best approach is to create a `ovd_config.yml` file in the current directory or configure `OVD_CONFIG` with a file path.
This allows the user flexibility in how to configure the application. When running with Python (using `ovd-dev` or `gunicorn --workers $NUM_PROCESSES --bind :$DRIVER_PORT $SSL "osvimdriver:create_wsgi_app()"`) the best approach is to create a `ovd_config.yml` file in the current directory or configure `OVD_CONFIG` with a file path.
7 changes: 2 additions & 5 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ ARG DRIVER_PORT
ENV DRIVER_PORT ${DRIVER_PORT:-8292}
ARG NUM_PROCESSES
ENV NUM_PROCESSES ${NUM_PROCESSES:-4}
ARG NUM_THREADS
ENV NUM_THREADS ${NUM_THREADS:-2}
ARG WSGI_CONTAINER
ENV WSGI_CONTAINER ${WSGI_CONTAINER:-gunicorn}

COPY whls/*.whl /whls/

Expand All @@ -33,4 +29,5 @@ WORKDIR /home/ovd

EXPOSE 8292

CMD ["ovd"]
CMD if [ $SSL_ENABLED | tr [:upper:] [:lower:] == "true" ]; then SSL="--certfile /var/ovd/certs/tls.crt --keyfile /var/ovd/certs/tls.key" ; fi \
&& gunicorn --workers $NUM_PROCESSES --bind :$DRIVER_PORT $SSL "osvimdriver:create_wsgi_app()"
4 changes: 0 additions & 4 deletions helm/os-vim-driver/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,8 @@ app:
## as top level fields in the Elasticsearch index.
LOG_TYPE: logstash

## configuration for WSGI container
## WSGI_CONTAINER can be uwsgi or gunicorn
WSGI_CONTAINER: gunicorn
## the number of processes and threads to spawn to handle requests
NUM_PROCESSES: "4"
NUM_THREADS: "4"

## ovd_config.yml (driver configuration) overrides
override:
Expand Down
12 changes: 0 additions & 12 deletions osvimdriver/bin/ovd

This file was deleted.

7 changes: 0 additions & 7 deletions osvimdriver/bin/ovd-gunicorn

This file was deleted.

9 changes: 0 additions & 9 deletions osvimdriver/bin/ovd-uwsgi

This file was deleted.

4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,10 @@
'python-novaclient>=13.0.0,<14.0.0',
'tosca-parser @ git+https://github.com/IBM/tosca-parser.git@accanto',
'heat-translator @ git+https://github.com/IBM/heat-translator.git@accanto-nfv',
'uwsgi==2.0.19.1',
'gunicorn==20.1.0'
],
entry_points='''
[console_scripts]
ovd-dev=osvimdriver.__main__:main
''',
scripts=['osvimdriver/bin/ovd-uwsgi', 'osvimdriver/bin/ovd-gunicorn', 'osvimdriver/bin/ovd']
'''
)