by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Mohammed Lubbad
@mlubbad
Hello everybody, I have an issue while Im trying to run deployer
The issue is when I execute this command "./vendor/bin/dep deploy live "
it gives me this error message " Command "deploy" is not defined. "
Frederick Henderson
@frederickjh
I found the issue with ssh. In ~/.ssh/config you have lines that start with Host and lines that start with Hostname. What you put after Host can be an alias for the host not even a real hostname. I tend to create short names and place them here. Normally I also place the real hostname on this line, but this time I forgot and only put it on the Hostname. Just learned that ssh matches the items in the Host before those in the Hostname. With Deployer I am using the real hostname. Once I added it to Host in my ~/.ssh/config I was able to connect via ssh during a dep deploy hostname.
Bert
@bert-w

im breaking my head over the general flow of Deployer: so the way I look at it is that Deployer basically runs all its commands on the target machine. This means you need all this crust (composer/npm/git) available on your target machine in order to create a build.

So currently i'm running a build that rsync's to my target machine, which is done using bitbucket pipelines (docker container). It doesnt have zero-downtime deployment and rollbacks, but it gets the job done in like 5 lines of code. The bitbucket pipeline instance already has your complete git repository, and depending on your docker image you have php/composer/npm at your disposal. So the script isnt much more than composer-install & upload.

Somehow it feels wrong to have a local bash script invoke a PHP script that invokes remote bash scripts to deploy a website on the remote machine right?

Pascal Krason
@Padrio
Hi there, i’, completely new to deployer and have a problem. Our depository is hosted on a custom gittea instance, where the ssh port for git has been changed to 2222 - but using the notation i cant provide the port since that’s how you tell them the user
define('repository', 'git@git.host.tld:2222/username/my-cms.git’); - the notation i’m using
But deployer thinks 2222 is the user
edvordo
@edvordo
I'd suggest adding the host and subsequently port to the ~/.ssh/config file. If this is on some CI/CD pipeline, just create this file on the fly with the required contents.
Pascal Krason
@Padrio
Yes, did that now
But, it seems like it wont accept the repository url
[Symfony\Component\Process\Exception\ProcessFailedException]                                                                                                  
  The command "ssh -A -tt ***-backend 'cd /gopanel/sites/redacted && (/usr/bin/git clone -b develop  --recursive   /gopanel/sites/redacted/releases/  
  1 2>&1)'" failed.                                                                                                                                             

  Exit Code: 128(Invalid exit argument)
It does not want to use the url
because i’m stupid
and used define instead of set
Did the initial configuration last night with almost no sleep… i will never learn not to touch any code when i’m tired
Frederick Henderson
@frederickjh
@Padrio Do you have passwordless login setup using an ssh key? If you have multiple keys in your ~/.ssh/config file you should use IdentitiesOnly yes and IdentityFile ~/.ssh/id_rsa for your host. You of course should use the path to your key file.
This would of course be in the ~/.ssh/config file on the host you are deploying to.
Pascal Krason
@Padrio
@frederickjh Thanks, yes; i use two different SSH Keys for about ~ 30 Servers. The first one is to access my own core infrastructure. The seond one is used to connect to my customers servers. Booth are equiped with an Passphrase. I also use an ssh config on my mac, but i didn’t knew that it would work to enter the git server credentials into my local config and that the forwarding would also work for the cloning process :D
Frederick Henderson
@frederickjh
Yes it will and you do not need the private keys on your server that is in the middle if you use ssh forwarding. You can just copy the public keys to the server in the middle. The ssh agent will use these to find the correct key, based on your ~/.ssh/config.
fapchat2
@fapchat2
<?php
require_once '/home/fapchat/vendor/autoload.php';

use Psr\Http\Message\ResponseInterface;
use GuzzleHttp\Exception\RequestException;

use GuzzleHttp\Client;

$client = new Client([
     'base_uri' => 'http://httpbin.org/get',
 ]);


$promise = $client->requestAsync('GET' );
$promise->then(
    function (ResponseInterface $res) {
        echo $res->getStatusCode() . "\n";
    },
    function (RequestException $e) {
        echo $e->getMessage() . "\n";
        echo $e->getRequest()->getMethod();
    }
);
Why does that code not echo anything?
edvordo
@edvordo
it probably does, the code just doesn't wait for the request to finish, so you don't get anything in the response
you can do two things
  1. make a regular request
  2. if you want to keep using async, fine, but you'll need to call $promise->wait();
