From 986ddf76bb9490407a9dff9f807d4f8f6212deeb Mon Sep 17 00:00:00 2001 From: BroodjeAap Date: Sat, 17 Dec 2022 15:38:35 +0000 Subject: [PATCH] added compose yml --- README.md | 49 ++++++++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 31 +++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 docker-compose.yml diff --git a/README.md b/README.md index 76ced66..a326967 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,55 @@ A change detection server that can notify through various services written in Go +# Run + +### Docker + +Easiest way to get started is with the prebuilt docker image: +``` +docker run \ + -p 8080:8080 \ + -v /host/path/to/config:/config \ + ghcr.io/broodjeaap/go-watch:master +``` + +This will start GoWatch with a SQLite database, stored in the `/config` directory, which is probably fine for most use cases. + +To use another database, the environment variable `GOWATCH_DATABASE_DSN` can be used, for example with a PostgreSQL database: +``` +version: "3" + +services: + app: + build: + context: . + dockerfile: Dockerfile + target: base + container_name: go-watch + environment: + - GOWATCH_DATABASE_DSN=postgres://gorm:gorm@db:5432/gorm + volumes: + - /host/path/to/config:/config + ports: + - "8080:8080" + depends_on: + db: + condition: service_healthy + db: + image: postgres:15 + environment: + - POSTGRES_USER=gorm + - POSTGRES_PASSWORD=gorm + - POSTGRES_DB=gorm + volumes: + - /host/path/to/db:/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"] + interval: 10s + timeout: 5s + retries: 5 +``` + # Intro GoWatch works through filters, a filter performs operations on the input it recieves. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..4697c30 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,31 @@ +version: "3" + +services: + app: + build: + context: . + dockerfile: Dockerfile + target: base + container_name: go-watch + environment: + - GOWATCH_DATABASE_DSN=postgres://gorm:gorm@db:5432/gorm + volumes: + - /host/path/to/config:/config + ports: + - "8080:8080" + depends_on: + db: + condition: service_healthy + db: + image: postgres:15 + environment: + - POSTGRES_USER=gorm + - POSTGRES_PASSWORD=gorm + - POSTGRES_DB=gorm + volumes: + - /host/path/to/db:/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"] + interval: 10s + timeout: 5s + retries: 5 \ No newline at end of file