LiteFS Run Command


The run command will execute the program listed after the double dash. It provides options for promoting the current node or for performing write forwarding using the HALT lock. See the migrations guide for details about promotion & write forwarding.


litefs run [arguments] -- CMD [ARGS...]


      only execute if node is a candidate
      promote node to primary
  -with-halt-lock-on string
      full database path to halt


Promote the local node to become the primary and then run Rails migrations:

litefs run -promote -- bin/rails db:migrate

Run Rails migrations on the /litefs/db database from any node and have those write forwarded back to the primary node:

litefs run -with-halt-lock-on /litefs/db -- bin/rails db:migrate