Rails JSON API RESTful Server, that also handles Shopify Webhooks and a Rails Cron-Job Worker.
- Waffle Board
- Mail-Funnel Server API
- Mail-Funnel Client
- Mail-Funnel Client-Server WIKI
- Mail-Funnel Client-Server ISSUES
You must first start the Sidekiq Worker Server
bundle exec sidekiq -c 10 -q mailers
Then you run the server
bundle && rails db:reset && bundle exec rails s -p 3001 // or simply bundle exec rails s -p 3001
Then you start the client
bundle && rails db:reset && bundle exec rails s // or simply bundle exec rails s
URL + DNS
TODO: Replace herokudns.com with .herokuapp.com
## PRODUCTION https://mail-funnel-server.herokuapp.com/ # CNAME ENTRIES App URL: api.mailfunnels.com App DNS: api.mailfunnels.herokudns.com # #STAGING https://mail-funnel-server-staging.herokuapp.com # CNAME ENTRIES APP URL: staging.api.mailfunnels.com APP DNS: staging.api.mailfunnels.herokudns.com APP URL: www.staging.api.mailfunnels.com APP DNS: www.staging.api.mailfunnels.herokudns.com
www.staging.mailfunnels.herokudns.com ## PRODUCTION https://mail-funnel-client.herokuapp.com/ # CNAME ENTRIES App URL: mailfunnels.com App DNS: mailfunnels.herokudns.com ## STAGING https://mail-funnel-client-staging.herokuapp.com/ # CNAME ENTRIES APP URL: staging.mailfunnels.com APP DNS: staging.mailfunnels.herokudns.com APP URL: www.staging.mailfunnels.com APP DNS: www.staging.mailfunnels.herokudns.com
Contribute code to the mail-funnel-server. Notify us if you are interested in joining the team, or fork us, and submit a pull request!
Github Dev-Ops Integrations (Services)
Github addons that we installed have configured to use automatically when we push or deploy code (depending on when each service is congured to run)!
- List of Git Addons, TODO: https://github.com/stevemao/awesome-git-addons
- GitBook - http://gitbook.com
- Code Climate: Code Quality Scanner
- CodeCov: Code Coverage Tool
- DeppBot: Gem (Dependency) scanner that finds any security issues in any installed gems, and out-dated incompatible gem versions
Slack Commands + Addons
The Slack Services and Tools we have implemented, and their usage.
- Leap (Currently used)
/leap — Share your browser window to a private URL. /leap screen — Share your entire screen to a private URL. /leap broadcast browser — Share your browser window to your personal URL. /leap broadcast screen — Share your entire screen to your personal URL.
The purpose of this server is to serve the mail-funnel-client (soon available in app-store) with the following services: Shopify Webhooks, REST CRUD JSON Web-Services and a Ruby background-job worker.
- Shopify Webhooks - Shopify-API is configured and authenticated and the hooks are ready in /app/api/api.rb
REST JSON Web-Services
- REST Web-Service JSON API that serves CRUD operations for
- Security: https://www.codeschool.com/blog/2014/02/03/token-based-authentication-rails/
Sends emails using SendGrid
Possible Rails Libraries:
- Config ActionMailer to use Sendgrid - https://sendgrid.com/docs/Integrate/Frameworks/rubyonrails.html
- Sendgrid Ruby Lib - https://sendgrid.com/docs/Integrate/Code_Examples/v2_Mail/ruby.html
- A background process (IE: Job / Worker)
- We use Heroku Scheduler: https://devcenter.heroku.com/articles/scheduler
- Heroku Jobs: https://devcenter.heroku.com/articles/scheduled-jobs-custom-clock-processes
- Heroku Alternative Worker: https://devcenter.heroku.com/articles/delayed-job
- One last alternative that is compatible - https://github.com/Rykian/clockwork
- Worker runs every 5 minutes , iterating through each row in the Jobs table
- The Worker checks each Job's and evaluates if it should be executed based on this algorithm:
1. Evaluate the Job's "frequency" value and "frequency-value" value. 1.1 `Frequency:String` = execute_once (default), (currently disabled: execute_twice, execute_thrice) 1.2 `Frequency-Value::Integer` (military-style / minutes are multiples of 5) = 0030, 1100, 1345, 2005 2 Check the `Executed:Boolean` param, check if job has been executed yet 2.1 (Disabled)'Executed_Count:Integer` param (record how many times it has been executed)
- Job Host - Worker: Iterates through client Jobs, and sends emails to everybody on list
- Crono: Time based worker - https://github.com/plashchynski/crono
Mailers / Sendgrid Mailers
- Sendgrid-ActionMailer - https://github.com/eddiezane/sendgrid-actionmailer
- CI Server - https://github.com/travis-ci
- First download and install Ngrok (http://ngrok.com but we have a in our apps/bin), and run it
./ngrok http 3001 # This starts ngrok
You will need to configure your .env first. The .env can be used with the
RAILS_ENV=Development APP_NAME=mailfunnel-server APP_KEY=##KEY######## APP_SECRET=##SECRET### APP_URL=http://GENERATED-URL.ngrok.io/api/ # Or your servers URL APP_SCOPE = "read_orders, read_products"
Then run the server on port 3001
rails s -p 3001
Mail-Funnel REST Server
Rails JSON REST API http://mailfunnel.bluehelmet.io Shopify API Endpoint http://mailfunnel.bluehelmet.io/api/
API JSON Authentication (Task)
- (Task) Setup Gelato - https://gelato.io/
- Ruby on Rails application hosting.
Travis-CI OR Circle-CI
Dependency Security Analyzer
- Github Webhook trigers an audit after every push