WP-CLI With Local 6

Despite working for a different hosting company with another local development option, I was using Local for local WordPress development for years before joining Pantheon, and I recently was trying to get it working again since upgrading to the latest version. With Local 3, I learned this neat trick from Sal Ferrarello for using WP-CLI outside of the container, but the setup changed a bit when I moved to 6.0.

Socket Path

Local no longer has you SSH into the container to use WP-CLI, but the “open site shell” option in the drop-down menu instead sets up all the various environmental variables needed to use WP-CLI, but it’s annoying to have to go through the Local GUI every time.

We’ll follow the same instructions in Sal’s configuration to setup wp-cli.local.yml and wp-cli.local.php, but instead of looking for the remote host and remote port in Local’s database tab, we need the path to the mysqld.sock file.

Screenshot of Local App GUI with an arrow pointing to the Socket path.

With that path, we can update our DB_HOST constant in in wp-cli.local.php like so:

define('DB_HOST', 'localhost:/Users/philiptyler/Library/Application Support/Local/run/Nn6ehKT-l/mysql/mysqld.sock');

You can confirm WP-CLI works without SSH by running a sample command in your project directory:

$ wp option get siteurl

and you should get your site’s URL back successfully.

Beginner’s Tournament II: Match 5 vs KorokBean

Once again getting to posting/reviewing these games later than I’d like so, the notes are sparse. My last game of the round-robin games, leaving me at three match wins and two draws, or 8/10 games. With that, I have a chance of moving forward to the next round, but that depends on the outcome of Doomsbeard‘s games— He could take the group if he wins all four remaining games, or we could be tied (which would go to a blitz runoff) if he draws either match.

Game 1

Don’t have a whole lot to say about this one. I had a fun Tinüe at the end, although didn’t quite play it out, it was getting there. With some slight variation, it looks like I had possible wins a little faster, but took the slightly longer approach to Tinüe.

Game 2

A “Knight” opening served me well, although I worried about taking my cap out of play by spreading it to the edge in that early play, I eventually got it back in the middle after a scenic trip around the board.

Beginner’s Tournament II: Match 4 vs Joagwa (BeerPoet)

My second split win. We played across two days, and each took the win as White.

Game One

This one might have been my favorite of the tournament (so far?). I also actually reviewed right away as opposed to days/weeks later, so I got better notes into the playback.

Game Two

Twenty-four hours later, we played game two, and BeerPoet had me on the ropes pretty much the entire game. I’m fairly sure it would have ended up with a Tinüe in those bottom two rows anyway.

Beginner’s Tournament II: Match 3 vs DoomsBeard

Split wins as white, both solid games, both of us lost to missed threats. Also the first game I got to watch back with full commentary which is always a blessing and a curse— there is plenty to learn from the commentary on a game, plenty painful to hear all the thoughts you could have had without the pressure of clock and tunnel vision being in the middle of a game brings.

Game 1

Game 2

A bit harder to step through in the embedded view, but this one has a few more branches explored if we had been better about catching the threats we missed.

Commentary from Nitzel & Ineria

Ineria intended to capture from the beginning, but due to technical difficulties, they picked up on Nitzel’s stream about halfway through the first game. You can watch the whole video from Twitch. Always lovely to hear the commentator’s confused voices with such classics as “Why did he do that?” and “How do I pronounce pwhaug?”.

Beginner’s Tournament II: Match 2 vs Sky

Game 1

The hard cap next to that back wall was a nice position to hold to keep those road threats going and forcing the black capstone to keep vacuuming up pieces for a few rounds.

Game 2

I felt very clever about my wall-smashing road at the end of this one, until post-game, Sky pointed out I had a solid Tinue halfway through the game I flat out ignored multiple times, hyper-focused on the horizontal threat. Reviewing the game with ptn.ninja it seems impossible to me that I would miss it, yet there it is.

Beginner’s Tournament II: Match 1 vs cAlx

Another Tak beginner’s tournament, this time I hoped to review each match as I went, but of course by the time I’ve gotten started, a few days have passed and I’ve already lost most useful insight I might have had.

I probably would have had more to say about these games if I’d reflected & reviewed right after the games, but a solid opening match for the tournament. Two hard caps in game one was a unique development.

Game 1

Game 2

Tak Blitz Tournament, February 2021

Another Tak tournament from US Tak Association right on the heels of the beginner’s tournament wrapping up. This one was a quick blitz tournament, Something I’d played probably a handful of times before today.

With fourteen players, the tournament consisted of nine rounds, clock at 3 minutes with 5 second increments, and a Komi of 3 points to black on a flat win. I rounded out my nine games at second-to-last, but had a great time, and was happy to have scored at least a couple points over the nine rounds.

Game 1: PlutoTheBrave

First pairing of the tournament, and missed the road threat across the bottom of the board. Of course saw the missed threat as soon as I played. Blitz is an unforgiving beast.

Game 2: Reimen

This was probably the most interesting (and longest) game. I wasn’t sure throwing the capstone’s stack at 21 was the right move, but I think glad I did it later. I was able to keep up the pressure of road threats in the NW quadrant for a bit, but nothing that could stick— Reiman was cutting them off right and left, and then I was down to a few seconds on the clock for quite a bit, so I was just placing flats without being entirely sure of the count. With the +3 komi, it ended with a tie, the only one of the tournament, I think.

Game 3: EVRNjayhawker

My brain was not functioning by this one. A straight line down the middle is just the worst kind of loss to see on the board. Somehow I thought I was being clever not capturing with 9. 2c4>. Trying not to think about this one any more than I have to.

Game 4: T0afer

My only win! The citadel in the middle was a nice position to gain, I think, then bi-directional road threat at the end gave me the missed threat.

Game 5: Ineria

This was one I definitely wanted to review after the fact. I had a great match with Ineria during the tournament last month, and was looking forward to this pairing especially during the blitz tournament. And it did not go well for me. By the time I dropped my cap (in a terrible location) at move 11, I was pretty sure I was already in trouble, and I’m not 100% sure where it all went sideways for me (or if there’s ever one single point like that), but on reflection:

  • I should have made the immediate road threat at move 6, instead of giving up tempo AND increasing the black cap’s influence by giving it two different places to threaten me.
  • Capstone was out when it was too late and was a desperate move. Maybe could/should have been a flat. Not sure of a better, earlier move with the cap unless I dropped it in D in the first five or six moves. I tried a preemptive cap in the middle of the road in my game with Simmon and I’m not sure it really did that much for me.
  • Wall at 14 b3 might have been more disruptive, but if I’d survived and we kept moving towards flats, would have been a liability as white.

Game 6: Reid

A surprise opening from Reid, not going for the normal opposite or parallel corners. Was wondering a few moves in if I should have made my initial road threat in the B column, but I suppose that would have likely meant granting Reid’s highwaymen control of C3 & C4. Looking back, why did I not place a d6 instead of Cd4? Might not have changed much, just a slightly earlier capture to break up that road. Somewhere along the line I realized I was going to lose the capture war(s) over B4 and B5, and then I was going to have nothing to stop Reid’s road.

Game 7: Ally

Interesting, Ally here went for the off-center road threat I was considering in the previous game. As I’d assumed above, that did give black (me) the chance for a citadel in the middle of the board, but this is not entirely a center control game, so that only got me so far.

In that final move, I had realized I was going to lose the stack war over B2, but had miscalculated that white already had enough stones to throw up the B column and win. If I’d kept capturing and Ally had to use C2 to capture the stack would no longer be enough for a road with a single throw, but it still might have been tough to avoid Tinuë within a few moves, as I had so little in place on the left half of the board.

Game 8: Morten

Another deviation from the “standard” openings, an edge crawl, less common in 6×6 games. I think I was pretty fried by this point. Not sure what else I have to say about this game except that even being able to make a couple weak threats at moves 13 and 14, I felt like Moreton never lost control of the board here. 17. f2+ might have been a better move than uselessly throwing 3d4>12, but with the cap right there I don’t think would have really won me anything.

