diff options
| author | pauline nemchak <doublewebstandards@gmail.com> | 2026-04-09 19:55:18 +0100 |
|---|---|---|
| committer | pauline nemchak <doublewebstandards@gmail.com> | 2026-04-09 19:55:18 +0100 |
| commit | eb9caf82d99d61a022f67695f208067992a1a9ec (patch) | |
| tree | c51d0704424646a8e28e6e2af2b87257ff57b8f4 | |
| parent | cb311847ae2c570b0fd2afaf7cb0f8aa7ec9acd3 (diff) | |
| download | tar tar.gz tar.bz2 tar.lz tar.xz tar.zst zip | |
changed taskfile to include docker
Signed-off-by: pauline nemchak <doublewebstandards@gmail.com>
Diffstat
| -rw-r--r-- | .mailmap | 1 | +1 −0 |
| -rw-r--r-- | Taskfile.yml | 31 | +28 −3 |
2 files changed, 29 insertions, 3 deletions
diff --git a/.mailmap b/.mailmap index d8e0402..1ad4d8b 100644 --- a/.mailmap +++ b/.mailmap @@ -2,3 +2,4 @@ Nikolay Govorov <me@govorov.online> Nikolay Govorov <mr@dimidiumlabs.io> +pauline nemchak <doublewebstandards@gmail.com> diff --git a/Taskfile.yml b/Taskfile.yml index b3090e6..05ffcdf 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -10,6 +10,7 @@ vars: DIST_DIR: build/dist ARCHES: amd64 arm64 riscv64 ppc64le DEV_DB: mirum-local-dev + DOCKER: "false" tasks: ci: @@ -182,10 +183,11 @@ tasks: key: "dev/server.key" EOF - devenv:db: - desc: Create the dev postgres role and database (idempotent, needs sudo) + devenv:db:local: + internal: true + desc: Create the dev postgres role and database on a local install (needs sudo) status: - - PGPASSWORD={{.DEV_DB}} psql -h localhost -U {{.DEV_DB}} -d {{.DEV_DB}} -c 'SELECT 1' >/dev/null 2>&1 + - '[ "{{.DOCKER}}" = "true" ] || PGPASSWORD={{.DEV_DB}} psql -h localhost -U {{.DEV_DB}} -d {{.DEV_DB}} -c "SELECT 1" >/dev/null 2>&1' cmds: - | sudo -u postgres psql -tAc "SELECT 1 FROM pg_roles WHERE rolname='{{.DEV_DB}}'" | grep -q 1 || @@ -194,6 +196,29 @@ tasks: sudo -u postgres psql -tAc "SELECT 1 FROM pg_database WHERE datname='{{.DEV_DB}}'" | grep -q 1 || sudo -u postgres psql -c "CREATE DATABASE \"{{.DEV_DB}}\" OWNER \"{{.DEV_DB}}\"" + devenv:db:docker: + internal: true + desc: Start a Postgres Docker container for dev + status: + - '[ "{{.DOCKER}}" != "true" ] || docker exec {{.DEV_DB}} pg_isready -U {{.DEV_DB}} >/dev/null 2>&1 || nc -z localhost 5432 2>/dev/null' + cmds: + - docker run -d + --name {{.DEV_DB}} + -e POSTGRES_USER={{.DEV_DB}} + -e POSTGRES_PASSWORD={{.DEV_DB}} + -e POSTGRES_DB={{.DEV_DB}} + -p 5432:5432 + postgres:18 + - | + echo "Waiting for postgres..." + until docker exec {{.DEV_DB}} pg_isready -U {{.DEV_DB}} >/dev/null 2>&1; do + sleep 1 + done + + devenv:db: + desc: "Create the dev postgres role and database (set DOCKER=true for Docker)" + deps: [devenv:db:local, devenv:db:docker] + devenv: desc: Provision a full local dev environment (keys, config, database) deps: [devenv:keys, devenv:config, devenv:db] |
