DEV Community

Timothy Miller
Timothy Miller

Posted on • Originally published at timothymiller.dev on

I’m done with LocalWP

I hate to say it, but I am abandoning Local WP (formerly by Flywheel). I used it the last couple of years, but I can’t do it anymore. I’m done.

Why?

One big reason: databases. It is a huge pain in the neck importing databases into Local. I don’t have to do it very often, but every time I do it drives me nuts. Database imports have required nasty hacks for at least four years, so I don’t expect it to be fixed anytime soon.

It also seems like the focus of the app has changed. It used to be a great tool for developing WordPress sites locally, now it seems more like a great integration for its parent company, WPEngine. I love WPEngine as a platform, but many of my clients use other WordPress hosts, and Local simply isn’t the best option for sites that aren’t using WPEngine. Even for WPEngine sites, the connector utility is sketchy at best. It’s great when it works, awful when it doesn’t.

What do you use instead?

I’m back to my old Docker Compose setup, which I made a video about several years ago. I have a boilerplate docker-compose template that I use in every WordPress site, and this allows me to create and destroy my local servers with very simple commands:

# firing up the server
docker-compose up

# shutting down the server
docker-compose stop

# destroying the server
docker-compose rm
Enter fullscreen mode Exit fullscreen mode

In case you’re curious, here’s what my typical docker compose file looks like:

version: '2'

services:
   mysql:
     image: mysql:5.6
     volumes:
  # this line automatically imports .sql files
  # all I do is drop them into a /db folder
  # and Docker does the rest!
       - ./db:/docker-entrypoint-initdb.d
       - ./db/conf:/etc/mysql/conf.d
     restart: always
     ports:
         - "3306:3306"
     environment:
       MYSQL_ROOT_PASSWORD: wordpress
       MYSQL_DATABASE: wordpress
       MYSQL_USER: wordpress
       MYSQL_PASSWORD: wordpress

   # I usually leave PHP MyAdmin disabled unless I need it
   # myadmin:
   #    image: phpmyadmin/phpmyadmin
   #    ports:
   #       - "8888:80"
   #    depends_on:
   #       - mysql
   #    restart: always
   #    links:
   #       - mysql:db
   #    environment:
   #       MYSQL_USERNAME: wordpress
   #       MYSQL_PASSWORD: wordpress
   #       MYSQL_ROOT_PASSWORD: wordpress

   wordpress:
     depends_on:
       - mysql
     image: wordpress:php7.3
     links:
       - mysql:mysql
     volumes:
       - ./:/var/www/html
     ports:
     # I use a unique port number for each client
     # (you only change the first number, "8000")
       - 8000:80
     restart: always
     environment:
       WORDPRESS_DB_PASSWORD: wordpress


Enter fullscreen mode Exit fullscreen mode

As long as you have Docker installed and running, you can place this file inside your root directory (name it docker-compose.yml), run docker-compose up and Docker will do the rest. It will automatically spin up a new server and database, and import any SQL files that it finds in the /db folder. It works like magic, no more frustrations with Local.

If Docker is so great, why did I stop using Docker?

Partially because Local was new and shiny, and everyone else was using it. It’s a pretty app, and I like to use pretty apps.

I also tried it because Docker can be slow on Macs. Locals wasn’t really much better—they probably use similar tech behind the hood—but I hoped Locals would be better on Macs.

Now I use a Linux computer full time, and Docker works like a dream on Linux, so there’s really no downside to switching back to Docker.

Top comments (0)