Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a symlink inside a Lando instance

I'm running an instance of Wordpress locally (on Ubuntu) using an app called Lando (built on Docker). I'm developing a custom Wordpress plugin that I'd like to symlink into Wordpress within Lando but it's not working. The symlink is there, and pointing to the correct local directory but isn't being recognized.

$ ln -s /home/user/Source/ta-clicklist ta-clicklist
$ pwd
/home/user/Documents/mysite.local/wordpress/wp-content/plugins
$ ls -lah
total 36K
drwxr-xr-x  7 user user 4.0K Jul 14 16:36 .
drwxr-xr-x  6 user user 4.0K Jul 14 16:34 ..
drwxr-xr-x  4 user user 4.0K Jul 13 14:40 akismet
-rw-r--r--  1 user user 2.6K Mar 18  2019 hello.php
-rw-r--r--  1 user user   28 Jun  5  2014 index.php
lrwxrwxrwx  1 user user   30 Jul 14 16:36 ta-clicklist -> /home/user/Source/ta-clicklist
drwxr-xr-x 11 user user 4.0K Jun 19 13:50 td-cloud-library
drwxr-xr-x  8 user user 4.0K Jun 19 13:49 td-composer
drwxr-xr-x  5 user user 4.0K Jun 19 13:50 td-social-counter
drwxr-xr-x  4 user user 4.0K Jun 19 13:50 td-standard-pack

I've tried copying the files to the plugins folder, activating the plugin, then deleting the folder and symlinking it. But when I do I get the following error:

The plugin ta-clicklist/ta-clicklist.php has been deactivated due to an error:
Plugin file does not exist.

I found a blog post where someone suggested that you could set up a command in the Lando YAML file to configure a symlink at start time, but that doesn't seem to be working either (unless I'm doing something wrong). This is my .lando.yaml file.

name: serverwatch
recipe: wordpress
config:
  webroot: wordpress
services:
  appserver:
    run_as_root:
      # Symlink to the source files
      - ln -snf /home/user/Source/ta-clicklist /app/wordpress/wp-content/plugins/ta-clicklist

Does anyone have input they could offer?

Edited to update indentation of YAML file

like image 493
commadelimited Avatar asked Jul 14 '20 21:07

commadelimited


1 Answers

After re-reading the blog post I mentioned previously I realized my reference in the ln command was wrong. The source file needs to be referenced as /user/path/to/my/folder/ whereas I was referencing it as /home/user/path/to/my/folder/.

After updating the reference accordingly it's now working.

like image 54
commadelimited Avatar answered Nov 20 '22 23:11

commadelimited