[#260] One click deploy to heroku (#275)

* [#260] One click deploy to heroku

* Added app.json file for Heroku deployment
* Made changes in Procfile to accept the PORT as env variable
* Added the one click button in README.md

* Change readme and link

* Alignment of button in Readme

* Changing redis to free plan

* Removed node-js build-pack

* Changed the post-deploy script to be rake db:migrate

* Removed web concurrency variable from app.json for heroku

* Changed the link to chatwoot logo referenced in app.json

* Changed postdeploy hook

* Changed logo to be raw content from github

* Changed the SMTP variables

* Added optional conditional for sending mail
* Changed the naming of SMTP variables

* Having logo as base 64 encoded image for heroku deploy page

* Fixed key not found error for SMTP variables

* Correcting the specs for conversation assignment mailer

* Spec rubocop fixes

* Spec rubocop fixes
* Added the link to master for heroku app.json
This commit is contained in:
Sony Mathew 2019-11-24 17:19:14 +05:30 committed by GitHub
parent b6186e93e7
commit 70e4cc08b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 84 additions and 13 deletions

View file

@ -3,11 +3,11 @@ FB_VERIFY_TOKEN=
FB_APP_SECRET=
FB_APP_ID=
#ses
#mail
SES_ADDRESS=
SES_USERNAME=
SES_PASSWORD=
SMTP_ADDRESS=
SMTP_USERNAME=
SMTP_PASSWORD=
#misc
FRONTEND_URL=http://localhost:3000

View file

@ -1,2 +1,2 @@
backend: bin/rails s -p 3000
backend: bin/rails s -p ${PORT:=3000}
frontend: bin/webpack-dev-server

View file

@ -30,6 +30,12 @@ Detailed documentation is available at [www.chatwoot.com/docs](https://www.chatw
You can find the quick setup docs [here](https://www.chatwoot.com/docs/quick-setup).
## Heroku one-click deploy
Deploying chatwoot to heroku, it's a breeze. It's as simple as clicking this button.
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/chatwoot/chatwoot/tree/master)
## Contributors ✨
Thanks goes to all these [wonderful people](https://www.chatwoot.com/docs/contributors):

62
app.json Normal file

File diff suppressed because one or more lines are too long

View file

@ -3,6 +3,8 @@ class AssignmentMailer < ApplicationMailer
layout 'mailer'
def conversation_assigned(conversation, agent)
return if ENV.fetch('SMTP_ADDRESS', nil).blank?
@agent = agent
@conversation = conversation
mail(to: @agent.email, subject: "#{@agent.name}, A new conversation [ID - #{@conversation.display_id}] has been assigned to you.")

View file

@ -58,10 +58,10 @@ Rails.application.configure do
config.action_mailer.perform_caching = false
config.action_mailer.default_url_options = { :host => ENV['FRONTEND_URL'] }
config.action_mailer.smtp_settings = {
:address => ENV['SES_ADDRESS'],
:address => ENV['SMTP_ADDRESS'],
:port => 587,
:user_name => ENV["SES_USERNAME"],
:password => ENV["SES_PASSWORD"],
:user_name => ENV["SMTP_USERNAME"],
:password => ENV["SMTP_PASSWORD"],
:authentication => :login,
:enable_starttls_auto => true
}

View file

@ -58,10 +58,10 @@ Rails.application.configure do
config.action_mailer.perform_caching = false
config.action_mailer.default_url_options = { host: ENV['FRONTEND_URL'] }
config.action_mailer.smtp_settings = {
address: ENV['SES_ADDRESS'],
address: ENV['SMTP_ADDRESS'],
port: 587,
user_name: ENV['SES_USERNAME'], # Your SMTP user
password: ENV['SES_PASSWORD'], # Your SMTP password
user_name: ENV['SMTP_USERNAME'], # Your SMTP user
password: ENV['SMTP_PASSWORD'], # Your SMTP password
authentication: :login,
enable_starttls_auto: true
}

View file

@ -1,2 +1,2 @@
backend: ../bin/rails server -b 0.0.0.0 -p 3000
backend: ../bin/rails server -b 0.0.0.0 -p ${PORT:=3000}
frontend: ../bin/webpack-dev-server

View file

@ -67,7 +67,8 @@ RSpec.describe Conversation, type: :model do
# send_email_notification_to_assignee
expect(AssignmentMailer).to have_received(:conversation_assigned).with(conversation, new_assignee)
expect(assignment_mailer).to have_received(:deliver)
expect(assignment_mailer).to have_received(:deliver) if ENV.fetch('SMTP_ADDRESS', nil).present?
end
end