Cap deploy - ERROR: Repository not found - ruby-on-rails

I've inherited a project and am comfortable with the development side of things, but have poor sysops, and the Capistrano deploy is failing. For a project that has been deployed before by the previous dev:
cap deploy:check
runs fine, resulting in
You appear to have all necessary dependencies installed
But when I try to deploy, I get
...
ERROR: Repository not found.
...
I have:
Triple checked the github repo address
Confirmed I can push and pull fine from the repo on my local machine
Confirmed I can connect fine from the server to github via SSH
Confirmed I can clone the repo fine on the server
Tried with agent forwarding both on and off
Confirmed the repo path matches in .git/config and config/deploy.rb
At the moment, when agent forwarding off, the SSH into github from the server is returning the info for the previous dev, who still has access to the github repo.
Hi xxxxxx! You've successfully authenticated, but GitHub does not provide shell access.
When agent forwarding is on, I show as being the authenticated user.
Any tips on resolving this? More than happy for a decent URL that goes through troubleshooting this.

OK, figured it out by a process of elimination. It was the following line in 'deploy.rb'
set :deploy_via, "remote_cache"
When this is commented out it deploys fine. If I uncomment it, it breaks again with the same error. So that certainly seems to be the problem.
I have no idea why this would be happening. But for now, I'll close this.

I know I am way late to the game but I just ran into this issue with a project that I moved from Github to Bitbucket. I was able to checkout, update, push/pull from the repo on Bitbucket without issue however my initial cap deploy broke after moving to Bitbucket.
The short answer is that the remote cache on your server needs to be deleted. SSH into your server, and remove the entire cached-copy dir found inside the shared directory created by capistrano. The location of your shared and releases directory may not be the same as mine but this is all I had to do:
rm -rf www/shared/cached-copy
After this I was able to deploy without issue.
Hope that helps someone else that may run into this issue.

For troubleshooting tips--especially because you are deploying from a GitHub repo--I suggest reviewing the GitHub guide to Deploying with Capistrano. That guide also links to another you should review on managing deploy keys.
default_run_options[:pty] may be missing or incorrect in config/deploy.rb. This could cause the "successful auth, but no shell access for you" error.
Regarding the script still using the previous developer's credentials, the system account the capistrano script logs in with on the server (e.g set :user, "deployer") may have the previous developer's private key in ~/.ssh which the script may expect to use. If this is the case, you should reconfigure the script to use SSH agent forwarding according to the guides which would have the script start using your keys.

Related

Public testing environment for RoR + Angular

currently I need a little hint for test running a RoR + Angular Application. And with test running I talk about that the "project owner" can see the current version of the project. For large projects with a lot of developers we had a build server, where the server got the current version from the git repository and deployed it as a "nightly build".
For projects where I'm the only developer I use dropbox to synchronize my working directory to a server, that is accessible for the project owner.
But now I'm working on a small project with 2 other developers. The build server is too much and the dropbox solution, well it's not going to work, because every one of us has a different state. And working on the same Dropbox directory is a no go.
So what's the best solution?
Consider running it on Heroku, which has a free tier. Once set up properly, deployments can be done by simply pushing to your Heroku git remote, or you can set it up to watch an existing remote repository branch (such as a particular branch on Github).
Or you could run it on your own machine. If you are behind a firewall you could set up a tunnel so your team can see it, with something like ngrok.

engine yard No application found matching remotes:

I'm trying to deploy my application to production on my laptop but i keep getting a
No application found matching remotes:
git#github.com:this_is_the_old_github_remote/Application.git
so this used to be the old remote but it was recently changed
so this makes sense but how do I fix this issue and tell it to go to the new one
There are a couple of ways to work around this issue.
Update the repository's config to have the proper URL for your remote branch.
Tell the ey cli tool which application and environment you are trying to deploy to.
The first method is probably better so you do not have to worry about this in the future.
To update your repository configuration you simply need to run git remote set-url origin https://url.to/new/repo/Applicatoin.git
Once the repository in your git configuration and the Engine Yard dashboard match, you should be able to deploy normally.
To work around this issue via the Engine Yard CLI utility, you will need to run ey deploy --app=<Application Name> --environment=<Environment Name>.
Please keep in mind, regardless of which method above you use to work around this issue, Engine Yard's automation will pull the application from the repository you configured via the dashboard.
Updating the remote on your git configuration does not update Engine Yard's configuration.
If your local copy of the repository has changes that have not been pushed to the remote repository configured at Engine Yard, the changes will not propagate to your instances.
If you continue to run into any issues deploying, please feel free to contact us via http://support.cloud.engineyard.com or in IRC on irc.freenode.net in #EngineYard.

