Skip to content

Latest commit

 

History

History
59 lines (46 loc) · 2.73 KB

building.md

File metadata and controls

59 lines (46 loc) · 2.73 KB

To build Hideout, you need:

Clone the repo. This guide assumes it'll be at /home/user/Projects/hideout/.

Enter hideout-frontend/ and do:

elm make src/Main.elm --optimize --output=main.js

This compiles Elm code into main.js.

Enter hideout-backend/ and do:

stack install

This compiles Haskell code into an executable file at ~/.local/bin/hideout-backend-exe.

The pieces to run Hideout are

  • hideout-frontend/index.html
  • hideout-frontend/main.js
  • hideout-frontend/static/
  • ~/.local/bin/hideout-backend-exe

To host Hideout, see hosting.md

To develop Hideout, you further need:

  • nginx: https://nginx.org/en/docs/install.html, for a working local server.
  • nvm: https://github.com/nvm-sh/nvm, because elm-live needs npm. Before you try to install node and npm yourself, there are apparently right ways and wrong ways to do it. To save you an afternoon or two of your time, I feel morally obligated to point out that nvm is the proper way, or at least the least painful way, to get node and npm. Use the install script on nvm's GitHub to install nvm. Then do nvm install node to install node and npm.
  • elm-live: https://github.com/wking-io/elm-live, for hot-reloading.

I usually enter hideout-frontend/ and do:

elm-live src/Main.elm --pushstate -- --output=main.js

And keep a browser tab open at localhost:8000. This allows me to see compiler errors on a full screen, rather than a small tmux pane.

But elm-live can't get Hideout working locally. For that, we need nginx.

Nginx requires that server files are all "accessible". Specifically, try to stat into Hideout's directory, like:

stat ~/Projects/hideout/hideout-frontend/main.js

If it gives you some statistics, then it's all set. If it says "permission denied", then you need to use chmod to give x permission to all the directories leading to Hideout. In my case, I needed to do chmod +x ~. This is from a StackOverflow answer here: https://stackoverflow.com/a/43686446.

If your repo is at a different location than /home/user/Projects/hideout, then you need to modify the root directive at this line in your nginx.conf, to point to your location of hideout-frontend/.

Under hideout/, do:

sudo nginx -c $(pwd)/nginx.conf

This starts an nginx server, using a config provided by the repo.

Finally, run ~/.local/bin/hideout-backend-exe. If ~/.local/bin is on your $PATH, you can just do:

hideout-backend-exe

The server is now running on localhost.