Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible to make different aliases to same remote webhost account with only different paths on remote? #5789

Open
porg opened this issue May 26, 2023 · 2 comments

Comments

@porg
Copy link

porg commented May 26, 2023

Documentation does not answer my use case yet

Server side

Accessing production vs. staging in the shell on the server (via SSH)

$ ssh dd

# I'm now on my webhost, executing commands there.

$ wp @dd option get blogname
DD

$ wp @dds option get blogname
DDS
  • ✅ The different aliases return different results, each corresponding to their respective WordPress instance.

~/.wp-cli/config.yml (Webhost)

# Global parameter defaults
path: /data/web/•••/html/apps/dd/

# Aliases
@dd:
  path: /data/web/•••/html/apps/dd/

@dds:
  path: /data/web/•••/html/apps/dd-staging/

Client side (Mac)

Client side aliases to access different WP instances (production and staging-subdomain) on the very same remote webhost and very same user account there

  • I'm now on my Mac.
  • Running my local wp-cli which connects to the remote wp-cli.
    • This worked fine when I only had 1 WordPress instance on that webhost account.
  • For a while I used a production and a staging server with aliases on the server, as shown in the previous section. Worked fine all time.
    • Now I had set up two aliases on my client side machine corresponding to those two remote instances too.
    • ❌ But both aliases seem to resolve to the same WP instance on the remote!
$ wp @dd option get blogname
DD

$ wp @dds option get blogname
DD
  • ❌ The last command should have returned "DDS" but returned "DD".
    • I have my dounbts that the aliases resolve correctly.
    • See my client config:

~/.wp-cli/config.yml (Mac)

# Global parameter defaults
path: ~/Web

@dd:
  ssh: dd
  path: /data/web/•••/html/apps/dd/
@dds:
  ssh: dd
  path: /data/web/•••/html/apps/dd-staging/

Questions

  1. Is it a problem that I use the same alias names client side as server side?

    • I rather rule that out.
    • I temporarily set my client side aliases to @d and @ds respectively, but it made no difference.
    • Still got the same blogname for both, depsite them being different in reality.
  2. Is the same SSH connection but different paths not enough to constitute two indeed different valid aliases?

@danielbachhuber
Copy link
Member

Hey @porg,

In honesty, I wrote the aliases implementation and have no memory to how it works. We'll see if some other contributor can help out.

@porg
Copy link
Author

porg commented Jul 21, 2023

In honesty, I wrote the aliases implementation and have no memory to how it works.

😂 Honesty appreciated! 👍

We'll see if some other contributor can help out.

  • Ok. No hurry anyways.
  • Practically I usually anyhow ssh myhost and then wp @alias1 cmd or wp @alias2 cmd.
  • Directly calling wp @alias1-on-myhost vs. wp @alias2-on-myhost mostly has relevance for use cases where on one's local machine one can/shall only execute wp and not ssh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants