Install the Chouette IEV 3.X Web Service see how to
The next steps assume that :
- a Chouette IEV Web Service is running (on localhost, port 8080)
- a Postgres database exists (chouette2 on localhost, port 5432) with a postgres user (chouette, with password chouette)
On Debian/Ubuntu/Kubuntu OS : assumes that the depot contains the correct version
sudo apt-get install libpq-dev git unzip libgeos-dev proj-bin libproj-dev make
On OSX : assumes that the depot contains the correct version
brew install libffi geos proj
If your Linux distribution doesn't publish an RVM package, install RVM from sources
Install ruby 2.1.x
rvm install ruby-2.1.x
rvm --default use 2.1.x
Install bundler 1.10.x
gem install bundler -v 1.10.x
On Debian, chouette can also be installed as a package : see debian packages
Install web application
Get git source code :
cd
git clone -b V3_2 git://github.com/afimb/chouette2
cd chouette2
Download gem librairies
bundle install
Copy and fill application.yml
cp config/application.example.yml config/application.yml
- Configure domain_name with your domain, for example:
domain_name: chouette.mobi
See Action Mailer Configuration documentation - Configure SMTP settings with all lines started with
smtp_
For using SMTP you must set 'smtp' insmtp_delivery_method
See Action Mailer Configuration documentation - Fill secret_key_base and devise_secret_key by executing
rake secret
in your terminal See Rails documentation - Configure the Chouette IEV Web Service url
api_endpoint
- Configure the Google Analytics Key
google_analytics_tracker
See Google Analytics - Configure the IGN Géoportail Key
geoportail_api_key
See API Géoportail documentation - Configure OSRM Backend URL
osrm_endpoint
See Project-OSRM - If you want to enable Google oauth2 authentification
google_client_id
andgoogle_secret_id
See Google Oauth2 - If you want to enable Facebook oauth2 authentification
facebook_client_id
andfacebook_secret_id
See Facebook Oauth2
Add the PostGIS extension to your database
RAILS_ENV=production bundle exec rake db:gis:setup
Update the database schema
RAILS_ENV=production bundle exec rake db:migrate
Prepare the static resources (assets)
RAILS_ENV=production bundle exec rake assets:clobber assets:precompile
Configure asset access (Must be True if you use Webrick, or False if you use Apache or Nginx).
- Edit production.rb and change
config.serve_static_assets
Configure the way Chouette2 sends e-mail.
- Edit devise_async.rb and uncomment and set
Devise::Async.enabled
( true if you want to use asynchronously and false otherwise ) - see Devise Async specification
Launch the task if you want to send mail asynchronously (See previous section to de-activate it)
RAILS_ENV=production bundle exec rake jobs:work
This task may be added in the system start-up configuration
Launch the Rails server with WEBrick ( default RoR web server, note: Webrick runs on default port 3000)
RAILS_ENV=production bundle exec rails server
This task may be added in the system start-up configuration. Instead of using WEBrick, the Rails application may be deployed on Phusion Passenger with an Apache or NGinx front-end, to make server faster and more robust.
Apache like NGinx can serve static resources,
so change parameter serve_static_assets
to false in production.rb
If you run into problems related to libProj library, you can try building it from source.
Chouette depends on an older version of libProj. Newer versions that are pre-installed on Linux/MacOS exposes a different API. The last version of libProj that exposes both the old and new API is 7.2
Download https://download.osgeo.org/proj/proj-7.2.1.tar.gz and then follow instructions from https://proj.org/install.html#compilation-and-installation-from-source-code.
The first 3 build steps are sufficient.
Then launch Chouette2 with the PROJ4_LIBRARY_PATH env variable.
RAILS_ENV=development PROJ4_LIBRARY_PATH=/<path>/proj-7.2.1/build/lib bundle exec rails server
bundle exec rake db:create
bundle exec rake db:migrate
bundle exec rake spec