If I have opened an SSH window for more than 1 Local by Flywheel site, how can I see/confirm which site each console belongs to?
The window’s title does not help. Is there a way to add the website name to the window title?
Or is there some command that can tell me this info?
The prompt at the command line shows something like this: root@df617ba1fcb5 but that is not helpful.
Within FlywheelLocal, it would be nice if you could display the docker number somewhere in the site info.
In that case, I could then click on each site name within FlywheelLocal until I found the site matching the SSH prompt.
Also, having a reference to the command "C:\Users\sh\AppData\Local\Programs\local-by-flywheel\resources\extraResources\virtual-machine\vendor\docker\windows\docker.exe" exec -it df617ba1fcb54ebe129368a9d7ae17a29d01da3e678e7c2e1291bb4352167789 /bin/bash would also be helpful, as sometimes I loose the unix prompt (it becomes a windows prompt) and need this command to restore the docker prompt.
Is there an alias to this command I can use from within the command window?
I realized I can run an database query to find this info.
However, this only works if you haven’t imported the database from another site or your wp_options home and siteurl currently have already been updated to reflect the FlywheelLocal site you’re currently working on.
If, you’ve imported databases into more than 1 FlywheelLocal site and are about to use wp-cli’s wp search-replace command on each, you may have NO IDEA which window corresponds to which site!! - and there is No Easy Way to figure it out.
Since the db username is the same as the shell username, I don’t need the -u or -p flags to log into mysql. If you’re using the default database created by FlywheelLocal (local), the following one-line command will work:
mysql -e 'SELECT * FROM local.wp_options WHERE option_name LIKE "home";'
Otherwise, you can log in to mysql and run the following commands: mysql -u root -proot show databases;
Note the name of database you need to look at, and replace mydatabasename below with the appropriate database name: SELECT * FROM mydatabasename.wp_options WHERE option_name LIKE "home" OR option_name LIKE "siteurl";
(You don’t need to include OR option_name LIKE "siteurl".
In my case they hold different values, so I like to see that indeed they are set correctly.) \q
to quit mysql.
In the event that WP_HOME and WP_SITEURL are used in wp-config.php, the corresponding values in the database are ignored, and the db could conceivably hold a value different from the actual website url. In this case the website could still connect to the db and load the home page, even though the database holds the wrong url.
However, if the database was imported, rather than created by FlywheelLocal, you would need to run wp search-replace to update relevant the urls for the website’s internal links to load the correct website. Once this happens, home and siteurl would have been updated as well. But until then, it’ll hold the url of the site you exported the db from.
I note this edge case because if you’re trying this hack before running wp search-replace (or another method to update the database urls), the returned url will be incorrect. Never-the-less, the url returned may still provide insight as to which Local by Flywheel Site window you’re working in
Theoretically, the command could be saved to a file (if you have trouble remembering the syntax), and saved to every site, so you have a handy alias on hand.
Ok. I found a more foolproof way.
Go to the folder listed in title of the command window.
On Windows 10, it’s: C:\Users\your_windows_user_name\AppData\Roaming\Local by Flywheel\
(replace your_windows_user_name with your actual Windows logon name).
Then open sites.json. Searching for your docker id will locate the site name definitively.
For example, if your prompt is root@df617ba1fcb5:/# search the file for df617ba1fcb5.
sites.json is the master list for most info one may need about their sites, including: site id (useful for adminer - esp if your default browser is not supported by FlywheelLocal), docker container id, ports, and urls.
It’s handy to have a link to quickly view this file, so
You do not need to access the dashboard then start a site just to view it’s MySQL port number, for example, to setup MySQL Workbench connections to your sites. It’s a more efficient for bulk setting up Connections.
It’s also a handy way to efficiently add Notes (such as site container id and adminer site id references) to each site, if you have the Notes Add-On installed.
Hey there! Local Lightning might help fix some of these annoyances. If you’re interested in joining the beta, DM your email and we’ll get you enrolled in the program.