Forem Creators and Builders 🌱

Cover image for Can someone share his/her .env and docker-compose.yml files?
Muhammed Cetin
Muhammed Cetin

Posted on

Can someone share his/her .env and docker-compose.yml files?

Hello everyone,

I've been trying to install forem on Docker on Ubuntu 18.04 but I cannot success. I've tried to install it on Heroku, fail again. I've fullfilled Fastly, HoneyBadger, Amazon AWS and Cloudinary API settings on .env file and use the file in docker-compose.yml file via the setting below:

env_file:
- .env

I can install it on Development but in this time the chunk .js files cannot be loaded. They throw 404 errors.

When I'm trying to install on Production environment it throw "SECRET_KEY_BASE" error when rails loading. I've been tried a lot of methods to solve these errors, but each time I've gotten different errors.

Finally, @manuel and @akhil I've read your comments and tutorials but the errors persist.

Can you share your .env, docker-compose.yml, Containerfile files with hiding your secret values with me, please. I'm so tired :(

Have a good day.

Top comments (9)

Collapse
 
akhil profile image
Akhil Naidu • Edited

Hey, in Heroku the most important part is to add necessary plugins, build packs and ENV variables. I will list those names here.

Plugins/add-ons:

  1. Postgress
  2. Redis

Build packs(order is important):

  1. Nodejs
  2. Ruby
  3. PGBouncer

ENV(must configure variables):

  1. APP_DOMAIN=#name of your Heroku app without https
  2. APP_PROTOCOL=https://
  3. HONEYBADGER_API_KEY=#create an account
  4. FOREM_OWNER_SECRET=#some random password
  5. SECRET_KEY_BASE=#use "rake secret" to get this random string

Few points to remember

  1. Forem got rid of Elasticsearch, so any old users, it is easy and monetarily best to configure Forem in Heroku, if you are in US or UK. For others Dokku can be taken as second option. I'm actually writing a separate article on both these, so keep a watch on it
  2. Imgproxy is also a important installation, many people even forgot its existence while configuring Heroku, so if that is the case please add Cloudinary plugin/addon in Heroku

Following all these will give you a working Forem in Heroku but if you are using free plan, it will crash in a minute or two. At least I you can reach till hear think of getting standard tier of Heroku.

Collapse
 
ce7in profile image
Muhammed Cetin

I've done what you said but there is no change. On Heroku, I've assigned all .env variables and Buildpacks in correct order, it shows me the error message below:

NoMethodError: undefined method `protocol' for nil:NilClass

[PROJECT_ROOT]/app/lib/url.rb:67 :in `local_image`
Enter fullscreen mode Exit fullscreen mode

def self.local_image(image_name, host: nil)
host ||= ActionController::Base.asset_host || url(nil)
ActionController::Base.helpers.image_url(image_name, host: host)
end

I've forked forem on github and used GitHub connection as a deployment method. Then, I deployed it manually by using the "Manuel Deploy" section on Heroku.

I've also add Tier-1 dynos, Standard-0 Postgresqland Premium-0 Redis Add-ons.

What do I do wrong?

Collapse
 
akhil profile image
Akhil Naidu

Did you added honeybadger api keys? And https?

Thread Thread
 
ce7in profile image
Muhammed Cetin

Ofcourse. I've added an image below. You can see all filled variables.

forem.dev/remoteimages/uploads/art...

If you have a few minutes and share your main e-mail address here, I can add you as an owner on Heroku. If you can help, I will be so grateful.

Thread Thread
 
akhil profile image
Akhil Naidu • Edited

Did you updated the Forem to the latest version. If not first update it.

Whatever is the case, from the ENV screenshot you have sent I was not able to see one of the critical environmental variable for any Production, i.e., SECRET_KEY_BASE.

Thread Thread
 
ce7in profile image
Muhammed Cetin

How can I create a SECRET_KEY_BASE on Heroku. I think it is created by the command "rake credentials:edit". There is a way to do that on Heroku?

Thread Thread
 
akhil profile image
Akhil Naidu

You can get SECRET_KEY_BASE value, by executing the command rake secret within the Heroku machine (in Heroku terminal). Usually there are two ways to do it.

  1. You can install Heroku cli within your local PC and can directly access Heroku bash from your local terminal. (But if you are beginner, I suggest you to check the second option)

  2. If you are only familiar with Heroku through GUI, this is best suited for them. With in you app settings, at the top right corner you can see an option "More". Upon clicking on more you can now see a menu list which contains an option to access terminal, i.e., "run console". Clicking on run console will pop up a window to run Heroku commands. Within this type the command "bash" and press on "run", this will give access to Heroku bash/terminal.

Ta..da.., using one of above the two procedures you can access Heroku Terminal.

Once you have access to Heroku Terminal, just run the command, rake secret. This will result in providing you with a randomly generated string. Now you can use this randomly generated string as the value to your SECRET_KEY_BASE environmental variable.

Collapse
 
ce7in profile image
Muhammed Cetin

Thank you for your reply Akhil, should I add the env variables on Heroku Config Vars section or just .env file?

Collapse
 
akhil profile image
Akhil Naidu

In Heroku