Skip to content

Latest commit

 

History

History
70 lines (49 loc) · 2.58 KB

README.rdoc

File metadata and controls

70 lines (49 loc) · 2.58 KB

README

Schengen Calculator

Caclulator to help track the 90/180 day schengen visa rule for travellers in Europe. I had created similar functionality in Excel spreadsheet for my personal use when i was travelling in Europe, and thought it would be helpful for others to put online.

Live site can be found here: www.schengen-calculator.com

System Dependencies

Application setup

To develop locally, rails can be setup normally in the /src folder

  • Install RVM

  • Install Ruby 3.2.2 (on ubuntu 22 1. rvm install pkg openssl 2. rvm install 3.2.2 –with-openssl-dir=/usr/share/rvm/usr)

  • Install docker, docker desktop

in /src Folder

  • run docker-compose up (to run postgres container)

  • Set required Environment Variables

  • run command `bundle install`

  • Database setup

    • run command `./bin/rake db:create`

    • run command `./bin/rake db:migrate`

    • run command `./bin/rake db:seed`

After updating seed countries data

  • run command `./bin/rake db:update_countries`

To clean up guest user accounts up to last week

  • run command `./bin/rake db:guest_cleanup`

  • Optionally pass in a “to date” to delete guest accounts last modified up to that date

  • run command `./bin/rake db:guest_cleanup["2010-10-01"]`

How to run application and tests (test framework ‘MiniTest`)

  • run docker-compose up

  • command to run applicaiton `rails server`

  • command to run tests `.bin/rake test`

Deployment

  • Automatic deployment to AWS lambda / cloudfront via CDK and Github Actions

  • CDK Deployment code is in /deployment directory

To set up a new aws deployment: In aws create the nessessary application paramaters in AWS Paramater Store which are used on deployment to set the lambda environment Variables:

RAILS_MASTER_KEY: getParam('rails_master_key'),
DB_URL: getParam('db_url'),
SECRET_KEY_BASE: getParam('secret_key_base'),
FACEBOOK_ID: getParam('facebook_id'),
FACEBOOK_SECRET: getParam('facebook_secret'),
BREVO_LOGIN: getParam('brevo_login'),
BREVO_PASSWORD: getParam('brevo_password'),
TASK_PASSWORD: getParam('task_password')

The following secrets are required in github secrets. See aws documentation for setting up a deployment user role with least privileges. One approach: Attempt deploy with no permissions, then add permissions that fail until deploy passes.

AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION