Move docs to mkdocs and improve them
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
52
docs/administration/CLI tasks/maintenance_ tasks.md
Normal file
52
docs/administration/CLI tasks/maintenance_ tasks.md
Normal file
@@ -0,0 +1,52 @@
|
||||
# Maintenance tasks
|
||||
|
||||
## Installation
|
||||
|
||||
Generates new configuration files.
|
||||
|
||||
!!! warning
|
||||
This command generates configuration for your Mobilizon instance and should be run only once when installing.
|
||||
|
||||
If any options are left unspecified, you will be prompted interactively.
|
||||
|
||||
```bash
|
||||
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`.
|
||||
* `--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
|
||||
* `--admin_email ADMIN_EMAIL` The administrator's email
|
||||
* `--dbhost HOSTNAME` The database hostname of the PostgreSQL database to use
|
||||
* `--dbname DBNAME` The name of the database to use
|
||||
* `--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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
```
|
||||
4
docs/administration/CLI tasks/manage_users.md
Normal file
4
docs/administration/CLI tasks/manage_users.md
Normal file
@@ -0,0 +1,4 @@
|
||||
# Manage users
|
||||
|
||||
!!! bug
|
||||
Not yet existing
|
||||
25
docs/administration/CLI tasks/relay.md
Normal file
25
docs/administration/CLI tasks/relay.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# Relay
|
||||
|
||||
Manages remote relays
|
||||
|
||||
## Make your instance follow a mobilizon instance
|
||||
|
||||
```bash
|
||||
mix mobilizon.relay follow <relay_url>
|
||||
```
|
||||
|
||||
Example:
|
||||
```bash
|
||||
mix mobilizon.relay follow https://example.org/relay
|
||||
```
|
||||
|
||||
## Make your instance unfollow a mobilizon instance
|
||||
|
||||
```bash
|
||||
mix mobilizon.relay unfollow <relay_url>
|
||||
```
|
||||
|
||||
Example:
|
||||
```bash
|
||||
mix mobilizon.relay unfollow https://example.org/relay
|
||||
```
|
||||
113
docs/administration/dependencies.md
Normal file
113
docs/administration/dependencies.md
Normal file
@@ -0,0 +1,113 @@
|
||||
# Dependencies
|
||||
|
||||
## Debian / Ubuntu and derivatives
|
||||
|
||||
This documentation is appropriate for Debian 10 (Buster) and Ubuntu 18.04 LTS.
|
||||
|
||||
### Security
|
||||
|
||||
We advise to make sure your webserver is secure enough.
|
||||
For instance you can require authentication through SSH keys and not passwords, install Fail2Ban to block repeated login attempts and block unused ports by installing and configuring a firewall.
|
||||
|
||||
### Basic tools
|
||||
We begin by making sure some basic tools are installed:
|
||||
|
||||
```bash
|
||||
sudo apt install curl unzip vim openssl make git
|
||||
```
|
||||
|
||||
### Web server
|
||||
We only officially support nginx.
|
||||
|
||||
```bash
|
||||
sudo apt install nginx
|
||||
```
|
||||
|
||||
### HTTPS Certificates
|
||||
Then we need to install [certbot](https://certbot.eff.org/), a tool to ask for free Let's Encrypt HTTPS certificates.
|
||||
|
||||
```bash
|
||||
sudo apt install certbot
|
||||
```
|
||||
|
||||
You can use certbot with web server plugins or manually. See [Certbot's documentation](https://certbot.eff.org/instructions).
|
||||
|
||||
|
||||
### NodeJS
|
||||
We install the latest NodeJS version by adding NodeSource repos and installing NodeJS:
|
||||
|
||||
Head over to [this page](https://github.com/nodesource/distributions/blob/master/README.md#table-of-contents) and follow the instructions for `Node.js v12.x`.
|
||||
|
||||
!!! info
|
||||
Unless stated otherwise, Mobilizon always supports only the latest LTS version of NodeJS.
|
||||
|
||||
!!! tip
|
||||
NodeSource repos only gives updates for a specific version of NodeJS (it doesn't upgrade itself to a new major version). When a new major version of NodeJS is released, you need to remove the old repo and add the new one.
|
||||
|
||||
### Yarn
|
||||
Mobilizon uses [Yarn](https://yarnpkg.com/) to manage NodeJS packages, so we need to install it as well.
|
||||
|
||||
Follow the instructions on [this page](https://yarnpkg.com/en/docs/install#debian-stable) to add Yarn's repository and install it.
|
||||
|
||||
!!! info
|
||||
It is also possible to install `yarn` directly with `npm`:
|
||||
```bash
|
||||
npm install -g yarn
|
||||
```.
|
||||
You need to make sure npm's binary packages folder in your `$PATH` afterwards to use `yarn`.
|
||||
|
||||
### Erlang and Elixir
|
||||
|
||||
The packages from Debian or Ubuntu are badly packaged and often out of date, so we need to add one final source repository.
|
||||
|
||||
Follow the instructions for Ubuntu/Debian on [this page](https://elixir-lang.org/install.html#unix-and-unix-like) to add Erlang Solutions repo and install Erlang and Elixir.
|
||||
|
||||
!!! tip
|
||||
The Erlang package also wants to install an add-on for Emacs for some reason (but it doesn't install Emacs). If you see a warning, nothing to worry about.
|
||||
|
||||
### PostgreSQL and PostGIS
|
||||
|
||||
Mobilizon uses the [PostgreSQL](https://www.postgresql.org) database, and the PostgreSQL [Postgis](https://postgis.net) extension to store geographical data into PostgreSQL.
|
||||
|
||||
```bash
|
||||
sudo apt install postgresql postgresql-contrib postgis
|
||||
```
|
||||
|
||||
After that we can enable and start the PostgreSQL service.
|
||||
```
|
||||
sudo systemctl --now enable postgresql
|
||||
```
|
||||
|
||||
### Misc
|
||||
|
||||
We need the following tools to handle and optimize pictures that are uploaded on Mobilizon.
|
||||
|
||||
```bash
|
||||
sudo apt install imagemagick
|
||||
```
|
||||
|
||||
The following packages are optional, Mobilizon can run without them.
|
||||
|
||||
```bash
|
||||
sudo apt install webp gifsicle jpegoptim optipng pngquant
|
||||
```
|
||||
|
||||
Once finished, let's [head back to the install guide](index.md).
|
||||
|
||||
## Arch Linux
|
||||
|
||||
Run the following command to install all at once:
|
||||
```bash
|
||||
sudo pacman -S nodejs postgresql openssl git wget unzip base-devel yarn nginx elixir postgis imagemagick
|
||||
```
|
||||
|
||||
Now that dependencies are installed, before running Mobilizon you should start PostgreSQL:
|
||||
```
|
||||
sudo systemctl --now enable postgresql
|
||||
```
|
||||
|
||||
Once finished, let's [head back to the install guide](index.md).
|
||||
|
||||
## Other distributions
|
||||
|
||||
Feel free to update this file in a pull request!
|
||||
15
docs/administration/docker.md
Normal file
15
docs/administration/docker.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# 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`.
|
||||
149
docs/administration/index.md
Normal file
149
docs/administration/index.md
Normal file
@@ -0,0 +1,149 @@
|
||||
# Install
|
||||
|
||||
## 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).
|
||||
|
||||
## Dependencies
|
||||
|
||||
Mobilizon requires Elixir, NodeJS and PostgreSQL among other things.
|
||||
|
||||
Installing dependencies depends on the system you're using. Follow the steps of the [dependencies guide](dependencies.md).
|
||||
|
||||
## Setup
|
||||
|
||||
We're going to use a dedicated `mobilizon` user with `/home/mobilizon` home:
|
||||
```bash
|
||||
sudo adduser --disabled-login mobilizon
|
||||
```
|
||||
|
||||
!!! tip
|
||||
|
||||
On FreeBSD
|
||||
|
||||
``` bash
|
||||
sudo pw useradd -n mobilizon -d /home/mobilizon -s /usr/local/bin/bash -m
|
||||
sudo passwd mobilizon
|
||||
```
|
||||
|
||||
Then let's connect as this user:
|
||||
|
||||
```bash
|
||||
sudo -i -u mobilizon
|
||||
```
|
||||
|
||||
Let's start by cloning the repository in a directory named `live`:
|
||||
|
||||
```bash
|
||||
git clone https://framagit.org/framasoft/mobilizon live && cd live
|
||||
```
|
||||
|
||||
|
||||
## Installing dependencies
|
||||
|
||||
Install Elixir dependencies
|
||||
|
||||
```bash
|
||||
mix deps.get
|
||||
```
|
||||
|
||||
Then compile these dependencies and Mobilizon (this can take a few minutes)
|
||||
|
||||
```bash
|
||||
mix compile
|
||||
```
|
||||
|
||||
Go into the `js/` directory
|
||||
|
||||
```bash
|
||||
cd js
|
||||
```
|
||||
|
||||
and install the Javascript dependencies
|
||||
|
||||
```bash
|
||||
yarn install
|
||||
```
|
||||
|
||||
Finally, we can build the front-end (this can take a few seconds)
|
||||
```bash
|
||||
yarn run build
|
||||
```
|
||||
|
||||
Let's go back to the main directory
|
||||
```bash
|
||||
cd ../
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
Mobilizon provides a command line tool to generate configuration
|
||||
|
||||
```bash
|
||||
mix mobilizon.instance gen
|
||||
```
|
||||
|
||||
This will ask you questions about your instance and generate a `.env.prod` file.
|
||||
|
||||
|
||||
### Migration
|
||||
|
||||
Run database migrations: `mix ecto.migrate`. 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.
|
||||
|
||||
## Services
|
||||
|
||||
### Systemd
|
||||
|
||||
Copy the `support/systemd/mobilizon.service` to `/etc/systemd/system`.
|
||||
|
||||
```bash
|
||||
sudo cp support/systemd/mobilizon.service /etc/systemd/system/
|
||||
```
|
||||
|
||||
Reload Systemd to detect your new file
|
||||
|
||||
```bash
|
||||
sudo systemctl daemon-reload
|
||||
```
|
||||
|
||||
And enable the service
|
||||
|
||||
```bash
|
||||
systemctl enable --now mobilizon.service
|
||||
```
|
||||
|
||||
It will run Mobilizon and enable startup on boot. You can follow the logs with
|
||||
|
||||
```bash
|
||||
sudo journalctl -fu mobilizon.service
|
||||
```
|
||||
|
||||
The Mobilizon server runs on port 4000 on the local interface only, so you need to add a reverse-proxy.
|
||||
|
||||
## Reverse proxy
|
||||
|
||||
### Nginx
|
||||
|
||||
Copy the file from `support/nginx/mobilizon.conf` to `/etc/nginx/sites-available`.
|
||||
|
||||
```bash
|
||||
sudo cp support/nginx/mobilizon.conf /etc/nginx/sites-available
|
||||
```
|
||||
|
||||
Then symlink the file into the `/etc/nginx/sites-enabled` directory.
|
||||
|
||||
```bash
|
||||
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`.
|
||||
91
docs/administration/upgrading.md
Normal file
91
docs/administration/upgrading.md
Normal file
@@ -0,0 +1,91 @@
|
||||
---
|
||||
title: Upgrading to a new release
|
||||
---
|
||||
|
||||
# Preparing
|
||||
|
||||
The release page contains a changelog, and below it, upgrade instructions. **Read and understand** the release instructions.
|
||||
|
||||
Some tasks (like database migrations) can take a while, so we advise you to run commands inside a `tmux` or `screen`.
|
||||
|
||||
# Backup
|
||||
|
||||
Always make sure your database and `.env.production` file are properly backuped before performing upgrades.
|
||||
|
||||
Unless stated otherwise in the release notes, the following steps are enough to upgrade Mobilizon.
|
||||
|
||||
# Steps
|
||||
|
||||
### Fetch latest code
|
||||
Switch to the `mobilizon` user:
|
||||
|
||||
```bash
|
||||
sudo -i -u mobilizon
|
||||
```
|
||||
|
||||
And navigate to the Mobilizon root directory:
|
||||
|
||||
```bash
|
||||
cd /home/mobilizon/live
|
||||
```
|
||||
|
||||
Fetch the latest tags
|
||||
```bash
|
||||
git fetch --tags
|
||||
```
|
||||
|
||||
And checkout the tag you want to switch to. For instance, if I want to upgrade to version `v1.1`:
|
||||
```bash
|
||||
git checkout v1.1
|
||||
```
|
||||
|
||||
### Fetch new dependencies
|
||||
Fetch new and/or updated Elixir and NodeJS dependencies
|
||||
```bash
|
||||
mix deps.get
|
||||
```
|
||||
```bash
|
||||
cd js
|
||||
yarn install
|
||||
```
|
||||
|
||||
### Rebuild Mobilizon's front-end
|
||||
```bash
|
||||
yarn run build
|
||||
cd ../
|
||||
```
|
||||
|
||||
### Recompile Mobilizon
|
||||
```bash
|
||||
mix compile
|
||||
```
|
||||
Let's switch back to your regular user.
|
||||
|
||||
### Stop running Mobilizon processes
|
||||
```bash
|
||||
sudo systemctl stop mobilizon
|
||||
```
|
||||
|
||||
### Perform database migrations
|
||||
|
||||
Go back to the `mobilizon` user.
|
||||
```bash
|
||||
sudo -i -u mobilizon
|
||||
cd live
|
||||
mix ecto.migrate
|
||||
```
|
||||
### Restart Mobilizon
|
||||
Let's switch back one last time to your regular user.
|
||||
```bash
|
||||
sudo systemctl restart mobilizon
|
||||
```
|
||||
|
||||
You can follow the Mobilizon logs to check that everything works properly.
|
||||
```bash
|
||||
sudo journalctl -u mobilizon -f
|
||||
```
|
||||
|
||||
**That’s all!** You’re running the new version of Mobilizon now.
|
||||
|
||||
If you have issues after upgrading, try reviewing upgrade steps and release notes.
|
||||
Then feel free to [contact us](../about.md#discuss) or file an issue on [our Gitlab](https://framagit.org/framasoft/mobilizon/issues)
|
||||
Reference in New Issue
Block a user