2016-03-23 18:39:41 +01:00
# FabManager
2015-05-05 03:10:25 +02:00
2016-05-03 11:27:01 +02:00
FabManager is the FabLab management solution. It is web-based, open-source and totally free.
2015-05-05 03:10:25 +02:00
2018-12-18 10:55:28 +01:00
[![Coverage Status ](https://coveralls.io/repos/github/LaCasemate/fab-manager/badge.svg )](https://coveralls.io/github/LaCasemate/fab-manager)
[![Docker pulls ](https://img.shields.io/docker/pulls/sleede/fab-manager.svg )](https://hub.docker.com/r/sleede/fab-manager/)
[![Docker Build Status ](https://img.shields.io/docker/build/sleede/fab-manager.svg )](https://hub.docker.com/r/sleede/fab-manager/builds)
2015-05-05 03:10:25 +02:00
2017-02-15 15:41:25 +01:00
##### Table of Contents
2016-03-23 18:39:41 +01:00
1. [Software stack ](#software-stack )
2. [Contributing ](#contributing )
2016-09-01 18:06:18 +02:00
3. [Setup a production environment ](#setup-a-production-environment )
2016-04-11 20:24:09 +02:00
4. [Setup a development environment ](#setup-a-development-environment )< br />
4.1. [General Guidelines ](#general-guidelines )< br />
2018-11-26 10:53:33 +01:00
4.2. [Virtual Machine Instructions ](#virtual-machine-instructions )
2016-04-11 20:24:09 +02:00
5. [PostgreSQL ](#postgresql )< br />
2018-11-26 15:14:43 +01:00
5.1. [Install PostgreSQL 9.4 ](#setup-postgresql )< br />
5.2. [Run the PostgreSQL command line interface ](#run-postgresql-cli )< br />
5.3. [PostgreSQL Limitations ](#postgresql-limitations )
2016-04-11 20:24:09 +02:00
6. [ElasticSearch ](#elasticsearch )< br />
2018-11-26 15:14:43 +01:00
6.1. [Install ElasticSearch ](#setup-elasticsearch )< br />
6.2. [Rebuild statistics ](#rebuild-stats )< br />
6.3. [Backup and Restore ](#backup-and-restore-elasticsearch )
2016-04-11 20:24:09 +02:00
7. [Internationalization (i18n) ](#i18n )< br />
7.1. [Translation ](#i18n-translation )< br />
7.1.1. [Front-end translations ](#i18n-translation-front )< br />
7.1.2. [Back-end translations ](#i18n-translation-back )< br />
7.2. [Configuration ](#i18n-configuration )< br />
7.2.1. [Settings ](#i18n-settings )< br />
7.2.2. [Applying changes ](#i18n-apply )
2016-05-03 11:27:01 +02:00
8. [Open Projects ](#open-projects )
2016-06-16 18:01:45 +02:00
9. [Plugins ](#plugins )
2016-09-12 17:29:44 +02:00
10. [Single Sign-On ](#sso )
11. [Known issues ](#known-issues )
12. [Related Documentation ](#related-documentation )
2015-05-05 03:10:25 +02:00
2016-03-23 18:39:41 +01:00
< a name = "software-stack" > < / a >
## Software stack
2015-05-05 03:10:25 +02:00
2016-03-23 18:39:41 +01:00
FabManager is a Ruby on Rails / AngularJS web application that runs on the following software:
2015-05-05 03:10:25 +02:00
2016-09-01 18:06:18 +02:00
- Ubuntu LTS 14.04+ / Debian 8+
2016-03-31 11:56:58 +02:00
- Ruby 2.3
2016-03-23 18:39:41 +01:00
- Git 1.9.1+
- Redis 2.8.4+
- Sidekiq 3.3.4+
2018-04-09 16:37:21 +02:00
- Elasticsearch 5.6
2016-03-23 18:39:41 +01:00
- PostgreSQL 9.4
2015-05-05 03:10:25 +02:00
2016-03-23 18:39:41 +01:00
< a name = "contributing" > < / a >
## Contributing
2015-05-05 03:10:25 +02:00
2016-03-23 18:39:41 +01:00
Contributions are welcome. Please read [the contribution guidelines ](CONTRIBUTING.md ) for more information about the contribution process.
2015-05-05 03:10:25 +02:00
2016-04-11 20:24:09 +02:00
< a name = "setup-a-production-environment" > < / a >
2016-09-01 18:06:18 +02:00
## Setup a production environment
2016-04-11 20:24:09 +02:00
2018-11-27 10:40:51 +01:00
To run fab-manager as a production application, this is highly recommended to use [Docker-compose ](https://docs.docker.com/compose/overview/ ).
The procedure to follow is described in the [docker-compose readme ](docker/README.md ).
2016-04-11 20:24:09 +02:00
2016-03-23 18:39:41 +01:00
< a name = "setup-a-development-environment" > < / a >
## Setup a development environment
2015-05-05 03:10:25 +02:00
2017-12-13 17:51:44 +01:00
In you intend to run fab-manager on your local machine to contribute to the project development, you can set it up with the following procedure.
2018-11-26 15:14:43 +01:00
This procedure is not easy to follow so if you don't need to write some code for Fab-manager, please prefer the [docker-compose installation method ](docker/README.md ).
2016-09-01 18:06:18 +02:00
2016-03-23 18:39:41 +01:00
< a name = "general-guidelines" > < / a >
### General Guidelines
2015-05-05 03:10:25 +02:00
2018-11-26 10:53:33 +01:00
1. Install RVM, with the ruby version specified in the [.ruby-version file ](.ruby-version ).
2018-11-22 17:09:14 +01:00
For more details about the process, please read the [official RVM documentation ](http://rvm.io/rvm/install ).
2018-02-14 19:41:00 +01:00
If you're using ArchLinux, you may have to [read this ](doc/archlinux_readme.md ) before.
2018-11-22 17:09:14 +01:00
2018-11-27 10:40:51 +01:00
2. Install NVM, with the node.js version specified in the [.nvmrc file ](.nvmrc ).
2018-11-26 10:53:33 +01:00
For instructions about installing NVM, please refer to [the NVM readme ](https://github.com/creationix/nvm#installation ).
3. Install Yarn, the front-end package manager.
2018-11-22 17:09:14 +01:00
Depending on your system, the installation process may differ, please read the [official Yarn documentation ](https://yarnpkg.com/en/docs/install#debian-stable ).
2018-11-26 15:14:43 +01:00
4. Install docker.
Your system may provide a pre-packaged version of docker in its repositories, but this version may be outdated.
Please refer to [ubuntu ](https://docs.docker.com/install/linux/docker-ce/ubuntu/ ), [debian ](https://docs.docker.com/install/linux/docker-ce/debian/ ) or [MacOS ](https://docs.docker.com/docker-for-mac/install/ ) documentation to setup a recent version of docker.
2018-11-27 10:40:51 +01:00
5. Add your current user to the docker group, to allow using docker without `sudo` .
2018-11-26 15:14:43 +01:00
```bash
2018-11-26 16:49:26 +01:00
# add the docker group if it doesn't already exist
sudo groupadd doker
# add the current user to the docker group
2018-11-26 15:14:43 +01:00
sudo usermod -aG docker $(whoami)
2018-11-26 16:49:26 +01:00
# restart to validate changes
2018-11-26 15:14:43 +01:00
sudo reboot
```
6. Create a docker network for fab-manager.
You may have to change the network address if it is already in use.
```bash
docker network create --subnet=172.18.0.0/16 fabmanager
```
2016-05-03 11:27:01 +02:00
2018-11-26 15:14:43 +01:00
7. Retrieve the project from Git
2015-05-05 03:10:25 +02:00
2016-03-23 18:39:41 +01:00
```bash
git clone https://github.com/LaCasemate/fab-manager.git
```
2018-11-26 15:14:43 +01:00
8. Install the software dependencies.
2016-08-23 16:59:12 +02:00
First install [PostgreSQL ](#postgresql ) and [ElasticSearch ](#elasticsearch ) as specified in their respective documentations.
Then install the other dependencies:
2016-03-23 18:39:41 +01:00
- For Ubuntu/Debian:
2016-05-03 11:27:01 +02:00
2016-03-23 18:39:41 +01:00
```bash
2018-11-26 15:14:43 +01:00
# on Ubuntu 18.04 server, you may have to enable the "universe" repository
sudo add-apt-repository universe
# then, install the dependencies
2016-08-23 16:59:12 +02:00
sudo apt-get install libpq-dev redis-server imagemagick
2016-03-23 18:39:41 +01:00
```
- For MacOS X:
2016-05-03 11:27:01 +02:00
2016-03-23 18:39:41 +01:00
```bash
2016-08-23 16:59:12 +02:00
brew install redis imagemagick
2016-03-23 18:39:41 +01:00
```
2016-05-03 11:27:01 +02:00
2018-11-26 15:14:43 +01:00
9. Init the RVM and NVM instances and check they were correctly configured
2016-05-03 11:27:01 +02:00
2016-03-23 18:39:41 +01:00
```bash
cd fab-manager
2018-11-26 10:53:33 +01:00
rvm current | grep -q `cat .ruby-version` @fab -manager && echo "ok"
# Must print ok
nvm use
node --version | grep -q `cat .nvmrc` && echo "ok"
# Must print ok
2016-03-23 18:39:41 +01:00
```
2016-05-03 11:27:01 +02:00
2018-11-26 15:14:43 +01:00
10. Install bundler in the current RVM gemset
2016-03-23 18:39:41 +01:00
```bash
2019-03-25 14:57:48 +01:00
gem install bundler --version=1.17.3
2016-03-23 18:39:41 +01:00
```
2018-11-26 15:14:43 +01:00
11. Install the required ruby gems and javascript plugins
2016-03-23 18:39:41 +01:00
```bash
bundle install
2018-11-22 17:09:14 +01:00
yarn install
2016-03-23 18:39:41 +01:00
```
2016-05-03 11:27:01 +02:00
2018-11-26 15:14:43 +01:00
12. Create the default configuration files **and configure them!** (see the [environment configuration documentation ](doc/environment.md ))
2016-05-03 11:27:01 +02:00
2016-03-31 21:16:11 +02:00
```bash
cp config/database.yml.default config/database.yml
cp config/application.yml.default config/application.yml
2016-05-03 11:27:01 +02:00
vi config/application.yml
2016-03-31 21:16:11 +02:00
# or use your favorite text editor instead of vi (nano, ne...)
```
2016-05-03 11:27:01 +02:00
2018-11-26 15:14:43 +01:00
13. Build the databases.
2018-09-29 18:43:13 +02:00
- **Warning**: **DO NOT** run `rake db:setup` instead of these commands, as this will not run some required raw SQL instructions.
2018-07-04 16:30:19 +02:00
- **Please note**: Your password length must be between 8 and 128 characters, otherwise db:seed will be rejected. This is configured in [config/initializers/devise.rb ](config/initializers/devise.rb )
2016-03-23 18:39:41 +01:00
```bash
2019-01-21 11:49:35 +01:00
# for dev
2017-02-16 11:21:43 +01:00
rake db:create
rake db:migrate
2017-12-21 11:32:13 +01:00
ADMIN_EMAIL='youradminemail' ADMIN_PASSWORD='youradminpassword' rake db:seed
2019-02-13 12:59:28 +01:00
rake fablab:es:build_stats
2019-01-21 11:49:35 +01:00
# for tests
RAILS_ENV=test rake db:create
RAILS_ENV=test rake db:migrate
2016-03-23 18:39:41 +01:00
```
2016-05-03 11:27:01 +02:00
2018-11-26 15:14:43 +01:00
14. Create the pids folder used by Sidekiq. If you want to use a different location, you can configure it in `config/sidekiq.yml`
2016-03-23 18:39:41 +01:00
```bash
mkdir -p tmp/pids
```
2016-05-03 11:27:01 +02:00
2018-11-26 15:14:43 +01:00
15. Start the development web server
2016-03-23 18:39:41 +01:00
```bash
foreman s -p 3000
```
2016-05-03 11:27:01 +02:00
2018-11-26 15:14:43 +01:00
16. You should now be able to access your local development FabManager instance by accessing `http://localhost:3000` in your web browser.
2016-03-23 18:39:41 +01:00
2018-11-26 15:14:43 +01:00
17. You can login as the default administrator using the credentials defined previously.
2016-03-23 18:39:41 +01:00
2018-11-26 15:14:43 +01:00
18. Email notifications will be caught by MailCatcher.
2017-03-02 10:29:17 +01:00
To see the emails sent by the platform, open your web browser at `http://localhost:1080` to access the MailCatcher interface.
2018-02-14 19:41:00 +01:00
< a name = "virtual-machine-instructions" > < / a >
2018-07-04 14:32:17 +02:00
### Virtual Machine Instructions
2018-02-14 19:41:00 +01:00
These instructions allow to deploy a testing or development instance of Fab Manager inside a virtual
machine, with most of the software dependencies installed automatically and avoiding to install a lot
of software and services directly on the host computer.
**Note:** The provision scripts configure the sofware dependencies to play nice with each other while
they are inside the same virtual environment but said configuration is not optimized for a production
environment.
1. Install [Vagrant][vagrant] and [Virtual Box][virtualbox] (with the extension package).
2. Retrieve the project from Git
```bash
2018-02-26 18:52:26 +01:00
git clone https://github.com/LaCasemate/fab-manager
2018-02-14 19:41:00 +01:00
```
3. From the project directory, run:
```bash
vagrant up
```
4. Once the virtual machine finished building, reload it with:
```bash
vagrant reload
```
5. Log into the virtual machine with:
```bash
vagrant ssh
```
6. While logged in, navigate to the project folder and install the Gemfile
dependencies:
```bash
cd /vagrant
bundle install
```
7. Set a directory for Sidekick pids:
```bash
mkdir -p tmp/pids
```
8. Copy the default configuration files:
```bash
cp config/database.yml.virtual config/database.yml
cp config/application.yml.default config/application.yml
```
2018-02-26 19:26:11 +01:00
10. Set up the databases. (Note that you should provide the desired admin credentials and that these
specific set of commands must be used to set up the database as some raw SQL instructions are
2018-07-04 16:30:19 +02:00
included in the migrations. Password minimal length is 8 characters):
2018-02-14 19:41:00 +01:00
```bash
2018-02-26 19:26:11 +01:00
rake db:create
rake db:migrate
ADMIN_EMAIL='youradminemail' ADMIN_PASSWORD='youradminpassword' rake db:seed
2019-02-13 12:59:28 +01:00
rake fablab:es:build_stats
2019-01-21 11:49:35 +01:00
# for tests
RAILS_ENV=test rake db:create
RAILS_ENV=test rake db:migrate
2018-02-14 19:41:00 +01:00
```
11. Start the application and visit `localhost:3000` on your browser to check that it works:
```bash
foreman s -p 3000
```
2016-03-23 18:39:41 +01:00
< a name = "postgresql" > < / a >
## PostgreSQL
2018-11-26 15:14:43 +01:00
< a name = "setup-postgresql" > < / a >
### Install PostgreSQL 9.4
2016-03-23 18:39:41 +01:00
2018-11-26 15:14:43 +01:00
We will use docker to easily install the required version of PostgreSQL.
2016-03-23 18:39:41 +01:00
2018-11-26 15:14:43 +01:00
1. Create the docker binding folder
2016-03-23 18:39:41 +01:00
```bash
2018-11-26 15:14:43 +01:00
mkdir -p .docker/postgresql
2016-03-23 18:39:41 +01:00
```
2018-11-26 15:14:43 +01:00
2. Start the PostgreSQL container.
2016-03-23 18:39:41 +01:00
```bash
2018-11-26 15:14:43 +01:00
docker run --restart=always -d --name fabmanager-postgres \
-v $(pwd)/.docker/postgresql:/var/lib/postgresql/data \
--network fabmanager --ip 172.18.0.2 \
-p 5432:5432 \
postgres:9.4
2016-03-23 18:39:41 +01:00
```
2016-05-03 11:27:01 +02:00
2018-11-26 15:14:43 +01:00
3. Configure fab-manager to use it.
On linux systems, PostgreSQL will be available at 172.18.0.2.
On MacOS, you'll have to set the host to 127.0.0.1 (or localhost).
See [environment.md ](doc/environment.md ) for more details.
2016-03-23 18:39:41 +01:00
2018-11-26 15:14:43 +01:00
4. Finally, have a look at the [PostgreSQL Limitations ](#postgresql-limitations ) section or some errors will occurs preventing you from finishing the installation procedure.
2016-05-03 11:27:01 +02:00
2016-03-23 18:39:41 +01:00
2018-11-26 15:14:43 +01:00
< a name = "run-postgresql-cli" > < / a >
### Run the PostgreSQL command line interface
2016-03-23 18:39:41 +01:00
2018-11-26 15:14:43 +01:00
You may want to access the psql command line tool to check the content of the database, or to run some maintenance routines.
This can be achieved doing the following:
2016-08-23 16:59:12 +02:00
2018-11-26 15:14:43 +01:00
1. Enter into the PostgreSQL container
2016-08-23 16:59:12 +02:00
```bash
2018-11-26 15:14:43 +01:00
docker exec -it fabmanager-postgres bash
2016-08-23 16:59:12 +02:00
```
2015-05-05 03:10:25 +02:00
2018-11-26 15:14:43 +01:00
2. Run the PostgreSQL administration command line interface, logged as the postgres user
2016-03-23 18:39:41 +01:00
```bash
2018-11-26 15:14:43 +01:00
su postgres
psql
2016-03-23 18:39:41 +01:00
```
2017-02-16 11:21:43 +01:00
2016-09-01 18:06:18 +02:00
< a name = "postgresql-limitations" > < / a >
### PostgreSQL Limitations
2016-09-01 18:10:54 +02:00
- While setting up the database, we'll need to activate two PostgreSQL extensions: [unaccent ](https://www.postgresql.org/docs/current/static/unaccent.html ) and [trigram ](https://www.postgresql.org/docs/current/static/pgtrgm.html ).
This can only be achieved if the user, configured in `config/database.yml` , was granted the _SUPERUSER_ role **OR** if these extensions were white-listed.
2016-09-05 08:54:01 +02:00
So here's your choices, mainly depending on your security requirements:
2018-11-26 15:14:43 +01:00
- Use the default PostgreSQL super-user (postgres) as the database user. This is the default behavior in fab-manager.
- Set your user as _SUPERUSER_ ; run the following command in `psql` (after replacing `username` with you user name):
2016-10-07 11:11:58 +02:00
2016-09-01 18:06:18 +02:00
```sql
2018-11-26 15:14:43 +01:00
ALTER USER username WITH SUPERUSER;
2016-09-01 18:06:18 +02:00
```
2016-10-07 11:11:58 +02:00
- Install and configure the PostgreSQL extension [pgextwlist ](https://github.com/dimitri/pgextwlist ).
2016-09-01 18:06:18 +02:00
Please follow the instructions detailed on the extension website to whitelist `unaccent` and `trigram` for the user configured in `config/database.yml` .
2016-10-07 11:11:58 +02:00
- Some users may want to use another DBMS than PostgreSQL.
2016-09-01 18:06:18 +02:00
This is currently not supported, because of some PostgreSQL specific instructions that cannot be efficiently handled with the ActiveRecord ORM:
- `app/controllers/api/members_controllers.rb@list` is using `ILIKE`
- `app/controllers/api/invoices_controllers.rb@list` is using `ILIKE` and `date_trunc()`
- `db/migrate/20160613093842_create_unaccent_function.rb` is using [unaccent ](https://www.postgresql.org/docs/current/static/unaccent.html ) and [trigram ](https://www.postgresql.org/docs/current/static/pgtrgm.html ) modules and defines a PL/pgSQL function (`f_unaccent()`)
- `app/controllers/api/members_controllers.rb@search` is using `f_unaccent()` (see above) and `regexp_replace()`
2016-09-14 18:13:18 +02:00
- `db/migrate/20150604131525_add_meta_data_to_notifications.rb` is using [jsonb ](https://www.postgresql.org/docs/9.4/static/datatype-json.html ), a PostgreSQL 9.4+ datatype.
2016-09-15 17:54:48 +02:00
- `db/migrate/20160915105234_add_transformation_to_o_auth2_mapping.rb` is using [jsonb ](https://www.postgresql.org/docs/9.4/static/datatype-json.html ), a PostgreSQL 9.4+ datatype.
2018-12-18 10:21:35 +01:00
- `db/migrate/20181217103441_migrate_settings_value_to_history_values.rb` is using `SELECT DISTINCT ON` .
2016-09-01 18:06:18 +02:00
- If you intend to contribute to the project code, you will need to run the test suite with `rake test` .
2016-10-07 11:11:58 +02:00
This also requires your user to have the _SUPERUSER_ role.
Please see the [known issues ](#known-issues ) section for more information about this.
2015-05-05 03:10:25 +02:00
2016-03-23 18:39:41 +01:00
< a name = "elasticsearch" > < / a >
## ElasticSearch
2015-05-05 03:10:25 +02:00
2016-03-23 18:39:41 +01:00
ElasticSearch is a powerful search engine based on Apache Lucene combined with a NoSQL database used as a cache to index data and quickly process complex requests on it.
2016-05-03 11:27:01 +02:00
In FabManager, it is used for the admin's statistics module and to perform searches in projects.
2016-03-23 18:39:41 +01:00
2018-11-26 15:14:43 +01:00
< a name = "setup-elasticsearch" > < / a >
### Install ElasticSearch
2016-05-03 11:27:01 +02:00
2018-11-26 15:14:43 +01:00
1. Create the docker binding folders
2018-04-04 16:37:45 +02:00
```bash
2018-11-26 15:14:43 +01:00
mkdir -p .docker/elasticsearch/config
mkdir -p .docker/elasticsearch/plugins
mkdir -p .docker/elasticsearch/backups
2018-04-04 16:37:45 +02:00
```
2018-11-26 15:14:43 +01:00
2. Copy the default configuration files
2016-03-23 18:39:41 +01:00
```bash
2018-11-26 15:14:43 +01:00
cp docker/elasticsearch.yml .docker/elasticsearch/config
cp docker/log4j2.properties .docker/elasticsearch/config
2016-03-23 18:39:41 +01:00
```
2016-05-03 11:27:01 +02:00
2018-11-26 15:14:43 +01:00
3. Start the ElasticSearch container.
2016-03-23 18:39:41 +01:00
```bash
2018-11-26 15:14:43 +01:00
docker run --restart=always -d --name fabmanager-elastic \
-v $(pwd)/.docker/elasticsearch/config:/usr/share/elasticsearch/config \
-v $(pwd)/.docker/elasticsearch:/usr/share/elasticsearch/data \
-v $(pwd)/.docker/elasticsearch/plugins:/usr/share/elasticsearch/plugins \
-v $(pwd)/.docker/elasticsearch/backups:/usr/share/elasticsearch/backups \
--network fabmanager --ip 172.18.0.3 \
-p 9200:9200 -p 9300:9300 \
elasticsearch:5.6
2016-03-23 18:39:41 +01:00
```
2018-11-26 15:14:43 +01:00
4. Configure fab-manager to use it.
On linux systems, ElasticSearch will be available at 172.18.0.3.
On MacOS, you'll have to set the host to 127.0.0.1 (or localhost).
See [environment.md ](doc/environment.md ) for more details.
2016-08-23 16:59:12 +02:00
2018-11-26 15:14:43 +01:00
< a name = "rebuild-stats" > < / a >
### Rebuild statistics
2016-03-23 18:39:41 +01:00
2018-11-26 15:14:43 +01:00
Every nights, the statistics for the day that just ended are built automatically at 01:00 (AM) and stored in ElastricSearch.
See [schedule.yml ](config/schedule.yml ) to modify this behavior.
If the scheduled task wasn't executed for any reason (eg. you are in a dev environment and your computer was turned off at 1 AM), you can force the statistics data generation in ElasticSearch, running the following command.
2016-03-23 18:39:41 +01:00
```bash
2018-11-26 15:14:43 +01:00
# Here for the 50 last days
2019-02-13 12:59:28 +01:00
rake fablab:es:generate_stats[50]
2016-03-23 18:39:41 +01:00
```
2016-06-14 16:24:46 +02:00
< a name = "backup-and-restore-elasticsearch" > < / a >
### Backup and Restore
To backup and restore the ElasticSearch database, use the [elasticsearch-dump ](https://github.com/taskrabbit/elasticsearch-dump ) tool.
Dump the database with: `elasticdump --input=http://localhost:9200/stats --output=fablab_stats.json` .
Restore it with: `elasticdump --input=fablab_stats.json --output=http://localhost:9200/stats` .
2016-03-23 18:39:41 +01:00
< a name = "i18n" > < / a >
## Internationalization (i18n)
The FabManager application can only run in a single language but this language can easily be changed.
< a name = "i18n-translation" > < / a >
### Translation
Check the files located in `config/locales` :
- Front app translations (angular.js) are located in `config/locales/app.scope.XX.yml` .
Where scope has one the following meaning :
- admin: translations of the administrator views (manage and configure the FabLab).
2016-05-03 11:27:01 +02:00
- logged: translations of the end-user's views accessible only to connected users.
2016-03-23 18:39:41 +01:00
- public: translation of end-user's views publicly accessible to anyone.
- shared: translations shared by many views (like forms or buttons).
- Back app translations (Ruby on Rails) are located in `config/locales/XX.yml` .
- Emails translations are located in `config/locales/mails.XX.yml` .
- Messages related to the authentication system are located in `config/locales/devise.XX.yml` .
If you plan to translate the application to a new locale, please consider that the reference translation is French.
Indeed, in some cases, the English texts/sentences can seems confuse or lack of context as they were originally translated from French.
To prevent syntax mistakes while translating locale files, we **STRONGLY advise** you to use a text editor witch support syntax coloration for YML and Ruby.
< a name = "i18n-translation-front" > < / a >
#### Front-end translations
Front-end translations uses [angular-translate ](http://angular-translate.github.io ) with some interpolations interpreted by angular.js and other interpreted by [MessageFormat ](https://github.com/SlexAxton/messageformat.js/ ).
**These two kinds of interpolation use a near but different syntax witch SHOULD NOT be confused.**
Please refer to the official [angular-translate documentation ](http://angular-translate.github.io/docs/#/guide/14_pluralization ) before translating.
< a name = "i18n-translation-back" > < / a >
#### Back-end translations
2016-05-03 11:27:01 +02:00
Back-end translations uses the [Ruby on Rails syntax ](http://guides.rubyonrails.org/i18n.html ) but some complex interpolations are interpreted by [MessageFormat ](https://github.com/format-message/message-format-rb ) and are marked as it in comments.
**DO NOT confuse the syntaxes.**
2016-03-23 18:39:41 +01:00
In each cases, some inline comments are included in the localisation files.
They can be recognized as they start with the sharp character (#).
2016-10-07 11:11:58 +02:00
These comments are not required to be translated, they are intended to help the translator to have some context information about the sentence to translate.
2016-03-23 18:39:41 +01:00
< a name = "i18n-configuration" > < / a >
### Configuration
2016-05-03 11:27:01 +02:00
Locales configurations are made in `config/application.yml` .
2016-03-23 18:39:41 +01:00
If you are in a development environment, your can keep the default values, otherwise, in production, values must be configured carefully.
< a name = "i18n-settings" > < / a >
#### Settings
2016-07-07 15:31:22 +02:00
2018-11-26 10:53:33 +01:00
Please refer to the [environment configuration documentation ](doc/environment.md#internationalization-settings )
2016-07-07 15:31:22 +02:00
2016-03-23 18:39:41 +01:00
< a name = "i18n-apply" > < / a >
#### Applying changes
After modifying any values concerning the localisation, restart the application (ie. web server) to apply these changes in the i18n configuration.
2016-05-03 11:27:01 +02:00
< a name = "open-projects" > < / a >
## Open Projects
**This configuration is optional.**
2018-07-04 16:30:19 +02:00
You can configure your fab-manager to synchronize every project with the [Open Projects platform ](https://github.com/LaCasemate/openlab-projects ).
It's very simple and straightforward and in return, your users will be able to search over projects from all fab-manager instances from within your platform.
The deal is fair, you share your projects and as reward you benefits from projects of the whole community.
2016-05-03 11:29:14 +02:00
2016-05-03 11:27:01 +02:00
If you want to try it, you can visit [this fab-manager ](https://fablab.lacasemate.fr/#!/projects ) and see projects from different fab-managers.
To start using this awesome feature, there are a few steps:
- send a mail to **contact@fab-manager.com** asking for your Open Projects client's credentials and giving them the name of your fab-manager, they will give you an `OPENLAB_APP_ID` and an `OPENLAB_APP_SECRET`
2019-01-02 13:48:47 +01:00
- fill in the value of the keys in your environment file
2016-05-03 11:27:01 +02:00
- start your fab-manager app
- export your projects to open-projects (if you already have projects created on your fab-manager, unless you can skip that part) executing this command: `bundle exec rake fablab:openlab:bulk_export`
2016-06-13 11:34:11 +02:00
**IMPORTANT: please run your server in production mode.**
2016-05-03 11:29:38 +02:00
Go to your projects gallery and enjoy seeing your projects available from everywhere ! That's all.
2016-03-23 18:39:41 +01:00
2016-06-16 18:01:45 +02:00
< a name = "plugins" > < / a >
## Plugins
2016-06-16 18:08:20 +02:00
Fab-manager has a system of plugins mainly inspired by [Discourse ](https://github.com/discourse/discourse ) architecture.
2016-06-16 18:01:45 +02:00
It enables you to write plugins which can:
- have its proper models and database tables
- have its proper assets (js & css)
- override existing behaviours of Fab-manager
- add features by adding views, controllers, ect...
To install a plugin, you just have to copy the plugin folder which contains its code into the folder `plugins` of Fab-manager.
2016-06-16 18:08:20 +02:00
You can see an example on the [repo of navinum gamification plugin ](https://github.com/LaCasemate/navinum-gamification )
2016-06-16 18:01:45 +02:00
2016-09-12 17:29:44 +02:00
< a name = "sso" > < / a >
## Single Sign-On
Fab-manager can be connected to a [Single Sign-On ](https://en.wikipedia.org/wiki/Single_sign-on ) server which will provide its own authentication for the platform's users.
Currently OAuth 2 is the only supported protocol for SSO authentication.
For an example of how to use configure a SSO in Fab-manager, please read [sso_with_github.md ](doc/sso_with_github.md ).
2016-10-07 11:11:58 +02:00
Developers may find information on how to implement their own authentication protocol in [sso_authentication.md ](doc/sso_authentication.md ).
2016-09-12 17:29:44 +02:00
2016-03-23 18:39:41 +01:00
< a name = "known-issues" > < / a >
## Known issues
- When browsing a machine page, you may encounter an "InterceptError" in the console and the loading bar will stop loading before reaching its ending.
2016-09-05 08:54:01 +02:00
This may happen if the machine was created through a seed file without any image.
To solve this, simply add an image to the machine's profile and refresh the web page.
2016-03-23 18:39:41 +01:00
- When starting the Ruby on Rails server (eg. `foreman s` ) you may receive the following error:
2016-01-18 15:40:30 +01:00
2016-03-23 18:39:41 +01:00
worker.1 | invalid url: redis::6379
web.1 | Exiting
worker.1 | ...lib/redis/client.rb...:in `_parse_options'
2016-01-18 15:40:30 +01:00
2016-09-05 08:54:01 +02:00
This may happen when the `application.yml` file is missing.
To solve this issue copy `config/application.yml.default` to `config/application.yml` .
This is required before the first start.
2016-05-03 11:27:01 +02:00
2016-11-21 15:00:34 +01:00
- Due to a stripe limitation, you won't be able to create plans longer than one year.
2015-05-05 03:10:25 +02:00
2016-04-11 09:38:09 +02:00
- When running the tests suite with `rake test` , all tests may fail with errors similar to the following:
Error:
2017-02-15 15:41:25 +01:00
...
ActiveRecord::InvalidForeignKey: PG::ForeignKeyViolation: ERROR: insert or update on table "..." violates foreign key constraint "fk_rails_..."
2018-12-18 10:21:35 +01:00
DETAIL: Key (group_id)=(1) is not present in table "...".
2017-02-15 15:41:25 +01:00
: ...
test_after_commit (1.0.0) lib/test_after_commit/database_statements.rb:11:in `block in transaction'
test_after_commit (1.0.0) lib/test_after_commit/database_statements.rb:5:in `transaction'
2016-04-11 09:38:09 +02:00
2016-09-05 08:54:01 +02:00
This is due to an ActiveRecord behavior witch disable referential integrity in PostgreSQL to load the fixtures.
PostgreSQL will prevent any users to disable referential integrity on the fly if they doesn't have the `SUPERUSER` role.
2018-12-18 10:21:35 +01:00
To fix that, logon as the `postgres` user and run the PostgreSQL shell (see [the dedicated section ](#run-postgresql-cli ) for instructions).
2016-09-05 08:54:01 +02:00
Then, run the following command (replace `sleede` with your test database user, as specified in your database.yml):
2016-05-03 11:27:01 +02:00
2016-04-11 09:38:09 +02:00
ALTER ROLE sleede WITH SUPERUSER;
2016-09-05 08:54:01 +02:00
DO NOT do this in a production environment, unless you know what you're doing: this could lead to a serious security issue.
2016-10-07 11:11:58 +02:00
- With Ubuntu 16.04, ElasticSearch may refuse to start even after having configured the service with systemd.
2016-09-05 08:54:01 +02:00
To solve this issue, you may have to set `START_DAEMON` to `true` in `/etc/default/elasticsearch` .
Then reload ElasticSearch with:
2016-10-07 11:11:58 +02:00
2016-09-05 08:54:01 +02:00
```bash
sudo systemctl restart elasticsearch.service
```
2016-06-13 08:30:43 +02:00
2016-03-23 18:39:41 +01:00
< a name = "related-documentation" > < / a >
## Related Documentation
2016-01-18 15:40:30 +01:00
2016-04-11 20:24:09 +02:00
- [Ruby 2.3.0 ](http://ruby-doc.org/core-2.3.0/ )
2016-03-23 18:39:41 +01:00
- [Ruby on Rails ](http://api.rubyonrails.org )
- [AngularJS ](https://docs.angularjs.org/api )
- [Angular-Bootstrap ](http://angular-ui.github.io/bootstrap/ )
2018-04-09 16:37:21 +02:00
- [ElasticSearch 5.6 ](https://www.elastic.co/guide/en/elasticsearch/reference/5.6/index.html )
2018-02-14 19:41:00 +01:00
---
[vagrant]: https://www.vagrantup.com/downloads.html
[virtualbox]: https://www.virtualbox.org/wiki/Downloads