diff --git a/README.md b/README.md
index cbfc21824..912820488 100644
--- a/README.md
+++ b/README.md
@@ -6,26 +6,27 @@ FabManager is the FabLab management solution. It is web-based, open-source and t
##### Table of Contents
1. [Software stack](#software-stack)
2. [Contributing](#contributing)
-3. [Setup a development environment](#setup-a-development-environment)
-3.1. [General Guidelines](#general-guidelines)
-3.2. [Environment Configuration](#environment-configuration)
-4. [PostgreSQL](#postgresql)
-4.1. [Install PostgreSQL 9.4 on Ubuntu/Debian](#postgresql-on-debian)
-4.2. [Install and launch PostgreSQL on MacOS X](#postgresql-on-macosx)
-4.3. [Setup the FabManager database in PostgreSQL](#setup-fabmanager-in-postgresql)
-5. [ElasticSearch](#elasticsearch)
-5.1. [Install ElasticSearch on Ubuntu/Debian](#elasticsearch-on-debian)
-5.2. [Install ElasticSearch on MacOS X](#elasticsearch-on-macosx)
-5.3. [Setup ElasticSearch for the FabManager](#setup-fabmanager-in-elasticsearch)
-6. [Internationalization (i18n)](#i18n)
-6.1. [Translation](#i18n-translation)
-6.1.1. [Front-end translations](#i18n-translation-front)
-6.1.2. [Back-end translations](#i18n-translation-back)
-6.2. [Configuration](#i18n-configuration)
-6.2.1. [Settings](#i18n-settings)
-6.2.2. [Applying changes](#i18n-apply)
-7. [Known issues](#known-issues)
-8. [Related Documentation](#related-documentation)
+3. [Setup a production environment with Docker and CoreOS](#setup-a-production-environment)
+4. [Setup a development environment](#setup-a-development-environment)
+4.1. [General Guidelines](#general-guidelines)
+4.2. [Environment Configuration](#environment-configuration)
+5. [PostgreSQL](#postgresql)
+5.1. [Install PostgreSQL 9.4 on Ubuntu/Debian](#postgresql-on-debian)
+5.2. [Install and launch PostgreSQL on MacOS X](#postgresql-on-macosx)
+5.3. [Setup the FabManager database in PostgreSQL](#setup-fabmanager-in-postgresql)
+6. [ElasticSearch](#elasticsearch)
+6.1. [Install ElasticSearch on Ubuntu/Debian](#elasticsearch-on-debian)
+6.2. [Install ElasticSearch on MacOS X](#elasticsearch-on-macosx)
+6.3. [Setup ElasticSearch for the FabManager](#setup-fabmanager-in-elasticsearch)
+7. [Internationalization (i18n)](#i18n)
+7.1. [Translation](#i18n-translation)
+7.1.1. [Front-end translations](#i18n-translation-front)
+7.1.2. [Back-end translations](#i18n-translation-back)
+7.2. [Configuration](#i18n-configuration)
+7.2.1. [Settings](#i18n-settings)
+7.2.2. [Applying changes](#i18n-apply)
+8. [Known issues](#known-issues)
+9. [Related Documentation](#related-documentation)
@@ -49,6 +50,11 @@ Contributions are welcome. Please read [the contribution guidelines](CONTRIBUTIN
**IMPORTANT**: **do not** update Arshaw/fullCalendar.js as it contains a hack for the remove-event cross.
+
+## Setup a production environment with Docker and CoreOS
+
+[Docker Readme](docker/README.md)
+
## Setup a development environment
@@ -543,7 +549,7 @@ After modifying any values concerning the localisation, restart the application
## Related Documentation
-- [Ruby 2.2.3](http://ruby-doc.org/core-2.2.3/)
+- [Ruby 2.3.0](http://ruby-doc.org/core-2.3.0/)
- [Ruby on Rails](http://api.rubyonrails.org)
- [AngularJS](https://docs.angularjs.org/api)
- [Angular-Bootstrap](http://angular-ui.github.io/bootstrap/)
diff --git a/docker/README.md b/docker/README.md
index 7d9ae31e8..7cd9b0f00 100644
--- a/docker/README.md
+++ b/docker/README.md
@@ -1,14 +1,50 @@
+# full procedure to put into production a fabmanager app with Docker
-## Docker
+This README tries to describe all steps to put a fabmanager app into production on a server, based on a solution using Docker and DigitalOcean.
+In order to make all this stuff working, please use the same directories structure as described in this guide in your fabmanager app folder.
-Docker is an application deployment software.
+### docker/env
-## PREPARE HOST COREOS
-Install VPS WITH Version coreOS STABLE (Ex : on DigitalOcean)
+Make a copy of the **env.example** and use it as a starting point.
+List all the environment variables needed by your application.
-### Creating Swap File in CoreOS
+### docker/nginx_with_ssl.conf.example
+
+* Use nginx.conf.example especially if you are not using **SSL**
+* Replace **MAIN_DOMAIN** (example: fab-manager.com).
+* Replace **URL_WITH_PROTOCOL_HTTPS** (example: https://www.fab-manager.com).
+* Replace **ANOTHER_URL_1**, **ANOTHER_URL_2** (example: .fab-manager.fr)
+
+
+
+## Things are getting serious, starting deployment process guys
+
+
+### setup the server
+
+Go to **DigitalOcean** and create a Droplet with operating system coreOS **stable**.
+You need at least 2GB of addressable memory (RAM + swap) to install and use FabManager!.
+Choose datacenter. Set hostname as your domain name.
+
+
+### Buy domain name and link it with the droplet
+
+1. Buy a domain name on OVH
+2. Replace IP of the domain with droplet's IP (you can enable the flexible ip and use it)
+3. **Do not** fuck up trying to access your domain name right away, DNS are not aware of the change yet so **WAIT** and be patient.
+
+
+### Connect to the droplet via SSH
+
+You can already connect to the server with this command: `ssh core@droplet-ip`. When DNS propagation will be done, you will be able to
+connect to the server with `ssh core@your-domain-name`.
+
+
+
+### Create SWAP file in coreOS
Firstly, switch to sudo and create swap file
+
```bash
sudo -i
touch /2GiB.swap
@@ -18,7 +54,8 @@ chmod 600 /2GiB.swap
mkswap /2GiB.swap
```
-Create file /etc/systemd/system/swap.service with
+Create file **/etc/systemd/system/swap.service**, filling it with the lines:
+
```bash
[Unit]
Description=Turn on swap
@@ -35,43 +72,44 @@ WantedBy=multi-user.target
```
Then add service and start:
+
```bash
systemctl enable /etc/systemd/system/swap.service
-systemctl start swap
+systemctl start swap
exit
```
-## PREPARE FOLDERS AND ENV CONFIG ON HOST
+### Setup folders and env file
+```bash
mkdir -p /home/core/fabmanager/config
-MOVE docker/env.example to /home/core/fabmanager/config/env
-CUSTOM ENV
+```
+
+Copy the previously customized `env` file as `/home/core/fabmanager/config/env`.
+
+```bash
mkdir -p /home/core/fabmanager/config/nginx
-MOVE docker/nginx.conf.example to /home/core/fabmanager/config/nginx/fabmanager.conf
-CUSTOM fabmanager.conf
+```
-IF SSL
-mkdir -p /home/core/fabmanager/config/nginx/ssl
-Move your crt and deprotected key
-MOVE docker/nginx_with_ssl.conf.example to /home/core/fabmanager/config/nginx/fabmanager.conf
-CUSTOM fabmanager.conf
+Copy the previously customized `nginx.conf` as `/home/core/fabmanager/config/nginx/fabmanager.conf`.
-## DEPLOY DOCKERS CONTAINERS ON HOST
+### Deploy dockers containers on host
-
```bash
docker pull redis:3.0
docker pull postgres:9.4
docker pull elasticsearch:1.7
-docker pull sleede/fabmanager
+docker pull sleede/fab-manager
docker run --restart=always -d --name=fabmanager-postgres -v /home/core/fabmanager/postgresql:/var/lib/postgresql/data postgres:9.4
docker run --restart=always -d --name=fabmanager-redis -v /home/core/fabmanager/redis:/data redis:3.0
docker run --restart=always -d --name=fabmanager-elastic -v /home/core/fabmanager/elasticsearch:/usr/share/elasticsearch/data elasticsearch:1.7
```
-### DB CREATE
+### Rails specific commands
+
+#### DB CREATE
```bash
docker run --rm \
@@ -80,11 +118,11 @@ docker run --rm \
--link=fabmanager-elastic:elasticsearch \
-e RAILS_ENV=production \
--env-file /home/core/fabmanager/config/env \
- sleede/fabmanager \
+ sleede/fab-manager \
bundle exec rake db:create
```
-### DB MIGRATE
+#### DB MIGRATE
```bash
docker run --rm \
@@ -93,11 +131,11 @@ docker run --rm \
--link=fabmanager-elastic:elasticsearch \
-e RAILS_ENV=production \
--env-file /home/core/fabmanager/config/env \
- sleede/fabmanager \
+ sleede/fab-manager \
bundle exec rake db:migrate
```
-### DB SEED
+#### DB SEED
```bash
docker run --rm \
@@ -106,12 +144,12 @@ docker run --rm \
--link=fabmanager-elastic:elasticsearch \
-e RAILS_ENV=production \
--env-file /home/core/fabmanager/config/env \
- sleede/fabmanager \
+ sleede/fab-manager \
bundle exec rake db:seed
```
-### PREPARE ELASTIC
+#### PREPARE ELASTIC
```bash
docker run --rm \
@@ -121,27 +159,12 @@ docker run --rm \
--link=fabmanager-elastic:elasticsearch \
-e RAILS_ENV=production \
--env-file /home/core/fabmanager/config/env \
- sleede/fabmanager \
+ sleede/fab-manager \
bundle exec rake fablab:es_build_stats
```
-### recreate every versions of images
-
-```bash
-docker run --rm \
- --link=fabmanager-postgres:postgres \
- --link=fabmanager-redis:redis \
- --link=fabmanager-elastic:elasticsearch \
- -e RAILS_ENV=production \
- --env-file /home/core/fabmanager/config/env \
- -v /home/core/fabmanager/public/uploads:/usr/src/app/public/uploads \
- sleede/fabmanager \
- bundle exec rake fablab:build_images_versions
-```
-
-
-### BUILD ASSETS
+#### BUILD ASSETS
```bash
docker run --rm \
@@ -151,16 +174,12 @@ docker run --rm \
-e RAILS_ENV=production \
--env-file /home/core/fabmanager/config/env \
-v /home/core/fabmanager/public/assets:/usr/src/app/public/assets \
- sleede/fabmanager \
+ sleede/fab-manager \
bundle exec rake assets:precompile
-
-docker run --rm -v /home/core/fabmanager/public/assets:/usr/src/app/public/assets sleede/fabmanager cp vendor/assets/components/select2/select2.png public/assets/select2.png
-docker run --rm -v /home/core/fabmanager/public/assets:/usr/src/app/public/assets sleede/fabmanager cp vendor/assets/components/select2/select2x2.png public/assets/select2x2.png
-docker run --rm -v /home/core/fabmanager/public/assets:/usr/src/app/public/assets sleede/fabmanager cp vendor/assets/components/select2/select2-spinner.gif public/assets/select2-spinner.gif
```
-### RUN APP
+#### RUN APP
```bash
docker run --restart=always -d --name=fabmanager \
@@ -177,19 +196,22 @@ docker run --restart=always -d --name=fabmanager \
-v /home/core/fabmanager/public/uploads:/usr/src/app/public/uploads \
-v /home/core/fabmanager/invoices:/usr/src/app/invoices \
-v /home/core/fabmanager/log:/var/log/supervisor \
- sleede/fabmanager
+ sleede/fab-manager
```
-### for debug
-```bash
-docker run --rm -it \
- --link=fabmanager-postgres:postgres \
- --link=fabmanager-redis:redis \
- --link=fabmanager-elastic:elasticsearch \
- -e RAILS_ENV=production \
- --env-file /home/core/fabmanager/config/env \
- sleede/fabmanager \
- bash
-```
+### Dockers utils
+
+#### Restart app
+
+`docker restart fabmanager-app`
+
+#### Remove app
+
+`docker rm -f fabmanager-app`
+
+#### Open a bash in the app context
+
+`docker exec -it fabmanager-app bash`
+
diff --git a/docker/nginx.conf.example b/docker/nginx.conf.example
index bca995d9e..7e0a2bafe 100644
--- a/docker/nginx.conf.example
+++ b/docker/nginx.conf.example
@@ -4,7 +4,7 @@ upstream puma {
server {
listen 80;
- server_name demo.fab-manager.com;
+ server_name MAIN_DOMAIN;
root /usr/src/app/public;
location ^~ /assets/ {
diff --git a/docker/nginx_with_ssl.conf.example b/docker/nginx_with_ssl.conf.example
index a71e9e35f..105f0fcd1 100644
--- a/docker/nginx_with_ssl.conf.example
+++ b/docker/nginx_with_ssl.conf.example
@@ -4,11 +4,11 @@ upstream puma {
server {
listen 443 ssl;
- server_name demo.fab-manager.com;
+ server_name MAIN_DOMAIN;
root /usr/src/app/public;
ssl on;
- ssl_certificate /etc/nginx/conf.d/ssl/fab-manager.crt;
- ssl_certificate_key /etc/nginx/conf.d/ssl/fab-manager.deprotected.key;
+ ssl_certificate /etc/nginx/conf.d/ssl/MAIN_DOMAIN.crt;
+ ssl_certificate_key /etc/nginx/conf.d/ssl/MAIN_DOMAIN.deprotected.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
ssl_prefer_server_ciphers on;
@@ -58,6 +58,6 @@ server {
server {
listen 80;
- server_name demo.fab-manager.com;
- rewrite ^ https://demo.fab-manager.com$request_uri? permanent;
+ server_name MAIN_DOMAIN ANOTHER_DOMAIN_1 ANOTHER_DOMAIN_2;
+ rewrite ^ URL_WITH_PROTOCOL_HTTPS$request_uri? permanent;
}
diff --git a/docker/supervisor.conf b/docker/supervisor.conf
index c722ea67e..35173f0ce 100644
--- a/docker/supervisor.conf
+++ b/docker/supervisor.conf
@@ -5,7 +5,7 @@ file=/var/run/supervisor.sock ; path to your socket file
nodaemon=true ; dont run supervisord as a daemon
logfile=/var/log/supervisor/supervisord.log ; supervisord log file
logfile_maxbytes=10MB ; maximum size of logfile before rotation
-logfile_backups=10 ; number of backed up logfiles
+logfile_backups=100 ; number of backed up logfiles
loglevel=info ; info, debug, warn, trace
pidfile=/var/run/supervisord.pid ; pidfile location
user=root ; default user