Giter Club home page Giter Club logo

southwest-checkin-3's Introduction

Southwest Checkin 3.X

Build Status Coverage Status

Deploy

Automatically checks in passengers for their Southwest Flight.

Version 3 is a upgrade of v2 to maintain support with the latest ruby and rails for Heroku hosting. I've cloned for some tools such as GitGuardian and so there are no issues if upstream repos archive or delete.

If you are interested in the old version, see the 2.0 branch. If you are interested in the old version, see the 1.0 branch.

Features

  • Accounts
    • an easy and convient way to manage your reservations
    • view or remove your reservations at any time
    • increased security
  • Email Notifications
    • Notified when a reservation is added
    • Notified on successful checkin
  • Checks in all passengers for a given confirmation number
  • Secured via HTTPS
  • Modern UI
  • Modern background processing and job scheduling
  • Full test suite

Build

Can run on Heroku with a single button click Updated for Ruby 2.6.3, Rails 5.2.3 by a non-Rails person

Grab the source for checkin

git clone https://github.com/davidkassa/southwest-checkin-3.git
cd southwest-checkin-3

Install the bundled gems

bundle install

Create a db user and give them create privileges (ignore any directory errors) Populate the db

rake db:create db:migrate db:seed

Create a config file replace your website, email, and email server. It must accept mail on port 587 with tls. You can use .env.example as a template

echo 'SITE_NAME=Southwest Checkin
SITE_URL=http://mywebsite.com
ASSET_HOST=http://mywebsite.com
[email protected]
[email protected]
DEPLOY_BRANCH=master
DEPLOY_USER=deploy
DEPLOY_PORT=22
MAILER_ADDRESS=mail.mywebsite.com
MAILER_DOMAIN=mywebsite.com
[email protected]
MAILER_PASSWORD=mypassword
MAILER_DEFAULT_HOST=
DEPLOY_DOMAIN=
DEPLOY_TO=
DEPLOY_REPOSITORY=
DEPLOY_USE_RBENV=true
MAILER_DEFAULT_PROTOCOL=http
MAILER_DEFAULT_HOST=mywebsite.com' > .env

Old but maybe useful bits

Create a script to launch everything

echo '#!/bin/sh
service postgresql restart
service redis-server restart
sleep 2
echo Starting rails
tmux new -s rails  -d
tmux send-keys  -t rails "cd /root/southwest-checkin/app" C-m
tmux send-keys  -t rails "/root/.rbenv/shims/rails s -b 0.0.0.0 -p 80 -e development" C-m
tmux new -s sidekiq -d
sleep 2
echo Starting sidekiq
tmux send-keys  -t sidekiq "cd /root/southwest-checkin" C-m
tmux send-keys  -t sidekiq "/root/.rbenv/shims/bundle exec sidekiq &" C-m' > /root/start.sh

Enable Email in Dev Mode (update action_mailer settings) nano config/environments/development.rb

Rails.application.configure do
  # Settings specified here will take precedence over those in config/application.rb.

  # In the development environment your application's code is reloaded on
  # every request. This slows down response time but is perfect for development
  # since you don't have to restart the web server when you make code changes.
  config.cache_classes = false

  # Do not eager load code on boot.
  config.eager_load = false

  # Show full error reports and disable caching.
  config.consider_all_requests_local       = true
  config.action_controller.perform_caching = false

  config.action_mailer.asset_host = ENV['ASSET_HOST']
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.default_url_options = {
    host: ENV['MAILER_DEFAULT_HOST'],
    protocol: ENV['MAILER_DEFAULT_PROTOCOL'] || 'https'
  }
  config.action_mailer.default_options  = {
    from: ENV['MAILER_DEFAULT_FROM_EMAIL'],
    reply_to: ENV['MAILER_DEFAULT_REPLY_TO']
  }
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
    address:              ENV['MAILER_ADDRESS'],
    user_name:            ENV['MAILER_USERNAME'],
    password:             ENV['MAILER_PASSWORD'],
    port:                 587,
    authentication:       'plain',
    enable_starttls_auto: true }

  # Print deprecation notices to the Rails logger.
  config.active_support.deprecation = :log

  # Raise an error on page load if there are pending migrations.
  config.active_record.migration_error = :page_load

  # Debug mode disables concatenation and preprocessing of assets.
  # This option may cause significant delays in view rendering with a large
  # number of complex assets.
  config.assets.debug = true

  # Asset digests allow you to set far-future HTTP expiration dates on all assets,
  # yet still be able to expire them through the digest params.
  config.assets.digest = true

  # Adds additional error checking when serving assets at runtime.
  # Checks for improperly declared sprockets dependencies.
  # Raises helpful error messages.
  config.assets.raise_runtime_errors = true

  # Raises error for missing translations
  # config.action_view.raise_on_missing_translations = true
