Deployer: Ubuntu problem with relative symlinks. Rollback has broken.

Created on 13 Sep 2017  ·  3Comments  ·  Source: deployphp/deployer

| Q | A
| ----------------- | ---
| Issue Type | Bug
| Deployer Version | Deployer v5.1.3
| Local Machine OS | MBP Siera
| Remote Machine OS | Ubuntu 14.04.05

Description

Every second attempt to override a symlink fails, because or --relative flag.

Steps to reproduce

This is the command executed by rollback command:
cd /var/www/products/test && (cd /var/www/products/test && ln -nfs --relative /var/www/products/test/releases/2 current)

Run it twice, and you will have a broken symbolic link.

root@825605-app2:/var/www/products/test# cd /var/www/products/test && (cd /var/www/products/test && ln -nfs --relative /var/www/products/test/releases/2 current)
root@825605-app2:/var/www/products/test# ls -la
total 20
drwxr-xr-x  5 root root 4096 Sep 13 04:33 .
drwxr-xr-x 16 root root 4096 Sep 13 03:32 ..
lrwxrwxrwx  1 root root    1 Sep 13 04:33 current -> 2
drwxr-xr-x  2 root root 4096 Sep 13 04:30 .dep
drwxr-xr-x  4 root root 4096 Sep 13 04:32 releases
drwxr-xr-x  4 root root 4096 Sep 13 04:16 shared
root@825605-app2:/var/www/products/test# cd /var/www/products/test && (cd /var/www/products/test && ln -nfs --relative /var/www/products/test/releases/1 current)
root@825605-app2:/var/www/products/test# ls -la
total 20
drwxr-xr-x  5 root root 4096 Sep 13 04:33 .
drwxr-xr-x 16 root root 4096 Sep 13 03:32 ..
lrwxrwxrwx  1 root root   10 Sep 13 04:33 current -> releases/1
drwxr-xr-x  2 root root 4096 Sep 13 04:30 .dep
drwxr-xr-x  4 root root 4096 Sep 13 04:32 releases
drwxr-xr-x  4 root root 4096 Sep 13 04:16 shared
root@825605-app2:/var/www/products/test# cd /var/www/products/test && (cd /var/www/products/test && ln -nfs --relative /var/www/products/test/releases/1 current)
root@825605-app2:/var/www/products/test# ls -la
total 20
drwxr-xr-x  5 root root 4096 Sep 13 04:34 .
drwxr-xr-x 16 root root 4096 Sep 13 03:32 ..
lrwxrwxrwx  1 root root    1 Sep 13 04:34 current -> 1
drwxr-xr-x  2 root root 4096 Sep 13 04:30 .dep
drwxr-xr-x  4 root root 4096 Sep 13 04:32 releases
drwxr-xr-x  4 root root 4096 Sep 13 04:16 shared
root@825605-app2:/var/www/products/test# cd /var/www/products/test && (cd /var/www/products/test && ln -nfs --relative /var/www/products/test/releases/1 current)
root@825605-app2:/var/www/products/test# ls -la
total 20
drwxr-xr-x  5 root root 4096 Sep 13 04:34 .
drwxr-xr-x 16 root root 4096 Sep 13 03:32 ..
lrwxrwxrwx  1 root root   10 Sep 13 04:34 current -> releases/1
drwxr-xr-x  2 root root 4096 Sep 13 04:30 .dep
drwxr-xr-x  4 root root 4096 Sep 13 04:32 releases
drwxr-xr-x  4 root root 4096 Sep 13 04:16 shared

Content of deploy.php

Doesn't matter.

Output log

➤ Executing task rollback
[server_ip] > cd /var/www/products/test/ && ([ -d releases ] && [ "$(ls -A releases)" ] && echo "true" || echo "false")
[server_ip] < ssh multiplexing initialization
[server_ip] < Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-121-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Wed Sep 13 04:18:12 CDT 2017

  System load:  3.82                Users logged in:     1
  Usage of /:   86.7% of 269.95GB   IP address for em1: server_ip
  Memory usage: 72%                 IP address for em2: server_ip
  Swap usage:   100%                IP address for tun0: server_ip
  Processes:    424

  => / is using 86.7% of 269.95GB
  => /boot is using 89.7% of 476MB

  Graph this data and manage this system at:
    https://landscape.canonical.com/

130 packages can be updated.
1 update is a security update.

New release '16.04.3 LTS' available.
Run 'do-release-upgrade' to upgrade to it.


*** System restart required ***

[server_ip] < true
[server_ip] > cd /var/www/products/test && (cd releases && ls -t -1 -d */)
[server_ip] < 2/
[server_ip] < 1/
[server_ip] > cd /var/www/products/test && (if [ -f .dep/releases ]; then echo "true"; fi)
[server_ip] < true
[server_ip] > cd /var/www/products/test && (tail -n 15 .dep/releases)
[server_ip] < 20170913041546,1
[server_ip] < 20170913041805,2
[server_ip] > cd /var/www/products/test && (if [[ $(man ln 2>&1 || ln -h 2>&1 || ln --help 2>&1) =~ '--relative' ]]; then echo 'true'; fi)
[server_ip] < true
[server_ip] > cd /var/www/products/test && (cd /var/www/products/test && ln -nfs --relative /var/www/products/test/releases/1 current)
[server_ip] > cd /var/www/products/test && (rm -rf /var/www/products/test/releases/2)
Rollback to `1` release was successful.
• done on [server_ip]
✔ Ok [8s 891ms]
minor bug

All 3 comments

Yes, this is known bug. See https://github.com/deployphp/deployer/blob/master/KNOWN_BUGS.md#ubuntu-1404-coreutils-821

Try adding this:

set('use_relative_symlink', false);

Will be cool to add warning on 'Ubuntu 14.04 LTS' about this bug.

@antonmedv Yep, thanks, I've already disabled this option. 👍
Will try to PR implemented warning as soon as possible.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

khoanguyen96 picture khoanguyen96  ·  5Comments

sweebee picture sweebee  ·  3Comments

greatwitenorth picture greatwitenorth  ·  4Comments

antonmedv picture antonmedv  ·  5Comments

lsv picture lsv  ·  4Comments