Cant push bin directory to github - ruby-on-rails

I've made an app that works fine on localhost and I was making commits to github, having the repository there. Since I didn't started to make deploy on heroku I didn't noticed that the bin directory from the app folder wasn't pushing to github?? Ive tried everything, deleting the cache, the remote repository, but nothing... Why I cant push the bin directory to github?? Without the bin directory I can't deploy on heroku. Trows me the error: bin/rails directory not found.
I'm a bit confusing and tired of trying to push it to github.
Any suggestions/solutions would be very welcomed.

Related

Avoid Heroku from cleaning some assets

I have a rails app hosted on Heroku. I added a "Audio" folder in Assets. The "Audio" folder is not included into my git pushes. My app generates some audio files that are automatically added to the assets/audio folder. That's why I don't want Heroku to clean the assets inside this particular folder each time I push a modification.
One solution would be to host the generated audio files with AWS S3 but it's quite a lot of work to set up.
I wonder if, instead, there is a way to tell Heroku not to clean the assets in the "Audio" folder?
I searched on the internet but didn't find anything so far...
So far I know Heroku will clean you temporary assets everytime you deploy your application and the build starts.
Check this answer: Store file in directory tmp on heroku Rails
If your application is Rails 5.2 based you can implement your upload to AWS via Active Storage, check: https://evilmartians.com/chronicles/rails-5-2-active-storage-and-beyond

Recover files from an Rails app through git cloning the heroku app?

I am a Git/Heroku Newbie and I've lost files from a Rails app which I've also deployed to Heroku. Is it possible to recover the source files from Heroku?
I've found this link which says:
To clone the source of an existing application from Heroku using Git, use the heroku git:clone command:
heroku git:clone -a myapp
Replace myapp with the name of your app.
This will create a new directory named after your app with its source and complete repository history, as well as adding a heroku git remote to facilitate further updates.
I've done this but I don't know where this "new directory" is?
Thank you!
(And of course, next time I should use something like Github).
It was actually possible to copy all of the app's source files from Heroku to my local disk. When typing:
heroku git:clone -a myherokuapp
in my rails app folder (e.g. myapp) the new directory can be found at /myapp/myherokuapp/.

Pushing RoR app to Heroku, files in /public are missing

Let me start by saying I am using Ruby 2.0.0 and Rails 4.1.1
I've worked my way through the Treehouse basic RoR course; ending in a very basic version of Twitter. I have the application running just fine on my local install, but when I pushed it to Heroku it seems to be missing the files in the /public directory; namely the /assets css and javascript.
I've precompiled my assets as instructed, and verified that they area indeed showing up on my GitHub remote that is using the same branch. I was told that Heroku will not compile your assets for you.
All my routes and HTML is displaying just fine, but I cannot pull any of the files that live in the /public directory (404.html, 500.html, etc)
It feels to me like it is a permissions issue or something with the /public directory, but I haven't found a way to actually browse what files are on my Heroku instance. I've tried re-pushing several times while making small changes, and the css/js never seems to appear.
In case that you have already set:
config.serve_static_assets = true
in your config/environments/production.rb
And still not working, you can actually see the logs from your heroku app using heroku logs or heroku logs -n NUMBER_OF_DESIRED_LINES_HERE in your terminal.

Heroku - deploy app from another directory

I had the directory called A from which I deployed a Rails app to Heroku. Now, I moved this project on my localhost to another directory called B and from this B directory I would need to deploy the app to the origrinal Heroku app (to the same app where I deployed the code from A directory).
Is there any way to do that?
You'll need to add the git repo url to B.
git remote add heroku git#heroku.com:YOURAPPNAME.git
and git push heroku master would work.
As long as you moved the .git directory together with the rest of the files, there should be no difference and everything should work as before. If you don't have the .git directory, you will have to set the remote heroku url again.

From manual pull on server to Capistrano

I've always deployed my apps through SSH by manually logging in and running git pull origin master, running migrations and pre-compiling assets.
Now i started to get more interested in Capistrano so i gave it a try, i setup a recipe with the repository pointing to github and deploy_to to /home/myusername/apps/greatapp
The current app on the server is already hooked up with Git too so i didn't know why i had to specify the github url in the recipe again, but i ran cap deploy which was successful.
The changes didn't apply, so out of curiosity i browsed to the app folder on the server and found out that Capistrano created folders: shared, releases and current. the latter contained the app, so now i have 2 copies one in /home/myusername/apps/greatapp and another in /home/myusername/apps/greatapp/current.
Is this how it should be? and I have to migrate user uploads to current and destroy the old app?
Does Capistrano pull the repo on my localhost then upload it through SSH or run pull on the server? in other words can someone outline how the deployment works?
Does Capistrano run precompile:assets?
/releases/ is for previous versions incase you want to do cap:rollback.
/current/ as you rightly pointed out is for the current version of your app.
/shared/ is for files and folders that you want to persist between deployments, they typically get symlinked to your /current/ folder as part of your recipe.
Capistrano connects to your server in a shell and then executes the git commands on the server.
Capistrano should automatically put anything in public/system (the rails convention for stored user-uploaded files) into the shared directory, and set up the necessary symlinks.
If you put in the github url, it actually fetches from your github repo. Read https://help.github.com/articles/deploying-with-capistrano for more info.
It does, by default.

Resources