<?xml version='1.0' encoding='UTF-8' standalone='yes'?> <html xmlns='http://www.w3.org/1999/xhtml'> <head> <title>Read me</title> </head> <body> <section> <h1>Introduction</h1> <p> This is the website of Station. </p> </section> <section> <h1>Installation</h1> <h2>Right in local machine</h2> <p> Install database <a href="https://www.postgresql.org/">PostgreSQL</a>. </p> <p> Install Haskell compiler <a href="https://www.haskell.org/ghc/">GHC</a> and package installer <a href="https://www.haskell.org/cabal/index.html">cabal-install</a>. </p> <h2>With Docker</h2> <p>Install docker and docker-compose</p> <p>Jump right to execution. Haskell setup is automatically done in docker.</p> </section> <section> <h1>Environment variables</h1> <p> <table> <thead> <th>Variable</th> <th>Type</th> <th>Default</th> <th>Description</th> </thead> <tbody> <tr> <td>PORT</td> <td>number</td> <td>8000</td> <td>Socket port to listen on</td> </tr> <tr> <td>DATABASE_URL</td> <td>connection string</td> <td></td> <td>PostgreSQL database to use</td> </tr> <tr> <td>LOG</td> <td>True / False</td> <td>False</td> <td>Display log messages</td> </tr> </tbody> </table> </p> </section> <section> <h1>Initialize database</h1> <blockquote> <code>psql $DATABASE_URL < sql/setup.sql</code> </blockquote> </section> <section> <h1>Build</h1> <blockquote> <code>cabal v2-build</code> </blockquote> </section> <section> <h1>Execution</h1> <h2>Right in local machine</h2> <blockquote> <code>cabal v2-run</code> </blockquote> <h2>With docker</h2> <p>Before this, please copy .env.repo to .env</p> <blockquote> <code>source dev-cmds.sh</code> </blockquote> <p>Available commands are documented in dev-cmds.sh itself.</p> <p><i>Note: requires docker-compose. In some OSes, docker-compose may not come with docker-compose and need to be install separately.</i></p> <p>Different from production setup, codes are bind-mounted in /opt. So a <code>sm_restart web</code> will update dependencies, compile and run modified codes</p> </section> <section> <h1>Other Commands</h1> <dl> <dt>Help text</dt> <dd> <code>cabal v2-run station help</code> </dd> <dt>Database migration</dt> <dd> <code>cabal v2-run station migrate</code> </dd> <dt>Add user</dt> <dd> <code>cabal v2-run station adduser {username} {password} {role}</code> </dd> </dl> </section> </body> </html>