From dd6756b135708ee585b6e755606261a67c3434b6 Mon Sep 17 00:00:00 2001 From: Alax Alves Date: Wed, 27 Feb 2019 08:43:33 -0300 Subject: [PATCH 001/123] Shortening docker image in ~30% --- Dockerfile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index b6eadad88..3e8c3f9c4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,11 @@ # Dockerfile # Mapknitter # https://github.com/publiclab/mapknitter/ +# This image deploys Mapknitter! FROM debian:buster LABEL This image deploys Mapknitter! # Set correct environment variables. -RUN mkdir -p /app ENV HOME /root # Install dependencies @@ -40,5 +40,8 @@ RUN sed -i "s/ LONG_PASSWORD |//g" /usr/local/rvm/gems/ruby-*/gems/mysql2-*/lib/ # Add the Rails app WORKDIR /app -ADD . /app -RUN bower install --allow-root +COPY Gemfile /app/Gemfile +COPY Gemfile.lock /app/Gemfile.lock +COPY start.sh /app/start.sh + +CMD [ "sh", "start.sh" ] From ad3bc24c8770e4e611d8d98ceccc0bcd43f9d23a Mon Sep 17 00:00:00 2001 From: Alax Alves Date: Wed, 27 Feb 2019 08:45:49 -0300 Subject: [PATCH 002/123] Caching bundle, gathering env variables and using newer sintax --- docker-compose.yml | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 6b51161bc..e38cb8870 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,20 +1,24 @@ -db: - image: mysql:5.7 - environment: - - MYSQL_DATABASE=mapknitter - - MYSQL_USER=mapknitter - - MYSQL_PASSWORD=mapknitter - - MYSQL_RANDOM_ROOT_PASSWORD=true - volumes: - - ../mysql:/var/lib/mysql -web: - build: . - command: ./start.sh - environment: - - RAILS_ENV=production - volumes: - - ./:/app - ports: - - "127.0.0.1:3000:3000" - links: - - db +version: '3.5' +services: + db: + container_name: db + image: mysql:5.6 + env_file: + - mapknitter.env + volumes: + - /srv/mapknitter_priv1/mk1_database:/var/lib/mysql + web: + container_name: web + build: . + env_file: + - mapknitter.env + volumes: + - .:/app + - bundle_cache:/usr/local/bundle + ports: + - 3000:3000 + depends_on: + - db + +volumes: + bundle_cache: From d54686bdb082a1d3a00c90803834cd82dc655a68 Mon Sep 17 00:00:00 2001 From: Alax Alves Date: Wed, 27 Feb 2019 08:46:21 -0300 Subject: [PATCH 003/123] Creating startup script and env file --- docker-compose.yml | 2 +- mapknitter.env | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 mapknitter.env diff --git a/docker-compose.yml b/docker-compose.yml index e38cb8870..6097447c2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: '3.5' +version: '3.3' services: db: container_name: db diff --git a/mapknitter.env b/mapknitter.env new file mode 100644 index 000000000..8b17bf30b --- /dev/null +++ b/mapknitter.env @@ -0,0 +1,5 @@ +MYSQL_DATABASE=mapknitter +MYSQL_USER=mapknitter +MYSQL_PASSWORD=mapknitter +MYSQL_RANDOM_ROOT_PASSWORD=true +RAILS_ENV=production \ No newline at end of file From a7ef7a7fbce8af356a356730f02ba77c50c7dca5 Mon Sep 17 00:00:00 2001 From: Alax Alves Date: Wed, 27 Feb 2019 09:09:08 -0300 Subject: [PATCH 004/123] Improving travis CI configuration --- .travis.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4032623a4..e8fb770dc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,11 +6,9 @@ install: - cp config/database.yml.example config/database.yml - cp config/config.yml.example config/config.yml - cp db/schema.rb.example db/schema.rb - - docker-compose build - - docker-compose run web bash -l -c "sleep 10" - - docker-compose run web bash -l -c "rake db:setup" - - docker-compose run web bash -l -c "rake db:migrate" - - docker-compose run web bower install --allow-root + - docker-compose up -d --build + - docker-compose exec web bundle install + - docker-compose exec web /bin/bash -lc "rake db:setup || rake db:migrate" script: - - docker-compose run web bash -l -c "rake test" + - docker-compose exec web rake test From a1049e32f1346636fcb1a80707b0f0fed43575f5 Mon Sep 17 00:00:00 2001 From: Alax Alves Date: Tue, 5 Mar 2019 17:44:34 -0300 Subject: [PATCH 005/123] Loading assets in production env --- app/assets/javascripts/application.js | 2 -- app/assets/javascripts/maps.js | 1 - app/assets/stylesheets/maps.css.scss | 1 - config/environments/production.rb | 6 ++++-- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 79057b5d1..068faeff6 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -20,8 +20,6 @@ //= require leaflet-providers/leaflet-providers.js //= require leaflet-toolbar/dist/leaflet.toolbar.js //= require leaflet-distortableimage/dist/leaflet.distortableimage.js -//= require leaflet-easybutton/src/easy-button.js -//= require leaflet-google/index.js //= require sparklines/source/sparkline.js //= require annotations-legacy.js //= require glfx-js/dist/glfx.js diff --git a/app/assets/javascripts/maps.js b/app/assets/javascripts/maps.js index 291f25edc..90a586db6 100644 --- a/app/assets/javascripts/maps.js +++ b/app/assets/javascripts/maps.js @@ -2,7 +2,6 @@ //= require knitter //= require exif-js/exif.js //= require mapknitter -//= require seiyria-bootstrap-slider/dist/bootstrap-slider.min.js /* Move navbar links into dropdown if nav is inside the sidebar. */ jQuery(document).ready(function($) { diff --git a/app/assets/stylesheets/maps.css.scss b/app/assets/stylesheets/maps.css.scss index d130286fa..895175dc5 100644 --- a/app/assets/stylesheets/maps.css.scss +++ b/app/assets/stylesheets/maps.css.scss @@ -1,5 +1,4 @@ /* - *= require seiyria-bootstrap-slider/dist/css/bootstrap-slider.min.css *= require jquery-ui/themes/overcast/jquery-ui.min.css */ /* Variables */ diff --git a/config/environments/production.rb b/config/environments/production.rb index d62f32c3c..aec63e513 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -9,13 +9,15 @@ config.action_controller.perform_caching = true # Disable Rails's static asset server (Apache or nginx will already do this) - config.serve_static_assets = false + config.serve_static_assets = true # Compress JavaScripts and CSS config.assets.compress = true # Don't fallback to assets pipeline if a precompiled asset is missed - config.assets.compile = false + config.assets.compile = true + + config.assets.js_compressor = :uglifier # Generate digests for assets URLs config.assets.digest = true From 7959f7b84d70b686c17e4e7c4adc2004117de9c7 Mon Sep 17 00:00:00 2001 From: Alax Alves Date: Tue, 5 Mar 2019 19:58:36 -0300 Subject: [PATCH 006/123] Allow uglifier to interpret ES6 --- config/environments/production.rb | 4 +++- docker-compose.yml | 2 ++ mapknitter.env | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index aec63e513..43ace49a3 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,3 +1,5 @@ +require 'uglifier' + Mapknitter::Application.configure do # Settings specified here will take precedence over those in config/application.rb @@ -17,7 +19,7 @@ # Don't fallback to assets pipeline if a precompiled asset is missed config.assets.compile = true - config.assets.js_compressor = :uglifier + config.assets.js_compressor = Uglifier.new(:harmony => true) # Generate digests for assets URLs config.assets.digest = true diff --git a/docker-compose.yml b/docker-compose.yml index 6097447c2..6ab18679f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,6 +15,7 @@ services: volumes: - .:/app - bundle_cache:/usr/local/bundle + - bower_cache:/app/public/lib ports: - 3000:3000 depends_on: @@ -22,3 +23,4 @@ services: volumes: bundle_cache: + bower_cache: diff --git a/mapknitter.env b/mapknitter.env index 8b17bf30b..eb1a7a8ca 100644 --- a/mapknitter.env +++ b/mapknitter.env @@ -2,4 +2,4 @@ MYSQL_DATABASE=mapknitter MYSQL_USER=mapknitter MYSQL_PASSWORD=mapknitter MYSQL_RANDOM_ROOT_PASSWORD=true -RAILS_ENV=production \ No newline at end of file +RAILS_ENV=production From 19ada8ef810022f5f643032a3c338076d5f97692 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Wed, 20 Mar 2019 23:45:09 -0500 Subject: [PATCH 007/123] Fix start command --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3e8c3f9c4..56c92e607 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,4 +44,4 @@ COPY Gemfile /app/Gemfile COPY Gemfile.lock /app/Gemfile.lock COPY start.sh /app/start.sh -CMD [ "sh", "start.sh" ] +CMD [ "bash", "-l", "start.sh" ] From d62051220d522b019be805c7dae795574457b15c Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Thu, 21 Mar 2019 00:09:47 -0500 Subject: [PATCH 008/123] Fix travis script --- config/environments/production.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 43ace49a3..ca5cdf415 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -42,7 +42,7 @@ # config.force_ssl = true # See everything in the log (default is :info) - # config.log_level = :debug + config.log_level = :debug # Prepend all log lines with the following tags # config.log_tags = [ :subdomain, :uuid ] From 935be16f769e18a74981b08dca404a341db644a0 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Thu, 21 Mar 2019 00:53:13 -0500 Subject: [PATCH 009/123] Tweak travis script --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e8fb770dc..4861265d0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,8 +7,8 @@ install: - cp config/config.yml.example config/config.yml - cp db/schema.rb.example db/schema.rb - docker-compose up -d --build - - docker-compose exec web bundle install - - docker-compose exec web /bin/bash -lc "rake db:setup || rake db:migrate" + - docker-compose exec web bash -l -c "bundle install" + - docker-compose exec web bash -l -c "rake db:setup || rake db:migrate" script: - docker-compose exec web rake test From 5c72ffe6ed73d6170aad2c1cb13acf7298954c7f Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Thu, 21 Mar 2019 01:11:04 -0500 Subject: [PATCH 010/123] Add delay --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 4861265d0..339c1ea2b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ install: - cp config/config.yml.example config/config.yml - cp db/schema.rb.example db/schema.rb - docker-compose up -d --build + - docker-compose exec web bash -l -c "sleep 10" - docker-compose exec web bash -l -c "bundle install" - docker-compose exec web bash -l -c "rake db:setup || rake db:migrate" From 9d9f3ea80f0248f8b19b4bebbb6ad9096bc6562a Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Thu, 21 Mar 2019 22:11:29 -0500 Subject: [PATCH 011/123] Revert assets changes --- app/assets/javascripts/application.js | 2 ++ app/assets/javascripts/maps.js | 1 + app/assets/stylesheets/maps.css.scss | 1 + config/environments/production.rb | 2 +- 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 068faeff6..79057b5d1 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -20,6 +20,8 @@ //= require leaflet-providers/leaflet-providers.js //= require leaflet-toolbar/dist/leaflet.toolbar.js //= require leaflet-distortableimage/dist/leaflet.distortableimage.js +//= require leaflet-easybutton/src/easy-button.js +//= require leaflet-google/index.js //= require sparklines/source/sparkline.js //= require annotations-legacy.js //= require glfx-js/dist/glfx.js diff --git a/app/assets/javascripts/maps.js b/app/assets/javascripts/maps.js index 90a586db6..291f25edc 100644 --- a/app/assets/javascripts/maps.js +++ b/app/assets/javascripts/maps.js @@ -2,6 +2,7 @@ //= require knitter //= require exif-js/exif.js //= require mapknitter +//= require seiyria-bootstrap-slider/dist/bootstrap-slider.min.js /* Move navbar links into dropdown if nav is inside the sidebar. */ jQuery(document).ready(function($) { diff --git a/app/assets/stylesheets/maps.css.scss b/app/assets/stylesheets/maps.css.scss index 895175dc5..d130286fa 100644 --- a/app/assets/stylesheets/maps.css.scss +++ b/app/assets/stylesheets/maps.css.scss @@ -1,4 +1,5 @@ /* + *= require seiyria-bootstrap-slider/dist/css/bootstrap-slider.min.css *= require jquery-ui/themes/overcast/jquery-ui.min.css */ /* Variables */ diff --git a/config/environments/production.rb b/config/environments/production.rb index ca5cdf415..43ace49a3 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -42,7 +42,7 @@ # config.force_ssl = true # See everything in the log (default is :info) - config.log_level = :debug + # config.log_level = :debug # Prepend all log lines with the following tags # config.log_tags = [ :subdomain, :uuid ] From f6372c9f5e9a439a68a004e5630f07d8abd85738 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Thu, 21 Mar 2019 22:37:50 -0500 Subject: [PATCH 012/123] Return to Mysql5.7 --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 6ab18679f..4694f764d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: '3.3' services: db: container_name: db - image: mysql:5.6 + image: mysql:5.7 env_file: - mapknitter.env volumes: From efc01e20a2af00c2b6ba6d7c7296455f35e489e8 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Thu, 21 Mar 2019 22:41:04 -0500 Subject: [PATCH 013/123] Tweak travis script --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 339c1ea2b..dacd3f3d0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,4 +12,4 @@ install: - docker-compose exec web bash -l -c "rake db:setup || rake db:migrate" script: - - docker-compose exec web rake test + - docker-compose exec web bash -l -c "rake test" From 2af8a5d277c19809357cfc1cf94b70a5136dec68 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Thu, 21 Mar 2019 22:45:01 -0500 Subject: [PATCH 014/123] Fix make redeploy-container command --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d051bfc37..9bc6c1fe8 100644 --- a/Makefile +++ b/Makefile @@ -10,4 +10,4 @@ deploy-container: docker-compose up -d redeploy-container: - docker-compose up --force-create -d + docker-compose up --force-recreate -d From 7c49d7054de23c3a72990e354ec8be8587cc1923 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Fri, 22 Mar 2019 21:50:27 -0500 Subject: [PATCH 015/123] Add db migrate and precompile step. --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 9bc6c1fe8..46e3a2689 100644 --- a/Makefile +++ b/Makefile @@ -11,3 +11,4 @@ deploy-container: redeploy-container: docker-compose up --force-recreate -d + docker-compose run web bash -l -c "sleep 10 && rake db:migrate && rake assets:precompile" From 4b4c64e62453124cb8984aca119268591b1e8f50 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Fri, 22 Mar 2019 22:03:29 -0500 Subject: [PATCH 016/123] Add bower install to Makefile --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 46e3a2689..d6d6eda16 100644 --- a/Makefile +++ b/Makefile @@ -4,11 +4,11 @@ build: cp config/database.yml.example config/database.yml cp db/schema.rb.example db/schema.rb docker-compose build - docker-compose run web bash -l -c "sleep 10 && rake db:setup && rake db:migrate && rake assets:precompile" + docker-compose run web bash -l -c "sleep 10 && bower install --allow-root && rake db:setup && rake db:migrate && rake assets:precompile" deploy-container: docker-compose up -d redeploy-container: docker-compose up --force-recreate -d - docker-compose run web bash -l -c "sleep 10 && rake db:migrate && rake assets:precompile" + docker-compose run web bash -l -c "sleep 10 && bower install --allow-root && rake db:migrate && rake assets:precompile" From 3d12cad552a77d479468615987ebaee03870d728 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Fri, 22 Mar 2019 23:18:25 -0500 Subject: [PATCH 017/123] Clean after docker run. Avoid one bower run. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d6d6eda16..8c827971c 100644 --- a/Makefile +++ b/Makefile @@ -4,11 +4,11 @@ build: cp config/database.yml.example config/database.yml cp db/schema.rb.example db/schema.rb docker-compose build - docker-compose run web bash -l -c "sleep 10 && bower install --allow-root && rake db:setup && rake db:migrate && rake assets:precompile" + docker-compose run --rm web bash -l -c "sleep 10 && bower install --allow-root && rake db:setup && rake db:migrate && rake assets:precompile" deploy-container: docker-compose up -d redeploy-container: docker-compose up --force-recreate -d - docker-compose run web bash -l -c "sleep 10 && bower install --allow-root && rake db:migrate && rake assets:precompile" + docker-compose exec web bash -l -c "sleep 10 && rake db:migrate && rake assets:precompile" From a16a4c6112d6cfc0d1b15180a43209537342dd35 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Sat, 23 Mar 2019 20:18:24 -0500 Subject: [PATCH 018/123] Changes to be able to build container in Google Cloud --- .gcloudignore | 43 ++++++++++++++++++++++++++++++++++++ Dockerfile => Dockerfile.txt | 0 app.yaml | 5 +++++ cloudbuild.yaml | 5 +++++ docker-compose.yml | 7 ++++-- 5 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 .gcloudignore rename Dockerfile => Dockerfile.txt (100%) create mode 100644 app.yaml create mode 100644 cloudbuild.yaml diff --git a/.gcloudignore b/.gcloudignore new file mode 100644 index 000000000..1ee4d0dca --- /dev/null +++ b/.gcloudignore @@ -0,0 +1,43 @@ +# See http://help.github.com/ignore-files/ for more about ignoring files. +# +# If you find yourself ignoring temporary files generated by your text editor +# or operating system, you probably want to add a global ignore instead: +# git config --global core.excludesfile ~/.gitignore_global + +# Ignore bundler config +/.bundle + +# Ignore the default SQLite database. +/db/*.sqlite3 + +# Ignore all logfiles and tempfiles. +/tmp +*.swp +*.swo +*~ +.ruby-version +.DS_Store +log/ +tmp/* +tmp/**/* +coverage* +public/warpables/* +public/system/* +public/warps/* +public/tms/* +db/schema.rb +*.db +config/database.yml +config/amazon_s3.yml +config/initializers/recaptcha.rb +config/config.yml +config/initializers/site_keys.rb +vendor/bundle +app/assets/bower_components +app/assets/node_modules +public/assets +public/lib +node_modules +todo.txt +.sass-cache +.git/ diff --git a/Dockerfile b/Dockerfile.txt similarity index 100% rename from Dockerfile rename to Dockerfile.txt diff --git a/app.yaml b/app.yaml new file mode 100644 index 000000000..4cc8bf652 --- /dev/null +++ b/app.yaml @@ -0,0 +1,5 @@ +env: flex +runtime: custom + +manual_scaling: + instances: 1 diff --git a/cloudbuild.yaml b/cloudbuild.yaml new file mode 100644 index 000000000..1ff833f35 --- /dev/null +++ b/cloudbuild.yaml @@ -0,0 +1,5 @@ +steps: + - name: 'docker/compose:1.19.0' + args: ['up', '-d'] + - name: 'gcr.io/cloud-builders/docker' + args: ['tag', 'mapknitter-dev:latest', 'gcr.io/public-lab/mapknitter-dev'] diff --git a/docker-compose.yml b/docker-compose.yml index 4694f764d..15ac29dde 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,10 +6,13 @@ services: env_file: - mapknitter.env volumes: - - /srv/mapknitter_priv1/mk1_database:/var/lib/mysql + - ../mysql:/var/lib/mysql web: container_name: web - build: . + image: mapknitter-dev + build: + context: . + dockerfile: Dockerfile.txt env_file: - mapknitter.env volumes: From abb64e8187784eb3c6b0c2e49cf2974d054b971e Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Sat, 23 Mar 2019 20:20:07 -0500 Subject: [PATCH 019/123] Remove spurious symlink --- libmysqlclient.18.dylib | 1 - 1 file changed, 1 deletion(-) delete mode 120000 libmysqlclient.18.dylib diff --git a/libmysqlclient.18.dylib b/libmysqlclient.18.dylib deleted file mode 120000 index a488c8c50..000000000 --- a/libmysqlclient.18.dylib +++ /dev/null @@ -1 +0,0 @@ -/usr/local/mysql/lib/libmysqlclient.18.dylib \ No newline at end of file From 2aea36b7a8d26d85bdd9b3349ef59fecd5ec5926 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Sat, 23 Mar 2019 20:30:21 -0500 Subject: [PATCH 020/123] Copy config examples when making build --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 8c827971c..0c0eace4c 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,8 @@ export COMPOSE_HTTP_TIMEOUT=360 build: cp config/database.yml.example config/database.yml + cp config/config.yml.example config/config.yml + cp config/initializers/recaptcha.rb.example config/initializers/recaptcha.rb cp db/schema.rb.example db/schema.rb docker-compose build docker-compose run --rm web bash -l -c "sleep 10 && bower install --allow-root && rake db:setup && rake db:migrate && rake assets:precompile" From f19fce8e61c38653ec49ca2758dafba8bfd41e56 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Sat, 23 Mar 2019 21:37:26 -0500 Subject: [PATCH 021/123] Export env variable name --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 0c0eace4c..c41336285 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ export COMPOSE_HTTP_TIMEOUT=360 +export COMPOSE_PROJECT_NAME build: cp config/database.yml.example config/database.yml From 5ad45413c415a627b96f54269ef428cb572291b3 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Sat, 23 Mar 2019 21:43:03 -0500 Subject: [PATCH 022/123] Tag cloud image --- cloudbuild.yaml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cloudbuild.yaml b/cloudbuild.yaml index 1ff833f35..23f4c9865 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -1,5 +1,6 @@ steps: - - name: 'docker/compose:1.19.0' - args: ['up', '-d'] - - name: 'gcr.io/cloud-builders/docker' - args: ['tag', 'mapknitter-dev:latest', 'gcr.io/public-lab/mapknitter-dev'] +- name: 'docker/compose:1.19.0' + args: ['up', '-d'] +- name: 'gcr.io/cloud-builders/docker' + args: ['tag', 'mapknitter-dev:latest', 'gcr.io/public-lab/mapknitter-dev'] +images: ['gcr.io/$PROJECT_ID/$REPO_NAME:$COMMIT_SHA'] From c0371a33bb099b02ee0d8a86bae0e6f961e65b2d Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Sat, 23 Mar 2019 22:09:45 -0500 Subject: [PATCH 023/123] Add timeout --- cloudbuild.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/cloudbuild.yaml b/cloudbuild.yaml index 23f4c9865..1e279ee1d 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -4,3 +4,4 @@ steps: - name: 'gcr.io/cloud-builders/docker' args: ['tag', 'mapknitter-dev:latest', 'gcr.io/public-lab/mapknitter-dev'] images: ['gcr.io/$PROJECT_ID/$REPO_NAME:$COMMIT_SHA'] +timeout: 1200s From 2251b9ae238a640752b013e98bff08bb8b3b34c0 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Sat, 23 Mar 2019 22:28:25 -0500 Subject: [PATCH 024/123] Push to cloud registry --- cloudbuild.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cloudbuild.yaml b/cloudbuild.yaml index 1e279ee1d..0d4ad5207 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -3,5 +3,12 @@ steps: args: ['up', '-d'] - name: 'gcr.io/cloud-builders/docker' args: ['tag', 'mapknitter-dev:latest', 'gcr.io/public-lab/mapknitter-dev'] -images: ['gcr.io/$PROJECT_ID/$REPO_NAME:$COMMIT_SHA'] +# Push it to GCR. +- name: 'gcr.io/cloud-builders/docker' + args: ['push', 'gcr.io/$PROJECT_ID/mapknitter-dev'] +# Deploy your Flex app from the image in GCR. +- name: 'gcr.io/cloud-builders/gcloud' + args: ['app', 'deploy', 'app.yaml', '--image-url=gcr.io/$PROJECT_ID/mapknitter-dev'] +# Note that this build pushes this image. +images: ['gcr.io/$PROJECT_ID/mapknitter-dev'] timeout: 1200s From f57ae3035d95f30a494dc6e5182b83cf83f36328 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Sat, 23 Mar 2019 22:31:21 -0500 Subject: [PATCH 025/123] Fix jenkins build error with docker-compose tty --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c41336285..7118ed9ae 100644 --- a/Makefile +++ b/Makefile @@ -14,4 +14,4 @@ deploy-container: redeploy-container: docker-compose up --force-recreate -d - docker-compose exec web bash -l -c "sleep 10 && rake db:migrate && rake assets:precompile" + docker-compose exec -T web bash -l -c "sleep 10 && rake db:migrate && rake assets:precompile" From 5d5f0d995be57b1d0644c2d2034824c88dc57897 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Sun, 24 Mar 2019 23:59:32 -0500 Subject: [PATCH 026/123] Add app to container and .dockerignore all else --- .dockerignore | 42 ++++++++++++++++++++++++++++++++++++++++++ Dockerfile.txt | 1 + 2 files changed, 43 insertions(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..a1a54852d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,42 @@ +# See http://help.github.com/ignore-files/ for more about ignoring files. +# +# If you find yourself ignoring temporary files generated by your text editor +# or operating system, you probably want to add a global ignore instead: +# git config --global core.excludesfile ~/.gitignore_global + +# Ignore bundler config +/.bundle + +# Ignore the default SQLite database. +/db/*.sqlite3 + +# Ignore all logfiles and tempfiles. +/tmp +*.swp +*.swo +*~ +.ruby-version +.DS_Store +log/ +tmp/* +tmp/**/* +coverage* +public/warpables/* +public/system/* +public/warps/* +public/tms/* +*.db +config/database.yml +config/amazon_s3.yml +config/initializers/recaptcha.rb +config/config.yml +config/initializers/site_keys.rb +vendor/bundle +app/assets/bower_components +app/assets/node_modules +public/assets +public/lib +node_modules +todo.txt +.sass-cache +.git/ diff --git a/Dockerfile.txt b/Dockerfile.txt index 56c92e607..2ddabdb54 100644 --- a/Dockerfile.txt +++ b/Dockerfile.txt @@ -39,6 +39,7 @@ RUN bundle install RUN sed -i "s/ LONG_PASSWORD |//g" /usr/local/rvm/gems/ruby-*/gems/mysql2-*/lib/mysql2/client.rb # Add the Rails app +ADD . /app WORKDIR /app COPY Gemfile /app/Gemfile COPY Gemfile.lock /app/Gemfile.lock From 71fc7eb2aa2a955405bb55e0c065c74154b303d8 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Mon, 25 Mar 2019 00:31:40 -0500 Subject: [PATCH 027/123] Copy configuration files when deploying to GCE --- .gcloudignore | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gcloudignore b/.gcloudignore index 1ee4d0dca..56086cb2a 100644 --- a/.gcloudignore +++ b/.gcloudignore @@ -27,10 +27,7 @@ public/warps/* public/tms/* db/schema.rb *.db -config/database.yml config/amazon_s3.yml -config/initializers/recaptcha.rb -config/config.yml config/initializers/site_keys.rb vendor/bundle app/assets/bower_components From 0f376bd4513e8ccc4eadab238bdd69300a118eee Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Mon, 25 Mar 2019 01:04:45 -0500 Subject: [PATCH 028/123] Allow copy config to container --- .dockerignore | 3 --- 1 file changed, 3 deletions(-) diff --git a/.dockerignore b/.dockerignore index a1a54852d..a303caa43 100644 --- a/.dockerignore +++ b/.dockerignore @@ -26,10 +26,7 @@ public/system/* public/warps/* public/tms/* *.db -config/database.yml config/amazon_s3.yml -config/initializers/recaptcha.rb -config/config.yml config/initializers/site_keys.rb vendor/bundle app/assets/bower_components From 1b90a6d9cce4d8bc97c7ae46ebfb8f87ca90a0cd Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Mon, 25 Mar 2019 01:48:19 -0500 Subject: [PATCH 029/123] Time extended (for cloud build & push) --- cloudbuild.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudbuild.yaml b/cloudbuild.yaml index 0d4ad5207..2fae80ea1 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -11,4 +11,4 @@ steps: args: ['app', 'deploy', 'app.yaml', '--image-url=gcr.io/$PROJECT_ID/mapknitter-dev'] # Note that this build pushes this image. images: ['gcr.io/$PROJECT_ID/mapknitter-dev'] -timeout: 1200s +timeout: 2200s From 055e127a1ce6668b7ed85c6e43503ff90e9e146f Mon Sep 17 00:00:00 2001 From: rarrunategu1 Date: Thu, 21 Mar 2019 16:23:25 -0400 Subject: [PATCH 030/123] Delete redundant index.html.erb file (#427) --- app/views/map/index.html.erb | 59 ------------------------------------ 1 file changed, 59 deletions(-) delete mode 100644 app/views/map/index.html.erb diff --git a/app/views/map/index.html.erb b/app/views/map/index.html.erb deleted file mode 100644 index bef67e39e..000000000 --- a/app/views/map/index.html.erb +++ /dev/null @@ -1,59 +0,0 @@ -
- -
- - - -
- - -

