Deployer: Deploy from local machine

Created on 10 Mar 2016  路  19Comments  路  Source: deployphp/deployer

Sorry for creating a new issue but I've got a problem.
Right now for a project I'm using git locally but that's not on any site like github.
I want to deploy my app directly from my machine to the vps.
Is it possible to deploy my app from my local master branch to vps directly?
And if not how about deploying the whole directory to the vps?

Most helpful comment

All 19 comments

Have you attempted to install git on your VPS?

apt-get install git

@jakenoble yeah git is installed. What I don't figure out is how to deploy from my machine?
What configuration on my end should be done?

What have you tried so far?

You start the deployment process from your local machine and it SSH's to your remote, uses git to download the code base and set up your app.

uses git to download the code base and set up your app. this is the problem.
The project is not on GitHub. so set('repository', '[email protected]:org/app.git') is nonsense.
The whole project is on my local machine. could I describe my problem?

It doesn't need to be on github, just in a repo that Deployer supports.

If you're not using some sort of source control then you have bigger issues. Even if you're a lone developer like myself.

@jakenoble let me say this way: my project is not on any online source control online like GitHub, bitbucket etc. But I'm using git locally. now I want to deploy my app from my machine to vps.
That's all I need.

I do not think Deployer does this.

I think you need something else then or a custom solution, your case seems fairly niche.

I don't think this is niche. There are many cases that a developer want to deploy to vps from local machine. Isn't it?

I deploy using my local machine to a VPS, but the code is just pulled from a repo where is stored and versioned using git. Your repo is not remote and presumably cannot be accessed on any publicly available IP or domain so Deployer cannot locate it. What you need Deployer todo is export the code locally, move it to the server and then run any custom commands to set up the app, I am sure you can do that with a custom recipe in Deployer using SCP or SFTP to move the files to the VPS.

I would say its niche to have code in one place and not in remote source control of some sort as at least a back up? What if your machine was stolen tonight? Or your office burnt down along with your machine and all your local git repos?

Already tried set('repository', 'file:///<pathtoyourlocalgit/app.git') or set('repository', '/<pathtoyourlocalgit/app.git') ?
Just a shot in the dark...

@sr972 I am fairly sure that will fail, its run from the remote VPS, so file:/// will not exist.

Oh sure.. Checkout is going to proceed on remote not on local.. My fault...
But you can use runLocally(string $command) and checkout local and then rsync it to the vps.

@sr972 Yes, thats a good idea. I have never used runLocally other than for tests.

@mehrdaad
You can follow steps:

  1. Make your local machine to git server, it is may be access from your remote machine
  2. set('repository', 'git@your-local-machine:org/app.git')
  3. run deployer

https://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server
https://www.linux.com/learn/tutorials/824358-how-to-run-your-own-git-server

Why not use bitbucket? Unlimited free private repos for teams up to 5 people. How git basically works is you have a repo on your machine and usually a master on a remote server.
You push to that master repo, tag it and push tag, then use deployer to deploy to your webserver.

Anything not in the master repo does not exist as far as any developers on your project are concerned.

@oisvidi Din't know bitbucket was free for small teams.Tnx for telling! tnx

@mehrdaad GitLab.com is also a very good choice.
https://about.gitlab.com/gitlab-com/

  1. Unlimited repositories
  2. Unlimited private collaborators
  3. 10GB disk space per project (including Git LFS)
  4. Unlimited total disk space
  5. Completely free, no credit card required

Hi @mehrdaad

I was with same trouble and I fix it overriding the deploy:update_code task: https://github.com/deployphp/deployer/blob/master/recipe/common.php#L173

// skip git clone
task('deploy:update_code', function () {});

Then you can just copy the local directory to your deploy server via ssh.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

timkley picture timkley  路  4Comments

dima-stefantsov picture dima-stefantsov  路  4Comments

ElForastero picture ElForastero  路  3Comments

greatwitenorth picture greatwitenorth  路  4Comments

lsv picture lsv  路  4Comments