.. _advanced-configuration-section: ====================== Advanced configuration ====================== Application settings -------------------- Spatial extents ~~~~~~~~~~~~~~~ In order to check your configuration of spatial extents, a small tool is available at http://server/tools/extents/. .. note :: Administrator privileges are required. Email settings ~~~~~~~~~~~~~~ Geotrek-admin will send emails: * to administrators when internal errors occur * to managers when a feedback report is created Email configuration takes place in ``/opt/geotrek-admin/var/conf/custom.py``, where you control recipients emails (``ADMINS``, ``MANAGERS``) and email server configuration. Set configuration settings in ``geotrek/settings/custom.py.dist`` template file. You can test your configuration with the following command. A fake email will be sent to the managers: .. code-block :: bash sudo geotrek sendtestemail --managers API ~~~ .. code-block :: python API_IS_PUBLIC = True Choose if you want the API V2 to be available for everyone without authentication. This API provides access to promotion content (Treks, POIs, Touristic Contents ...). Set to False if Geotrek is intended to be used only for managing content and not promoting them. Note that this setting does not impact the Path endpoints, which means that the Paths informations will always need authentication to be display in the API, regardless of this setting. Swagger API documentation ~~~~~~~~~~~~~~~~~~~~~~~~~ In order to enable swagger module to auto-document API, in the custom settings file, add the following code: .. code-block :: python # Enable API v2 documentation INSTALLED_APPS += ('drf_yasg', ) Then run ``sudo dpkg-reconfigure -u geotrek-admin``. The API swagger documentation is now availaible here : `/api/v2` Share services between several Geotrek instances ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ As explained :ref:`in the design section `, *Geotrek-admin* relies on several services. They are generic and reusable, and can thus be shared between several instances, in order to save system resources for example. A simple way to achieve this is to install one instance with everything as usual (*standalone*), and plug the other instances on its underlying services. Capture and conversion '''''''''''''''''''''' If you want to use external services, in ``.env``, add following variables: .. code-block :: python CAPTURE_HOST=x.x.x.x CAPTURE_PORT=XX CONVERSION_HOST=x.x.x.x CONVERSION_PORT=XX Then, you can delete all screamshotter and convertit references in ``docker-compose.yml``. Shutdown useless services ''''''''''''''''''''''''' Now that your instances point the shared server. You can shutdown the useless services on each instance. Start by stopping everything: .. code-block :: bash sudo systemctl stop geotrek Control number of workers and request timeouts ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ By default, the application runs on 4 processes, and timeouts after 30 seconds. To control those values, edit and fix your ``docker-compose.yml`` file in web and api section. To know how many workers you should set, please refer to `gunicorn documentation `_. External authent ~~~~~~~~~~~~~~~~ You can authenticate user against a remote database table or view. To enable this feature, fill these fields in ``/opt/geotrek-admin/var/conf/custom.py``: .. code-block :: python AUTHENT_DATABASE = 'authent' DATABASES['authent'] = { 'ENGINE': 'django.contrib.gis.db.backends.postgis', 'NAME': '', 'USER': '', 'PASSWORD': '', 'HOST': '', 'PORT': '', } AUTHENT_TABLENAME = '' AUTHENTICATION_BACKENDS = ['geotrek.authent.backend.DatabaseBackend'] Expected columns in table/view are : * username : string (*unique*) * first_name : string * last_name : string * password : string (simple md5 encoded, or full hashed and salted password) * email : string * level : integer (1: readonly, 2: redactor, 3: path manager, 4: trekking manager, 5: management and trekking editor, 6: administrator) * structure : string * lang : string (language code) .. note :: The schema used in ``AUTHENT_TABLENAME`` must be in the user search_path (``ALTER USER $geotrek_db_user SET search_path=public,userschema;``) User management will be disabled from Administration backoffice. In order to disable remote login, just comment *AUTHENTICATION_BACKENDS* line in settings file, and restart instance (see paragraph above). Geotrek-admin can support many types of users authentication (LDAP, oauth, ...), contact us for more details. Custom SQL ~~~~~~~~~~ Put your custom SQL in a file name ``/opt/geotrek-admin/var/conf/extra_sql//
_