MapKnitter by Public Lab | Turn images into maps

- -
- -

Recent Maps (RSS)

- <%= render :partial => 'map/list' %> -
- -
- -
From 5ce038548982f1b96a4d9275aa314fb6d3f8825d Mon Sep 17 00:00:00 2001 From: Jeffrey Warren Date: Fri, 22 Mar 2019 17:12:29 -0400 Subject: [PATCH 031/123] Setupcoveralls (#438) * Add coveralls * Fix gemfile * Fix env variable * Add coveralls token * Update README.md --- .coveralls.yml | 2 ++ .travis.yml | 3 ++- Gemfile | 1 + README.md | 1 + test/test_helper.rb | 2 ++ 5 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .coveralls.yml diff --git a/.coveralls.yml b/.coveralls.yml new file mode 100644 index 000000000..333dc951d --- /dev/null +++ b/.coveralls.yml @@ -0,0 +1,2 @@ +service_name: travis-ci +repo_token: REPO_TOKEN diff --git a/.travis.yml b/.travis.yml index dacd3f3d0..1e92c76f1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,4 +12,5 @@ install: - docker-compose exec web bash -l -c "rake db:setup || rake db:migrate" script: - - docker-compose exec web bash -l -c "rake test" + - sed -ri "s/REPO_TOKEN/$REPO_TOKEN/" .coveralls.yml + - docker-compose run web bash -l -c "CI=true TRAVIS=true rake test" diff --git a/Gemfile b/Gemfile index 5d7695a30..3cad68f5e 100644 --- a/Gemfile +++ b/Gemfile @@ -18,6 +18,7 @@ group :dependencies do gem "ruby-openid", "~>2.5" gem "open_id_authentication" gem "RubyInline" + gem "coveralls", require: false gem "paperclip", "~>4.2.2" # if you use amazon s3 for warpable image storage diff --git a/README.md b/README.md index ff2a8c287..8de976e50 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ ## MapKnitter 2 +[![Coverage Status](https://coveralls.io/repos/github/kaunair/mapknitter/badge.svg?branch=%28HEAD+detached+at+3dd0c43%29)](https://coveralls.io/github/kaunair/mapknitter?branch=%28HEAD+detached+at+3dd0c43%29) Use Public Lab's open source MapKnitter to upload your own aerial photographs (for example those from balloon or kite mapping: http://publiclab.org/balloon-mapping) and combine them into: diff --git a/test/test_helper.rb b/test/test_helper.rb index 8bf1192ff..320e5e9ae 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,3 +1,5 @@ +require 'coveralls' +Coveralls.wear!('rails') ENV["RAILS_ENV"] = "test" require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' From 5c640d6190bb041b31d2765b88067cf0357ff279 Mon Sep 17 00:00:00 2001 From: Milo MacPhail <40954168+milomacphail@users.noreply.github.com> Date: Fri, 22 Mar 2019 19:24:43 -0400 Subject: [PATCH 032/123] Remove legacy image controller code #404 (#417) Deleted the lines from the selection indicated in the issue. --- app/controllers/images_controller.rb | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/app/controllers/images_controller.rb b/app/controllers/images_controller.rb index 2d35ea965..1d45e5e72 100644 --- a/app/controllers/images_controller.rb +++ b/app/controllers/images_controller.rb @@ -9,22 +9,6 @@ class ImagesController < ApplicationController #Convert model to json without including root name. Eg. 'warpable' ActiveRecord::Base.include_root_in_json = false - # legacy - def new - @map = Map.find params[:id] - @warpable = Warpable.new - respond_to do |format| - format.html { render :template => 'legacy/new', :layout => false } - format.json { render :json => @warpable } - end - end - - # legacy - def uploaded_confirmation - @warpable = Warpable.find params[:id] - render :template => 'legacy/new', :layout => false - end - # proxy, used if MapKnitter is being backed by Amazon S3 file storage, # to enable client-side distortion using webgl-distort, which requires same-origin def fetch From a635bde2f8a6a4ca4d9fee5dcdcb773e84f5613f Mon Sep 17 00:00:00 2001 From: Sonali Agrawal Date: Sun, 24 Mar 2019 00:17:32 +0530 Subject: [PATCH 033/123] Change comment count on comment creation via AJAX #441 (#443) This closes issue #441 "Change comment count on comment creation via AJAX #441" by incrementing comments-number each time a new comment is added. This would ensure that the counter indicating the number of comments is increased without needing to refresh the page. --- app/assets/javascripts/maps.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/assets/javascripts/maps.js b/app/assets/javascripts/maps.js index 291f25edc..ae81e336a 100644 --- a/app/assets/javascripts/maps.js +++ b/app/assets/javascripts/maps.js @@ -58,6 +58,7 @@ jQuery(document).ready(function($) { $("#new_comment textarea").val('')     $("#comments").append(xhr.responseText) + $("#comments-number").text(function(i, str) { return (parseInt(str) + 1); }); $('.comment:last').click(edit_comment).click(delete_comment)   }).on("ajax:error", function(e, xhr, status, error) { if (xhr.responseText == "Login required.") { From d03b16dc7d32e681a9e9ec28ac42e6b8d8b90bdf Mon Sep 17 00:00:00 2001 From: Ananya Agrawal <33188930+ananya@users.noreply.github.com> Date: Sun, 24 Mar 2019 01:18:50 +0530 Subject: [PATCH 034/123] update syntax of active record query(license method) (#439) Fixes #437 --- app/controllers/feeds_controller.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/feeds_controller.rb b/app/controllers/feeds_controller.rb index c86b0f82d..92eba4e55 100644 --- a/app/controllers/feeds_controller.rb +++ b/app/controllers/feeds_controller.rb @@ -18,8 +18,12 @@ def clean end def license - @maps = Map.find(:all,:order => "id DESC",:limit => 20, :conditions => {:archived => false, :password => '', :license => params[:id]},:joins => :warpables, :group => "maps.id") - render :layout => false, :template => "feeds/license" + @maps = Map.order(id: :desc) + .limit(20) + .where(archived: false, password: '', license: params[:id]) + .joins(:warpables) + .group("maps.id") + render layout: false, template: "feeds/license" response.headers["Content-Type"] = "application/xml; charset=utf-8" end From 3fccda244084522605937435bf3d0880b3f67859 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Sun, 24 Mar 2019 22:54:59 -0500 Subject: [PATCH 035/123] Docker improve rebased (#450) * Shortening docker image in ~30% * Caching bundle, gathering env variables and using newer sintax * Creating startup script and env file * Improving travis CI configuration * Loading assets in production env * Allow uglifier to interpret ES6 * Don't dettach when building container in travis * Fix start command * Fix travis script * Try to resolve travis tests invocation * Tweak travis script * Add delay * Bundle install before db setup * Shortening docker image in ~30% * Caching bundle, gathering env variables and using newer sintax * Creating startup script and env file * Improving travis CI configuration * Loading assets in production env * Allow uglifier to interpret ES6 * Fix start command * Fix travis script * Tweak travis script * Add delay * Revert assets changes * Return to Mysql5.7 * Tweak travis script * Fix make redeploy-container command * Add db migrate and precompile step. * Add bower install to Makefile * Clean after docker run. Avoid one bower run. --- .travis.yml | 2 +- Dockerfile.txt | 1 - app/assets/javascripts/application.js | 2 -- app/assets/javascripts/maps.js | 1 - app/assets/stylesheets/maps.css.scss | 1 - config/environments/production.rb | 2 +- 6 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1e92c76f1..9e1357904 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,4 +13,4 @@ install: script: - sed -ri "s/REPO_TOKEN/$REPO_TOKEN/" .coveralls.yml - - docker-compose run web bash -l -c "CI=true TRAVIS=true rake test" + - docker-compose exec web bash -l -c "CI=true TRAVIS=true rake test" diff --git a/Dockerfile.txt b/Dockerfile.txt index 2ddabdb54..07f481246 100644 --- a/Dockerfile.txt +++ b/Dockerfile.txt @@ -3,7 +3,6 @@ # This image deploys Mapknitter! FROM debian:buster -LABEL This image deploys Mapknitter! # Set correct environment variables. ENV HOME /root diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 79057b5d1..068faeff6 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -20,8 +20,6 @@ //= require leaflet-providers/leaflet-providers.js //= require leaflet-toolbar/dist/leaflet.toolbar.js //= require leaflet-distortableimage/dist/leaflet.distortableimage.js -//= require leaflet-easybutton/src/easy-button.js -//= require leaflet-google/index.js //= require sparklines/source/sparkline.js //= require annotations-legacy.js //= require glfx-js/dist/glfx.js diff --git a/app/assets/javascripts/maps.js b/app/assets/javascripts/maps.js index ae81e336a..40f6aac8f 100644 --- a/app/assets/javascripts/maps.js +++ b/app/assets/javascripts/maps.js @@ -2,7 +2,6 @@ //= require knitter //= require exif-js/exif.js //= require mapknitter -//= require seiyria-bootstrap-slider/dist/bootstrap-slider.min.js /* Move navbar links into dropdown if nav is inside the sidebar. */ jQuery(document).ready(function($) { diff --git a/app/assets/stylesheets/maps.css.scss b/app/assets/stylesheets/maps.css.scss index d130286fa..895175dc5 100644 --- a/app/assets/stylesheets/maps.css.scss +++ b/app/assets/stylesheets/maps.css.scss @@ -1,5 +1,4 @@ /* - *= require seiyria-bootstrap-slider/dist/css/bootstrap-slider.min.css *= require jquery-ui/themes/overcast/jquery-ui.min.css */ /* Variables */ diff --git a/config/environments/production.rb b/config/environments/production.rb index 43ace49a3..ca5cdf415 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -42,7 +42,7 @@ # config.force_ssl = true # See everything in the log (default is :info) - # config.log_level = :debug + config.log_level = :debug # Prepend all log lines with the following tags # config.log_tags = [ :subdomain, :uuid ] From 29450fdeb67c1bc6be270611a853b6dd11b8a035 Mon Sep 17 00:00:00 2001 From: Ananya Agrawal <33188930+ananya@users.noreply.github.com> Date: Mon, 25 Mar 2019 19:42:15 +0530 Subject: [PATCH 036/123] updte pr template (#448) --- PULL_REQUEST_TEMPLATE.md | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md index 0198120c9..e8b32e9cc 100644 --- a/PULL_REQUEST_TEMPLATE.md +++ b/PULL_REQUEST_TEMPLATE.md @@ -1,9 +1,19 @@ -References \#0000 (\<=== Add issue number here) +Fixes #0000 (<=== Add issue number here) -Make sure these boxes are checked before your pull request is ready to be reviewed and merged. Thanks! +Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks! -* [ ] tests pass -- `rake test` -* [ ] code has been rebased on top of latest master (check if another pull request was added recently, and please rebase) -* [ ] pull request is descriptively named and, if possible, multiple commits squashed if they're smaller changes +[//]: # (To mark checkboxe write 'x' within the square brackets) + +* [ ] PR is descriptively titled 📑 and links the original issue above 🔗 +* [ ] tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR -- or run tests locally with `rake test` +* [ ] code is in uniquely-named feature branch and has no merge conflicts 📁 +* [ ] screenshots/GIFs are attached 📎 in case of UI updation +* [ ] ask `@publiclab/reviewers` for help, in a comment below + +> We're happy to help you get this ready -- don't be afraid to ask for help, and **don't be discouraged** if your tests fail at first! + +If tests do fail, click on the red `X` to learn why by reading the logs. + +Please be sure you've reviewed our contribution guidelines at https://publiclab.org/contributing-to-public-lab-software Thanks! From 494e6dee3eecfe0df91b1842322d387b952c986c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Mon, 25 Mar 2019 10:18:37 -0400 Subject: [PATCH 037/123] Bump recaptcha from 4.13.1 to 4.13.2 (#452) Bumps [recaptcha](https://github.com/ambethia/recaptcha) from 4.13.1 to 4.13.2. - [Release notes](https://github.com/ambethia/recaptcha/releases) - [Changelog](https://github.com/ambethia/recaptcha/blob/master/CHANGELOG.md) - [Commits](https://github.com/ambethia/recaptcha/compare/v4.13.1...v4.13.2) Signed-off-by: dependabot[bot] --- Gemfile.lock | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index e41685fa7..694ad9a97 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -44,6 +44,15 @@ GEM cocaine (0.5.8) climate_control (>= 0.0.3, < 1.0) concurrent-ruby (1.1.4) + coveralls (0.7.1) + multi_json (~> 1.3) + rest-client + simplecov (>= 0.7) + term-ansicolor + thor + docile (1.3.1) + domain_name (0.5.20180417) + unf (>= 0.0.5, < 1.0.0) erubis (2.7.0) execjs (2.7.0) ffi (1.10.0) @@ -53,6 +62,8 @@ GEM geokit-rails (1.1.4) geokit (>= 1.5.0) hike (1.2.3) + http-cookie (1.0.3) + domain_name (~> 0.5) httparty (0.16.2) multi_xml (>= 0.5.2) i18n (0.9.5) @@ -74,6 +85,7 @@ GEM multi_json (1.13.1) multi_xml (0.6.0) mysql2 (0.3.21) + netrc (0.11.0) nokogiri (1.10.1) mini_portile2 (~> 2.4.0) oa-core (0.3.2) @@ -125,9 +137,13 @@ GEM rdiscount (2.2.0.1) rdoc (3.12.2) json (~> 1.4) - recaptcha (4.13.1) + recaptcha (4.13.2) json ref (2.0.0) + rest-client (2.0.2) + http-cookie (>= 1.0.2, < 2.0) + mime-types (>= 1.16, < 4.0) + netrc (~> 0.8) right_aws (3.1.0) right_http_connection (>= 1.2.5) right_http_connection (1.5.0) @@ -139,12 +155,19 @@ GEM sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) + simplecov (0.16.1) + docile (~> 1.1) + json (>= 1.8, < 3) + simplecov-html (~> 0.10.0) + simplecov-html (0.10.2) sprockets (2.2.3) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) sqlite3 (1.4.0) + term-ansicolor (1.7.1) + tins (~> 1.0) test-unit (3.3.0) power_assert therubyracer (0.12.3) @@ -152,12 +175,16 @@ GEM ref thor (0.20.3) tilt (1.4.1) + tins (1.20.2) treetop (1.4.15) polyglot polyglot (>= 0.3.1) tzinfo (0.3.55) uglifier (4.1.20) execjs (>= 0.3.0, < 3) + unf (0.1.4) + unf_ext + unf_ext (0.0.7.5) uuidtools (2.1.5) will_paginate (3.1.7) will_paginate-bootstrap (1.0.2) @@ -170,6 +197,7 @@ DEPENDENCIES RubyInline autoprefixer-rails aws-sdk (~> 1.5.7) + coveralls friendly_id geokit-rails (= 1.1.4) image_science (= 1.2.6) From ad5557fd3680a62db08de60d4e9972c619f63e03 Mon Sep 17 00:00:00 2001 From: Sasha Boginsky <41092741+sashadev-sky@users.noreply.github.com> Date: Mon, 25 Mar 2019 10:58:22 -0400 Subject: [PATCH 038/123] Restructure rake test task runner (#380) * add a mysql setup file * Squash commits --- .travis.yml | 2 +- MYSQL.md | 1 - Rakefile | 6 +++ lib/tasks/test_unit.rake | 112 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 119 insertions(+), 2 deletions(-) create mode 100644 lib/tasks/test_unit.rake diff --git a/.travis.yml b/.travis.yml index 9e1357904..9646de0d7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,4 +13,4 @@ install: script: - sed -ri "s/REPO_TOKEN/$REPO_TOKEN/" .coveralls.yml - - docker-compose exec web bash -l -c "CI=true TRAVIS=true rake test" + - docker-compose run web bash -l -c "CI=true TRAVIS=true rake test:all" diff --git a/MYSQL.md b/MYSQL.md index 711b3f960..3eaa15bbe 100644 --- a/MYSQL.md +++ b/MYSQL.md @@ -144,6 +144,5 @@ $ mysql -u -p ``` - ## Pending: please add instructions for your respective system diff --git a/Rakefile b/Rakefile index b6446b5e1..ffd116932 100644 --- a/Rakefile +++ b/Rakefile @@ -3,4 +3,10 @@ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. require File.expand_path('../config/application', __FILE__) +# Load all the rake tasks from the "tasks" folder. +task_dir = File.expand_path("../tasks", __FILE__) +Dir["#{task_dir}/**/*.rake"].each do |task_file| + load task_file +end + Mapknitter::Application.load_tasks \ No newline at end of file diff --git a/lib/tasks/test_unit.rake b/lib/tasks/test_unit.rake new file mode 100644 index 000000000..803b8645b --- /dev/null +++ b/lib/tasks/test_unit.rake @@ -0,0 +1,112 @@ +# ==================== # + +# HOW TO RUN # + +# You can find all rake tasks, both those that come built-in with rake / rails and custom created ones, +# by running `rake --tasks`. Note you might need to set up repo configurations before you are able to run this. + +# `rake --tasks`, shows two columns: the name of the rake task (functions as the CLI command to run the task) and the +# description (what the task does). All the tasks created in this file start with "Autotask" in the description +# for easy reference. You can also find the commands (or command patterns for collections) commented above their respective tasks below. + +# TEST STRUCTURE # + +# Currently, you can +# 1) run all unit, functional, and integration tests together. +# 2) run only unit, functional, or integration tests (files within the corresponding folder can be run concurrently or one a time). +# 3) Last, you can run separate test files within the unit, functional, and integration test folders. + +# If proper naming convention is followed, tasks are autogenerated for individual testing files added to the unit, functional, and +# integration folders (see creation of 'COMPUTE' arrays below). + +# ==================== # + +namespace :test do + + # command: rake test:all + # run unit, functional, and integration test folders (one folder at a time, in the order indicated in the pattern below) + Rake::TestTask.new do |t| + t.name = "all" + t.description = "Autotask - run unit, functional, and integration tests" + t.libs << "test" + t.pattern = FileList["test/unit/*_test.rb", "test/functional/*_test.rb", "test/integration/*_test.rb"] + t.warning = false + t.verbose = true + end + + # command pattern: rake test:unit_test_file.rb + # autogenerates a rake task for every test file added to test/unit + COMPUTE_UNIT_TASKS = [] + Dir.glob("test/unit/*_test.rb").each do |task| + collection = task.gsub(/test\/unit\//, "") + Rake::TestTask.new(:"#{collection}") do |t| + t.libs << "test" + t.description = "Autotask - run unit tests - #{collection}" + t.pattern = FileList["test/unit/#{collection}"] + t.warning = false + t.verbose = true + end + COMPUTE_UNIT_TASKS << "#{collection}" + end + + # command: rake test:unit + # run all unit test files (one file at a time in alphabetical order) + desc "Autotask - run unit tests" + task :unit => COMPUTE_UNIT_TASKS + + # command: rake test:unit_parallel + # run all unit test files concurrently (one file at a time, order is not guaranteed) + desc "Autotask - run unit tests in parallel" + multitask :unit_parallel => COMPUTE_UNIT_TASKS + + # command pattern: rake test:functional_test_file.rb + # autogenerates a rake task for every test file added to test/functional + COMPUTE_FUNCTIONAL_TASKS = [] + Dir.glob("test/functional/*_test.rb").each do |task| + collection = task.gsub(/test\/functional\//, "") + Rake::TestTask.new(:"#{collection}") do |t| + t.libs << "test" + t.description = "Autotask - run functional tests - #{collection}" + t.pattern = FileList["test/functional/#{collection}"] + t.warning = false + t.verbose = true + end + COMPUTE_FUNCTIONAL_TASKS << "#{collection}" + end + + # command: rake test:functional + # run all functional test files + desc "Autotask - run functional tests" + task :functional => COMPUTE_FUNCTIONAL_TASKS + + # command: rake test:functional_parallel + # run all functional test files concurrently + desc "Autotask - run functional tests in parallel" + multitask :functional_parallel => COMPUTE_FUNCTIONAL_TASKS + + # command pattern: rake test:integration_test_file.rb + # autogenerates a rake task for every test file added to test/integration + COMPUTE_INTEGRATION_TASKS = [] + Dir.glob("test/integration/*_test.rb").each do |task| + collection = task.gsub(/test\/integration\//, "") + Rake::TestTask.new(:"#{collection}") do |t| + t.libs << "test" + t.description = "Autotask - run integration tests - #{collection}" + t.pattern = FileList["test/integration/#{collection}"] + t.warning = false + t.verbose = true + end + COMPUTE_INTEGRATION_TASKS << "#{collection}" + end + + # command: rake test:integration + # run all integration test files + desc "Autotask - run integration tests" + task :integration => COMPUTE_INTEGRATION_TASKS + + # command: rake test:integration_parallel + # run all integration test files concurrently + desc "Autotask - run integration tests in parallel" + multitask :integration_parallel => COMPUTE_INTEGRATION_TASKS + +end \ No newline at end of file From 933581f5412fda6f330c906da92572dd68aca151 Mon Sep 17 00:00:00 2001 From: Kaustubh Nair Date: Wed, 27 Mar 2019 04:56:42 +0530 Subject: [PATCH 039/123] Update README.md (#456) --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 8de976e50..560b85281 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -## MapKnitter 2 -[![Coverage Status](https://coveralls.io/repos/github/kaunair/mapknitter/badge.svg?branch=%28HEAD+detached+at+3dd0c43%29)](https://coveralls.io/github/kaunair/mapknitter?branch=%28HEAD+detached+at+3dd0c43%29) +## MapKnitter 2 [![Coverage Status](https://coveralls.io/repos/github/publiclab/mapknitter/badge.svg?branch=%28HEAD+detached+at+FETCH_HEAD%29)](https://coveralls.io/github/publiclab/mapknitter?branch=%28HEAD+detached+at+FETCH_HEAD%29) Use Public Lab's open source MapKnitter to upload your own aerial photographs (for example those from balloon or kite mapping: http://publiclab.org/balloon-mapping) and combine them into: From afe88afad52b14661b2805cbf0c6b9f430496a1b Mon Sep 17 00:00:00 2001 From: Sasha Boginsky <41092741+sashadev-sky@users.noreply.github.com> Date: Tue, 26 Mar 2019 22:04:19 -0400 Subject: [PATCH 040/123] Change run to exec (#457) --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9646de0d7..a8ea6b3cd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,4 +13,4 @@ install: script: - sed -ri "s/REPO_TOKEN/$REPO_TOKEN/" .coveralls.yml - - docker-compose run web bash -l -c "CI=true TRAVIS=true rake test:all" + - docker-compose exec web bash -l -c "CI=true TRAVIS=true rake test:all" From 2661538273fa9bcdde0f2d44a7cdedaf3f7f5293 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Wed, 27 Mar 2019 00:31:36 -0400 Subject: [PATCH 041/123] Bump paperclip from 4.2.4 to 4.3.7 (#285) Bumps [paperclip](https://github.com/thoughtbot/paperclip) from 4.2.4 to 4.3.7. - [Release notes](https://github.com/thoughtbot/paperclip/releases) - [Changelog](https://github.com/thoughtbot/paperclip/blob/v4.3.7/NEWS) - [Commits](https://github.com/thoughtbot/paperclip/compare/v4.2.4...v4.3.7) Signed-off-by: dependabot[bot] --- Gemfile | 2 +- Gemfile.lock | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 3cad68f5e..c66b8dc55 100644 --- a/Gemfile +++ b/Gemfile @@ -19,7 +19,7 @@ group :dependencies do gem "open_id_authentication" gem "RubyInline" gem "coveralls", require: false - gem "paperclip", "~>4.2.2" + gem "paperclip", "~>4.3.7" # if you use amazon s3 for warpable image storage gem 'aws-sdk', '~> 1.5.7' diff --git a/Gemfile.lock b/Gemfile.lock index 694ad9a97..258147011 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -43,7 +43,7 @@ GEM climate_control (0.2.0) cocaine (0.5.8) climate_control (>= 0.0.3, < 1.0) - concurrent-ruby (1.1.4) + concurrent-ruby (1.1.5) coveralls (0.7.1) multi_json (~> 1.3) rest-client @@ -81,6 +81,7 @@ GEM mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.25.1) + mimemagic (0.3.0) mini_portile2 (2.4.0) multi_json (1.13.1) multi_xml (0.6.0) @@ -95,11 +96,12 @@ GEM ruby-openid-apps-discovery (~> 1.2.0) open_id_authentication (1.3.0) rack-openid (~> 1.3) - paperclip (4.2.4) + paperclip (4.3.7) activemodel (>= 3.2.0) activesupport (>= 3.2.0) cocaine (~> 0.5.5) mime-types + mimemagic (= 0.3.0) passenger (6.0.2) rack rake (>= 0.8.1) @@ -205,7 +207,7 @@ DEPENDENCIES mysql2 (< 0.4) oa-openid (= 0.3.2) open_id_authentication - paperclip (~> 4.2.2) + paperclip (~> 4.3.7) passenger rails (~> 3.2) rake (~> 12.3.2) From 1b645a2dd00ea8d4aefa1d28e3073d46ce90458f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Thu, 28 Mar 2019 20:44:44 -0400 Subject: [PATCH 042/123] Bump test-unit from 3.3.0 to 3.3.1 (#458) Bumps [test-unit](https://github.com/test-unit/test-unit) from 3.3.0 to 3.3.1. - [Release notes](https://github.com/test-unit/test-unit/releases) - [Commits](https://github.com/test-unit/test-unit/compare/3.3.0...3.3.1) Signed-off-by: dependabot[bot] --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 258147011..f9a4ab8a6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -106,7 +106,7 @@ GEM rack rake (>= 0.8.1) polyglot (0.3.5) - power_assert (1.1.3) + power_assert (1.1.4) rack (1.4.7) rack-cache (1.8.0) rack (>= 0.4) @@ -170,7 +170,7 @@ GEM sqlite3 (1.4.0) term-ansicolor (1.7.1) tins (~> 1.0) - test-unit (3.3.0) + test-unit (3.3.1) power_assert therubyracer (0.12.3) libv8 (~> 3.16.14.15) From ef157c9f2904b59fe430cc3ec215ec5724e93208 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Thu, 28 Mar 2019 20:45:06 -0400 Subject: [PATCH 043/123] Bump coveralls from 0.7.1 to 0.8.22 (#453) Bumps [coveralls](https://coveralls.io) from 0.7.1 to 0.8.22. Signed-off-by: dependabot[bot] --- Gemfile.lock | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index f9a4ab8a6..ca1e2ab2b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -44,15 +44,13 @@ GEM cocaine (0.5.8) climate_control (>= 0.0.3, < 1.0) concurrent-ruby (1.1.5) - coveralls (0.7.1) - multi_json (~> 1.3) - rest-client - simplecov (>= 0.7) - term-ansicolor - thor + coveralls (0.8.22) + json (>= 1.8, < 3) + simplecov (~> 0.16.1) + term-ansicolor (~> 1.3) + thor (~> 0.19.4) + tins (~> 1.6) docile (1.3.1) - domain_name (0.5.20180417) - unf (>= 0.0.5, < 1.0.0) erubis (2.7.0) execjs (2.7.0) ffi (1.10.0) @@ -62,8 +60,6 @@ GEM geokit-rails (1.1.4) geokit (>= 1.5.0) hike (1.2.3) - http-cookie (1.0.3) - domain_name (~> 0.5) httparty (0.16.2) multi_xml (>= 0.5.2) i18n (0.9.5) @@ -86,7 +82,6 @@ GEM multi_json (1.13.1) multi_xml (0.6.0) mysql2 (0.3.21) - netrc (0.11.0) nokogiri (1.10.1) mini_portile2 (~> 2.4.0) oa-core (0.3.2) @@ -142,10 +137,6 @@ GEM recaptcha (4.13.2) json ref (2.0.0) - rest-client (2.0.2) - http-cookie (>= 1.0.2, < 2.0) - mime-types (>= 1.16, < 4.0) - netrc (~> 0.8) right_aws (3.1.0) right_http_connection (>= 1.2.5) right_http_connection (1.5.0) @@ -175,7 +166,7 @@ GEM therubyracer (0.12.3) libv8 (~> 3.16.14.15) ref - thor (0.20.3) + thor (0.19.4) tilt (1.4.1) tins (1.20.2) treetop (1.4.15) @@ -184,9 +175,6 @@ GEM tzinfo (0.3.55) uglifier (4.1.20) execjs (>= 0.3.0, < 3) - unf (0.1.4) - unf_ext - unf_ext (0.0.7.5) uuidtools (2.1.5) will_paginate (3.1.7) will_paginate-bootstrap (1.0.2) From f61168e04406210e8859d6d5e2a462d77219fc14 Mon Sep 17 00:00:00 2001 From: Divya Baid <32747809+divyabaid16@users.noreply.github.com> Date: Sat, 30 Mar 2019 00:25:53 +0530 Subject: [PATCH 044/123] gridview aligned (#464) --- app/assets/stylesheets/maps.css.scss | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/assets/stylesheets/maps.css.scss b/app/assets/stylesheets/maps.css.scss index 895175dc5..aa75a2cd5 100644 --- a/app/assets/stylesheets/maps.css.scss +++ b/app/assets/stylesheets/maps.css.scss @@ -33,10 +33,20 @@ html, body { .map-list .map img { max-height:300px; } + .map-list .map h3 { overflow:hidden; } +.map-list .map { + clear:none; + display: inline-block +} + +.map-list div:nth-child(4n+1){ + clear:left; +} + code { padding: 3px 5px; color: #d14; From c605073567bb6bcf983316813a65b8b9349a4710 Mon Sep 17 00:00:00 2001 From: Gaurav Sachdeva Date: Sat, 30 Mar 2019 06:29:13 +0530 Subject: [PATCH 045/123] Alert improvement and adding byebug gem (#383) * byebug gem added and alerts in separate file * adding byebug history to gitignore * adding timestamp to redirect * added z-index to render login dropdown above leaflet icon --- .gitignore | 1 + Gemfile | 1 + app/controllers/sessions_controller.rb | 2 +- app/views/layouts/_alerts.html.erb | 15 +++++++++++++++ app/views/layouts/application.html.erb | 9 +-------- app/views/maps/index.html.erb | 2 +- 6 files changed, 20 insertions(+), 10 deletions(-) create mode 100644 app/views/layouts/_alerts.html.erb diff --git a/.gitignore b/.gitignore index 11cdd9386..f97bae752 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,4 @@ public/lib node_modules todo.txt .sass-cache +.byebug_history \ No newline at end of file diff --git a/Gemfile b/Gemfile index c66b8dc55..6c0d4876b 100644 --- a/Gemfile +++ b/Gemfile @@ -43,6 +43,7 @@ group :test do end group :development do + gem "byebug" gem "jshintrb" gem "therubyracer" end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 98841b78a..0b1998e31 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -64,7 +64,7 @@ def successful_login(back_to, id) def logout session[:user_id] = nil flash[:success] = "You have successfully logged out." - redirect_to '/' + redirect_to '/' + '?_=' + Time.now.to_i.to_s end protected diff --git a/app/views/layouts/_alerts.html.erb b/app/views/layouts/_alerts.html.erb new file mode 100644 index 000000000..0425944c0 --- /dev/null +++ b/app/views/layouts/_alerts.html.erb @@ -0,0 +1,15 @@ +
+ <% flash.each do |key, value| %> + <% if key == :notice %> +
+ <%= value %> +
+ <% else %> +
+ <%= value %> +
+ <% end %> + <% end %> +
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 6ded824c7..8ea32cd5f 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -17,15 +17,8 @@ <%= render 'layouts/header' %> - -
- <% if flash[:notice] %>
<%=raw flash[:notice] %>
<% end %> - <% if flash[:error] %>
<%=raw flash[:error] %>
<% end %> - <% if flash[:warning] %>
<%=raw flash[:warning] %>
<% end %> -
- + <%= render 'layouts/alerts' %> <%= yield; %> - <%= render 'layouts/footer' %> +
+ pop out +

Public Lab chatroom

+
- - + <% end %> @@ -159,7 +195,7 @@ <%= render :partial => "/images/new" unless params[:action] == 'new' %> <% end %> - + + \ No newline at end of file diff --git a/app/views/maps/index.html.erb b/app/views/maps/index.html.erb index 6f1ec2e9b..2c4808b13 100644 --- a/app/views/maps/index.html.erb +++ b/app/views/maps/index.html.erb @@ -12,16 +12,18 @@
-
+
<% if logged_in? %> - + Create a map <% else %> -

+

Create a map

-

Log in to create a map, or if you have privacy concerns, you may create a map anonymously.

+

+ Log in to create a map, or if you have privacy concerns, you may create a map anonymously. +


-

Make maps from aerial photos

@@ -72,7 +73,6 @@


-

<%= @title ||= "Featured" %> | Authors <% if params[:controller] == "tags" %> @@ -82,7 +82,7 @@
<% @maps.each_with_index do |map,i| %> - <%= render :partial => 'maps/list', :locals => {:map => map} %> + <%= render :partial => 'maps/list', :locals => {:map => map} %> <% end %>

@@ -209,4 +209,4 @@ }; L.control.layers(baseMaps,overlayMaps).addTo(Mapknitterunique); - + \ No newline at end of file diff --git a/app/views/maps/new.html.erb b/app/views/maps/new.html.erb index f512995e3..694c7542e 100644 --- a/app/views/maps/new.html.erb +++ b/app/views/maps/new.html.erb @@ -17,8 +17,8 @@
<%= f.label :slug, "URL" %> -
-
mapknitter.org/maps/
+
+ <%= f.text_field :slug, :class => "form-control" %>
@@ -51,7 +51,7 @@ -

