Deploying Ruby on Rails apps to Railway - ruby-on-rails

I hope you are all well!
For several days now I have been trying to deploy a simple rails app to Railway.app, and failing catastrophically and repeatedly to get it to run.
Here is the github repo:
https://github.com/CaffieneSage/blogApp-rails-
The error I am getting is during the deploy step specifically:
bundler: not executable: bin/rails
I have successfully deployed apps to heroku in the past. I suspect there is something simple that I am missing. I have tried rerolling and deploying the default rails app to simplify things. I have made sure to us postgres instead of SQLite3 as the db. I have spun up an instance of postgres on railway and tried to set my environment variables to point to it. I have had a go within the CLI as well.
Thanks in advance for any advice you may have to offer!
This is my first post on stack overflow, please go easy on me ;]

The issue likely stems from the script bin/rails not having the executable bit on the file.
You can see the file permissions using ls:
ls -l bin/
All of the files will display:
-rw-r—r—
These need to have the executable bit set, so you can run something like:
chmod +x bin/*
After which all the files should have this permission set:
-rwxr-xr-x
Don’t forget to commit the changes.
Read more on file permissions: https://en.wikipedia.org/wiki/File-system_permissions

Related

Following tutorial for installing Ruby on Rails for Heroku. Currently stuck

very new to all this. I am following a tutorial to get Heroku running through ruby on rails.
I have Microsoft Windows so I am currently following Heroku's official tutorial and am stuck here
I installed PostgresSQL 10.1 using windows installer x86-64 and have noted my login information for Postgres.
However, I do not understand this part:
Remember to update your PATH environment variable to add the bin
directory of your Postgres installation. The directory will be similar
to this: C:\Program Files\PostgreSQL\<VERSION>\bin. If you forget to
update your PATH, commands like heroku pg:psql won’t work.
The closest thing I could find to an explanation and tutorial was this Java site.
I went inside Enviromental Variables and set the system path to: C:\Program Files\PostgreSQL\10\bin
However, when I tried testing it out by typing in heroku pg:psql, it said no app specified so I'm unsure if I did it correctly or not.
Also, the next tutorial step is:
Open the config\database.yml file and set the username and password
for your local (development) database. Look for these line:
I searched and I have no such file on my computers. Needless to say, I'm stumped. Any assistance to progress through the tutorial is appreciated. Thank you.
regarding your first error, the problem is that you are not specifying for which app you want to open the database cli (psql). Hopefully, the solution is easy:
heroku pg:psql --app app_name
# or
heroku pg:psql -a app_name
About the second question, the tutorial assumes that you have already created an application.
If you go to the root path of your project, you will find some subfolders such as app, config, db, lib, public, tmp, vendor.. Here you will find config\database.yml.

Ruby on rails KeyError environment variable

I experience an error : 'fetch': key not found: "APPLICATION_HOST" (KeyError)'
This errors occurres since I tried to implement a new gem that requires dotenv gem. That produced a lot of tries to fix. I revert my code to a stable one but I still cannot run my app supposed related to my machine configuration.
For now none of my environment variables in my .env file can be read by the app.
A teammate has the same code as mine and hasn't any config in his ~/.bashrc neither in ~/.bash_profileand our .env file has chown readable states.
Last information we use a gemset for this project.
Thanks by advance for any help
I solved the problem by cloning the repo in another folder and the project runs again!

Difference between "Redmine on Heroku" and "Installing Redmine" documentation

My intention is to install Redmine on Heroku.
On redmine.org, there are two docs that I came across:
http://www.redmine.org/projects/redmine/wiki/RedmineInstall http://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_on_Heroku.
I know the second doc is self-explanatory in its title but I want to know if I follow the first doc's instructions, would I be able to still deploy Redmine to Heroku. OR is it better that I follow the second doc's instructions?
A noob at this, any feedback would be appreciated. Thanks in advance.
==============
Following the Heroku specific instructions (step 5), I tried to run rake generate_secret_token using Ruby's CMD however I get back 'Please configure your config/database.yml first'. There are two related files in two different locations. C:\Users\\redmine\config AND from C:\Users\\Desktop\\redmine-2.5.1\config. Which database.yml do I use? The config file on the second path has only database.yml.example. Do I make the change there and save it as 'database.yml'? Or do I make the change in the first location, cd to the first location and run rake generate_secret_token?
Follow the Heroku-specific instructions. The first document explains how to install Redmine on a server that you have full (root) control over. It entails logging into the machine and running various commands to install software.
Heroku does not give you a full server instance in the way the first document requires. Instead, you work on your application on your own machine and push it from there to Heroku. Things like database setup are configured through Heroku addons. You do not get access to the filesystem, which is in fact read-only.
The first document wouldn’t work for installing on Heroku.

aws.push command not running .config commands or container_commands

I have a simple setup with a load-balanced application and want to run some commands for cron setups (for instance, using the whenever gem). However, none of my commands seem to get run on the remote server.
# .elasticbeanstalk/Production.config
container_commands:
20_update_crontab:
command: whenever --update-crontab app
leader_only: true
Even tried:
# .elasticbeanstalk/Production.config
commands:
update_crontab:
command: whenever --update-crontab app
Is there something I am missing? These should run with git aws.push correct?
When I check the logs, I don't really get any information saying it was trying to run:
$ eb logs | grep whenever
Using whenever (0.9.2)
The descriptions on this page are pretty good, just can't figure out why it isn't running.
http://www.infoq.com/news/2012/11/elastic-beanstalk-config-files
Elastic Beanstalk configuration files should be placed in .ebextenstions/. It looks like yours are in .elasticbeanstalk/
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers.html
Create a configuration file with the extension .config (e.g., myapp.config) and place it in an .ebextensions top-level directory of your source bundle.
I had a similar problem where I was trying to install libjpeg for my EC2 instance using the configuration files and it was never installed. I tried everything and was never able to find a "good solution", but I did solve it though.
Solution:
How to solve it? Set up a completely new Elastic Beanstalk Application and deploy the same app again. After I did this it worked from the start with the new EB App.
Check out my other answer here: https://stackoverflow.com/a/23109410/2335675
Check it out, hope it helps for you.

Rails sprocket Error compiling CSS assest - CHOWN issue

I've been breaking my head over this for over 2 days now, and can't seem to figure out where the problem is. This is mostly a problem related to my setup, but if anyone could help me find a solution to this problem, then I'll be his slave for eternity..!
I'm running Snow leopard(host) and VMware fusion running Ubuntu Lucid server (guest OS). Somehow after a lot of head-banging I managed to get my workspace shared from Mac to Ubuntu. So, essentially I've been able to isolate my dev environment on a VM, which makes it easy for the entire dev team to be on the same environment irrespective of their host OS / setting, etc. While, it certainly has made everything easy, I'm stuck with a specific problem occurring due to sprockets (I guess). Every time I make changes to my stylesheets and reload, I get this error:
Error compiling CSS asset
Errno::EPERM: Operation not permitted - /mnt/hgfs/banjarey/tmp/cache/assets/DCF/780/sprockets%2F5f78b3457def1d02bd3fb75d4e0cfb63
/home/coderboy/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/core_ext/file/atomic.rb:38:in `chown'
The strage thing though is that if I reload the page twice or thrice, the css compiles and everything works alright.
It's a real shame to be reloading the page twice or thrice for every single css change I make. I've played around with memberships and permissions a little bit, but been an amateur I've not ventured deep enough I guess.
Any idea folks ??
I have the same problem. my solution is to modify the File Permission after precompile assets:
#chown apache.root yourapp -R
#chmod 755 yourapp -R
A bit late with this answer, but chmod everytime the app is deploy does not seem to be a good solution. I think the issue is your apache instance and your passenger instance are running as different users. So the solution is to check what user your apache server is running as and set the PassengerDefaultUser,
For example:
PassengerDefaultUser www-data
This worked for me. As Passenger was making files only readable by nobody, weird is that if you just refresh a few times it some how works out, but making sure they are the same user stops this error.
I experienced the same error, but in development!
Solved after clean and recompile assets:
rake assets:clean && rake assets:precompile
Make sure the underlying file system supports the requested operation.
The following commands fixed it for me.
mv public/assets /tmp
ln -s /tmp/assets public/assets

Resources