diff --git a/app.json b/app.json index cca08fec2..0d908761c 100644 --- a/app.json +++ b/app.json @@ -28,6 +28,10 @@ "FRONTEND_URL": { "description": "Public root URL of the Chatwoot installation. This will be used in the emails.", "value": "https://CHANGE.herokuapp.com" + }, + "INSTALLATION_ENV": { + "description": "Installation method used for Chatwoot.", + "value": "heroku" } }, "formation": { diff --git a/deployment/setup_18.04.sh b/deployment/setup_18.04.sh index 610cef22b..551b08e63 100644 --- a/deployment/setup_18.04.sh +++ b/deployment/setup_18.04.sh @@ -63,6 +63,7 @@ sed -i -e '/POSTGRES_HOST/ s/=.*/=localhost/' .env sed -i -e '/POSTGRES_USERNAME/ s/=.*/=chatwoot/' .env sed -i -e "/POSTGRES_PASSWORD/ s/=.*/=$pg_pass/" .env sed -i -e '/RAILS_ENV/ s/=.*/=$RAILS_ENV/' .env +echo -en "\nINSTALLATION_ENV=LINUX_SCRIPT" >> ".env" RAILS_ENV=production bundle exec rake db:create RAILS_ENV=production bundle exec rake db:reset diff --git a/deployment/setup_20.04.sh b/deployment/setup_20.04.sh index 7dcace44d..9ab2352a0 100644 --- a/deployment/setup_20.04.sh +++ b/deployment/setup_20.04.sh @@ -70,6 +70,7 @@ sed -i -e '/POSTGRES_HOST/ s/=.*/=localhost/' .env sed -i -e '/POSTGRES_USERNAME/ s/=.*/=chatwoot/' .env sed -i -e "/POSTGRES_PASSWORD/ s/=.*/=$pg_pass/" .env sed -i -e '/RAILS_ENV/ s/=.*/=$RAILS_ENV/' .env +echo -en "\nINSTALLATION_ENV=LINUX_SCRIPT" >> ".env" RAILS_ENV=production bundle exec rake db:create RAILS_ENV=production bundle exec rake db:reset diff --git a/docker-compose.production.yaml b/docker-compose.production.yaml index bda73a089..ba6704d4e 100644 --- a/docker-compose.production.yaml +++ b/docker-compose.production.yaml @@ -15,6 +15,7 @@ services: environment: - NODE_ENV=production - RAILS_ENV=production + - INSTALLATION_ENV=docker entrypoint: docker/entrypoints/rails.sh command: ['bundle', 'exec', 'rails', 's', '-p', '3000', '-b', '0.0.0.0'] @@ -26,6 +27,7 @@ services: environment: - NODE_ENV=production - RAILS_ENV=production + - INSTALLATION_ENV=docker command: ['bundle', 'exec', 'sidekiq', '-C', 'config/sidekiq.yml'] postgres: diff --git a/lib/chatwoot_hub.rb b/lib/chatwoot_hub.rb index 91b5150dc..b34d95bdb 100644 --- a/lib/chatwoot_hub.rb +++ b/lib/chatwoot_hub.rb @@ -14,7 +14,8 @@ class ChatwootHub { installation_identifier: installation_identifier, installation_version: Chatwoot.config[:version], - installation_host: URI.parse(ENV.fetch('FRONTEND_URL', '')).host + installation_host: URI.parse(ENV.fetch('FRONTEND_URL', '')).host, + installation_env: ENV.fetch('INSTALLATION_ENV', '') } end