.. twisted_server: API Servers =========== The system provides two API servers for external communication. This page documents their systemd service configuration on Linux systems (Google Cloud Platform and Raspberry Pi). .. note:: For new external partner integrations, use the **FastAPI REST API Bridge** instead of Twisted. See :doc:`/development/tools/python/fastapi/fastapi` for details. | FastAPI REST API Bridge Server ------------------------------- Modern REST API server for external partner integrations. Runs on port 8001 (internal) and is exposed via Apache at ``/api`` path. **Service Configuration:** Service file: ``/etc/systemd/system/odoo-api-bridge.service`` The service is automatically created by the installation script ``scripts/install_api_bridge.sh`` from the ``odoo_xmlrpc_twisted`` repository. Example configuration: .. code:: [Unit] Description=Odoo API Bridge FastAPI Server After=network.target Wants=network.target [Service] Type=exec User=odooapi Group=odooapi WorkingDirectory=/usr/local/logistics/Python/repo/odoo_xmlrpc_twisted Environment=PATH=/usr/local/logistics/Python/venv/odoo_xmlrpc_twisted/bin Environment=PYTHONPATH=/usr/local/logistics/Python/repo/odoo_xmlrpc_twisted Environment=ENVIRONMENT=production ExecStart=/usr/local/logistics/Python/venv/odoo_xmlrpc_twisted/bin/uvicorn odoo_bridge_secure:app --host 127.0.0.1 --port 8001 --workers 2 ExecReload=/bin/kill -HUP $MAINPID Restart=always RestartSec=5 [Install] WantedBy=multi-user.target **Service Management:** Enable the service to start at boot: .. code:: sudo systemctl enable odoo-api-bridge Start the service: .. code:: sudo systemctl start odoo-api-bridge Stop the service: .. code:: sudo systemctl stop odoo-api-bridge Check service status: .. code:: sudo systemctl status odoo-api-bridge View logs: .. code:: sudo journalctl -u odoo-api-bridge -f **For complete installation and configuration:** See :doc:`/development/tools/python/fastapi/fastapi` | Twisted XMLRPC Server (Legacy) ------------------------------- Legacy XMLRPC server for existing integrations. According to the `following description `__ a service has been created for Twisted Server. The description both includes Google Cloud Platform and Raspberry Pi. 1. twisted-server.service Script``twisted-server.service`` installed in directory ``/etc/systemd/system/``. Script starts the Django Server on Debian Linux. Example of the script **twisted-server.service**: .. code:: sudo nano /etc/systemd/system/twisted-server.service Content: .. code:: [Unit] Description=Handling of the Twisted Server After=multi-user.target [Service] Type=simple ExecStart=/usr/local/logistics/Python/venv/odoo_xmlrpc_twisted/bin/python3 /usr/local/logistics/Python/repo/odoo_xmlrpc_twisted/Twisted.py Restart=on-abort [Install] WantedBy=multi-user.target | 2. Start and Stop of the Server Reload Systemd to read the new service unit file: .. code:: sudo systemctl daemon-reload Enable the service to start at boot: .. code:: sudo systemctl enable twisted-server Start of the Server .. code:: sudo systemctl start twisted-server Stop of the Server .. code:: sudo systemctl stop twisted-server Status of the Server .. code:: sudo systemctl status twisted-server