So my wonderful 6-year old Dell XPS 13 Developer edition’s soldering at the power port finally gave way, leaving me with a fully function laptop with only one little issue that it can’t get power. The sent me packing to my ‘backup’ Windows 10 laptop. I really wanted to keep working in a Linux environment and the new WSL with Ubuntu feature seemed like the perfect choice…. well, may be not so much. Here are some random notes I painfully learned on setting up Rails 5.2 with Postgresql 11 on Windows Subsystem for Linux:

Is This Thing On?

The Postgresql service (and WSL as a whole) isn’t on when you don’t have a window open. When it start’s Postgres doesn’t start with it, so: sudo service postgresql start

Force TCP

If it’s a local database, Rails will by default try to connect to Postgresql with UNIX sockets instead of through the TCP port. Per WSL issue #921, this won’t work. The solution: set host to 127.0.0.1 and include the ‘port’ in your config\database.yml file:
development:
  <<: *default
  host: 127.0.0.1
  database: development
  username: <username>
  password: <password>
  port: 5432

Disable fsync

You’ll then run into the following error while attempt to create the database with rake db:migrate:
WARNING:  could not flush dirty data: Function not implemented
This is discussed in WSL issue # 2628, which is a couple clicks away from this Postgresql thread on fsync. After a few wrong turns, it led me to this thread, which has you add the following line to /etc/postgresql.conf:
fsync=off
Worked like a charm… after only 6+ hours of teeth-gnashing