We have written a `Makefile` with common targets used during development.
### Building
-`build-backend`– builds a release backend executable.
-`build-octo-cli`– builds a release octo CLI executable. NOTE: this is not the octo CLI executable that is used for distribution but the dependencies are close enough for development purposes.
-`build-frontend`– build the frontend release.
### Development
For development, we have set up `ghcid` commands that rebuild the project every time you make a change. The targets should self-explanatory:
We have two commands to run the backend and frontend in the `Makefile`:
-`run-backend-dev`
Builds a production version of the backend server, runs database migrations and starts the server with mock control scripts. You can see the used config in [`dev/dev_backend.sh`](./dev/dev_backend.sh).
### NOTE:
1. You need to have a [Postgres](https://www.postgresql.org) database running on `localhost:5432` (the default port).
2. You need to create an empty `octopod` database.
3. You also need to have an `octopod:octopod` user set up as it will be used by the server to access the database.
The easiest way to do this is by running the following command after you have _Postgres running_:
```bash
psql -c "CREATE ROLE IF NOT EXISTS octopod WITH PASSWORD 'octopod' SUPERUSER LOGIN;"
```
4. You will need [sqitch](https://sqitch.org) installed on your system as it will be used to run migrations on the database.
-`run-frontend-dev`
Build a production version of the frontend and runs it locally, pointing it to the locally running backend server.
### NOTE:
You need to have [_Caddy 2_](https://caddyserver.com/v2) installed on your system as it is automatically used as a proxy.
For convenience, the repo currently also contains a `stack.yaml` that can be used for development. It is only used to build the macOS octo CLI release but supports building both octo CLI and the _Octopod Server_ in an environment close enough to the release environment to be useful during development if you prefer stack.