rails | jquery-rails | bootstrap |
---|---|---|
7.0.3.1 | 4.5 | 5.2 |
A business social network tool dedicated to quality management
This application is a SharingFile System with surveys management facilities or an open source CRM - Client Relation Management
Deliver files and documents to your clients and Record your clients’satisfaction <img src=public/images/doc/colibri_front.png>
Online class documentation (not up to date) : https://alexandrecuer.github.io/sharebox/
documentation is generated by yard (just launch yard doc
in the root folder)
Check online prototype : http://cerema-autun.herokuapp.com
Check the wiki for architecture details and roadmap : https://github.com/alexandrecuer/sharebox/wiki
An automatic process is available for deployment on a linux Ubuntu server or virtual machine. It will install the required dependencies then the application in /var/www/colibri/sharebox.
When installing the server, reserve 8GB at least for the system and create a specific mounting point for /var/www
check : https://github.com/alexandrecuer/colibriScripts </b>
Uses the following gems :
- devise for user authentification
- passenger as the application server (in standalone mode)
- aws-sdk for storage on S3
frontoffice : * bootstrap * font-awesome icons and cosmectic details * jquery rails
File storage
The application use rails ActiveStorage for file storage/documents processing
migration guide from paperclip
Document storage is configured for : - Amazon S3 in production mode - local file system in development mode. In that case, the aws-sdk gem is not used.
corresponding model and controller can be found there : - app/models/asset.rb - app/controllers/assets_controller.rb - see the get_file private method
to open a file, follow the route /forge/get/:id
Switching between S3 and local storage
Modify the value of config.active_storage.service in the corresponding config/environments/*.rb file(s)
- config.active_storage.service = :local or :local_production > local storage will be activated
- config.active_storage.service = :amazon > all files will go in the S3 bucket
let’s take the case of a file with an active_storage_blobs.key value equal to xMRXuT6nqpoiConJFQJFt6c9 : - if local storage is activated, the file will be stored as rails_root/(storage or production_storage)/xM/RX/xMRXuT6nqpoiConJFQJFt6c9 - if S3 storage is activated, the file will be stored directly at the root of the bucket : S3 bucket/xMRXuT6nqpoiConJFQJFt6c9
in local storage, if you delete the file the folders xM/RX will remain on disk
in lib/tasks, you can find a rake utility to clean the storage or production_storage folder
just launch :
bundle exec rake storage:clean_storage['storage']
bundle exec rake storage:clean_storage['storage_production']
empty folders will be deleted
S3 storage environmental variables : TO REVIEW
S3_BUCKET_NAME | <a href=https://devcenter.heroku.com/articles/s3#s3-setup>Heroku specific doc</a> |
AWS_REGION |
<a href=https://docs.aws.amazon.com/fr_fr/general/latest/gr/rande.html#s3_region>AWS regional parameters</a> exemple : AWS_REGION=eu-west-3 AWS_HOST_NAME=s3.eu-west-3.amazonaws.com |
AWS_HOST_NAME | |
AWS_URL | S3_BUCKET_NAME.AWS_HOST_NAME |
AWS_ACCESS_KEY_ID | <a href=https://console.aws.amazon.com/iam/home#/users>IAM - Identity and Access Management</a> |
AWS_SECRET_ACCESS_KEY |
Mail delivery Environmental variables
GMAIL_USERNAME |
SendGrid is the preferred option <a href=https://sendgrid.com/>sendgrid</a> <a href=https://mail.google.com/>gmail</a> Please note gmail is not a reliable solution as a backoffice mailer if, however, you were considering using gmail for mail delivery, you may need to configure your google account in order to allow external applications to use it <a href=https://www.google.com/settings/security/lesssecureapps>lesssecureapps</a> <a href=https://accounts.google.com/DisplayUnlockCaptcha>unlockcaptach</a> |
GMAIL_PASSWORD | |
SMTP_ADDRESS | example if using sendgrid : SMTP_ADDRESS="smtp.sengrid.net" SMTP_PORT=587 |
SMTP_PORT | |
DOMAIN | In development mode : localhost For a production server :ip address or domain name of the server |
User management
5 different user profiles are available
profile 0 : external user
customer who is not registered in the tool and who has received a token by email to answer a satisfaction survey not related to a deliverable
profile 1 : standard public user
customer who wants to access a deliverable and to complete an associated satisfaction survey, if any
profile 2 : team member
team members can only send customer satisfaction surveys without making deliverables available on the cloud
a specific environmental variable TEAM permits to active the profile 2
TEAM | cerema.fr |
Initialize TEAM with your domain name - otherwise there will be no difference between profile 1 and profile 2
profile 3 : private user
full team member who dematerializes his productions
Private users can create directories and upload files in folders they don’t own, if they have received shared access - this constitutes a primitive kind of collaborative work
profile 4 : admin
all powers - access to all directories and assets, surveys management, ability to modify directories (moving and changing ownership)
Deployment to Heroku through GitHub integration
This application has been designed for an automatic deployment from github to the heroku cloud You will need a S3 bucket as Heroku has an ephemeral file system Here are the main steps : - Fork and customize the repository to your needs - Create a new Heroku app and link it to the GitHub repository previously forked - Fill all the eleven needed config variables (AWS_ACCESS_KEY_ID, AWS_HOST_NAME, AWS_REGION, AWS_SECRET_ACCESS_KEY, AWS_URL, DOMAIN, GMAIL_PASSWORD, GMAIL_USERNAME, S3_BUCKET_NAME, SMTP_ADDRESS, SMTP_PORT plus an extra one: TEAM) - Proceed to a manual deploy
To customize the application to your needs, check the following files - config/config.yml (site_name and admin_mel) - config/initializers/devise.rb (config.mailer_sender)
admin_mel will receive activity notifications : new shares, pending users. Pending users are unregistered users benefiting from at least one shared access to a folder
config.mailer_sender will be the sending email as far as authentification issues are considered (eg password changes)
You can find the two site’s logos in the /app/assets/images directory
Please note that the first user to register in the system will be given admin rights !!
for more details : deploy on heroku in images
Installation on Heroku (for production) from a development server
If you don’t want to use the github integration method, an alternative option is possible
Install Heroku CLI
Or https://cli-assets.heroku.com/branches/stable/heroku-windows-amd64.exe
Open your local app directory in a git bash, and login to Heroku :
$ cd /c/Sites/sharebox
$ heroku login
Enter your Heroku credentials:
Email: alexandre.cuer@cerema.fr
Password: *************
Logged in as alexandre.cuer@cerema.fr
Once succesfully logged, create a new heroku app :
$ heroku create
Creating app... done, desolate-earth-32333
https://desolate-earth-32333.herokuapp.com/ | https://git.heroku.com/desolate-earth-32333.git
Heroku will define a random name for your production server, here : desolate-earth-32333.
Push the files with git.
$ git init
$ git add .
$ git commit -a -m "Switch to production"
$ git push heroku master
Fix environmental variables (we assume you are using gmail)
$ heroku config:set S3_BUCKET_NAME="your_bucket"
$ heroku config:set AWS_REGION="your_region"
$ heroku config:set AWS_HOST_NAME="your_host_name"
$ heroku config:set AWS_URL="your_url"
$ heroku config:set AWS_ACCESS_KEY_ID="your_access_key"
$ heroku config:set AWS_SECRET_ACCESS_KEY="your_secret_access_key"
$ heroku config:set GMAIL_USERNAME="your_gmail_address"
$ heroku config:set GMAIL_PASSWORD="your_gmail_password"
$ heroku config:set SMTP_ADDRESS="smtp.gmail.com"
$ heroku config:set SMTP_PORT=587
$ heroku config:set DOMAIN="desolate-earth-32333.herokuapp.com"
If for some reason, one variable is not correctly fixed, you can correct it from the heroku dashboard.
Go to https://dashboard.heroku.com/apps > Settings > Reveal Config Vars
Create the database and the tables
$ heroku run rake db:schema:load
Working behind a proxy server
If you work behind a proxy, please set http_proxy and https_proxy variables
$ export https_proxy="http://user_name:password@proxy_url:proxy_port"
$ export http_proxy="http://user_name:password@proxy_url:proxy_port"
Installation on a microsoft windows development machine
Follow the specific guide