Pascal Krason
@Padrio
@frederickjh Thank you, i know how the ssh config works :P
I’m using this method now, aspecially when it comes to CI/CD that’ll make everything much easier. Has anyone implemented it in his drone.io workflow? Or maybe Jira?
edvordo
@edvordo
Bitbucket makes this fairly easy. You can generate an unique ssh key for a repo, you add it to the authorized_keys file on server, update the known_hosts in bitbucket settings and you can use it to deploy you application via their pipelines (CI/CD tool). You can also add you own keys of course.
fapchat2
@fapchat2
@edvordo thanks
Pascal Krason
@Padrio
@edvordo If you meant me, thanks. I used bitbucket at my work before - awesome software. But on-premise is too expensive & i don’t need that much features; so i switched to gittea. Has all basic features i need, does not take lot of resources & is fairly easy to manage without consuming too much time maintining it. For CI/CD is drone a great tool. Small & just right for me
edvordo
@edvordo
Well, you mentioned Jira, so I assumed you use Bitbucket. But sure, whatever fits your needs :)
clem983
@clem983
Hi everybody :)
Is there someone here using docker in prod, and deploying the project with deployer ? I'm trying to, but I don't understand how to do it, because some commands have to be executed on the server, and some others in the container. I don't find information about that ! If someone can help me ... :)
Frederick Henderson
@frederickjh
By the server do you mean the Docker Host?
clem983
@clem983
@frederickjh Yes :)
Frederick Henderson
@frederickjh
Are you deploying from the Docker host or from another computer?
clem983
@clem983
@frederickjh From an other computer.
Frederick Henderson
@frederickjh
I am not sure there. I know there is a way to run commands locally but not sure about on an intermediary host.
Sacharski Bartłomiej
@bsacharski
Hello. I am trying to start using deployer in one of my projects and I'm currently experiencing a problem.
What I'm trying to do is connect via ssh to the server using user A credentials, and then switch to user B and clone the repo to release directory.
I've set up the host with the become('B') directive, however the deploy:update_code code is still being executed as user A. Is sudo-ing as another user not supported when running git command?
BT643
@BT643

I have a Symfony 3 application that I'm deploying with Deployer, but I've recently started using FosJsRoutingBundle so I have to run this additional build step:

bin/console fos:js-routing:dump --format=json

What's the best practice for adding that?

https://symfony.com/doc/master/bundles/FOSJsRoutingBundle/usage.html

My deploy.php is really simple at the moment:

// Tasks
task('build', function () {
    run('cd {{release_path}} && build');
});

// [Optional] if deploy fails automatically unlock.
after('deploy:failed', 'deploy:unlock');

// Migrate database before symlink new release.
before('deploy:symlink', 'database:migrate');
Matthew Weier O'Phinney
@weierophinney

I've been looking through the docs, code base, and issues, and I'm still not finding the information I need: How do I distribute recipes others can use in their deploy.php?

Considering the deploy.php may or may not be in the same repository as the code being deployed, and considering you likely don't want the package installed in your production application, how can I provide my recipes for others to use? Does it require being installed as a global composer package? or is there some other mechanism?

edvordo
@edvordo
Your custom recipe doesn't need to be in the production application. You only need it while deploying so it can be a dev dependency. That being said, if you have some new recipe, you can try PRing it into https://github.com/deployphp/recipes
Frederick Henderson
@frederickjh
Actually @edvordo deployphp/recipes has been moved to the main project recently. There hasn't been a release since then.
edvordo
@edvordo
Oh, I didn't notice, sorry.
PTAH
@ptahdunbar
Aarrr, I'm running into TTY mode requires /dev/tty to be read/writable issue and setting git_tty to false isn't helping. I'm using github actions, any pointers? deployphp/deployer#1713
PTAH
@ptahdunbar
resolved, turned out one of my run commands override tty to true. now i'm back with another error: Host key verification failed. :/
Matteo
@matteo.capretto_gitlab
hi there!
ive got a strange error when running deployer to deploy a laravel app
Uninitialized "output" in Deployer container.
and, when run without a command... Call to undefined method Deployer\Host\Host::stage()
host('staging.internal')
->stage('staging')
->user('deployuser')
->set('branch', 'staging')
->set('deploy_path', '/var/hosting/sites/{{application}}_staging');
any idea please?
TYSM
Robin Houtevelts
@RobinHoutevelts

Hi

I'm investigating to see if deployer would be a good fit to use in our company.

I find the docs a bit lacking so I'm trying my luck here:

How would someone go about trying to achieve this scenario:

I have one backend server and three frontend servers that are in a loadbalancer and have database replication with the backend server. I want to deploy the frontend servers one by one.

So basically these steps:

  • Stop replication on frontend hosts
  • Run migrations against the backend server
  • Loop over the frontend hosts and:
    • Remove it from loadbalancer
    • Place code
    • Start replication
    • Insert back into loadbalancer

We are currenty using an in-house solution in nodejs and bash. But would prefer to have something in PHP because our devs are comfortable in it.

Robin Houtevelts
@RobinHoutevelts
Been going over the project again and seems like I'll be able to do this