Forem Creators and Builders

loading...

local Forem Instance to Production level Instance in Heroku or VPS

akhil profile image Akhil Naidu ・Updated on ・1 min read

After several trials in various operating systems with a different way of installation procedures, finally, I was able to install Forem in my local machine.

  1. Linux + Docker combination is a hassle-free installation.

  2. Windows with WSL with the documentation is also pretty good.

  3. Mac + Docker is easy peasy.


Now I have a local instance, but pushing it to Heroku is not an easy task; I was encountering a lot of errors.

So I decided to look over the complete documentation of Forem before pushing it to Heroku. During this process, I learned a lot about rails and foreman and found some interesting points which might have a reason for the failure of production Forem instance.

  1. Almost all env variables are essential.
  2. Addons like Redis, ElasticSearch, Postgres are crucial.

Noting these developments, I restarted my trials to push my development local instance to Heroku for a production instance but failed 😑.

I am not a developer and not sure what I am missing here, and if anyone can suggest to me how to proceed to the next phase, please guide me through it.

Discussion (9)

Collapse
ben profile image
Ben Halpern

We're definitely lacking the docs to give good guidance here.

  • How about we pledge to circle back with some good instructions :)
Collapse
akhil profile image
Akhil Naidu Author

The moment I saw this reply from you, Ben, I was attached to my chair and keyboard -I was typing some reply, then erasing back to first and rethinking how to reply to this.

I realized that I don't have any words; I would be waiting for that documentation 😇.

Collapse
akhil profile image
Akhil Naidu Author

I searched in Docs but failed to find any. Can I have an update on this?

Collapse
joaotorres profile image
Joao Torres

I managed to run it locally on a Mac running Postrgres and ElasticSearch with Docker and it wasn't too much hassle, but gave me the impression that on Heroku it wouldn't be as easy.

As self-hosting was openly discouraged by the devs I'm looking around to figure out how to proceed.

Collapse
akhil profile image
Akhil Naidu Author

For the official rollout, with proper documentation; we should wait till the first quarter of 2021.

Also, I'm not sure about, "how it would be" and "when it would be", but it will be much easier for an individual to configure and host Forem in their own VPS (Which is more cost-efficient, for smaller communities)

Collapse
lee profile image
Lee

Do you want to drop some of the errors / issues you are facing in this thread and I’ll see what I can help with?

Collapse
akhil profile image
Akhil Naidu Author

@lee Wynne

I'm back again to check the updates if the ready to dev is available or not, but realised that it might take some more time.

Also, I've gone through the entire procedure to have a production forem; failed again! The build was successful, but the release phase in Heroku failed me.

Here I'm attaching the release phase error.