end

southwest-checkin-3's People

Contributors

aortbals avatar davidkassa avatar dependabot-preview[bot] avatar mkunz7 avatar jbeda avatar flyize avatar dcjones21 avatar ggruen avatar nickaknudson avatar sguha00 avatar pw10n avatar missouribp avatar cthornton avatar dionlarson avatar mickgiles avatar sarahpythonista avatar

Stargazers

Panda avatar Josh Johanning avatar Kyle Reeves avatar  avatar Matthew Kitchin avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar Matthew Kitchin avatar  avatar

southwest-checkin-3's Issues

Migrate from v2 to v3?

I have a server running the old v2 code. Is there an easy way to migrate to this version, while keeping all user logins and reservations from the old system?

Thanks for all the work. Glad to see someone who knows what they're doing back working on this!

Add reservation error

I'm a long time user of the previous versions of this app. My last working instance was a local Ubuntu instance of version 2. It is getting an error now adding a reservation. I decided to try your version in a new Heroku instance. I tried adding 2 separate flights, and they both error out.
Any ideas?
There was a problem retrieving your reservation. Please check the following fields to make sure they are correct:
Payload can't be blank
User reservations is invalid

Issue running in Heroku (and elsewhere)

I'm trying to run your updated version and I'm getting this error when deploying to Heroku.

Directly inheriting from ActiveRecord::Migration is not supported. Please specify the Rails release the migration was written for:

  class CreateAirports < ActiveRecord::Migration[4.2]

Check-in didn't fire with Heroku dyno sleeping

I had the worker and web dyno set to enabled. The web dyno was sleeping. The check-in should have launched at 6:50 (CDT). At 6:53, still hadn't happened. I hit the web interface and woke it up, and the check-in happened immediately. This is the same behavior I saw with the previous versions of the app. The worker Dyno was definitely set to enabled. Did you say previously that leaving the worker thread enabled should have been sufficient? If I have to keep the web thread online, I could do that with Uptime Robot, and then maybe allow web to sleep at night and stop the worker process with this add on? https://devcenter.heroku.com/articles/process-scheduler
Any thoughts?

Failed checkin tonight

