diff options
| author | Luc Donnet | 2018-02-19 11:37:33 +0100 |
|---|---|---|
| committer | GitHub | 2018-02-19 11:37:33 +0100 |
| commit | 3809301116aec5466445b29637026804da3d6745 (patch) | |
| tree | 903d6613b4cc253184770818a345ce3872fa45a4 | |
| parent | 70fc9b5e5332aa7802e57e68f6b57f7f1604d255 (diff) | |
| parent | 7b17deff51545358009cb417cbb9d796565e7540 (diff) | |
| download | chouette-core-3809301116aec5466445b29637026804da3d6745.tar.bz2 | |
Merge pull request #316 from af83/0000-docker
0000-docker
| -rw-r--r-- | Dockerfile | 6 | ||||
| -rw-r--r-- | Gemfile | 1 | ||||
| -rw-r--r-- | INSTALL.md | 44 | ||||
| -rw-r--r-- | config/environments/production.rb | 1 | ||||
| -rw-r--r-- | config/initializers/sidekiq.rb | 4 | ||||
| -rw-r--r-- | config/secrets.yml.docker | 1 | ||||
| -rw-r--r-- | lib/tasks/install.rake | 4 | ||||
| -rw-r--r-- | spec/javascript/time_table/actions_spec.js | 1 |
8 files changed, 57 insertions, 5 deletions
diff --git a/Dockerfile b/Dockerfile index 8259981f8..e484de431 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM debian:stable-slim -ENV RAILS_ENV=production RAILS_SERVE_STATIC_FILES=true RAILS_LOG_TO_STDOUT=true +ENV RAILS_ENV=production RAILS_SERVE_STATIC_FILES=true RAILS_LOG_TO_STDOUT=true SIDEKIQ_REDIS_URL=redis://redis:6379/12 RUN apt-get update && \ apt-get install -y --no-install-recommends ruby2.3 && \ @@ -12,10 +12,10 @@ RUN apt-get update && \ COPY stif-boiv-release.tar.gz / RUN mkdir /app && apt-get update &&\ - apt-get -y install --no-install-recommends build-essential ruby2.3-dev libpq-dev libxml2-dev zlib1g-dev libproj-dev&& \ + apt-get -y install --no-install-recommends build-essential ruby2.3-dev libpq-dev libxml2-dev zlib1g-dev libproj-dev libmagic1 libmagic-dev&& \ tar -C /app -zxf stif-boiv-release.tar.gz && \ cd /app && bundle install --local && \ - apt-get -y remove build-essential ruby2.3-dev libpq-dev libxml2-dev zlib1g-dev && \ + apt-get -y remove build-essential ruby2.3-dev libpq-dev libxml2-dev zlib1g-dev libmagic-dev&& \ apt-get clean && apt-get -y autoremove && rm -rf /var/lib/apt/lists/* && \ cd /app && rm config/database.yml && mv config/database.yml.docker config/database.yml && \ cd /app && rm config/secrets.yml && mv config/secrets.yml.docker config/secrets.yml && \ @@ -142,6 +142,7 @@ gem 'rake' gem 'devise-async' gem 'apartment', '~> 1.0.0' gem 'aasm' +gem 'activerecord-nulldb-adapter' gem 'puma', '~> 3.10.0' gem 'newrelic_rpm' diff --git a/INSTALL.md b/INSTALL.md index 9e04730f7..e44b072f4 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -46,6 +46,7 @@ yarn install bundle config build.libv8 --with-system-v8 bundle ``` + or ```sh @@ -95,6 +96,46 @@ On mac/OS : brew install postgis ``` +<<<<<<< HEAD +### Authentication + +See `config.chouette_authentication_settings`. + +Use the database authentication or get an invitation to [STIF Portail](http://stif-portail-dev.af83.priv/). + +### Run seed + +Run : + + bundle exec rake db:seed + +Two users are created : stif-boiv@af83.com/secret and stif-boiv+transporteur@af83.com/secret + +If you have access to STIF CodifLigne and Reflex : + + bundle exec rake codifligne:sync + bundle exec rake reflex:sync + +To create Referential with some data (Route, JourneyPattern, VehicleJourney, etc) : + + bundle exec rake referential:create + +# Troubleshooting + +If PG complains about illegal type `hstore` in your tests that is probably because the shared extension is not installed, here is what to do: + +#### Check installation + +* Run tests + + bundle exec rake spec + bundle exec rake teaspoon + +* Start local server + + bundle exec rails server + +======= On debian/ubuntu system : ```sh @@ -135,6 +176,7 @@ RAILS_ENV=test bundle exec rake db:create db:migrate ``` #### Load seed datas +>>>>>>> master ```sh bundle exec rake db:seed:stif @@ -169,7 +211,7 @@ bundle exec rake referential:create #### Run tests -#### Rspec +#### Rspec ```sh bundle exec rake spec diff --git a/config/environments/production.rb b/config/environments/production.rb index 57a8e1483..9a699eb44 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -47,6 +47,7 @@ Rails.application.configure do # Set to :debug to see everything in the log. # config.log_level = :info + config.log_level = :info # Prepend all log lines with the following tags. # config.log_tags = [ :subdomain, :uuid ] diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb index a177e7091..2f65b8800 100644 --- a/config/initializers/sidekiq.rb +++ b/config/initializers/sidekiq.rb @@ -14,4 +14,8 @@ Sidekiq.configure_client do |config| config.redis = { url: ENV.fetch('SIDEKIQ_REDIS_URL', 'redis://localhost:6379/12') } end +Sidekiq.configure_client do |config| + config.redis = { url: ENV.fetch('SIDEKIQ_REDIS_URL', 'redis://localhost:6379/12') } +end + Sidekiq.default_worker_options = { retry: false } diff --git a/config/secrets.yml.docker b/config/secrets.yml.docker index 1bef794a8..7e7808070 100644 --- a/config/secrets.yml.docker +++ b/config/secrets.yml.docker @@ -14,3 +14,4 @@ secret_key_base: <%= ENV.fetch 'SECRET_KEY_BASE', 'change_this_string_for_something_more_secure' %> api_endpoint: <%= ENV.fetch 'IEV_API_ENDPOINT', 'http://iev:8080/chouette_iev/' %> api_token: <%= ENV.fetch 'IEV_API_TOKEN', 'change this according to IEV configuration' %> + newrelic_licence_key: <%= ENF.fetch 'NR_LICENCE_KEY', 'will_not_work' %> diff --git a/lib/tasks/install.rake b/lib/tasks/install.rake index 1150825b2..7d8ecdce0 100644 --- a/lib/tasks/install.rake +++ b/lib/tasks/install.rake @@ -9,9 +9,11 @@ task :package do sh "bundle package --all" sh "bundle exec rake assets:clobber RAILS_ENV=production" sh "bundle exec rake assets:precompile RAILS_ENV=production" + sh "bundle exec rake i18n:js:export RAILS_ENV=production" sh "tar -rf tmp/package/stif-boiv-release-#{release_name}.tar vendor/cache" sh "tar -rf tmp/package/stif-boiv-release-#{release_name}.tar public/assets" sh "tar -rf tmp/package/stif-boiv-release-#{release_name}.tar public/packs" + sh "tar -rf tmp/package/stif-boiv-release-#{release_name}.tar public/javascripts" %w{deploy-helper.sh README sidekiq-stif-boiv.service stif-boiv.conf stif-boiv-setup.sh template-stif-boiv.sql}.each do |f| cp "install/#{f}", "tmp/package/#{f}" @@ -37,9 +39,11 @@ task :pkg4docker do # sh "RAILS_DB_ADAPTER=nulldb bundle exec rake assets:precompile RAILS_ENV=production" sh "bundle exec rake assets:clobber RAILS_ENV=production" sh "bundle exec rake assets:precompile RAILS_ENV=production" + sh "bundle exec rake i18n:js:export RAILS_ENV=production" sh "tar -rf tmp/package/stif-boiv-release-#{release_name}.tar vendor/cache" sh "tar -rf tmp/package/stif-boiv-release-#{release_name}.tar public/assets" sh "tar -rf tmp/package/stif-boiv-release-#{release_name}.tar public/packs" + sh "tar -rf tmp/package/stif-boiv-release-#{release_name}.tar public/javascripts" sh "gzip -c tmp/package/stif-boiv-release-#{release_name}.tar > tmp/stif-boiv-release.tar.gz" diff --git a/spec/javascript/time_table/actions_spec.js b/spec/javascript/time_table/actions_spec.js index 9c1a6b6f1..003b7f6b5 100644 --- a/spec/javascript/time_table/actions_spec.js +++ b/spec/javascript/time_table/actions_spec.js @@ -61,7 +61,6 @@ describe('actions', () => { expect(actions.unselect2Tags(selectedItem)).toEqual(expectedAction) }) - it('should create an action to go to previous page', () => { let pagination = { currentPage: '2017-01-01', |
