Create a symlink inside a Lando instance
Asked Answered
F

1

7

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

Furlana answered 14/7, 2020 at 21:44 Comment(4)
You indent is not representing what is in the linked blog post, possibly making it fail. appserver should be a level under servicesFourier
Thank you. I fixed the indentation and updated the post. Unfortunately that didn't work. I'm also not sure what to expect. When I do an ls -lah command on my machine (and within Lando) I don't see ta-clicklist so it appears the symlink command isn't working.Furlana
@Furlana I am having the exact problem you described. I'm wondering if you were able to fix it?Ovate
@AdrianoCastro not yet. decided to just forget about the symlink for the time being and work directly within that folder. That said I'm coming back to this site now and it's become more urgent that I get this working.Furlana
F
6

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.

Furlana answered 13/8, 2020 at 15:36 Comment(3)
Working here as well! Nice catch!Ovate
For anybody wondering why, here's Lando documentation docs.lando.dev/config/files.htmlColchicum
Is this still working for you? I've recently upgraded Landon and Ubuntu and now get 403 errors when trying to load all JS/CSS files served from the symlinked directory.Bushore

© 2022 - 2024 — McMap. All rights reserved.