add docker compose instructions

This commit is contained in:
array-in-a-matrix 2024-08-02 21:58:55 -04:00
parent 6ca0c224ce
commit 754a1f5b4d

View file

@ -32,12 +32,16 @@ nimble test
### Docker
#### Compile binary
To compile the binary only, run the following (executable will be found in `/bin/`):
```sh
docker buildx build -t glimpse-server:latest --output=bin --target=runner -f bin.dockerfile .
```
#### Deploy using docker run
To deploy an instance of glimpse within docker, run the following (make sure to update the database's host accordingly):
```sh
@ -51,11 +55,25 @@ Use the following to run a temporary PostgreSQL database, (**DO NOT USE IN PRODU
docker run -it --rm -e POSTGRES_USER=user -e POSTGRES_PASSWORD=postgresql -p 5432:5432 postgres
```
#### Deploy using docker compose
The docker compose provided sets up a postgres server alongside glimpse. To deploy, run (add the `-d` to detach and run in the background):
```sh
docker compose up
```
To shutdown the servers:
```sh
docker compose down
```
## Usage
### Configuration
Glimpse will create the default configuration file, `config.ini`, in the root of the directory if it does not exist. Configuration relating to web framework, [Jester](https://github.com/dom96/jester), is under the `Server` section. Database configuration is under the `Database` section. Other configuration variables are under `General`.
Glimpse will create the default configuration file, `config.ini`, in the root of the directory if it does not exist. Configuration relating to web framework, [Jester](https://github.com/dom96/jester), is under the `Server` section. Database configuration is under the `Database` section. Other configuration variables are under `General`. If running glimpse using the docker image, `docker run ...`, make sure to adjust container's network pointing it to the database (Use `network_mode: host` if database is running from host).
### API Endpoints