Better docs

Signed-off-by: Thomas Citharel <tcit@tcit.fr>

Nicer docs

No 3rd stage

Add mix.deps get before docs

Add :ex_doc on test env so that it runs into CI
This commit is contained in:
Thomas Citharel
2019-03-14 15:00:34 +01:00
parent c20eaa379c
commit bba6629046
19 changed files with 772 additions and 150 deletions

View File

@@ -0,0 +1,52 @@
# Dependencies
- [Debian / Ubuntu and derivatives](#debian--ubuntu-and-derivatives)
- [Arch Linux](#arch-linux)
- [Other distributions](#other-distributions)
## Debian / Ubuntu and derivatives
1. On a fresh Debian/Ubuntu, as root user, install basic utility programs needed for the installation
```
sudo apt-get install curl sudo unzip vim
```
2. It would be wise to disable root access and to continue this tutorial with a user with sudoers group access
3. Install certbot (choose instructions for nginx and your distribution) :
[https://certbot.eff.org/all-instructions](https://certbot.eff.org/all-instructions)
4. Install NodeJS 10.x (current LTS):
[https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions](https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions)
5. Install Erlang and Elixir:
[https://elixir-lang.org/install.html#unix-and-unix-like](https://elixir-lang.org/install.html#unix-and-unix-like)
6. Install PostGIS:
[https://postgis.net/install/](https://postgis.net/install/)
6. Run:
```
sudo apt update
sudo apt install nginx postgresql postgresql-contrib openssl make git esl-erlang elixir postgis
```
Now that dependencies are installed, before running MobiliZon you should start PostgreSQL:
```
sudo systemctl start postgresql
```
## Arch Linux
1. Run:
```
sudo pacman -S nodejs postgresql openssl git wget unzip base-devel npm nginx elixir postgis
```
Now that dependencies are installed, before running MobiliZon you should start PostgreSQL and Redis:
```
sudo systemctl start postgresql
```
## Other distributions
Feel free to update this file in a pull request!

View 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 and the front-end container running on localhost.

View File

@@ -0,0 +1,131 @@
# Install
## Dependencies
Follow the steps of the [dependencies guide](dependencies.html)
## Database
Create the production database and a mobilizon user inside PostgreSQL:
```bash
sudo -u postgres createuser -P mobilizon
sudo -u postgres createdb -O mobilizon mobilizon_prod
```
Then enable extensions PeerTube needs:
```bash
sudo -u postgres psql -c "CREATE EXTENSION postgis;" mobilizon_prod
sudo -u postgres psql -c "CREATE EXTENSION pg_trgm;" mobilizon_prod
sudo -u postgres psql -c "CREATE EXTENSION unaccent;" mobilizon_prod
```
## MobiliZon user
Create a `mobilizon` user with `/home/mobilizon` home:
```bash
sudo adduser --disabled-login mobilizon
sudo -i -u mobilizon
```
**On FreeBSD**
```bash
sudo pw useradd -n mobilizon -d /home/mobilizon -s /usr/local/bin/bash -m
sudo passwd mobilizon
```
You can now fetch the code with git:
```bash
git clone https://framagit.org/framasoft/mobilizon live && cd live
```
## Configuration
### Backend
Install Elixir dependencies
```bash
mix deps.get
```
Configure your instance with
```bash
mix mobilizon.instance gen
```
This will ask you questions about your instance and generate an `.env.prod` file.
### Migration
Run database migrations: `mix ecto.migrate`. You will have to do this again after most updates.
> If some migrations fail, it probably means you're not using a recent enough version of PostgreSQL,
or that you didn't installed [the required extensions](#database).
### Front-end
Go into the `js/` directory
```bash
cd js/
```
and install the Javascript dependencies
```bash
npm install
```
Finally, build the front-end with
```bash
npm run build
```
### Testing
Go back to the previous directory
```bash
cd ../
```
Now try to run the server
```bash
mix phx.server
```
It runs on port 4000.
## 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
```