2023-02-09 10:11:03 +03:00
|
|
|
.PHONY: help install server clickhouse clickhouse-prod clickhouse-stop postgres postgres-prod postgres-stop
|
2022-07-06 17:47:31 +03:00
|
|
|
|
2022-10-18 18:13:59 +03:00
|
|
|
help:
|
|
|
|
@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
|
|
|
|
|
|
|
install: ## Run the initial setup
|
2021-06-15 10:34:43 +03:00
|
|
|
mix deps.get
|
|
|
|
mix ecto.create
|
|
|
|
mix ecto.migrate
|
2022-07-06 17:47:31 +03:00
|
|
|
mix download_country_database
|
2021-09-16 11:05:43 +03:00
|
|
|
npm install --prefix assets
|
2022-10-11 15:24:26 +03:00
|
|
|
npm install --prefix tracker
|
2022-10-24 13:52:15 +03:00
|
|
|
npm run deploy --prefix tracker
|
2021-06-15 10:34:43 +03:00
|
|
|
|
2022-10-18 18:13:59 +03:00
|
|
|
server: ## Start the web server
|
2021-06-15 10:34:43 +03:00
|
|
|
mix phx.server
|
|
|
|
|
2023-07-19 11:23:31 +03:00
|
|
|
CH_FLAGS ?= --detach -p 8123:8123 -p 9000:9000 --ulimit nofile=262144:262144 --name plausible_clickhouse
|
2022-10-18 18:13:59 +03:00
|
|
|
|
|
|
|
clickhouse: ## Start a container with a recent version of clickhouse
|
2024-01-17 18:32:12 +03:00
|
|
|
docker run $(CH_FLAGS) --volume=$$PWD/.clickhouse_db_vol:/var/lib/clickhouse clickhouse/clickhouse-server:latest-alpine
|
2022-10-18 18:13:59 +03:00
|
|
|
|
|
|
|
clickhouse-prod: ## Start a container with the same version of clickhouse as the one in prod
|
2023-07-11 14:54:50 +03:00
|
|
|
docker run $(CH_FLAGS) --volume=$$PWD/.clickhouse_db_vol_prod:/var/lib/clickhouse clickhouse/clickhouse-server:23.3.7.5-alpine
|
2022-04-27 21:52:12 +03:00
|
|
|
|
2022-10-18 18:13:59 +03:00
|
|
|
clickhouse-stop: ## Stop and remove the clickhouse container
|
2021-05-19 16:49:39 +03:00
|
|
|
docker stop plausible_clickhouse && docker rm plausible_clickhouse
|
2020-11-05 14:43:24 +03:00
|
|
|
|
2022-10-18 18:13:59 +03:00
|
|
|
PG_FLAGS ?= --detach -e POSTGRES_PASSWORD="postgres" -p 5432:5432 --name plausible_db
|
|
|
|
|
|
|
|
postgres: ## Start a container with a recent version of postgres
|
2023-06-30 15:01:12 +03:00
|
|
|
docker run $(PG_FLAGS) --volume=plausible_db:/var/lib/postgresql/data postgres:latest
|
2022-10-18 18:13:59 +03:00
|
|
|
|
|
|
|
postgres-prod: ## Start a container with the same version of postgres as the one in prod
|
2023-06-30 15:01:12 +03:00
|
|
|
docker run $(PG_FLAGS) --volume=plausible_db_prod:/var/lib/postgresql/data postgres:15
|
2021-05-19 16:49:39 +03:00
|
|
|
|
2022-10-18 18:13:59 +03:00
|
|
|
postgres-stop: ## Stop and remove the postgres container
|
2021-05-19 16:49:39 +03:00
|
|
|
docker stop plausible_db && docker rm plausible_db
|
2024-02-27 16:19:09 +03:00
|
|
|
|
|
|
|
minio: ## Start a transient container with a recent version of minio (s3)
|
|
|
|
docker run -d --rm -p 6000:6000 -p 6001:6001 --name plausible_minio minio/minio server /data --address ":6000" --console-address ":6001"
|
|
|
|
|
|
|
|
minio-stop: ## Stop and remove the minio container
|
|
|
|
docker stop plausible_minio
|