diff --git a/js/package.json b/js/package.json index ea93c57d..7cb86ae3 100644 --- a/js/package.json +++ b/js/package.json @@ -1,6 +1,6 @@ { "name": "mobilizon", - "version": "0.1.0", + "version": "1.0.0-beta.1", "private": true, "scripts": { "build": "vue-cli-service build", diff --git a/mix.exs b/mix.exs index 68064da7..a9a9fd08 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule Mobilizon.Mixfile do use Mix.Project - @version "0.0.1-dev" + @version "1.0.0-beta.1" def project do [ diff --git a/support/guides/development/development.md b/support/guides/development/development.md index cb96f1f3..b1fca76d 100644 --- a/support/guides/development/development.md +++ b/support/guides/development/development.md @@ -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. diff --git a/support/guides/development/styleguide.md b/support/guides/development/styleguide.md index 5670dcad..7965df7b 100644 --- a/support/guides/development/styleguide.md +++ b/support/guides/development/styleguide.md @@ -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/) \ No newline at end of file diff --git a/support/guides/development/tests.md b/support/guides/development/tests.md index ab180ccf..003a01d3 100644 --- a/support/guides/development/tests.md +++ b/support/guides/development/tests.md @@ -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! \ No newline at end of file diff --git a/support/guides/install/install.md b/support/guides/install/install.md index baccbba8..a4da4d07 100644 --- a/support/guides/install/install.md +++ b/support/guides/install/install.md @@ -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`. \ No newline at end of file diff --git a/support/nginx/mobilizon.vhost b/support/nginx/mobilizon.conf similarity index 82% rename from support/nginx/mobilizon.vhost rename to support/nginx/mobilizon.conf index 66d34d2f..762fa94f 100644 --- a/support/nginx/mobilizon.vhost +++ b/support/nginx/mobilizon.conf @@ -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; + } + }