This project is the FabLab Manager web application.
The purpose of this web application is to allow users to document their FabLab projects. The FabLab also have the ability to plan some events (workshops or courses) and to expose them to its users.
This product can be extended to be used as a complete internal management system for a FabLab.
The underlying technologies are:
Ruby on Railsfor the backend application (server RESTful API)AngularJSfor the frontend application (web-based graphical user interface)
The following files must be filled with the correct configuration to allow FabManager to run correctly:
-
config/environments/production.rb
mandrill-> change this if you're using a different mailing system
-
config/environments/staging.rb
config.action_mailer.default_url_options-> change the URL according to the staging deployment urlmandrill-> change this if you're using a different mailing system
-
config/application.yml
DEVISE_KEY-> generate any secret phrase to secure the Devise authentication. You can use the$ rake secretcommand for this purpose.SECRET_KEY_BASE-> generate any secret phrase here to prevent XSS attacks. You can use the$ rake secretcommand for this purpose.DEFAULT_MAIL_FROM-> default e-mail address from which the emails are sentMANDRILL_USERNAME-> if you plan to use mandrillMANDRILL_APIKEY-> if you plan to use mandrillTWITTER_NAME-> twitter api configurationTWITTER_CONSUMER_KEY-> twitter api configurationTWITTER_CONSUMER_SECRET-> twitter api configurationTWITTER_ACCESS_TOKEN-> twitter api configurationTWITTER_ACCESS_TOKEN_SECRET-> twitter api configurationGOOGLE_ANALYTICS_ACCOUNT-> Google analytics account identifier (if you want to use GA)APPLICATION_ROOT_URL-> The public URL where you application is deployed in production (eg. fablab.lacasemate.com)
-
config/mandrill.rb You may change this if you don't want to use mandrill as your production mailing system
-
config/database.yml.default Copy/Paste this file to
config/database.ymland modify the configuration according to your postgreSQL configuration -
config/disqus_api.yml Insert here your identifiers for the Disqus API
-
Install RVM with latest ruby version See http://rvm.io/rvm/install
-
Retrieve the project from Git
$ git clone [email protected]:LaCasemate/fab-manager.git -
Install the dependencies
- Ubuntu:
$ sudo apt-get install libpq-dev postgresql redis-server imagemagick - MacOS:
$ brew install postgresql redis imagemagick
- Ubuntu:
-
Init the RVM instance and check it was correctly configured
$ cd fab-manager $ rvm current -
Setup the project requirements
$ bundle install -
Build the database. You may have to configure your postgreSQL instance before, as described in chapter
3.2 Setup the FabManager database in PostgreSQL$ rake db:setup -
Create the pids folder used by sidekiq. If you want to use a different location, you can configure it in
config/sidekiq.yml$ mkdir -p tmp/pids -
Configure the application environment variables, as explained in chapter
1. Configuration -
Start the development web server
$ foreman s -p 3000
$ ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
The first command will start postgresql at login with launchd. The second will load postgresql now.
###
# set postgreSQL to valid password
###
sudo sed -i 's/all\s*peer/all md5/g' /etc/postgresql/*/main/pg_hba.conf
sudo service postgresql restart
-
Login as the postgres user
$ sudo -i -u postgres -
Run the postgreSQL administration command line interface
-
Create a new user in postgres (in this example, the user will be named "sleede")
-
Grant him the right to create databases
-
Then create the fablab database
-
To finish, attribute a password to this user
psql -f /path/of/the/create_db_user.sql
If you encounter a problem with bundler (unable to run $ rails c or $ rails g), you can fix it running the following commands:
$ bundle pack
$ bundle install --path vendor/cache
- Angular-Bootstrap: http://angular-ui.github.io/bootstrap/
You will need to install the Vagrant and Virtualbox first. After that you can setup develop environment by one command.
References:
https://gorails.com/guides/using-vagrant-for-rails-development
Install plugin for Vagrant first:
vagrant plugin install vagrant-librarian-chef-nochef
Uncomment ip on Vagrantfile:
$ vi Vagrantfile
uncomment line 11 in other to assign ip should look like this
config.vm.network "private_network", ip: "192.168.33.13"
How to start the Vagrant in project directory:
vagrant up
Setup the FabManager database in PostgreSQL
- Login as the postgres user
vagrant ssh
$ sudo -i -u postgres
- To finish, attribute a password to this user and some extra stuff...
sudo apt-get install redis-server
sudo apt-get install graphicsmagick
psql -f /vagrant/create_db_user.sql
exit
cd /vagrant
rake db:migrate
rake db:seed
exit
Start rails server:
vagrant ssh -c /home/vagrant/serve
or
Login VM:
vagrant ssh
cd /vagrant
rails s -b 0.0.0.0
By default, Vagrant will share your project directory (the directory with the Vagrantfile) to /vagrant.
Notice: If bundle command fail when bootstrap, you can run it manually after login.