Political fact-checking
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Removed bootstrap, everything on top of Blueprint.js now + standardiz… Jul 10, 2018
app Handle deleted users in statements (#302) Jan 21, 2019
bin Update rails & add active storage support (#72) Apr 18, 2018
config Source can have linked any number of media personalities (#290) Jan 6, 2019
db Handle deleted users in statements (#302) Jan 21, 2019
lib Replace deprecated rubocop-rails package (#250) Oct 3, 2018
log Init Sep 18, 2017
public Init Sep 18, 2017
storage Setup JS environment May 10, 2018
test Handle deleted users in statements (#302) Jan 21, 2019
tmp Init Sep 18, 2017
vendor Init Sep 18, 2017
.dockerignore demagog on docker (#259) Oct 29, 2018
.editorconfig Init Sep 18, 2017
.env.test Add image URL encoding (#67) Mar 15, 2018
.env.webpacker demagog on docker (#259) Oct 29, 2018
.gitignore Gitignore .vscode (#262) Nov 12, 2018
.postcssrc.yml Setup JS environment May 10, 2018
.prettierrc.json Setup JS environment May 10, 2018
.rubocop.yml Replace deprecated rubocop-rails package (#250) Oct 3, 2018
.ruby-version Update ruby version (#74) Apr 26, 2018
.stylelintrc Css Grid Redesign (formerly jQuery/Foundation removal) (#81) Jun 1, 2018
CHANGELOG-cs.md Handle deleted users in statements (#302) Jan 21, 2019
Capfile Notifications (#127) Jul 22, 2018
Dockerfile demagog on docker (#259) Oct 29, 2018
Gemfile Replace deprecated rubocop-rails package (#250) Oct 3, 2018
Gemfile.lock Source can have linked any number of media personalities (#290) Jan 6, 2019
Guardfile Deprecate old portrait (#80) Jun 3, 2018
LICENSE Create LICENSE Jan 23, 2018
Procfile Add Procfile Sep 18, 2017
README.md Log to Sentry only when SENTRY_DSN env var is present (= in productio… Dec 29, 2018
Rakefile Enforce rubocop Sep 21, 2017
config.ru Enforce rubocop Sep 21, 2017
docker-compose.yml demagog on docker (#259) Oct 29, 2018
package.json Upgrade Redux to v4 and RxJS to v6 (#272) Nov 12, 2018
tsconfig.json Finish statements admin (#108) Jun 24, 2018
tslint.json Setup JS environment May 10, 2018
yarn.lock Upgrade Redux to v4 and RxJS to v6 (#272) Nov 12, 2018

README.md

README

Political fact checking website. For more information see http://demagog.cz/o-nas (in czech).

Ruby version

2.5.3

Setup

Demagog can be run, tested and fully developed in the docker environment

First run

docker-compose build
docker-compose up

Setting up database

docker-compose exec web rails db:create db:migrate db:seed

Running tests

docker-compose exec web rails test
docker-compose exec web yarn jest

Rebuilding single service

docker-compose up -d --no-deps --build <service_name>

Configuration

Site configuration is done via .env file (see dotenv project).

// .env
DEMAGOG_IMAGE_SERVICE_URL=https://pacific-meadow-53023.herokuapp.com
LEGACY_DATABASE_URL=mysql2://username:password@server/database

# You can speed up your local full DB migration by setting path to local
# image cache. Images will be downloaded from the image service to the cache
# only once and then the migration will take images from the cache. This
# setting is optional.
MIGRATION_IMAGE_CACHE=/tmp/demagog_image_cache

# S3 keys are needed for non-development environment only
AMAZON_S3_ACCESS_KEY_ID=amazon-access-id
AMAZON_S3_SECRET_ACCESS_KEY=amazon-secret-access-key
AMAZON_S3_REGION=region
AMAZON_S3_BUCKET=bucket-name
AMAZON_S3_ENDPOINT=https://example.com

# Sendgrid SMTP service (only for production)
SENDGRID_USERNAME=sendgrid-username
SENDGRID_PASSWORD=sendgrid-password

# Sentry.io project to log to (only for production)
SENTRY_DSN=sentry-dsn

Dev setup from legacy DB

  1. Install rails and yarn
  2. Clone repo
  3. bundle install
  4. yarn install
  5. Add image service into .env (as seen above)
  6. Set up MySQL DB, add credentials to .env (DB_USERNAME, DB_PASSWORD, DB_HOST)
  7. Prepare local legacy DB on MySQL, add its URL into .env as LEGACY_DATABASE_URL
  8. Run DB migration rails db:drop db:create db:migrate migration:run
  9. rails server

Run guard-livereload server with guard.

Generating Apollo flow types

docker-compose exec web rails apollo:types

Services (job queues, cache servers, search engines, etc.)

Redis server

Redis server is not essential for running https://demagog.cz, but it helps to improve performance

It's used to cache:

  • speaker statistics
  • speaker statistics for debate (article)

Deployment instructions

Deploy to production:

cap production deploy

Stop production unicorn:

cap production rvm:hook unicorn:reload

Reload production unicorn:

cap production rvm:hook unicorn:reload

Stop production unicorn:

cap production rvm:hook unicorn:stop

Start production unicorn:

cap production rvm:hook unicorn:start