Running the latest version on Heroku. I've had no problems for a long time. Checkins failed tonight.
This is what I found in the logs. Any ideas?
13 Feb 2020 16:40:01.781336 <190>1 2020-02-13T22:40:01.297542+00:00 app worker.1 - - D, [2020-02-13T22:40:01.297347 #4] DEBUG -- : ETHON: performed EASY effective_url=https://mobile.southwest.com/api/extensions/v1/mobile/reservations/record-locator/*****/boarding-passes response_code=503 return_code=ok total_time=0.450938 Heroku/Syslog drain 13 Feb 2020 16:40:01.783306 <190>1 2020-02-13T22:40:01.310335+00:00 app worker.1 - - D, [2020-02-13T22:40:01.310209 #4] DEBUG -- : �[1m�[36mCheckin Load (1.8ms)�[0m �[1m�[34mSELECT "checkins".* FROM "checkins" WHERE "checkins"."flight_id" = $1 LIMIT $2�[0m [["flight_id", 64], ["LIMIT", 1]] Heroku/Syslog drain 13 Feb 2020 16:40:01.783186 <190>1 2020-02-13T22:40:01.354014+00:00 app worker.1 - - D, [2020-02-13T22:40:01.353880 #4] DEBUG -- : �[1m�[35m (2.5ms)�[0m �[1m�[35mBEGIN�[0m Heroku/Syslog drain 13 Feb 2020 16:40:01.783336 <190>1 2020-02-13T22:40:01.357226+00:00 app worker.1 - - D, [2020-02-13T22:40:01.357106 #4] DEBUG -- : ETHON: performed EASY effective_url=https://mobile.southwest.com/api/extensions/v1/mobile/reservations/record-locator/*****/boarding-passes response_code=500 return_code=ok total_time=0.505351 Heroku/Syslog drain 13 Feb 2020 16:40:01.783288 <190>1 2020-02-13T22:40:01.363891+00:00 app worker.1 - - D, [2020-02-13T22:40:01.363791 #4] DEBUG -- : �[1m�[36mFlight Load (9.3ms)�[0m �[1m�[34mSELECT "flights".* FROM "flights" WHERE "flights"."id" = $1 LIMIT $2�[0m [["id", 64], ["LIMIT", 1]] Heroku/Syslog drain 13 Feb 2020 16:40:01.783189 <190>1 2020-02-13T22:40:01.368750+00:00 app worker.1 - - D, [2020-02-13T22:40:01.368650 #4] DEBUG -- : �[1m�[35m (2.9ms)�[0m �[1m�[31mROLLBACK�[0m Heroku/Syslog drain 13 Feb 2020 16:40:01.783319 <190>1 2020-02-13T22:40:01.369974+00:00 app worker.1 - - E, [2020-02-13T22:40:01.369872 #4] ERROR -- : Error performing CheckinJob (Job ID: 498c7cf1-e44a-4dbf-a4cb-9c0e8c314e3c) from Sidekiq(checkin) in 536.16ms: JSON::GeneratorError (source sequence is illegal/malformed utf-8): Heroku/Syslog drain

Error at startup

Sorry for the format, but I think this is all one line. I get this error at startup. I do not have a flight with an ID of 2. I did previously, I deleted it, but I still get this error at startup. Is there some way to manually purge it? It seems like it is a stuck job somewhere. I don't think it is actually causing a problem. Everything is working great. Thank you!

Aug 23 06:03:49 **checkin app/worker.1: 4 TID-gn3sp58s0 WARN: {"context":"Job raised exception","job":{"class":"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper","wrapped":"CheckinJob","queue":"checkin","args":[{"job_class":"CheckinJob","job_id":"40282890-2248-4011-a017-6b09139a3434","provider_job_id":null,"queue_name":"checkin","priority":null,"arguments":[{"_aj_globalid":"gid://southwest-checkin/Flight/2"}],"executions":0,"locale":"en"}],"retry":true,"jid":"851658833aa6985b555f30f5","created_at":1565707389.6293173,"enqueued_at":1566558229.5856776,"error_message":"Error while trying to deserialize arguments: Couldn't find Flight with 'id'=2","error_class":"ActiveJob::DeserializationError","failed_at":1566558229.6815257,"retry_count":15,"retried_at":1566485192.843961,"processor":"fac031ea-303c-4c86-9e20-22b2fb8d4b34:4"},"jobstr":"{\"class\":\"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper\",\"wrapped\":\"CheckinJob\",\"queue\":\"checkin\",\"args\":[{\"job_class\":\"CheckinJob\",\"job_id\":\"40282890-2248-4011-a017-6b09139a3434\",\"provider_job_id\":null,\"queue_name\":\"checkin\",\"priority\":null,\"arguments\":[{\"_aj_globalid\":\"gid://southwest-checkin/Flight/2\"}],\"executions\":0,\"locale\":\"en\"}],\"retry\":true,\"jid\":\"851658833aa6985b555f30f5\",\"created_at\":1565707389.6293173,\"enqueued_at\":1566558229.5856776,\"error_message\":\"Error while trying to deserialize arguments: Couldn't find Flight with 'id'=2\",\"error_class\":\"ActiveJob::DeserializationError\",\"failed_at\":1566345188.3116784,\"retry_count\":15,\"retried_at\":1566485192.843961}"}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.