Clone project files issue on deploy

Having issues deploy Trellis. The initial server setup worked just fine and everything seems to be installed on the system. The problem is when I deploy it just hangs. I see on the server that the /srv/www/mysite folder is created along with /releases and /shared folders but nothing more than that.

I am using AWS/Ubuntu and have the standard ubuntu user. I also created a user ‘web’ and created a deployid key pair. I have added the .pub to bitbucket and can, when logged in as the web user on the instance, download the repo just fine. Not sure where to look next at what might be causing problems.

Here is the output using -vvvv (I truncated output for parts which seemingly passed)

PLAY [Deploy WP site] *********************************************************
GATHERING FACTS ***************************************************************
ok: [my-ip]
TASK: [deploy | Initialize] ***************************************************
ok: [my-ip] => {"ansible_facts": {"deploy_helper": {"current_path": "/srv/www/mysite.com/current", "new_release": "20150820212103", "new_release_path": "/srv/www/mysite.com/releases/20150820212103", "previous_release": null, "previous_release_path": null, "project_path": "/srv/www/mysite.com", "releases_path": "/srv/www/mysite.com/releases", "shared_path": "/srv/www/mysite.com/shared", "unfinished_filename": "DEPLOY_UNFINISHED"}}, "changed": false, "state": "present"}
TASK: [deploy | Check whether project source path is a git repo] **************
ok: [my-ip] => {"changed": false, "stat": {"exists": false}}
TASK: [deploy | Get current git remote URL] ***********************************
skipping: [my-ip]
TASK: [deploy | Update git remote URL] ****************************************
skipping: [my-ip]

TASK: [deploy | Clone project files] ******************************************
<my-ip> ESTABLISH CONNECTION FOR USER: web
<myip> REMOTE_MODULE git repo="ssh://git@bitbucket.org:********@bitbucket.org/stringify/web-production.git" dest="/srv/www/stringify.com/shared/source" version="master" accept_hostkey=yes
<myip> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/dan/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 myip /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1440105648.19-117237565742971 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1440105648.19-117237565742971 && echo $HOME/.ansible/tmp/ansible-tmp-1440105648.19-117237565742971'
<myip> PUT /var/folders/0d/9l_nb0q52hn__xq7rdchnw640000gn/T/tmphwWtmC TO /home/web/.ansible/tmp/ansible-tmp-1440105648.19-117237565742971/git
<myip> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/dan/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 myip /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/web/.ansible/tmp/ansible-tmp-1440105648.19-117237565742971/git; rm -rf /home/web/.ansible/tmp/ansible-tmp-1440105648.19-117237565742971/ >/dev/null 2>&1'

It’s definitely hanging because it can’t clone your remote repo without intervention (such as entering a password).

The golden rule for debugging things like this is to SSH into your server manually and run the command as the same user.

The command is something like:

git clone ssh://git@bitbucket.org:********@bitbucket.org/stringify/web-production.git

edit: I kind of skipped over where you said you tried this and it was working. There must be a difference between what you did and what Ansible is doing though. Maybe you can detail exactly what you tried?

Did you create the web user before or after you provisioned the server? Because that should be done automatically by Ansible when provisioning.

Could you also confirm that your repo specification has this structure:
repo: git@bitbucket.org:username/projectname.git
I was under the impression that the colons and slashes had to be just so, but maybe there are other options.

As for that web user, and as @kalenjohnson mentioned, Trellis will create the user and add the keys you specify. It is assumed you have the private key on your local control machine. The SSH agent forwarding allows your remote server to forward credential authentication between bitbucket and your local machine. If you created the web user manually and created its keypair on your server, maybe you only have the private key on the server. Maybe that would work, but the intention is for the private key to be on your local control machine.

So I was able to get the deploy working successfully. When I first went to the staging url I added the site name, my username, password ,etc and then it installed. After that when I logged in even though it said I was an administrator I couldn’t add any plugins, nor update Wordpress (it said please notify administrator).

That’s by design, by default, updates are made locally in development, with Composer:

Just in case you’re not familiar with the composer.json file, the Composer wiki may come in handy. By default, the Trellis deploy will run composer install with the project_post_build_commands, which installs/updates the plugins etc. that you’ve specified in your composer.json.