Move configuration to traditional way
⭐️ This is the way. Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -15,7 +15,7 @@ mix mobilizon.instance gen [<options>]
|
||||
|
||||
### Options
|
||||
* `-f`, `--force` Whether to erase existing files
|
||||
* `-o`, `--output PATH` The path to output the `.env` file. Defaults to `.env.production`.
|
||||
* `-o`, `--output PATH` The path to output the `prod.secret.exs` file. Defaults to `config/prod.secret.exs`.
|
||||
* `--output_psql PATH` The path to output the SQL script. Defaults to `setup_db.psql`.
|
||||
* `--domain DOMAIN` The instance's domain
|
||||
* `--instance_name INSTANCE_NAME` The instance's name
|
||||
@@ -25,34 +25,3 @@ mix mobilizon.instance gen [<options>]
|
||||
* `--dbuser DBUSER` The database user (aka role) to use for the database connection
|
||||
* `--dbpass DBPASS` The database user's password to use for the database connection
|
||||
* `--dbport DBPORT` The database port
|
||||
|
||||
## Depreciated commands
|
||||
|
||||
### move_participant_stats
|
||||
|
||||
!!! tip "Environment"
|
||||
You need to run these commands with the appropriate environment loaded
|
||||
|
||||
Task to move participant stats directly on the `event` table (so there's no need to count event participants each time).
|
||||
This task should **only be run once** when migrating from `v1.0.0-beta.1` to `v1.0.0-beta.2`.
|
||||
|
||||
This task will be removed in version `v1.0.0-beta.3`.
|
||||
|
||||
```bash
|
||||
mix mobilizon.move_participant_stats
|
||||
```
|
||||
|
||||
### setup_search
|
||||
|
||||
!!! tip "Environment"
|
||||
You need to run these commands with the appropriate environment loaded
|
||||
|
||||
Task to setup search for existing events.
|
||||
|
||||
This task should **only be run once** when migrating from `v1.0.0-beta.1` to `v1.0.0-beta.2`.
|
||||
|
||||
This task will be removed in version `v1.0.0-beta.3`.
|
||||
|
||||
```bash
|
||||
mix mobilizon.setup_search
|
||||
```
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Manage actors
|
||||
|
||||
!!! tip "Environment"
|
||||
You need to run these commands with the appropriate environment loaded
|
||||
You need to run these commands with the appropriate environment loaded, so probably prefix with `MIX_ENV=prod`.
|
||||
|
||||
## List all available commands
|
||||
```bash
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Manage users
|
||||
|
||||
!!! tip "Environment"
|
||||
You need to run these commands with the appropriate environment loaded
|
||||
You need to run these commands with the appropriate environment loaded, so probably prefix with `MIX_ENV=prod`.
|
||||
|
||||
|
||||
## List all available commands
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Manages remote relays
|
||||
|
||||
!!! tip "Environment"
|
||||
You need to run these commands with the appropriate environment loaded
|
||||
You need to run these commands with the appropriate environment loaded, so probably prefix with `MIX_ENV=prod`.
|
||||
|
||||
## Make your instance follow a mobilizon instance
|
||||
|
||||
|
||||
31
docs/administration/configure/email.md
Normal file
31
docs/administration/configure/email.md
Normal 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.
|
||||
@@ -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!
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
# Docker
|
||||
|
||||
You can quickly get a server running using Docker. You'll need both [Docker](https://www.docker.com/community-edition) and [Docker-Compose](https://docs.docker.com/compose/install/).
|
||||
|
||||
Start by cloning the repo
|
||||
```bash
|
||||
git clone https://framagit.org/framasoft/mobilizon && cd mobilizon
|
||||
```
|
||||
|
||||
Then, just run `make` to build containers.
|
||||
```bash
|
||||
make
|
||||
```
|
||||
|
||||
This will start a database container, an API container also containing the front-end running on `localhost`.
|
||||
@@ -1,13 +1,14 @@
|
||||
# Install
|
||||
|
||||
!!! info "Docker"
|
||||
|
||||
Docker production installation is not yet supported. See [issue #352](https://framagit.org/framasoft/mobilizon/issues/352).
|
||||
|
||||
## Pre-requisites
|
||||
|
||||
* A Linux machine with **root access**
|
||||
* A **domain name** (or subdomain) for the Mobilizon server, e.g. `example.net`
|
||||
* An **SMTP server** to deliver emails
|
||||
|
||||
!!! tip
|
||||
You can also install Mobilizon [with Docker](docker.md).
|
||||
* An **SMTP server** to deliver emails
|
||||
|
||||
## Dependencies
|
||||
|
||||
@@ -88,12 +89,33 @@ Mobilizon provides a command line tool to generate configuration
|
||||
mix mobilizon.instance gen
|
||||
```
|
||||
|
||||
This will ask you questions about your instance and generate a `.env.prod` file.
|
||||
This will ask you questions about your setup and your instance to generate a `prod.secret.exs` file in the `config/` folder, and a `setup_db.psql` file to setup the database.
|
||||
|
||||
### Database setup
|
||||
|
||||
### Migration
|
||||
The `setup_db.psql` file contains SQL instructions to create a PostgreSQL user and database with the chosen credentials and add the required extensions to the Mobilizon database.
|
||||
|
||||
Run database migrations: `mix ecto.migrate`. You will have to do this again after most updates.
|
||||
Execute
|
||||
```bash
|
||||
sudo -u postgres psql -f setup_db.psql
|
||||
```
|
||||
|
||||
!!! warning
|
||||
|
||||
When it's done, don't forget to remove the `setup_db.psql` file.
|
||||
|
||||
### Database Migration
|
||||
|
||||
Run database migrations:
|
||||
```bash
|
||||
MIX_ENV=prod mix ecto.migrate
|
||||
```
|
||||
|
||||
!!! note
|
||||
|
||||
Note the `MIX_ENV=prod` environment variable prefix in front of the command. You will have to use it for each `mix` command from now on.
|
||||
|
||||
You will have to do this again after most updates.
|
||||
|
||||
!!! tip
|
||||
If some migrations fail, it probably means you're not using a recent enough version of PostgreSQL, or that you haven't installed the required extensions.
|
||||
@@ -147,3 +169,13 @@ sudo ln -s /etc/nginx/sites-available/mobilizon.conf /etc/nginx/sites-enabled/
|
||||
Edit the file `/etc/nginx/sites-available` and adapt it to your own configuration.
|
||||
|
||||
Test the configuration with `sudo nginx -t` and reload nginx with `systemctl reload nginx`.
|
||||
|
||||
## Optional tasks
|
||||
|
||||
### Geolocation databases
|
||||
|
||||
Mobilizon can use geolocation from MMDB format data from sources like [MaxMind GeoIP](https://dev.maxmind.com/geoip/geoip2/geolite2/) databases or [db-ip.com](https://db-ip.com/db/download/ip-to-city-lite) databases. This allows showing events happening near the user's location.
|
||||
|
||||
You will need to download the City database and put it into `priv/data/GeoLite2-City.mmdb`.
|
||||
|
||||
Mobilizon will only show a warning at startup if the database is missing, but it isn't required.
|
||||
@@ -10,7 +10,7 @@ Some tasks (like database migrations) can take a while, so we advise you to run
|
||||
|
||||
# Backup
|
||||
|
||||
Always make sure your database and `.env.production` file are properly backuped before performing upgrades.
|
||||
Always make sure your database and `config` folder are properly backuped before performing upgrades.
|
||||
|
||||
Unless stated otherwise in the release notes, the following steps are enough to upgrade Mobilizon.
|
||||
|
||||
@@ -57,7 +57,7 @@ cd ../
|
||||
|
||||
### Recompile Mobilizon
|
||||
```bash
|
||||
mix compile
|
||||
MIX_ENV=prod mix compile
|
||||
```
|
||||
Let's switch back to your regular user.
|
||||
|
||||
@@ -72,7 +72,7 @@ Go back to the `mobilizon` user.
|
||||
```bash
|
||||
sudo -i -u mobilizon
|
||||
cd live
|
||||
mix ecto.migrate
|
||||
MIX_ENV=prod mix ecto.migrate
|
||||
```
|
||||
### Restart Mobilizon
|
||||
Let's switch back one last time to your regular user.
|
||||
|
||||
Reference in New Issue
Block a user