5

Capistrano configfile has the config

set :scm,:git and the :repo_url and :branch

Can I deploy with capistrano without scm?

set :scm, :none            
set :repository,  "."       

What is the benefit of scm config in the Capistrano deploy?

wcc526
  • 3,915
  • 2
  • 31
  • 29
  • 1
    why would you wanna do that? I personally would never wanna write a single line of code without scm... – joni Jun 14 '14 at 14:18
  • scm is good,but I mean why should I config the scm in the capistrano?Capistrano will deploy the code from the github instead of the local machine? – wcc526 Jun 14 '14 at 14:24
  • 2
    @joni One reason I have in mind is, that capistrano fetches the "naked" source from the vcs, which means, that all the build tasks has to run on _every_ server. For some tasks (like creating the assets, or downloading the dependencies) it is not required. You could also use an automatic build step to create an archive, which is then used by all servers. – KingCrunch Oct 07 '14 at 21:30

4 Answers4

6

With Capistrano 2 you could do that. With Capistrano 3 you can't.

One trick you can do is host a Git repository on the same server the app is hosted, since to 'host' a repository means simply having the repo files in a directory somewhere. You can push updates there from your local machine via SSH, and for Capistrano the repo URL would be just the path to the repo on the server.

You don't need a third-party service to host repos, and you don't need any special server software either.

As to the benefits of having code under source control - there are too many, which is why everyone is using it, which is why Capistrano developers don't even bother with supporting non-SCM deploy.

Leonid Shevtsov
  • 14,024
  • 9
  • 51
  • 82
  • "which is why everyone is using it" - of course I'm using it, but only until the build process which is part of our CI pipeline. The build task for instance runs webpack and then we want to deploy to another machine. How is a scm helpful here? I don't understand the point of Capistrano – fishbone May 05 '20 at 11:29
4

You can use the CapistranoRailsArtifact gem to do that.

This gem allows

you to package your Rails app into a .tar.gz and deploy it easily. This works by creating a new type of 'scm' for Capistrano 3.

David Resnick
  • 4,891
  • 5
  • 38
  • 42
0

First, No

Capistrano has to work with scm.

create an account with github or bitbucket and load your code. Which is even more important for you. Then setup capistrano to load code from that repo.

acacia
  • 1,375
  • 1
  • 14
  • 40
0

This can be useful e.g. for static sites created with something like jekyll/middleman/nanoc etc. These tools usually generate the code to be uploaded in some kind of "build" directory, which is not included in the repository, only the source files are. So in this case you can use Capistrano with scm = none and repository = "./build".

Kuba Suder
  • 7,587
  • 9
  • 36
  • 39