The command "bin/rails s -p 3000 -b 0.0.0.0" is working fine but in the development environment even with the custom domain name.
While trying to run the rails in production with the command "bin/rails s -e production -p 3000 -b 0.0.0.0", everything fails even though the env variables are set to production in the .env file.
Errors like:
"WARNING: table: "settings_communities" does not exist or not database connection, Settings::Community.community_name
fallback to returns the default value.
WARNING: table: "settings_rate_limits" does not exist or not database connection, Settings::RateLimit.user_considered_new_days
fallback to returns the default value.
Exiting
/home/ubuntu/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/activerecord-6.1.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:19:in `exec': PG::UndefinedTable: ERROR: relation "tags" does not exist (ActiveRecord::StatementInvalid)
LINE 8: WHERE a.attrelid = '"tags"'::regclass
^
[Note: the settings_communities and other table names displayed in the error messages are there available in the database; and the db connectivity is good if I just run the command "bin/rails s -p 3000 -b 0.0.0.0".
Any guidance how to run the local installation to production?
thanks.
Top comments (11)
Hey!
What you are trying to acheive is a to create a production instance based upon development instance.
I would suggest you not doing that
Problems you might face
And there are many more and out of which => few of the problems are the problems you are facing right now, "which is evident from your last couple of posts"
Solution to resolve
Forem has a detailed guide on selfhosting and the team quickly respond to your help tags; if you are following according to the documentation and the required backend eco-system.
If you want to install Forem on your own, using Heroku or Dokku, you need to have prior knowledge of these technolgies and understand the nuances of the Forem.
To summerise
Thanks for the advice, but I already went down this road.
If someone has a good explanation why the env variables set to production don't work on a VM environment, it would be great.
Is just setting the development environment to production environment and making it work such a hard thing for the community of developers? Hard to believe!!
See, development instance is meant for testing, adding, removing or updating new features. It is to make the life of developers easy; it is not meant for production.
Think of development instance as a living but barely surviving application. Once the feature is working without any issues, we will then push it to production.
Exactly, I agree with you; my question is how do we push it to production?
I would like to know if there is a way to push to production other than Dockers and Ansible way.
Looking for a regular developer to answer, no offence meant.
Thanks.
For using your custom repo
In my knowledge, there are two ways to push your own modified code to production.
Alternative to Heroku
In the option 2, if you prefer hosting on your own dedicated server => the alternative to Heroku is dokku. Dokku is extremely similar to Heroku, but based on selfhost.
Leewardslope is a Forem instance that is based on Dokku and by Personal Repository
leewardslope / leewardslope
A community for constructive discussions; inspired by Forem.
Foremπ±
For Empowering CommunityWelcome to the Forem codebase, the platform that powers dev.to. We are so excited to have you. With your help, we can build out Foremβs usability, scalability, and stability to better serve our communities.
What is Forem?
Forem is open source software for building communities. Communities for your peers, customers, fanbases, families, friends, and any other time and space where people need to come together to be part of a collective See our announcement post for a high-level overview of what Forem is.
dev.to (or just DEV) is hosted by Forem. It is a community of software developers who write articles, take part in discussions, and build their professional profiles. We value supportive and constructive dialogue in the pursuit of great code and career growth for all members. The ecosystem spans from beginner to advanced developers, and all are welcome to find their placeβ¦
t2d, Under Construction!
I'm also, working a project related to this; where the users points
leewardslope / t2d
TUI for Dokku-CLI
What is t2d?
t2d aka Talk to Dokku; is a beautiful Terminal User Interface(TUI) powered by dokku. With t2d you will be able to deploy apps in most popular programming languages, link them to most popular databases and all that with almost zero configuration from your side. Apart from all these amazing features it will also save you money along the way.
Our Vision
We started to work on this because current deployment solutions were expensive or hard to configure. With t2d we plan to provide a solution where deployment experience is smooth, enjoyable and affordable.
What is Dokku?
Dokku is Docker-powered Heroku-like tool that allows you to deploy complex applications by simply pushing it via Git repository. Behind the scenes it runs on herokuish, which essentially is emulating same functionalities that you are using when you deploy your apps on Heroku. As it supports all the Heroku buildpacks, itβ¦
Quick References
Production: Forem on Heroku
Akhil Naidu γ» Jun 9 γ» 4 min read
Production: Installing Forem using t2d script.
Akhil Naidu γ» Jun 23 γ» 3 min read
Step by Step tutorial on how to install Forem
Akhil Naidu γ» Jul 8 γ» 2 min read
Hey @9comindia !
I see you have a lot of questions and want to try to help you out.
Before I do, can you give me an overall idea of what you are trying to do with Forem? If I am remembering correctly you are not using Forem self-host right?
If we have a little idea of what you are trying to accomplish with Forem I think the team would be able to offer more help.
Hi @coffeecraftcode , if your query was about the purpose of my forem instance, I am trying to create a web platform and an android app for people to have logical discussions on various topics. (Topics are yet to be decided).
I still have many custom requirements like restricting the user roles on creating new topics/tags, approval mechanisms, etc. apart from the credit and badges changes.
But I need to get the web site and android app running before getting into the customization help.
Here is the website. logicrace.com
The blocker issues right now are:
[Note: I didn't use the Dockers as well, it's just a plain local installation on the cloud VM]
Thank you.
Hey!
Thanks for the added detail. I was asking for the purpose of your instance so I could get a better idea of what you were using the code for and to see if we could help.
I've talked to the team about your questions here and while we fully encourage you to continue asking the community on forem.dev for help if anyone else has used a similar set up, this is outside of our recommended self-host path and as such we cannot provide support.
Our team endeavors to help people out who are following the forem/selfhost instructions and getting stuck. Unfortunately we can't offer much help in this instance since the way you are using Forem is unknown territory for us as well.
Best of luck as you continue to work on this project! If you do decide to use the self-host repo instead of the path you're currently taking let us know and we'll be happy to help if you get stuck :)
If it is ok with you I would love to add all of your questions in to one post that we can tag with #communityhelp to see if anyone else in the community has a similar set up to you and can offer advice. Would you be ok with me doing that and posting it under the Forem team for more visibility? That way if you have any more qusetions you can also just comment on that post instead of having to create another.
That's great! thank you.
Here is the post with your #help posts in one place. Hopefully some community members can help you get things sorted π€
Questions from the Community: Can you help?
yes, I am not using Forem selfhost, I am using the github.com/forem/forem.git code to deploy on a ubuntu cloud VM (other than aws, gcp and digitalocean) in production. [Not using the Dockers, plain local installation on the cloud VM instance]
Till now, I am able to do are:
5 Image upload is happening, but the storage is happening on the VM locally.
Major issue pending:
I am suspecting this issue is because my rails server is running in development mode instead of the production mode.
{Note: I have already set Rails, Node and Rack environments to production in the .env file. But the Rails server is taking only the development mode.]
So could you please help me on steps how do I change my development environment to production environment? thank you.