Update docs and support

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2019-10-11 17:03:18 +02:00
parent e9e3a86bd1
commit aa11f8d639
5 changed files with 74 additions and 38 deletions

View File

@ -6,19 +6,20 @@ make
```
## Manual
### Server
* Install dependencies:
* Elixir (and Erlang) by following the instructions at [https://elixir-lang.github.io/install.html](https://elixir-lang.github.io/install.html)
* Fetch backend Elixir dependencies with `mix deps.get`.
* [PostgreSQL]() with PostGIS
* Install NodeJS (we guarantee support for the latest LTS and later) ![](https://img.shields.io/badge/node-%3E%3D%2010.0+-brightgreen.svg)
* Start services:
* Start postgres
* Setup services:
* Make sure the postgis extension is installed on your system.
* Create a postgres user with database creation capabilities, using the
following: `createuser -d -P mobilizon` and set `mobilizon` as the password.
* Install packages
* Fetch backend Elixir dependencies with `mix deps.get`.
* Go into the `cd js` directory, `yarn install` and then back `cd ../`
* Setup
* Create your database with `mix ecto.create`.
* Create the postgis extension on the database with a postgres user that has
superuser capabilities: `psql mobilizon_dev`
@ -26,23 +27,11 @@ make
``` create extension if not exists postgis; ```
* Run migrations: `mix ecto.migrate`.
* Start Phoenix endpoint with `mix phx.server`.
* Start Phoenix endpoint with `mix phx.server`. The client development server will also automatically be launched and will reload on file change.
Now you can visit [`localhost:4000`](http://localhost:4000) in your browser
and see the website (server *and* client) in action.
### Client
If you plan to specifically change the client side (front-end), do the following
once the server is running:
* Install NodeJS (we guarantee support for the latest LTS and later) ![](https://img.shields.io/badge/node-%3E%3D%2010.0+-brightgreen.svg)
* Change directory to `js/` and do:
* Install JavaScript package dependencies: `yarn install`.
* Run the development server in watch mode: `yarn run dev`. This will open a
browser at [`localhost:8080`](http://localhost:8080) that gets
automatically reloaded on change.
## Docker
You need to install the latest supported [Docker](https://docs.docker.com/install/#supported-platforms) and [Docker-Compose](https://docs.docker.com/compose/install/) before using the Docker way of installing Mobilizon.
@ -50,4 +39,4 @@ Just run :
```bash
make start
```
to start a database container, an API container and the front-end dev container running on localhost.
to build and launch a database container and an API container running on localhost.

View File

@ -12,11 +12,17 @@ These two commands must not return an error code, since they are required to pas
## Front-end
We use `tslint` with the `tslint-config-airbnb` preset.
Errors should be reported when running in dev mode `yarn run dev` or when building a production bundle `yarn run build`.
### Linting
We use `tslint` and `eslint` with the `airbnb` preset.
Errors should be reported when the development server is running or when building a production bundle `yarn run build`.
Please run the following command before pushing code `yarn run lint`.
This command must not return an error code, since it's required to pass inside CI.
We also try to follow the [official Vue.js style guide](https://vuejs.org/v2/style-guide/).
### Styleguide
We present the components used on Mobilizon's front-end here: https://framasoft.frama.io/mobilizon/frontend/. The documentation is builded through [Vue Styleguidist](https://vue-styleguidist.github.io/)

View File

@ -33,4 +33,22 @@ mix test test/mobilizon/actors/actors_test.exs:85
## Front-end
Waiting for [https://framagit.org/framasoft/mobilizon/merge_requests/42](https://framagit.org/framasoft/mobilizon/merge_requests/42) to be ready.
### Unit tests
Not done yet.
### End-to-end tests
We use [Cypress](https://cypress.io) for End-to-end testing.
When inside the `js` directory, you can do either
```bash
npx cypress run
```
to run the tests, or
```bash
npx cypress open
```
to open the interactive GUI.
Cypress provided [a subscription](https://www.cypress.io/oss-plan) to their recording dashboard since Mobilizon is an Open-Source project. Thanks!

View File

@ -86,23 +86,6 @@ Finally, build the front-end with
yarn 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
@ -130,3 +113,25 @@ It will run Mobilizon and enable startup on boot. You can follow the logs with
```bash
sudo journalctl -fu mobilizon.service
```
The Elixir 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`.

View File

@ -34,6 +34,8 @@ server {
ssl_stapling on;
ssl_stapling_verify on;
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
@ -45,13 +47,29 @@ server {
client_max_body_size 16m;
location / {
gzip off;
proxy_http_version 1.1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# For Websocket support
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://localhost:4000;
client_max_body_size 16m;
}
location ~* \.(css|js)$ {
root /var/www/mobilizon/priv/static;
etag off;
expires 1y;
access_log off;
add_header Cache-Control public;
}
}