Move configuration to traditional way

️ This is the way.

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2020-01-30 20:27:25 +01:00
parent 98051b08c3
commit 9e3df495dc
32 changed files with 368 additions and 256 deletions

View File

@@ -0,0 +1,31 @@
# Email
Mobilizon requires a SMTP server to deliver emails. Using 3rd-party mail providers (Mandrill, SendGrid, Mailjet, …) will be possible in the future.
## SMTP configuration
Mobilizon default settings assumes a SMTP server listens on `localhost`, port `25`. To specify a specific server and credentials, you can add the following section in your `prod.secret.exs` file and modify credentials to your needs.
```elixir
config :mobilizon, Mobilizon.Web.Email.Mailer,
adapter: Bamboo.SMTPAdapter,
server: "localhost",
hostname: "localhost",
port: 25,
username: nil,
password: nil,
# can be `:always` or `:never`
tls: :if_available,
allowed_tls_versions: [:tlsv1, :"tlsv1.1", :"tlsv1.2"],
# can be `true`
ssl: false,
retries: 1,
# can be `true`
no_mx_lookups: false,
# can be `:always`. If your smtp relay requires authentication set it to `:always`.
auth: :if_available
```
!!! tip
The hostname option sets the FQDN to the header of your emails, its optional, but if you don't set it, the underlying `gen_smtp` module will use the hostname of your machine, like `localhost`.
You'll need to restart Mobilizon to recompile the app and apply the new settings.

View File

@@ -10,18 +10,28 @@ However, providing a geocoding service is quite expensive, especially if you wan
!!! note "Hardware setup"
To give an idea of what hardware is required to self-host a geocoding service, we successfully installed and used [Addok](#addok), [Pelias](#pelias) and [Mimirsbrunn](#mimirsbrunn) on a 8 cores/16GB RAM machine without any issues **importing only French addresses and data**.
## Change geocoder
To change geocoder backend, you need to add the following line in `prod.secret.exs`:
```elixir
config :mobilizon, Mobilizon.Service.Geospatial,
service: Mobilizon.Service.Geospatial.Nominatim
```
And change `Nominatim` to one of the supported geocoders. Depending on the provider, you'll also need to add some special config to specify eventual endpoints or API keys.
For instance, when using `Mimirsbrunn`, you'll need the following configuration:
```elixir
config :mobilizon, Mobilizon.Service.Geospatial,
service: Mobilizon.Service.Geospatial.Mimirsbrunn
config :mobilizon, Mobilizon.Service.Geospatial.Mimirsbrunn,
endpoint: "https://my-mimir-instance.tld"
```
## List of supported geocoders
This is the list of all geocoders supported by Mobilizon. The current default one is [Nominatim](#nominatim) and uses the official OpenStreetMap instance.
!!! bug
Changing geocoder through `.env` configuration isn't currently supported by Mobilizon.
Instead you need to edit the following line in `config.prod.exs`:
```elixir
config :mobilizon, Mobilizon.Service.Geospatial, service: Mobilizon.Service.Geospatial.Nominatim
```
And change `Nominatim` to one of the supported geocoders. This change might be overwritten when updating Mobilizon.
### Nominatim
[Nominatim](https://wiki.openstreetmap.org/wiki/Nominatim) is a GPL-2.0 licenced tool to search data by name and address. It's written in C and PHP and uses PostgreSQL.
@@ -35,6 +45,13 @@ It's the current default search tool on the [OpenStreetMap homepage](https://www
Several companies provide hosted instances of Nominatim that you can query via an API, for example see [MapQuest Open Initiative](https://developer.mapquest.com/documentation/open/nominatim-search).
** Default configuration **
```elixir
config :mobilizon, Mobilizon.Service.Geospatial.Nominatim,
endpoint: "https://nominatim.openstreetmap.org",
api_key: nil
```
### Addok
[Addok](https://github.com/addok/addok) is a WTFPL licenced search engine for address (and only address). It's written in Python and uses Redis.
@@ -42,6 +59,12 @@ It's used by French government for [adresse.data.gouv.fr](https://adresse.data.g
!!! warning "Terms"
When using France's Addok instance at `api-adresse.data.gouv.fr` (default endpoint for this geocoder if not configured otherwise), you need to read and accept the [GCU](https://adresse.data.gouv.fr/cgu) (in French).
** Default configuration **
```elixir
config :mobilizon, Mobilizon.Service.Geospatial.Addok,
endpoint: "https://api-adresse.data.gouv.fr"
```
### Photon
@@ -50,6 +73,12 @@ It's used by French government for [adresse.data.gouv.fr](https://adresse.data.g
!!! warning "Terms"
The terms of use for the official instance (default endpoint for this geocoder if not configured otherwise) are simply the following:
> You can use the API for your project, but please be fair - extensive usage will be throttled. We do not guarantee for the availability and usage might be subject of change in the future.
** Default configuration **
```elixir
config :mobilizon, Mobilizon.Service.Geospatial.Photon,
endpoint: "https://photon.komoot.de"
```
### Pelias
@@ -58,24 +87,53 @@ It's used by French government for [adresse.data.gouv.fr](https://adresse.data.g
There's [Geocode Earth](https://geocode.earth/) SAAS that provides a Pelias API.
They offer discounts for Open-Source projects. [See the pricing](https://geocode.earth/).
**Configuration example**
```elixir
config :mobilizon, Mobilizon.Service.Geospatial.Pelias,
endpoint: nil
```
### Mimirsbrunn
[Mimirsbrunn](https://github.com/CanalTP/mimirsbrunn) is an AGPL-3.0 licensed geocoding written in Rust and powered by ElasticSearch.
Mimirsbrunn is used by [Qwant Maps](https://www.qwant.com/maps) and [Navitia](https://www.navitia.io).
** Default configuration **
```elixir
config :mobilizon, Mobilizon.Service.Geospatial.Mimirsbrunn,
endpoint: nil
```
### Google Maps
[Google Maps](https://developers.google.com/maps/documentation/geocoding/intro) is a proprietary service that provides APIs for geocoding.
They don't have a free plan, but offer credit when creating a new account. [See the pricing](https://cloud.google.com/maps-platform/pricing/).
** Default configuration **
!!! note
`fetch_place_details` tells GoogleMaps to also fetch some details on a place when geocoding. It can be more expensive, since you're doing two requests to Google instead of one.
```elixir
config :mobilizon, Mobilizon.Service.Geospatial.GoogleMaps,
api_key: nil,
fetch_place_details: true
```
### MapQuest
[MapQuest](https://developer.mapquest.com/documentation/open/geocoding-api/) is a proprietary service that provides APIs for geocoding.
They offer a free plan. [See the pricing](https://developer.mapquest.com/plans).
** Default configuration **
```elixir
config :mobilizon, Mobilizon.Service.Geospatial.MapQuest,
api_key: nil
```
### More geocoding services
Geocoding implementations are simple modules that need to implement the [`Mobilizon.Service.Geospatial.Provider` behaviour](https://framasoft.frama.io/mobilizon/backend/Mobilizon.Service.Geospatial.Provider.html), so feel free to write your own!