Git push heroku master fails without error

I can't push to heroku after committing changes to my local git repo. Heroku authentication works, rails app is up and running, github push still works, and heroku push used to work up until now - when git push heroku master from local app root directory suddenly started failing without error message. Can only interrupt with Ctrl-C.
Haven't found hints anywhere online yet..
Here's a few tips to try debugging and see what's happening. First, check the Heroku dashboard and see if Heroku is up. It's been down a few times in the past. Next, set GIT_SSH=/pathto/yourscript, where yourscript invokes ssh with -vvv (for verbose debugging). See if it's a network connectivity issue. Third, see if your repository is heavily loaded with commits (like tons of Binary files in the Git index). Ours used to be slow, when we realized this, and split it nicely so that it worked great. We also raised a Heroku support ticket to perform git gc --prune --aggressive remotely on our repo, and the problem got resolved for us.

Jenkins Server Suddenly Fails. Cannot reach GUI

I setup a Jenkins server on a redhat linux VM a while back to run our unit and integration tests. It has worked without much trouble for about two months, but now I suddenly can no longer browse to the GUI/HUB. I don't believe I have changed anything (I know everyone says that :) ) however when I look at the logs I get the following errors
WARNING: Untrapped servlet exception
winstone.ClientSocketException: Failed to write to client
at winstone.ClientOutputStream.write(ClientOutputStream.java:41)
The Jenkins service is running, I have restarted it and the VM with no resolution to this issue. Even the jenkins jobs that I have written are still running as far as I can tell providing emails every now and again, but I cannot browse to the GUI. Anyone run into something like this before. I've searched for this issue and some people have been suggesting to re-install jenkins, but I am not trying to do that!
alright a long time later I finally figured it out. Turns out winstone was not the issue, but rather file permissions were to blame. Some of the files in my jenkins folder /var/lib/jenkins/ had root as their owner rather than jenkins. There were some in .m2 some in .grails and just scattered all about, not sure how this happened.
Anyway I just navigated to the home dir of jenkins /var/lib/jenkins and ran the following command
chown -R jenkins:jenkins jenkins

Ruby on Rails - Capistrano and SVN on Windows. Setup help

I have Subversion setup and running on my local network with windows and svnserve. I'd like to use Capistrano to deploy to a remote ubuntu server but am a bit on unsure on what I need to do to get the client end to work on windows. My understanding is that the remote server needs to be able to tunnel into my subversion server. I've read over a few tutorials but either they or I get all turned around about when they are talking about my local system, my svn server, or my remote system and of course almost none of them talk about capistrano and windows together.
Do I need to setup Apache to serve my subversion repository? I'd rather not but if I must what are the steps?
I found this tutorial but I have no idea if it will enable ssh access to the repository
You could try having capistrano checkout your code locally, zip and send it to the server. This isn't as efficient has having the server access svn because it has to send the entire codebase every time, but it will save you the trouble of exposing your repository to the outside.
From this page on the capistrano website, under Deployment Strategies:
set :deploy_via, :copy
set :copy_strategy, :export
set :copy_compression, :zip
You will need a command line zip utility available to make this work. The Info-Zip FTP site has one available.
I'm not a Windows person, but my understanding is that in Capistrano's normal state, it executes all of its commands on the server. That is why it needs to be able to pull the code via SVN from your machine.
Looking at that tutorial, it appears as though it is using Apache as the mechanism to allow a client(in this case Capistrano) to pull source code from your Windows machine. This will work for what you want to do.
You don't have to setup Apache in order to accomplish this, you could probably setup an SSH server on your Windows machine, though that is out of my realm of knowledge. :-)

Resources