Game 9: Simmon

A very satisfying game to finish on, even if I lost on time. I look forward to watching/hearing Simmon’s self-commentary on the match when he posts it. Simmon has been putting out quite a bit of content for the Tak community, including commentary for the last few tournaments at his YouTube channel. The early capstone-in-the-middle-of-the-road at 5 Cd2 was in direct response to not having a good place for my cap in my game with Ineria previously, but I don’t know how much it actually got me. The back-and-forth of the stack wars row 4 reminded me of playing some of the bots, which can sometimes go pretty wild on large stacks.

One of those throws in there (maybe 21 6e4+15?) probably took thirty seconds on its own as I debated what I was doing with it, how many stones I was dropping where, and then mis-clicked and had to retry a half-dozen times to get the right stones in the right place. After a bit more back-and-forth I was down to a no banked time for my last few moves, and the clock ran dry as I was partway through throwing that e4 stack.

Tak Beginner’s Tournament, 2020

I should separately introduce what Tak is, and why I have come to love it, but that’s a longer story to tell.

I’ve been playing Tak for almost five years now, about as long as it’s been around publicly. The 2019 Tak tournament at Gen Con ended up being the highlight of the trip for me (surprising myself coming in at sixth place, cash prize and everything), and after that, I joined the US Tak Association, who put on tournaments both live and online.

At the tail end of 2020 I competed in the 2020 Open and didn’t do particularly well, but enjoyed my time getting better playing the 6×6 game, and quickly signed up when a beginner’s tournament was announced— Despite playing the game for as long as I have, the road to getting that much better has been a slow one.

This week I played two of my pairings, one of which was recorded with commentary. I lost both games to not taking in the state of the board well or quickly enough— on the first, I missed my opponent’s threat, on the second I missed both my own win as well as my opponent’s win that quickly followed.

I’ve taken a note from another player and started reviewing every game I play, win-or-lose, so you, too, can watch both matches with step-by-step commentary by other players from the community.

I also reviewed game 2 on ptn.ninja, which includes a few comments, as well as playing out alternate branches the game could have taken.

Multiple Aliases in SSH Config

I used to use Text Expander to shortcut ssh hostnames, but as I setup a new laptop this last year, got into doing it all more “properly” with my ssh config file and wanted a fresh start.

If you’re unfamiliar with the practice, you can store an alias at ~/.ssh/config, with an entry like this:

host <alias>
    hostname <IP or FQDN>
    user <user>
    port <port>
    IdentityFile <path/to/private/key/file.rsa>

I’d gotten into the bad habit of using “old” names for a couple of our StagingPilot instances, relying on the muscle memory of an old name, even as we had migrated workers and services to new servers with revised names, and just redirected those old names with Text Expander. I was excited to discover I could add multiple aliases for a host in my config file, meaning I could use either interchangeably.

host spapp spserver
    hostname app.stagingpilot.com
    user ptyler
    IdentityFile ~/private/key/file

Now it no longer matters if I remember ssh spapp or ssh spserver, both resolve immediately.

Fixing Cloudway’s WP-Salt + WP-CLI Conflict

I discovered Cloudways hosting after seeing a client host a number of sites there, and enjoy the flexibility of their managed system as well as an extensive API to interact with and speed up both our StagingPilot integration as well as hosting a handful of my own sites.

One interesting quirk I’ve discovered is, they “offload” wp-config’s keys and salt constants to a separate file, wp-salt.php. This is fine, except that the require()statement in wp-config.php causes WP-CLI to throw a fatal error when run in any directory other than public_html/. Adding the directory magic constant __DIR__ to the file path (assuming you’re running PHP 5.3.0+ which… you truly have no excuse not to be) allows wp-config to read that salt file when called from anywhere, giving you free reign to work with WP-CLI wherever you need.

The following sed command will do the trick in one line.

sed -i "s|require('wp-salt.php')|require(__DIR__.'/wp-salt.php')|g" wp-config.php