Setup Krenalis for development
1. Install React and other dependencies
cd admin
npm ci
2. Configure
Set environment variables necessary to run Krenalis (you can add a configuration file .env (see .env.example) in the same directory of the krenalis executable).
3. Compile the server command
Within the root of this repository execute:
go build -tags freshadminassets,osusergo,netgo -trimpath
The freshadminassets tag makes Krenalis read the Admin files from the source code in the repository on every request, instead of using generated assets. This way, you don't need to generate the assets or restart Krenalis: after changing the Admin, just reload the page in the browser.
4. Run and open the browser
Launch the server command executing ./krenalis (or ./krenalis.exe on Windows) and visit http://127.0.0.1:2022/admin/.
Note that if it's the first time you are running Krenalis and the configured PostgreSQL database is empty, you need to start Krenalis by specifying the -init-db-if-empty option to initialize the database.
Expose on the Internet (optional)
These steps document how to expose a locally running Krenalis instance to the internet.
- Install cloudflared
- Check that it is installed correctly:
cloudflared --version - Run cloudflared:
cloudflared tunnel --url http://localhost:2022 - Make a note of the URL listed in the standard output (example: https://xxxxxxx.trycloudflare.com)
- Open the URL in a browser