+ [[ '' = \b\l\o\c\k\e\d ]]
+ STATEMENT_TIMEOUT=4500000
+ bundle exec rails app_initializer:setup
/app/vendor/bundle/ruby/2.7.0/gems/libhoney-1.14.5/lib/libhoney/client.rb:232: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/app/vendor/bundle/ruby/2.7.0/gems/libhoney-1.14.5/lib/libhoney/transmission.rb:11: warning: The called method `initialize' is defined here
/app/vendor/bundle/ruby/2.7.0/gems/zeitwerk-2.4.0/lib/zeitwerk/loader.rb:581: warning: constant ::Data is deprecated
== Preparing Elasticsearch ==
/app/vendor/bundle/ruby/2.7.0/gems/faraday-1.0.1/lib/faraday/dependency_loader.rb:21: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/app/vendor/bundle/ruby/2.7.0/gems/honeycomb-beeline-2.2.0/lib/honeycomb/integrations/faraday.rb:8: warning: The called method `initialize' is defined here
rails aborted!
Elasticsearch::Transport::Transport::Errors::Forbidden: [403] {"error":{"root_cause":[{"type":"bonsai_exception","reason":"Forbidden action"}],"type":"bonsai_exception","reason":"Forbidden action"},"status":403}
I, [2020-10-11T15:27:17.682607 #109]  INFO -- ddtrace: [ddtrace] DATADOG TRACER CONFIGURATION - {"date":"2020-10-11T15:27:17+00:00","os_name":"x86_64-pc-linux-gnu","version":"0.41.0","lang":"ruby","lang_version":"2.7.1","env":"production","enabled":true,"service":"practical_developer","dd_version":"","agent_url":"http://127.0.0.1:8126?timeout=1","debug":false,"analytics_enabled":false,"tags":"env:production,version:","runtime_metrics_enabled":false,"integrations_loaded":"elasticsearch@7.9.0,sidekiq@6.1.2,redis@4.2.2,rails@6.0.3.3,http@2.7.1,rack@2.2.3,active_support@6.0.3.3,action_pack@6.0.3.3,action_view@6.0.3.3,active_record@6.0.3.3","vm":"ruby-2.7.1","partial_flushing_enabled":true,"priority_sampling_enabled":true,"health_metrics_enabled":false,"integration_elasticsearch_analytics_enabled":"false","integration_elasticsearch_analytics_sample_rate":"1.0","integration_elasticsearch_enabled":"true","integration_elasticsearch_service_name":"elasticsearch","integration_elasticsearch_quantize":"{}","integration_sidekiq_analytics_enabled":"false","integration_sidekiq_analytics_sample_rate":"1.0","integration_sidekiq_enabled":"true","integration_sidekiq_service_name":"sidekiq","integration_sidekiq_tag_args":"false","integration_sidekiq_client_service_name":"sidekiq-client","integration_redis_analytics_enabled":"false","integration_redis_analytics_sample_rate":"1.0","integration_redis_enabled":"true","integration_redis_service_name":"redis","integration_rails_analytics_enabled":"","integration_rails_analytics_sample_rate":"1.0","integration_rails_enabled":"true","integration_rails_service_name":"practical_developer","integration_rails_cache_service":"practical_developer-cache","integration_rails_controller_service":"practical_developer","integration_rails_database_service":"practical_developer-postgres","integration_rails_distributed_tracing":"true","integration_rails_exception_controller":"","integration_rails_middleware":"true","integration_rails_middleware_names":"false","integration_rails_template_base_path":"views/","integration_rails_log_injection":"false","integration_http_analytics_enabled":"false","integration_http_analytics_sample_rate":"1.0","integration_http_enabled":"true","integration_http_service_name":"net/http","integration_http_distributed_tracing":"true","integration_http_split_by_domain":"false","integration_rack_analytics_enabled":"","integration_rack_analytics_sample_rate":"1.0","integration_rack_enabled":"true","integration_rack_service_name":"practical_developer","integration_rack_application":"#\u003cPracticalDeveloper::Application:0x0000557aeb46fcb0\u003e","integration_rack_distributed_tracing":"true","integration_rack_headers":"{:response=\u003e[\"Content-Type\", \"X-Request-ID\"]}","integration_rack_middleware_names":"false","integration_rack_quantize":"{}","integration_rack_request_queuing":"false","integration_rack_web_service_name":"web-server","integration_active_support_analytics_enabled":"false","integration_active_support_analytics_sample_rate":"1.0","integration_active_support_enabled":"true","integration_active_support_service_name":"","integration_active_support_cache_service":"practical_developer-cache","integration_action_pack_analytics_enabled":"","integration_action_pack_analytics_sample_rate":"1.0","integration_action_pack_enabled":"true","integration_action_pack_service_name":"practical_developer","integration_action_pack_controller_service":"practical_developer","integration_action_pack_exception_controller":"","integration_action_view_analytics_enabled":"false","integration_action_view_analytics_sample_rate":"1.0","integration_action_view_enabled":"true","integration_action_view_service_name":"practical_developer","integration_action_view_template_base_path":"views/","integration_active_record_analytics_enabled":"false","integration_active_record_analytics_sample_rate":"1.0","integration_active_record_enabled":"true","integration_active_record_service_name":"practical_developer-postgres","integration_active_record_orm_service_name":""}

INFO -- ddtrace: [ddtrace] DATADOG TRACER CONFIGURATION - {"date":"2020-10-11T15:27:23+00:00","os_name":"x86_64-pc-linux-gnu","version":"0.41.0","lang":"ruby","lang_version":"2.7.1","env":"production","enabled":true,"dd_version":"","agent_url":"http://127.0.0.1:8126?timeout=1","debug":false,"analytics_enabled":false,"tags":"env:production,version:","runtime_metrics_enabled":false,"integrations_loaded":"elasticsearch@7.9.0,sidekiq@6.1.2,redis@4.2.2,rails@6.0.3.3,http@2.7.1","vm":"ruby-2.7.1","partial_flushing_enabled":true,"priority_sampling_enabled":true,"health_metrics_enabled":false,"integration_elasticsearch_analytics_enabled":"false","integration_elasticsearch_analytics_sample_rate":"1.0","integration_elasticsearch_enabled":"true","integration_elasticsearch_service_name":"elasticsearch","integration_elasticsearch_quantize":"{}","integration_sidekiq_analytics_enabled":"false","integration_sidekiq_analytics_sample_rate":"1.0","integration_sidekiq_enabled":"true","integration_sidekiq_service_name":"sidekiq","integration_sidekiq_tag_args":"false","integration_sidekiq_client_service_name":"sidekiq-client","integration_redis_analytics_enabled":"false","integration_redis_analytics_sample_rate":"1.0","integration_redis_enabled":"true","integration_redis_service_name":"redis","integration_rails_analytics_enabled":"","integration_rails_analytics_sample_rate":"1.0","integration_rails_enabled":"true","integration_rails_service_name":"","integration_rails_cache_service":"","integration_rails_controller_service":"","integration_rails_database_service":"","integration_rails_distributed_tracing":"true","integration_rails_exception_controller":"","integration_rails_middleware":"true","integration_rails_middleware_names":"false","integration_rails_template_base_path":"views/","integration_rails_log_injection":"false","integration_http_analytics_enabled":"false","integration_http_analytics_sample_rate":"1.0","integration_http_enabled":"true","integration_http_service_name":"net/http","integration_http_distributed_tracing":"true","integration_http_split_by_domain":"false"}
Enter fullscreen mode Exit fullscreen mode
Collapse
cpluta profile image
Chris Pluta

It's been a while since I've seen this error and got around it. If I remember right I think it might be that Elastic Search may not be setup properly. If you don't have an account we use elastic.co/ and are using the Standard tier.

I hope this helps. 😄

Collapse
bighitbiker3 profile image
Elliott McNary

Hey! I just got around this error.
Elasticsearch::Transport::Transport::Errors::Forbidden 403 is due to the update_settings call in cluster.rb. With the managed Elasticsearch providers on Heroku you're not allowed to edit the settings of the cluster.

I added a rescue block in that code so it looks like

def update_settings
Search::Client.cluster.put_settings(body: default_settings)
rescue StandardError
handle_exception
end

Forem Open with the Forem app