+

Choose location via map

diff --git a/app/views/maps/show.html.erb b/app/views/maps/show.html.erb index 78cf4a2ec..d18d87d2f 100644 --- a/app/views/maps/show.html.erb +++ b/app/views/maps/show.html.erb @@ -1,14 +1,4 @@ <% content_for :title do %> - @@ -44,15 +34,15 @@

<% if logged_in? %> - Edit details + <% end %> - Embed code + + +

- NDVI (beta) - - Learn more + Learn more about ImageSequencer code

\ No newline at end of file diff --git a/app/views/users/profile.html.erb b/app/views/users/profile.html.erb index eb3f50ce8..893ba4e15 100644 --- a/app/views/users/profile.html.erb +++ b/app/views/users/profile.html.erb @@ -13,9 +13,10 @@
- <% @maps.each do |map| %> - <%= render :partial => "maps/list", :locals => {:map => map} %> - <% end %> - +
+ <% @maps.each_with_index do |map,i| %> + <%= render :partial => 'maps/list', :locals => {:map => map} %> + <% end %> +

diff --git a/bower.json b/bower.json index d73dcfe1c..afb109155 100644 --- a/bower.json +++ b/bower.json @@ -3,10 +3,10 @@ "version": "2.0.2", "dependencies": { "fontawesome": "~4.2.0", - "bootstrap": "~3.2.0", + "bootstrap": "^4.3.1", "seiyria-bootstrap-slider": "~4.4.0", "jquery": "~1.11", - "jquery-ui": "~1.11", + "jquery-ui": "^1.12.1", "jquery-ujs": "~1.0.3", "ol2": "git+https://github.com/openlayers/ol2#release-2.13.1", "blueimp-file-upload": "blueimp/jQuery-File-Upload#~9.8.1", From 74a51e0eec849d937652c83c7d865a570dcb9904 Mon Sep 17 00:00:00 2001 From: Stefanni Date: Thu, 4 Apr 2019 15:30:18 -0700 Subject: [PATCH 050/123] Bootstrap 4 small button fixes (#488) --- app/assets/stylesheets/maps.css.scss | 5 ++- app/views/comments/_comment.html.erb | 40 +++++++++++--------- app/views/export/index.html.erb | 2 +- app/views/images/_index.html.erb | 15 +++++--- app/views/images/_new.html.erb | 6 +-- app/views/layouts/knitter2.html.erb | 14 +++---- app/views/map/_annotations.html.erb | 2 +- app/views/map/view.html.erb | 2 +- app/views/maps/_sidebar_annotations.html.erb | 2 +- app/views/maps/_sidebar_exports.html.erb | 2 +- app/views/maps/annotate.html.erb | 2 +- app/views/maps/index.html.erb | 2 +- app/views/maps/new.html.erb | 4 +- 13 files changed, 54 insertions(+), 44 deletions(-) diff --git a/app/assets/stylesheets/maps.css.scss b/app/assets/stylesheets/maps.css.scss index aa75a2cd5..9ba839f1b 100644 --- a/app/assets/stylesheets/maps.css.scss +++ b/app/assets/stylesheets/maps.css.scss @@ -35,7 +35,8 @@ html, body { } .map-list .map h3 { - overflow:hidden; + padding-top: 10px; + overflow: hidden; } .map-list .map { @@ -250,7 +251,7 @@ table .btn { .comment-body { padding-left:4px; } - .btn-xs { + .btn-sm { margin-left:3px; } } diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index c0f21dd19..50e8cc46e 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -1,25 +1,31 @@
- <%= comment.author %> - commented <%= time_ago_in_words(comment.created_at) %> ago +
+
+ <%= comment.author %> + commented <%= time_ago_in_words(comment.created_at) %> ago +
- <% if current_user && current_user.can_edit?(comment) %> - - <% end %> +
+ <% if current_user && current_user.can_edit?(comment) %> + + <% end %> - <% if current_user && current_user.can_delete?(comment) %> - <%= link_to( - [@map, comment], - :method => "delete", - #:remote => true, - :confirm => "Are you sure? This cannot be undone.", - :class => "btn btn-default btn-xs pull-right delete-comment-btn", - :id => "comment-delete-#{comment.id}" - ) do %> + <% if current_user && current_user.can_delete?(comment) %> + <%= link_to( + [@map, comment], + :method => "delete", + #:remote => true, + :confirm => "Are you sure? This cannot be undone.", + :class => "btn btn-sm btn-outline-secondary float-right delete-comment-btn", + :id => "comment-delete-#{comment.id}" + ) do %> - - <% end %> - <% end %> + + <% end %> + <% end %> +
+
<%=raw markdown_to_html(comment.body) %>
diff --git a/app/views/map/_annotations.html.erb b/app/views/map/_annotations.html.erb index a298a9469..38ebf4b6c 100644 --- a/app/views/map/_annotations.html.erb +++ b/app/views/map/_annotations.html.erb @@ -148,6 +148,6 @@ <% end %> <% if @export && @export.jpg %> - Order a print + Order a print <% end %>
diff --git a/app/views/map/view.html.erb b/app/views/map/view.html.erb index b947d32b9..ff8db5d5c 100644 --- a/app/views/map/view.html.erb +++ b/app/views/map/view.html.erb @@ -202,7 +202,7 @@
-

Edit map detailsExpand

+

Edit map detailsExpand


- <%= link_to "« Back to main interface".html_safe, map_path(@map), :class => 'btn btn-default' %> + <%= link_to "« Back to main interface".html_safe, map_path(@map), :class => 'btn btn-outline-secondary' %>

<% end %> diff --git a/app/views/maps/index.html.erb b/app/views/maps/index.html.erb index 2c4808b13..a780309ec 100644 --- a/app/views/maps/index.html.erb +++ b/app/views/maps/index.html.erb @@ -50,7 +50,7 @@ - ---> \ No newline at end of file + diff --git a/app/views/layouts/knitter2.html.erb b/app/views/layouts/knitter2.html.erb index 87c2fb60d..4417082a7 100644 --- a/app/views/layouts/knitter2.html.erb +++ b/app/views/layouts/knitter2.html.erb @@ -78,6 +78,7 @@ Post +

+--> \ No newline at end of file From 800da0e5f9c4020881b704b0569ecb3a97a4e105 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Tue, 28 Apr 2020 13:08:16 -0400 Subject: [PATCH 090/123] Remove extra files from rebase --- test/functional/comments_controller_test.rb | 198 ------------------ test/functional/images_controller_test.rb | 9 - test/functional/maps_controller_test.rb | 213 -------------------- 3 files changed, 420 deletions(-) delete mode 100644 test/functional/comments_controller_test.rb delete mode 100644 test/functional/images_controller_test.rb delete mode 100644 test/functional/maps_controller_test.rb diff --git a/test/functional/comments_controller_test.rb b/test/functional/comments_controller_test.rb deleted file mode 100644 index faef34ada..000000000 --- a/test/functional/comments_controller_test.rb +++ /dev/null @@ -1,198 +0,0 @@ -require 'test_helper' - -class CommentsControllerTest < ActionController::TestCase - - # called before every single test - def setup - @map = maps(:saugus) - end - - # called after every single test - def teardown - end - - test "should not create comment if not logged in" do - before_count = Comment.count - - post(:create, - map_id: @map.slug, - comment: { - user_id: 1 - }) - - assert_response :success - assert_equal before_count, Comment.count - end - - test "should create comment" do - session[:user_id] = 1 - before_count = Comment.count - - post(:create, - map_id: @map.slug, - comment: { - body: "I'm gonna troll you!" - }) - - assert_response :success - assert_not_equal before_count, Comment.count - assert_equal "I'm gonna troll you!", @map.comments.last.body - end - - test "should update comment if commenter" do - @comment = comments(:four) - session[:user_id] = 4 - - put(:update, - id: @comment.id, - map_id: @map.slug, - comment: { - body: "I'm gonna troll you!" - }) - - #refresh the object - @comment.reload - - assert_redirected_to "/maps/" + @map.slug - assert_equal "I'm gonna troll you!", @comment.body - end - - test "should not update comment if not commenter" do - @comment = comments(:one) - session[:user_id] = 3 - - put(:update, - id: @comment.id, - map_id: @map.slug, - comment: { - body: "I'm gonna troll you!" - }) - - @comment.reload - - assert_redirected_to "/login" - assert_not_equal "I'm gonna troll you!", @comment.body - assert_equal "I'll just leave a comment, why don't I.", @comment.body - assert_equal "You do not have permissions to update that comment.", flash[:error] - end - - test "should not update comment if not logged in" do - @comment = comments(:one) - - put(:update, - id: @comment.id, - map_id: @map.slug, - comment: { - body: "I'm gonna troll you!" - }) - - @comment.reload - - assert_redirected_to "/login" - assert_not_equal "I'm gonna troll you!", @comment.body - assert_equal "I'll just leave a comment, why don't I.", @comment.body - assert_equal "You do not have permissions to update that comment.", flash[:error] - end - - test "should delete comment" do - @comment = comments(:one) - session[:user_id] = 1 - before_count = Comment.count - - delete(:destroy, - id: @comment.id, - map_id: @map.slug - ) - - assert_redirected_to "/maps/" + @map.slug - assert_not_equal before_count, Comment.count - assert_equal "Comment deleted.", flash[:notice] - end - - test "should not delete comment if not commmenter" do - @comment = comments(:one) - session[:user_id] = 3 - before_count = Comment.count - - delete(:destroy, - id: @comment.id, - map_id: @map.slug - ) - - assert_redirected_to "/maps/" + @map.slug - assert_equal before_count, Comment.count - assert_equal "You do not have permission to delete that comment.", flash[:error] - end - - test "should not delete comment if not logged in" do - @comment = comments(:one) - before_count = Comment.count - - delete(:destroy, - id: @comment.id, - map_id: @map.slug - ) - - assert_redirected_to "/maps/" + @map.slug - assert_equal before_count, Comment.count - assert_equal "You do not have permission to delete that comment.", flash[:error] - end - - test "should not send email to author" do - @user = users(:quentin) - session[:user_id] = @user.id - - post(:create, - map_id: @map.slug, - comment: { - body: "I'm gonna troll you!" - }) - - assert_response :success - assert !ActionMailer::Base.deliveries.collect(&:to).include?([@user.email]) - end - - test "should send email to author if someone else comments" do - @user = users(:quentin) - session[:user_id] = 3 - - post(:create, - map_id: @map.slug, - comment: { - body: "I'm gonna troll you!" - }) - - email = ActionMailer::Base.deliveries.last - - assert_response :success - assert ActionMailer::Base.deliveries.collect(&:to).include?([@user.email]) - assert ActionMailer::Base.deliveries.collect(&:subject).include?("New comment on '#{@map.name}'") - end - - test "should send email to all commenters on commenting" do - @joshua = users(:joshua) - @chris = users(:chris) - - session[:user_id] = @chris.id - - post(:create, - map_id: @map.slug, - comment: { - body: "I'm gonna troll you!" - }) - - session[:user_id] = @joshua.id - - post(:create, - map_id: @map.slug, - comment: { - body: "Yeah we'll see!" - }) - - email = ActionMailer::Base.deliveries.last - - assert_response :success - assert ActionMailer::Base.deliveries.collect(&:to).include?([@chris.email]) - assert ActionMailer::Base.deliveries.collect(&:subject).include?("New comment on '#{@map.name}'") - end -end diff --git a/test/functional/images_controller_test.rb b/test/functional/images_controller_test.rb deleted file mode 100644 index c8f381d94..000000000 --- a/test/functional/images_controller_test.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'test_helper' - -class ImagesControllerTest < ActionController::TestCase - - # called before every single test - def setup - @map = maps(:saugus) - end -end diff --git a/test/functional/maps_controller_test.rb b/test/functional/maps_controller_test.rb deleted file mode 100644 index b8ded2351..000000000 --- a/test/functional/maps_controller_test.rb +++ /dev/null @@ -1,213 +0,0 @@ -require 'test_helper' - -class MapsControllerTest < ActionController::TestCase - - # called before every single test - def setup - @map = maps(:saugus) - end - - # called after every single test - def teardown - end - - test "should display image url for maps by region" do - get :region , { minlat: 40, maxlat: 50, minlon: -80, maxlon: -60, format: :json} - - image_urls = [] - @map.warpables.each do | warpable| - image_urls.append(warpable.image.url) - end - - json_response = JSON.parse(response.body) - - assert_response :success - assert_equal image_urls, json_response[0]['image_urls'] - end - - test "should get index" do - get :index - @maps = assigns(:maps) - - assert_response :success - assert @maps.collect(&:name).include?("Saugus Landfill Incinerator") - assert @maps.collect(&:name).include?("Cubbon Park") - assert @maps.collect{ |map| map.user.login}.include?("quentin") - end - - test "should not display archived maps" do - session[:user_id] = 1 - get(:archive, id: @map.slug) - get :index - @maps = assigns(:maps) - - assert_response :success - assert !@maps.collect(&:name).include?("Saugus Landfill Incinerator") - assert @maps.collect(&:name).include?("Cubbon Park") - assert @maps.collect{ |map| map.user.login}.include?("quentin") - end - - test "should get map of maps" do - get :map - assert_response :success - end - - test "should get new" do - get :new - assert_response :success - assert_not_nil assigns(:map) - end - - test "should search for maps by name" do - get :search, q: 'Saugus' - @maps = assigns(:maps) - - assert_response :success - assert @maps.collect(&:name).include?("Saugus Landfill Incinerator") - assert !@maps.collect(&:name).include?("Cubbon Park") - end - - test "should search for maps by location" do - get :search, q: 'India' - @maps = assigns(:maps) - - assert_response :success - assert !@maps.collect(&:name).include?("Saugus Landfill Incinerator") - assert @maps.collect(&:name).include?("Cubbon Park") - end - - test "should search for maps by description" do - get :search, q: 'a park' - @maps = assigns(:maps) - - assert_response :success - assert !@maps.collect(&:name).include?("Saugus Landfill Incinerator") - assert @maps.collect(&:name).include?("Cubbon Park") - end - - test "should create map if logged in" do - session[:user_id] = 1 - before_count = Map.count - post(:create, map: { - name: "Coal terminal map", - slug: "coal-terminal", - location: "London", - lat: 42.43823313018592, - lon: -70.9849190711975 - }) - @map = assigns(:map) - - assert_response 302 - assert_redirected_to '/maps/'+@map.slug - assert_not_equal before_count, Map.count - assert Map.all.collect(&:name).include?("Coal terminal map") - assert_equal @map.user.login, "quentin" - end - - test "should create map if not logged in" do - before_count = Map.count - post(:create, map: { - name: "Coal terminal map", - slug: "coal-terminal", - location: "London", - lat: 42.43823313018592, - lon: -70.9849190711975 - }) - @map = assigns(:map) - - assert_redirected_to '/maps/'+@map.slug - assert_not_equal before_count, Map.count - assert Map.all.collect(&:name).include?("Coal terminal map") - assert_nil @map.user - end - - test "should render new if map not created" do - session[:user_id] = 1 - before_count = Map.count - post(:create, map: { - name: "Coal terminal map", - slug: "coal-terminal" - }) - @map = assigns(:map) - - assert_response :success - assert_template :new - assert_equal before_count, Map.count - assert !Map.all.collect(&:name).include?("Coal terminal map") - end - - test "should not delete map if not owner" do - session[:user_id] = 3 - before_count = Map.count - post(:destroy, id: @map.id) - - assert_redirected_to "/maps/" + @map.slug - assert_equal flash[:error], "Only admins or map owners may delete maps." - assert_equal before_count, Map.count - end - - test "should delete map if owner" do - session[:user_id] = 1 - before_count = Map.count - post(:destroy, id: @map.id) - - assert_redirected_to '/' - assert_not_equal before_count, Map.count - assert_equal flash[:notice], "Map deleted." - end - - test "should get show" do - get(:show, id: @map.id) - assert_response :success - assert_not_nil assigns(:map) - end - - test "should archive map" do - session[:user_id] = 1 - get(:archive, id: @map.slug) - @map.reload - - assert_redirected_to '/?_=' + Time.now.to_i.to_s - assert_true @map.archived - end - - test "should not archive map without enough permissions" do - session[:user_id] = 3 - get(:archive, id: @map.slug) - @map.reload - - assert_redirected_to '/?_=' + Time.now.to_i.to_s - assert_false @map.archived - end - - test "should update map" do - session[:user_id] = 1 - put(:update, - id: 1, - map: { - name: "Schrute farms", - location: "USA", - lat: 44, - lon: -74, - description: "A really green farm" - }, - tags: "beets bears") - @map.reload - - assert_redirected_to "/maps/" + @map.id.to_s - assert_equal "Schrute farms", @map.name - assert_equal 44, @map.lat - assert_equal -74, @map.lon - assert_equal "A really green farm", @map.description - assert @map.has_tag("beets") - assert @map.has_tag("bears") - end - - test "should display maps by region"do - get :region , { minlat: 40, maxlat: 50, minlon: -80, maxlon: -60} - @maps = assigns(:maps) - - assert_response :success - assert @maps.collect(&:name).include?("Saugus Landfill Incinerator") - end -end From 0f2f576394ca9de37dd5cc643cef23ec48bcd9f5 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Tue, 28 Apr 2020 13:29:26 -0400 Subject: [PATCH 091/123] Add bundle install as build step --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 3af3f9a22..bb80065a5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -51,4 +51,6 @@ RUN git config --global url."https://".insteadOf git:// COPY . /app/ WORKDIR /app +bundle install + CMD [ "sh", "/app/start.sh" ] From b18d999845c2477d33e7b67006499585acb50eae Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Tue, 28 Apr 2020 13:30:33 -0400 Subject: [PATCH 092/123] Deleted not needed Dockerfile --- Dockerfile.txt | 46 ---------------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 Dockerfile.txt diff --git a/Dockerfile.txt b/Dockerfile.txt deleted file mode 100644 index 248b0adc1..000000000 --- a/Dockerfile.txt +++ /dev/null @@ -1,46 +0,0 @@ -# Dockerfile # Mapknitter -# https://github.com/publiclab/mapknitter/ -# This image deploys Mapknitter! - -FROM ruby:2.4.6-stretch - -# Set correct environment variables. -ENV HOME /root -ENV PORT 8080 - -# Backported GDAL -RUN echo "deb http://packages.laboratoriopublico.org/publiclab/ stretch main" > /etc/apt/sources.list.d/publiclab.list - -# Obtain key -RUN apt-key adv --keyserver ipv4.pool.sks-keyservers.net --recv-keys BF26EE05EA6A68F0 - -# Install dependencies -RUN apt-get update -qq && apt-get install -y \ - nodejs gdal-bin curl procps git imagemagick python-gdal zip - -RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - && apt-get install -y npm -RUN npm install -g yarn - -# Install bundle of gems -SHELL [ "/bin/bash", "-l", "-c" ] -WORKDIR /tmp -ADD Gemfile /tmp/Gemfile -ADD Gemfile.lock /tmp/Gemfile.lock -RUN bundle install - -# Add the Rails app -ADD . /app -WORKDIR /app -COPY Gemfile /app/Gemfile -COPY Gemfile.lock /app/Gemfile.lock -COPY start.sh /app/start.sh - -# Add default configs -COPY config/database.yml.example /app/config/database.yml -COPY config/config.yml.example /app/config/config.yml -COPY config/initializers/recaptcha.rb.example /app/config/initializers/recaptcha.rb -COPY config/amazon_s3.yml.example /app/config/amazon_s3.yml -COPY Passenger.json.production Passenger.json - - -CMD [ "sh", "start.sh" ] From 811605d15233828532e321880213f30eaaf1e797 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Tue, 28 Apr 2020 13:33:07 -0400 Subject: [PATCH 093/123] Missed RUN in Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index bb80065a5..b047667b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -51,6 +51,6 @@ RUN git config --global url."https://".insteadOf git:// COPY . /app/ WORKDIR /app -bundle install +RUN bundle install CMD [ "sh", "/app/start.sh" ] From d772a5a8ca7e5536d58b382ae8e8a8da4f14d64d Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Tue, 28 Apr 2020 14:32:36 -0400 Subject: [PATCH 094/123] Add precompile step --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index b047667b2..ed4731d05 100644 --- a/Dockerfile +++ b/Dockerfile @@ -52,5 +52,6 @@ COPY . /app/ WORKDIR /app RUN bundle install +RUN rake assets:precompile CMD [ "sh", "/app/start.sh" ] From 74f688f18b7250070b75f1f7613b68a5fc2a9081 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Tue, 28 Apr 2020 15:08:49 -0400 Subject: [PATCH 095/123] Hardcode environment at build time --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ed4731d05..82d5773ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -52,6 +52,6 @@ COPY . /app/ WORKDIR /app RUN bundle install -RUN rake assets:precompile +RUN rake assets:precompile RAILS_ENV=production CMD [ "sh", "/app/start.sh" ] From 43e779d149fa97c6ffbc3446835e8dfcca88fa10 Mon Sep 17 00:00:00 2001 From: Alax Alves Date: Tue, 28 Apr 2020 16:42:28 -0300 Subject: [PATCH 096/123] Adding missing yaml and update bootsnap version --- .graphiticfg.yml | 2 ++ Gemfile | 2 +- Gemfile.lock | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 .graphiticfg.yml diff --git a/.graphiticfg.yml b/.graphiticfg.yml new file mode 100644 index 000000000..cfcea065e --- /dev/null +++ b/.graphiticfg.yml @@ -0,0 +1,2 @@ +--- +namespace: / diff --git a/Gemfile b/Gemfile index cda9fb459..639ea8b18 100644 --- a/Gemfile +++ b/Gemfile @@ -24,7 +24,7 @@ group :dependencies do gem 'open_id_authentication' gem 'RubyInline', '~> 3.12.5' gem 'paperclip', '~> 6.1.0' - gem 'bootsnap', '~> 1.4.5' + gem 'bootsnap', '~> 1.4.6' gem 'turbolinks', '~> 5' gem 'mini_magick', '~> 4.8' gem 'puma', '~> 4.3.3' diff --git a/Gemfile.lock b/Gemfile.lock index e216bcbae..7497cfb0f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -346,7 +346,7 @@ DEPENDENCIES action-cable-testing autoprefixer-rails (~> 9.7.3) aws-sdk-s3 (~> 1) - bootsnap (~> 1.4.5) + bootsnap (~> 1.4.6) bootstrap-sass byebug (~> 11.0.1) capybara From cdffc836bdaed8a395e8118ab2b0b9a34e3245fc Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Tue, 28 Apr 2020 18:45:26 -0400 Subject: [PATCH 097/123] Omit /app/tmp from volume --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index c2ec64b3b..ca4b0ebb2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,6 +18,7 @@ services: - .:/app - bundle_cache:/usr/local/bundle - yarn_cache:/app/node_modules/ + - /app/tmp ports: - ${PORT:-3000} depends_on: From 8c4adf9291e661979804c3ad6e889d63b0212fb9 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Tue, 28 Apr 2020 18:54:23 -0400 Subject: [PATCH 098/123] Revert try to get precompile to work --- docker-compose.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index ca4b0ebb2..c2ec64b3b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,7 +18,6 @@ services: - .:/app - bundle_cache:/usr/local/bundle - yarn_cache:/app/node_modules/ - - /app/tmp ports: - ${PORT:-3000} depends_on: From d23a54b8e65f6a75ffc082a93c2025f4ebff1e45 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Wed, 29 Apr 2020 15:17:34 -0400 Subject: [PATCH 099/123] Clean up patch for merging --- Dockerfile | 1 - Passengerfile.json.production | 7 ------- 2 files changed, 8 deletions(-) delete mode 100644 Passengerfile.json.production diff --git a/Dockerfile b/Dockerfile index 82d5773ed..b047667b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -52,6 +52,5 @@ COPY . /app/ WORKDIR /app RUN bundle install -RUN rake assets:precompile RAILS_ENV=production CMD [ "sh", "/app/start.sh" ] diff --git a/Passengerfile.json.production b/Passengerfile.json.production deleted file mode 100644 index cc2ba69e0..000000000 --- a/Passengerfile.json.production +++ /dev/null @@ -1,7 +0,0 @@ -{ - // Run the app in a production environment. The default value is "development". - "environment": "production", - // Run Passenger on the given port. In this example, we use port 80, - // the standard HTTP port. - "port": 8080 -} \ No newline at end of file From 61db31ef679a4446e45c925a25eca8781b004965 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Wed, 29 Apr 2020 15:17:57 -0400 Subject: [PATCH 100/123] List variables in app.yaml --- app.yaml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/app.yaml b/app.yaml index 4cc8bf652..76a354b38 100644 --- a/app.yaml +++ b/app.yaml @@ -3,3 +3,23 @@ runtime: custom manual_scaling: instances: 1 + +resources: + cpu: 1 + memory_gb: 4 +env_variables: + AWS_ACCESS_KEY_ID: + AWS_SECRET_ACCESS_KEY: + DB_USER: mapknitter + DB_PASS: mapknitter + DB_NAME: mapknitter + DB_HOST: localhost + DB_SOCKET: + RAILS_ENV: production + RECAPTCHA_KEY: + RECAPTCHA_SITE_KEY: + SECRET_KEY_BASE: + SENTRY_DSN: + +beta_settings: + cloud_sql_instances: From 61143200ae6fd1b27930299fa17697f7ccdb6370 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Wed, 29 Apr 2020 15:22:33 -0400 Subject: [PATCH 101/123] Tweak for jenkins --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index a645f6f53..45791d390 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,6 @@ build: cp config/database.yml.example config/database.yml cp config/config.yml.example config/config.yml cp config/initializers/recaptcha.rb.example config/initializers/recaptcha.rb - cp config/amazon_s3.yml.example config/amazon_s3.yml cp db/schema.rb.example db/schema.rb docker-compose down --remove-orphans docker-compose build From c494e2c07d6e459b0b2be329ab013224d2087640 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Wed, 29 Apr 2020 15:49:00 -0400 Subject: [PATCH 102/123] Add .env for jenkins --- .env | 1 + 1 file changed, 1 insertion(+) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 000000000..2fc80e3a4 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +PORT=3000 From 8f6f8f6d3d319ca0a8c930fe24b2406c972671f0 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Wed, 29 Apr 2020 16:21:05 -0400 Subject: [PATCH 103/123] Fix PORT for jenkins/docker-compose --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 45791d390..785044a78 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ export COMPOSE_HTTP_TIMEOUT=360 export COMPOSE_PROJECT_NAME +export PORT define wait_for_container @while ! docker-compose logs web | grep "web server started"; do\ From 1fdb48db20d4fee63980ce4e20224ee9c2abee82 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Wed, 29 Apr 2020 16:42:29 -0400 Subject: [PATCH 104/123] Address PORT properly --- .env | 1 - Procfile | 2 +- docker-compose.yml | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) delete mode 100644 .env diff --git a/.env b/.env deleted file mode 100644 index 2fc80e3a4..000000000 --- a/.env +++ /dev/null @@ -1 +0,0 @@ -PORT=3000 diff --git a/Procfile b/Procfile index b015561fd..d0e92fdb5 100644 --- a/Procfile +++ b/Procfile @@ -1,2 +1,2 @@ -passenger: passenger start --port $PORT +passenger: passenger start --port 3000 puma: puma -C config/puma.rb diff --git a/docker-compose.yml b/docker-compose.yml index c2ec64b3b..2a25c2255 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,7 +19,7 @@ services: - bundle_cache:/usr/local/bundle - yarn_cache:/app/node_modules/ ports: - - ${PORT:-3000} + - $PORT:3000 depends_on: - db From 4ee0c8a7e6ba9b6f5920dc53f4bcd765f0895ac5 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Wed, 29 Apr 2020 17:10:14 -0400 Subject: [PATCH 105/123] New form ports --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 2a25c2255..8b066f6d0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,7 +19,7 @@ services: - bundle_cache:/usr/local/bundle - yarn_cache:/app/node_modules/ ports: - - $PORT:3000 + - ${PORT}:3000 depends_on: - db From 437f65e8f5609804145cb528ca5f96cc94dffae5 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Wed, 29 Apr 2020 17:25:30 -0400 Subject: [PATCH 106/123] Enclose docker-compose ports in quotes --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 8b066f6d0..b8085bddd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,7 +19,7 @@ services: - bundle_cache:/usr/local/bundle - yarn_cache:/app/node_modules/ ports: - - ${PORT}:3000 + - "${PORT}:3000" depends_on: - db From 8bd99e6fd72d6caeeda839168af908ea543f7c6b Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Wed, 29 Apr 2020 17:28:31 -0400 Subject: [PATCH 107/123] ports yaml should be object not array --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index b8085bddd..63b71fcd4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,7 +19,7 @@ services: - bundle_cache:/usr/local/bundle - yarn_cache:/app/node_modules/ ports: - - "${PORT}:3000" + "${PORT}:3000" depends_on: - db From 97e9d662e3095c7ede4f9ce26c5c94c697b2fe9d Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Wed, 29 Apr 2020 17:32:02 -0400 Subject: [PATCH 108/123] Try different format for ports --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 63b71fcd4..e75a7a537 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,7 +19,7 @@ services: - bundle_cache:/usr/local/bundle - yarn_cache:/app/node_modules/ ports: - "${PORT}:3000" + - "${PORT}:3000" depends_on: - db From 747477421cb5202a37ba99cb518716393ad79304 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Wed, 29 Apr 2020 17:42:34 -0400 Subject: [PATCH 109/123] Try docker-compose format --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index e75a7a537..78dcbe96e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,7 +19,7 @@ services: - bundle_cache:/usr/local/bundle - yarn_cache:/app/node_modules/ ports: - - "${PORT}:3000" + - ${PORT:-3000}:3000 depends_on: - db From 4290838dd74039817ba7647d51fcbfe95322b61f Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Thu, 30 Apr 2020 04:00:21 -0400 Subject: [PATCH 110/123] Redirect script for AppEngine --- script/redirect.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 script/redirect.py diff --git a/script/redirect.py b/script/redirect.py new file mode 100644 index 000000000..a221f4762 --- /dev/null +++ b/script/redirect.py @@ -0,0 +1,15 @@ +from google.appengine.ext import webapp +from google.appengine.ext.webapp.util import run_wsgi_app + +class AllHandler(webapp.RequestHandler): + def get(self): + self.redirect("https://tycho.media.mit.edu/warps", True) + +application = webapp.WSGIApplication([('/.*', AllHandler)]) + +def main(): + run_wsgi_app(application) + +if __name__ == "__main__": + main() + From 91adfd65b12695058e75ed75de5cf949bae822a6 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Thu, 30 Apr 2020 04:20:18 -0400 Subject: [PATCH 111/123] Try to revertt to working condition for appengine --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 78dcbe96e..e6bee8bbd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,7 +19,7 @@ services: - bundle_cache:/usr/local/bundle - yarn_cache:/app/node_modules/ ports: - - ${PORT:-3000}:3000 + - ${PORT:-3000} depends_on: - db From 83d36b21f19851e536d38eaa0d07ca7c6c3bb6bd Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Thu, 30 Apr 2020 04:43:00 -0400 Subject: [PATCH 112/123] Point PORT in Procfile --- Procfile | 2 +- docker-compose.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Procfile b/Procfile index d0e92fdb5..b015561fd 100644 --- a/Procfile +++ b/Procfile @@ -1,2 +1,2 @@ -passenger: passenger start --port 3000 +passenger: passenger start --port $PORT puma: puma -C config/puma.rb diff --git a/docker-compose.yml b/docker-compose.yml index e6bee8bbd..78dcbe96e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,7 +19,7 @@ services: - bundle_cache:/usr/local/bundle - yarn_cache:/app/node_modules/ ports: - - ${PORT:-3000} + - ${PORT:-3000}:3000 depends_on: - db From 0fb07b0b1108e4375123a8c5e6c2b6f5192f457f Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Thu, 30 Apr 2020 04:43:59 -0400 Subject: [PATCH 113/123] Revert to known good config in appengine --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 78dcbe96e..e6bee8bbd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,7 +19,7 @@ services: - bundle_cache:/usr/local/bundle - yarn_cache:/app/node_modules/ ports: - - ${PORT:-3000}:3000 + - ${PORT:-3000} depends_on: - db From 5925808576fcb4faf6021a3070c1a76e60d4dc80 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Thu, 30 Apr 2020 10:19:59 -0400 Subject: [PATCH 114/123] Tweak assets precompilation --- start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start.sh b/start.sh index 08d2f2e9b..d5f24df31 100755 --- a/start.sh +++ b/start.sh @@ -28,7 +28,7 @@ else bump_database fi -bundle exec rails assets:precompile +rake assets:precompile if [ -f $pidfile ] ; then >&2 echo 'Server PID file already exists. Removing it...'; From 327020e0d79cd173e97b3a6aa0c8b40d9e45b9dd Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Thu, 30 Apr 2020 12:10:14 -0400 Subject: [PATCH 115/123] Restore PORT setting --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index e6bee8bbd..2a25c2255 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,7 +19,7 @@ services: - bundle_cache:/usr/local/bundle - yarn_cache:/app/node_modules/ ports: - - ${PORT:-3000} + - $PORT:3000 depends_on: - db From 63feb6a095c09f5ddfa0de17592ca7136cf4a4c2 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Thu, 30 Apr 2020 14:25:55 -0400 Subject: [PATCH 116/123] Add redirect to map /warps directory to legacy archive --- config/routes.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/routes.rb b/config/routes.rb index 5d7240e9b..8e7718e9c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -120,4 +120,5 @@ # See how all your routes lay out with 'rails routes' + get '/warps/:map/:file', to: redirect('https://archive.publiclab.org/warps/%{map}/%{file}') end From 8674246e34f78deaf51050958958a0b8bf44289f Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Thu, 30 Apr 2020 14:46:41 -0400 Subject: [PATCH 117/123] Add .env for jenkins/docker-compose --- .env | 1 + 1 file changed, 1 insertion(+) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 000000000..2fc80e3a4 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +PORT=3000 From af46e26cd61e4b6fc283f2f568b305079e5a070c Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Thu, 30 Apr 2020 15:29:34 -0400 Subject: [PATCH 118/123] Add hardcoded route to legacy warps --- config/routes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index 8e7718e9c..dc8370d06 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -120,5 +120,5 @@ # See how all your routes lay out with 'rails routes' - get '/warps/:map/:file', to: redirect('https://archive.publiclab.org/warps/%{map}/%{file}') + get '/warps/:map/:file(.:format)', to: redirect('https://archive.publiclab.org/warps/%{map}/%{file}.%{format}') end From 7c8dd13c3d971d7ee9cd51c72a67ecafecfcc467 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Thu, 30 Apr 2020 16:00:09 -0400 Subject: [PATCH 119/123] Remove .env for appengine --- .env | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .env diff --git a/.env b/.env deleted file mode 100644 index 2fc80e3a4..000000000 --- a/.env +++ /dev/null @@ -1 +0,0 @@ -PORT=3000 From 340f6115e95370461267343e68114ad934426791 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Thu, 30 Apr 2020 16:05:30 -0400 Subject: [PATCH 120/123] Satisfy appengine docker-compose --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 2a25c2255..e6bee8bbd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,7 +19,7 @@ services: - bundle_cache:/usr/local/bundle - yarn_cache:/app/node_modules/ ports: - - $PORT:3000 + - ${PORT:-3000} depends_on: - db From 6a7bdc5de583c25020c4438b5bf0f60bce1119ee Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Sat, 2 May 2020 02:18:46 -0400 Subject: [PATCH 121/123] Ignore app.yaml --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 5c03ac56c..6c00e62ed 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,9 @@ # Ignore bundler config /.bundle +# avoid committing your secrets inadvertly +app.yaml + # Ignore the default SQLite database. /db/*.sqlite3 From 22a03b1a118cc7cda6e7d66f99db48c674d62ebb Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Sat, 2 May 2020 02:20:04 -0400 Subject: [PATCH 122/123] Ignore app.yaml secrets --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 6c00e62ed..5866d40c4 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,7 @@ /.bundle # avoid committing your secrets inadvertly -app.yaml +./app.yaml # Ignore the default SQLite database. /db/*.sqlite3 From 1d4cf406a5f27f652d85ca4e3db279322928bd2c Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Sat, 2 May 2020 02:20:32 -0400 Subject: [PATCH 123/123] Satisfy Jenkins wihout hurting appengine hopefully --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index e6bee8bbd..e12aff86f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,7 +19,7 @@ services: - bundle_cache:/usr/local/bundle - yarn_cache:/app/node_modules/ ports: - - ${PORT:-3000} + - ${PORT:-3000}:${PORT:-3000} depends_on: - db