Skip to content

Commit b21a8bf

Browse files
committed
Revert unnecessary changes
1 parent c80300c commit b21a8bf

7 files changed

Lines changed: 8 additions & 72 deletions

File tree

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Make sure Docker, Elixir, Erlang and Node.js are all installed on your developme
1010

1111
### Start the environment
1212

13-
1. Run `make network`, `make postgres`, `make clickhouse`, `make ch-haproxy`
13+
1. Run both `make postgres` and `make clickhouse`.
1414
2. You can set up everything with `make install`, alternatively run each command separately:
1515
1. Run `mix deps.get`. This will download the required Elixir dependencies.
1616
2. Run `mix ecto.create`. This will create the required databases in both Postgres and Clickhouse.

Makefile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,10 @@ install: ## Run the initial setup
2121
server: ## Start the web server
2222
mix phx.server
2323

24-
CH_FLAGS ?= --detach -p 8123:8123 --ulimit nofile=262144:262144 --name plausible_clickhouse --env CLICKHOUSE_SKIP_USER_SETUP=1
25-
26-
network: ## Create a docker network for clickhouse and haproxy
27-
docker network create ch-net || true
24+
CH_FLAGS ?= --detach -p 8123:8123 -p 9000:9000 --ulimit nofile=262144:262144 --name plausible_clickhouse --env CLICKHOUSE_SKIP_USER_SETUP=1
2825

2926
clickhouse: ## Start a container with a recent version of clickhouse
30-
docker run $(CH_FLAGS) --network ch-net --volume=$$PWD/.clickhouse_db_vol:/var/lib/clickhouse --volume=$$PWD/.clickhouse_config:/etc/clickhouse-server/config.d clickhouse/clickhouse-server:latest-alpine
27+
docker run $(CH_FLAGS) --network host --volume=$$PWD/.clickhouse_db_vol:/var/lib/clickhouse --volume=$$PWD/.clickhouse_config:/etc/clickhouse-server/config.d clickhouse/clickhouse-server:latest-alpine
3128

3229
clickhouse-client: ## Connect to clickhouse
3330
docker exec -it plausible_clickhouse clickhouse-client -d plausible_events_db

config/.env.dev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
BASE_URL=http://localhost:8000
22
SECURE_COOKIE=false
33
DATABASE_URL=postgres://postgres:postgres@127.0.0.1:5432/plausible_dev
4-
CLICKHOUSE_DATABASE_URL=http://127.0.0.1:8124/plausible_events_db
4+
CLICKHOUSE_DATABASE_URL=http://127.0.0.1:8123/plausible_events_db
55
CLICKHOUSE_MAX_BUFFER_SIZE_BYTES=1000000
66
SECRET_KEY_BASE=/njrhntbycvastyvtk1zycwfm981vpo/0xrvwjjvemdakc/vsvbrevlwsc6u8rcg
77
TOTP_VAULT_KEY=Q3BD4nddbkVJIPXgHuo5NthGKSIH0yesRfG05J88HIo=

config/.env.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
DATABASE_URL=postgres://postgres:postgres@127.0.0.1:5432/plausible_test
2-
CLICKHOUSE_DATABASE_URL=http://127.0.0.1:8124/plausible_test
2+
CLICKHOUSE_DATABASE_URL=http://127.0.0.1:8123/plausible_test
33
SECRET_KEY_BASE=/njrhntbycvastyvtk1zycwfm981vpo/0xrvwjjvemdakc/vsvbrevlwsc6u8rcg
44
TOTP_VAULT_KEY=1Jah1HEOnCEnmBE+4/OgbJRraJIppPmYCNbZoFJboZs=
55
BASE_URL=http://localhost:8000

config/runtime.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ ch_db_url =
118118
get_var_from_path_or_env(
119119
config_dir,
120120
"CLICKHOUSE_DATABASE_URL",
121-
"http://plausible_events_db:8124/plausible_events_db"
121+
"http://plausible_events_db:8123/plausible_events_db"
122122
)
123123

124124
{ingest_pool_size, ""} =

haproxy.cfg

Lines changed: 0 additions & 36 deletions
This file was deleted.

lib/mix/tasks/send_pageview.ex

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ defmodule Mix.Tasks.SendPageview do
1919
@default_props "{}"
2020
@default_queryparams ""
2121
@default_interactive true
22-
@default_batches 1
23-
@default_batch_size 1
2422
@options [
2523
ip: :string,
2624
user_agent: :string,
@@ -34,9 +32,7 @@ defmodule Mix.Tasks.SendPageview do
3432
revenue_currency: :string,
3533
revenue_amount: :string,
3634
queryparams: :string,
37-
interactive: :string,
38-
batches: :integer,
39-
batch_size: :integer
35+
interactive: :string
4036
]
4137

4238
def run(opts) do
@@ -46,28 +42,7 @@ defmodule Mix.Tasks.SendPageview do
4642

4743
case invalid do
4844
[] ->
49-
batches = Keyword.get(parsed, :batches, @default_batches)
50-
batch_size = Keyword.get(parsed, :batch_size, @default_batch_size)
51-
from_same_ip_limit = 20
52-
for _ <- 1..batches do
53-
batch_ips =
54-
1..max(Integer.floor_div(batch_size, from_same_ip_limit), 1)
55-
|> Enum.map(fn _ -> Enum.map_join(1..4, ".", fn _ -> Enum.random(1..254) end) end)
56-
57-
tasks =
58-
1..batch_size
59-
|> Enum.map(fn i ->
60-
Task.async(fn ->
61-
do_send_pageview(
62-
parsed
63-
|> Keyword.update(:page, "#{@default_page}#{i}", fn page -> "#{page}/#{i}" end)
64-
|> Keyword.put(:ip, Enum.random(batch_ips))
65-
)
66-
end)
67-
end)
68-
69-
Task.await_many(tasks)
70-
end
45+
do_send_pageview(parsed)
7146

7247
[invalid_option | _] ->
7348
{key, _val} = invalid_option

0 commit comments

Comments
 (0)