Git Product home page Git Product logo

community-edition's People

Contributors

aerosol avatar avimanyu786 avatar birjj avatar bokub avatar bruising6802 avatar iwootten avatar jeroenvb3 avatar joshavant avatar ketan-vijayvargiya avatar kiprasmel avatar mabasic avatar metmarkosaric avatar navjotjsingh avatar onzecki avatar oscartbeaumont avatar paskal avatar philipinho avatar realorangeone avatar robertmarsal avatar ruslandoga avatar ukutaht avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

community-edition's Issues

being sent back to /settings when trying to open stats

Hey guys,

I've been running the docker version for a little while now, but one of the accounts is getting an error when he tries to access his domain stats.
Login works fine, but when clicking on a domain, he is being redirected to /settings, not the domain.

In the mean time the docker container is throwing an error:

plausible_1 | Request: GET /kwacha.webflow.io plausible_1 | ** (exit) an exception was raised: plausible_1 | ** (Plug.Conn.AlreadySentError) the response was already sent plausible_1 | (plug 1.10.1) lib/plug/conn.ex:1535: Plug.Conn.put_session/3 plausible_1 | (plausible 0.0.1) lib/plausible_web/controllers/stats_controller.ex:21: PlausibleWeb.StatsController.stats/2 plausible_1 | (plausible 0.0.1) lib/plausible_web/controllers/stats_controller.ex:1: PlausibleWeb.StatsController.action/2 plausible_1 | (plausible 0.0.1) lib/plausible_web/controllers/stats_controller.ex:1: PlausibleWeb.StatsController.phoenix_controller_pipeline/2 plausible_1 | (phoenix 1.4.17) lib/phoenix/router.ex:288: Phoenix.Router.__call__/2 plausible_1 | (plausible 0.0.1) lib/plug/error_handler.ex:65: PlausibleWeb.Router.call/2 plausible_1 | (plausible 0.0.1) lib/plausible_web/endpoint.ex:1: PlausibleWeb.Endpoint.plug_builder_call/2 plausible_1 | (plausible 0.0.1) lib/plausible_web/endpoint.ex:1: PlausibleWeb.Endpoint."call (overridable 3)"/2 plausible_1 | 12:34:33.670 request_id=FksO5iElfq0pwW4AAAFF [warn] Failed to send Sentry event.Cannot send Sentry event because of invalid DSN plausible_1 | 12:34:33.676 [error] #PID<0.4461.0> running PlausibleWeb.Endpoint (connection #PID<0.4460.0>, stream id 1) terminated plausible_1 | Server: stats.vejnoe.dk:80 (http) plausible_1 | Request: GET /kwacha.webflow.io plausible_1 | ** (exit) an exception was raised: plausible_1 | ** (Plug.Conn.AlreadySentError) the response was already sent plausible_1 | (plug 1.10.1) lib/plug/conn.ex:1535: Plug.Conn.put_session/3 plausible_1 | (plausible 0.0.1) lib/plausible_web/controllers/stats_controller.ex:21: PlausibleWeb.StatsController.stats/2 plausible_1 | (plausible 0.0.1) lib/plausible_web/controllers/stats_controller.ex:1: PlausibleWeb.StatsController.action/2 plausible_1 | (plausible 0.0.1) lib/plausible_web/controllers/stats_controller.ex:1: PlausibleWeb.StatsController.phoenix_controller_pipeline/2 plausible_1 | (phoenix 1.4.17) lib/phoenix/router.ex:288: Phoenix.Router.__call__/2 plausible_1 | (plausible 0.0.1) lib/plug/error_handler.ex:65: PlausibleWeb.Router.call/2 plausible_1 | (plausible 0.0.1) lib/plausible_web/endpoint.ex:1: PlausibleWeb.Endpoint.plug_builder_call/2 plausible_1 | (plausible 0.0.1) lib/plausible_web/endpoint.ex:1: PlausibleWeb.Endpoint."call (overridable 3)"/2

Historical data over 47 GB – any way to enfore a retention policy?

Hello all,

I'm running Plausible in a Docker container and I just noticed that it's storing 47GB of data, the majority of it in the ./store directory:

8.0K	./495
16K	./108
16K	./1b3
16K	./1eb
16K	./2b1
16K	./8db
16K	./bd3
16K	./c2f
16K	./c58
16K	./f69
20K	./403
40K	./58b
56K	./8fb
840K	./9d2
848K	./c99
36M	./fe5
88M	./38d
3.3G	./964
19G	./7a2
25G	./ee7
47G	.

I'm not sure what any of these directory names signify, so I'm hesitant to delete any of them. Nevertheless, I'd like to know if there's a way to limit the amount of historical data stored? 47GB is a bit excessive for a handful of small sites, especially given the fact that I have no intention of reviewing statistics from years ago.

Thanks!

Issue when generating certificate with certbot

I am following the documentation here, but when I enter:

sudo certbot --nginx

and select the virtual host, I get this error:

Obtaining a new certificate
Performing the following challenges:
http-01 challenge for plausible.laravelista.com
Waiting for verification...
Cleaning up challenges
Failed authorization procedure. plausible.laravelista.com (http-01): urn:ietf:params:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://plausible.laravelista.com/.well-known/acme-challenge/RIILIq6-u-mzcqo7mT8hDesS-VfPn1O1-obtFGt7ijI [2a03:b0c0:3:e0::476:7001]: "<html>\r\n<head><title>404 Not Found</title></head>\r\n<body>\r\n<center><h1>404 Not Found</h1></center>\r\n<hr><center>nginx/1.16.1</ce"

IMPORTANT NOTES:
 - The following errors were reported by the server:

   Domain: plausible.laravelista.com
   Type:   unauthorized
   Detail: Invalid response from
   http://plausible.laravelista.com/.well-known/acme-challenge/RIILIq6-u-mzcqo7mT8hDesS-VfPn1O1-obtFGt7ijI
   [2a03:b0c0:3:e0::476:7001]: "<html>\r\n<head><title>404 Not
   Found</title></head>\r\n<body>\r\n<center><h1>404 Not
   Found</h1></center>\r\n<hr><center>nginx/1.16.1</ce"

   To fix these errors, please make sure that your domain name was
   entered correctly and the DNS A/AAAA record(s) for that domain
   contain(s) the right IP address.

For some reason certbot is not getting the response from plausible container, but from my local nginx. When I try manually visiting the URL in browser I get the 404 response from plausible container.

Am I missing some options in the nginx virtual host config?

plausible.cnf

server {
        server_name plausible.laravelista.com;

        location / {
                proxy_pass http://127.0.0.1:8000;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
}

<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Message for you</title> <link rel="stylesheet" href="style.css"> </head> <body> <div class="wrapper"> <h2 class="question">You like me?</h2> <img class="gif" alt="gif" src="https://raw.githubusercontent.com/DzarelDeveloper/Img/main/gifyou.webp"> <div class="btn-group"> <button class="yes-btn">Yes</button> <button class="no- btn">No</button> </div> </div> <script src="script.js"></script> </body> </html>

Please do not submit issues here. Best place for self-hosting issues, questions and ideas is the community forum here on GitHub. Thanks!

Error since last update at boot

Plausible Self Hosted : Docker
Docker Version : Docker version 20.10.21, build baeda1f
Host informations : 5.4.0-97-generic #110-Ubuntu SMP Thu Jan 13 18:22:13 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Compose version : 3.3
Docker tag : latest

Error :

ERROR! Config provider Config.Reader failed with:
** (Jason.DecodeError) unexpected byte at position 38: 0x70 ("p")
    lib/jason.ex:92: Jason.decode!/2
    (stdlib 3.17.1) erl_eval.erl:685: :erl_eval.do_apply/6
    (stdlib 3.17.1) erl_eval.erl:446: :erl_eval.expr/5
    (elixir 1.13.4) src/elixir.erl:296: :elixir.recur_eval/3
    (elixir 1.13.4) src/elixir.erl:274: :elixir.eval_forms/3
    (elixir 1.13.4) lib/code.ex:404: Code.validated_eval_string/3
    (elixir 1.13.4) lib/config.ex:260: Config.__eval__!/3
    (elixir 1.13.4) lib/config/reader.ex:92: Config.Reader.read!/2

I use watchtower to auto pull and recreate, but i don't see any tags on the Docker Hub for plausible.

docker-compose up - Gives database errors and main app dies

When doing docker-compose up on master there is an error that causes the main app docker to terminate

Attaching to hosting_plausible_db_1, hosting_plausible_events_db_1, hosting_mail_1, hosting_plausible_1
mail_1                 |     1 LOG: MAIN
mail_1                 |     1   exim 4.89 daemon started: pid=1, -q30m, listening for SMTP on port 25 (IPv6 and IPv4)
plausible_db_1         | 
plausible_db_1         | PostgreSQL Database directory appears to contain a database; Skipping initialization
plausible_db_1         | 
plausible_db_1         | 2020-12-06 17:29:53.646 UTC [1] LOG:  starting PostgreSQL 13.1 (Debian 13.1-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
plausible_events_db_1  | Processing configuration file '/etc/clickhouse-server/config.xml'.
plausible_db_1         | 2020-12-06 17:29:53.698 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
plausible_db_1         | 2020-12-06 17:29:53.698 UTC [1] LOG:  listening on IPv6 address "::", port 5432
plausible_db_1         | 2020-12-06 17:29:53.708 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
plausible_db_1         | 2020-12-06 17:29:53.720 UTC [25] LOG:  database system was shut down at 2020-12-06 17:23:28 UTC
plausible_events_db_1  | Merging configuration file '/etc/clickhouse-server/config.d/docker_related_config.xml'.
plausible_db_1         | 2020-12-06 17:29:53.733 UTC [1] LOG:  database system is ready to accept connections
plausible_events_db_1  | Include not found: clickhouse_remote_servers
plausible_events_db_1  | Include not found: clickhouse_compression
plausible_events_db_1  | Logging warning to /var/log/clickhouse-server/clickhouse-server.log
plausible_events_db_1  | Logging errors to /var/log/clickhouse-server/clickhouse-server.err.log
plausible_events_db_1  | Logging warning to console
plausible_events_db_1  | Include not found: networks
plausible_events_db_1  | 2020.12.06 17:29:53.926051 [ 1 ] {} <Warning> Application: Listen [::1]:8123 failed: Poco::Exception. Code: 1000, e.code() = 99, e.displayText() = Net Exception: Cannot assign requested address: [::1]:8123 (version 20.11.4.13 (official build)). If it is an IPv6 or IPv4 address and your host has disabled IPv6 or IPv4, then consider to specify not disabled IPv4 or IPv6 address to listen in <listen_host> element of configuration file. Example for disabled IPv6: <listen_host>0.0.0.0</listen_host> . Example for disabled IPv4: <listen_host>::</listen_host>
plausible_events_db_1  | 2020.12.06 17:29:53.926781 [ 1 ] {} <Warning> Application: Listen [::1]:9000 failed: Poco::Exception. Code: 1000, e.code() = 99, e.displayText() = Net Exception: Cannot assign requested address: [::1]:9000 (version 20.11.4.13 (official build)). If it is an IPv6 or IPv4 address and your host has disabled IPv6 or IPv4, then consider to specify not disabled IPv4 or IPv6 address to listen in <listen_host> element of configuration file. Example for disabled IPv6: <listen_host>0.0.0.0</listen_host> . Example for disabled IPv4: <listen_host>::</listen_host>
plausible_events_db_1  | 2020.12.06 17:29:53.927464 [ 1 ] {} <Warning> Application: Listen [::1]:9009 failed: Poco::Exception. Code: 1000, e.code() = 99, e.displayText() = Net Exception: Cannot assign requested address: [::1]:9009 (version 20.11.4.13 (official build)). If it is an IPv6 or IPv4 address and your host has disabled IPv6 or IPv4, then consider to specify not disabled IPv4 or IPv6 address to listen in <listen_host> element of configuration file. Example for disabled IPv6: <listen_host>0.0.0.0</listen_host> . Example for disabled IPv4: <listen_host>::</listen_host>
plausible_events_db_1  | 2020.12.06 17:29:53.928301 [ 1 ] {} <Warning> Application: Listen [::1]:9004 failed: Poco::Exception. Code: 1000, e.code() = 99, e.displayText() = Net Exception: Cannot assign requested address: [::1]:9004 (version 20.11.4.13 (official build)). If it is an IPv6 or IPv4 address and your host has disabled IPv6 or IPv4, then consider to specify not disabled IPv4 or IPv6 address to listen in <listen_host> element of configuration file. Example for disabled IPv6: <listen_host>0.0.0.0</listen_host> . Example for disabled IPv4: <listen_host>::</listen_host>
plausible_events_db_1  | Include not found: clickhouse_remote_servers
plausible_events_db_1  | Include not found: clickhouse_compression
plausible_1            | Loading plausible..
plausible_1            | Starting dependencies..
plausible_1            | Starting repos..
plausible_1            | create Plausible.Repo database if it doesn't exist
plausible_db_1         | 2020-12-06 17:30:06.347 UTC [34] ERROR:  database "plausible_db" already exists
plausible_db_1         | 2020-12-06 17:30:06.347 UTC [34] STATEMENT:  CREATE DATABASE "plausible_db" ENCODING 'UTF8'
plausible_1            | create Plausible.ClickhouseRepo database if it doesn't exist
plausible_1            | 17:23:12.470 [error] Clickhousex.Protocol (#PID<0.245.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
plausible_1            | 17:23:12.470 [error] Clickhousex.Protocol (#PID<0.244.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
plausible_1            | 17:23:12.475 [error] GenServer #PID<0.265.0> terminating
plausible_1            | ** (UndefinedFunctionError) function :econnrefused.exception/1 is undefined (module :econnrefused is not available)
plausible_1            |     :econnrefused.exception([])
plausible_1            |     (db_connection 2.2.2) lib/db_connection/connection.ex:87: DBConnection.Connection.connect/2
plausible_1            |     (connection 1.0.4) lib/connection.ex:622: Connection.enter_connect/5
plausible_1            |     (stdlib 3.12.1) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
plausible_1            | Last message: nil
plausible_1            | 17:23:12.477 [error] GenServer #PID<0.266.0> terminating
plausible_1            | ** (UndefinedFunctionError) function :econnrefused.exception/1 is undefined (module :econnrefused is not available)
plausible_1            |     :econnrefused.exception([])
plausible_1            |     (db_connection 2.2.2) lib/db_connection/connection.ex:87: DBConnection.Connection.connect/2
plausible_1            |     (connection 1.0.4) lib/connection.ex:622: Connection.enter_connect/5
plausible_1            |     (stdlib 3.12.1) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
plausible_1            | Last message: nil
plausible_1            | 17:23:12.479 [error] GenServer #PID<0.267.0> terminating
plausible_1            | ** (UndefinedFunctionError) function :econnrefused.exception/1 is undefined (module :econnrefused is not available)
plausible_1            |     :econnrefused.exception([])
plausible_1            |     (db_connection 2.2.2) lib/db_connection/connection.ex:87: DBConnection.Connection.connect/2
plausible_1            |     (connection 1.0.4) lib/connection.ex:622: Connection.enter_connect/5
plausible_1            |     (stdlib 3.12.1) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
plausible_1            | Last message: nil
plausible_1            | 17:23:12.482 [error] GenServer #PID<0.268.0> terminating
plausible_1            | ** (UndefinedFunctionError) function :econnrefused.exception/1 is undefined (module :econnrefused is not available)
plausible_1            |     :econnrefused.exception([])
plausible_1            |     (db_connection 2.2.2) lib/db_connection/connection.ex:87: DBConnection.Connection.connect/2
plausible_1            |     (connection 1.0.4) lib/connection.ex:622: Connection.enter_connect/5
plausible_1            |     (stdlib 3.12.1) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
plausible_1            | Last message: nil
plausible_1            | ** (MatchError) no match of right hand side value: {:error, "killed"}
plausible_1            |     (plausible 0.0.1) lib/plausible_release.ex:56: anonymous fn/2 in Plausible.Release.createdb/0
plausible_1            |     (elixir 1.10.3) lib/enum.ex:2111: Enum."-reduce/3-lists^foldl/2-0-"/3
plausible_1            |     (plausible 0.0.1) lib/plausible_release.ex:55: Plausible.Release.createdb/0
plausible_1            |     (stdlib 3.12.1) erl_eval.erl:680: :erl_eval.do_apply/6
plausible_1            |     (elixir 1.10.3) lib/code.ex:341: Code.eval_string_with_error_handling/3
hosting_plausible_1 exited with code 1

Mailer/SMTP Setup

Hi there,

I'm trying to setup emails notifications on my Plausible self-hosted.

docker-compose.yml

version: "3.3"
services:
  mail:
    image: bytemark/smtp
    restart: always

  plausible_db:
    image: postgres:12
    restart: always
    volumes:
      - db-data:/var/lib/postgresql/data
    environment:
      - POSTGRES_PASSWORD=**********

  plausible_events_db:
    image: yandex/clickhouse-server:21.3.2.5
    restart: always
    volumes:
      - event-data:/var/lib/clickhouse
      - ./clickhouse/clickhouse-config.xml:/etc/clickhouse-server/config.d/logging.xml:ro
      - ./clickhouse/clickhouse-user-config.xml:/etc/clickhouse-server/users.d/logging.xml:ro
    ulimits:
      nofile:
        soft: 262144
        hard: 262144

  plausible:
    image: plausible/analytics:latest
    restart: always
    command: sh -c "sleep 10 && /entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh db init-admin && /entrypoint.sh run"
    depends_on:
      - plausible_db
      - plausible_events_db
      - mail
    ports:
      - 8000:8000
    env_file:
      - plausible-conf.env

plausible-conf.env

ADMIN_USER_EMAIL=**********
ADMIN_USER_NAME=**********
ADMIN_USER_PWD=**********
BASE_URL=**********
SECRET_KEY_BASE=**********
DISABLE_REGISTRATION=true
GOOGLE_CLIENT_ID=**********
GOOGLE_CLIENT_SECRET=**********
[email protected]
SMTP_HOST_ADDR=in-v3.mailjet.com
SMTP_USER_NAME=API_KEY
SMTP_USER_PWD=API_SECRET_KEY
SMTP_HOST_SSL_ENABLED=false
SMTP_RETRIES=2

Thank you !

Self-hosted JS snippet has no port 8000 in URL

I believe the javascript snippet we get to paste before is wrong. Currently, it is this

<script defer data-domain="localhost" src="http://localhost/js/script.js"></script>

but script.js does not exist at that location, since Plausible will run on port 8000 by default.

(A spinoff of plausible/docs#331)

Unable to get IP geolocation working

I'm having trouble getting IP geolocation to work. I've done a bit of debugging, and found that the geoip volume isn't mounted to the plausible container by default (as has someone else, it seems #7). After fixing this however, it still doesn't appear to work - no data is shown on the map, nor is there a tooltip when hovering.

So far I've tried:

  1. Update geoip/docker-compose.geoip.yml so the geoip volume is mounted at /geoip for the plausible service.
    index 239577c..04ebf28 100644
    --- a/geoip/docker-compose.geoip.yml
    +++ b/geoip/docker-compose.geoip.yml
    @@ -3,6 +3,8 @@ services:
       plausible:
         depends_on:
           - geoip
    +    volumes:
    +      - geoip:/geoip:ro
         environment:
           - GEOLITE2_COUNTRY_DB=/geoip/GeoLite2-Country.mmdb

    Then reload using docker-compose -f docker-compose.yml -f geoip/docker-compose.geoip.yml up -d.

  2. Check that the file actually exists within the plausible container.
    $ docker exec -it plausible_plausible_1 /bin/bash
    # ls -l /geoip/
    total 3836
    -rw-r--r-- 1 root root 3926614 Oct 28 00:13 GeoLite2-Country.mmdb
    # echo $GEOLITE2_COUNTRY_DB
    /geoip/GeoLite2-Country.mmdb
    
  3. Try completely from fresh
    $ docker-compose -f docker-compose.yml -f geoip/docker-compose.geoip.yml down -v
    Stopping plausible_plausible_1           ... done
    Stopping plausible_plausible_events_db_1 ... done
    Stopping plausible_mail_1                ... done
    Stopping plausible_plausible_db_1        ... done
    Stopping plausible_geoip_1               ... done
    Removing plausible_plausible_1           ... done
    Removing plausible_plausible_events_db_1 ... done
    Removing plausible_mail_1                ... done
    Removing plausible_plausible_db_1        ... done
    Removing plausible_geoip_1               ... done
    Removing network plausible_default
    Removing volume plausible_db-data
    Removing volume plausible_event-data
    Removing volume plausible_geoip
    $ docker-compose -f docker-compose.yml -f geoip/docker-compose.geoip.yml up -d
    Creating network "plausible_default" with the default driver
    Creating volume "plausible_db-data" with local driver
    Creating volume "plausible_event-data" with local driver
    Creating volume "plausible_geoip" with local driver
    Creating plausible_plausible_db_1        ... done
    Creating plausible_mail_1                ... done
    Creating plausible_geoip_1               ... done
    Creating plausible_plausible_events_db_1 ... done
    Creating plausible_plausible_1           ... done
    
  4. Check logs
    $ docker logs plausible_plausible_1
    Loading plausible..
    Starting dependencies..
    Starting repos..
    create Plausible.Repo database if it doesn't exist
    00:55:06.992 [error] Postgrex.Protocol (#PID<0.238.0>) failed to connect: ** (Postgrex.Error) FATAL 3D000 (invalid_catalog_name) database "plausible_db" does not exist
    00:55:06.992 [error] Postgrex.Protocol (#PID<0.237.0>) failed to connect: ** (Postgrex.Error) FATAL 3D000 (invalid_catalog_name) database "plausible_db" does not exist
    00:55:07.126 [error] Clickhousex.Protocol (#PID<0.244.0>) failed to connect: ** (ErlangError) Erlang error: "Code: 81, e.displayText() = DB::Exception: Database plausible_events_db doesn't exist (version 20.10.2.20 (official build))\n"
    00:55:07.126 [error] Clickhousex.Protocol (#PID<0.245.0>) failed to connect: ** (ErlangError) Erlang error: "Code: 81, e.displayText() = DB::Exception: Database plausible_events_db doesn't exist (version 20.10.2.20 (official build))\n"
    create Plausible.ClickhouseRepo database if it doesn't exist
    Creation of Db successful!
    Loading plausible..
    Starting dependencies..
    Starting repos..
    Running migrations for Elixir.Plausible.Repo
    Running migrations for Elixir.Plausible.ClickhouseRepo
    Migrations successful!
    Loading plausible..
    Starting dependencies..
    Starting repos..
    Admin user created successful!
    01:07:01.181 [error] Task #PID<0.4448.0> started from #PID<0.4449.0> terminating
    ** (CaseClauseError) no case clause matching: []
        (hackney 1.15.2) /app/deps/hackney/src/hackney_url.erl:224: :hackney_url.parse_netloc/2
        (hackney 1.15.2) /app/deps/hackney/src/hackney.erl:349: :hackney.request/5
        (httpoison 1.6.2) lib/httpoison/base.ex:796: HTTPoison.Base.request/6
        (httpoison 1.6.2) lib/httpoison.ex:128: HTTPoison.request!/5
        (elixir 1.10.3) lib/task/supervised.ex:90: Task.Supervised.invoke_mfa/2
        (stdlib 3.12.1) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
    Function: #Function<0.124948693/0 in Plausible.Slack.notify/1>
        Args: []
    

At this point I feel like more in-depth debugging is needed. I've verified that the file exists where Plausible is told it is, yet no data is returned from the /api/stats/:domain/countries endpoint.

Other than that, Plausible is amazing so far; major props for putting a self-hosted version out there.

v1.5.0 release

Going to track progress with this one. Here're the TODOs left.

Changes to docker compose config, in-repo upgrade docs

  • #52
  • add something like upgrades/postgres.md (naming is hard, suggestions are welcome) with the steps to upgrade postgres instances (more info in the PR above).

🙋‍♂️ Why not put it in the release notes on https://github.com/plausible/analytics/releases?
👩‍🏫 Because this guide is unlikely to change from release to release and we can link to that document on each update.

Changes to docs, manual tests

Changes to Plausible container image

Please make use of releases

Please make use of releases, that will make it easier to track for new releases and setup Ansible to act on that. Checking out the main branch, while config files need to be changed in there, creates issues with git. A git repo cannot pull in new changes with local changes. When using releases I can receive a notification of a new release, update the variable of that release tag, run a test and deploy it. Thanks for considering.

Fork compatible docker-compose for Windows (& Windows Server 2019)

Hi.
Just for people who are on Windows Server 2019. I have made a very small fork for a working configuration https://github.com/Brouilles/hosting. Please change the volumes path with yours. You need Docker with WSL (Windows Subsystem Linux 1.0).

No volume path for postgres because crash on Windows with authorize error. It's an known issue. (So it's recommended to use Docker volumes).

It's not really an issue. Sorry if it's the bad place.

How does this even work?

Not a self-hosting issue here, but I tried out the repo and it “just works”, but it makes me wonder how does it even work?

In particular, while you’re standing up both the postgres and clickhouse database, they’re on different containers (meaning you can’t access them using “localhost”, which is the default for both postgres and clickhouse configurations), not to mention the fact that we haven’t even created the database in both postgres and clickhouse…

In short, how is the plausible instance able to actually connect to and make queries to the database containers when the configuration is seemingly wrong and it’s not actually (seemingly) connected to the database?

No breakdown by event props possible

Thanks for the nice work with Plausible! We really like the clean approach.

We are trying to use the hosted version of Plausible but ran into a few issues. Setup itself was relatively easy with Docker, but integrating it with our website caused some issues. I'm breaking these down into seperate issues.

Following the documentation here: https://docs.plausible.io/custom-event-goals/
we set up event tracking and the events show up ok in the analytics UI. However, all props seem to get lost in the process. I looked at the tracking request itself and saw that the JS didn't even include the props object! I then looked at the snippet you are using on plausible.io and saw that there are substantial differences. Adapting your plausible.io script to my local installation was easy and now the props object is sent to the server (as well as referers, btw., that also didnt work before).

The events are shown on the analytics page, but there is no way to drill down like you show in your documentation. Is there some switch that i have to turn for this to work?

ARM Docker Image?

Hi!
I want to know if an ARM image is available? Compatible with the Raspberry Pi for exemple. It can be great ! But I don't know if dependencies are available for this architecture.

Matomo do (because the main dependencies is PHP). But with so many data I don't Care about.

Thanks and happy new year.

Docker compose fails

The latest docker compose on here fails. Replacing the plausible pull with plausible/analytics:v2.0 makes it work again.

s390x architecture

Is there a build method for the s390x architecture? I tried 'docker pull --platform linux/x86_64' and after downloading, the logs showed an error: "/entrypoint.sh: exec format error."

feature request: a matomo like setup.php installation

a simpler, matomo like installation process:

  • unpack the downloaded zip-file on the server
  • open the file setup.php in browser
  • make the entries for database (mysql) and first admin user

finished... go and integrate the js into all webs...

Slow performance with filters and old data

Hello,

I have a 4xCPU server with 8GB RAM at Digital Ocean, the site has 20-40 million pageviews per month and when I do queries with filters, for example page > contains > /url/ and 3 months ago, the CPU usage goes at 100% on clickhouse, but it stays like that for 20 seconds and crashes.

But apparently it generates some timeout and the result is not shown on the screen.

Is there any configuration for clickhouse to force the CPU usage for a longer time, until the required query finishes?

In the env, I already configured it as:

CLICKHOUSE_FLUSH_INTERVAL_MS=5000
CLICKHOUSE_MAX_BUFFER_SIZE=200000

But it didn't have much effect.

Putting a dedicated instance for the clickhouse could help?
What would be the CPU recommendation?

Can't deploy to a pre-existing database

I already have a postgresql server running so I created a database and a non-privileged user for Plausible but the app can't start with the provided docker-compose.

Here's the database url I used:

DATABASE_URL=postgres://plausible:[email protected]/plausible

Plausible complains it can't connect to the postgres database. I guess it's using it to create the db I put in the URL, and I didn't allow the plausible user to connect to the postgres database anyway.

I tried various things such as allowing the user to connect to the postgres db, trying not to run db createdb in the command, ...

Everything led to an error:

  • no db createdb: clickouse db is not set up
  • allow connection to postgres db: complains it doesn't have "CREATE DATABASE" privileges (that's not a privilege I'm going to give to an app)

Would it be possible to allow connections to pre-existing databases ? Like just test if the DB exists and the user can create a table and if so well, continue with the setup.

Events are Not getting tracked.

Please do not submit issues here. Best place for self-hosting issues, questions and ideas is the community forum here on GitHub. Thanks!

I am testing plausible and trying to integrate to my web App. Added tracker script. everything is running smooth on client side. There are no errors in docker logs. but No events are getting detected.

No Error on Client side from plausible
image

check for existence of my tracker scripts in browser
As script https:///js/script.js is loaded into by browser. I can see it from browser inspect -> sources

I am testing in my local web app.

I am using UI but nothing is happening in plausible. "it says Waiting for first pageview on problempulse.store"

Startup issue - Clickhouse DB Connection

Hey,

I tried to spin up the docker environment and im having the following error which I cannot resolve. It seems that the plausible_events_db container is not reachable.

Loading plausible..
Starting dependencies..
Starting repos..
create Plausible.Repo database if it doesn't exist
create Plausible.ClickhouseRepo database if it doesn't exist
13:47:45.948 [error] Clickhousex.Protocol (#PID<0.244.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
13:47:45.948 [error] Clickhousex.Protocol (#PID<0.245.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
13:47:45.962 [error] GenServer #PID<0.265.0> terminating
** (UndefinedFunctionError) function :econnrefused.exception/1 is undefined (module :econnrefused is not available)
    :econnrefused.exception([])
    (db_connection 2.2.2) lib/db_connection/connection.ex:87: DBConnection.Connection.connect/2
    (connection 1.0.4) lib/connection.ex:622: Connection.enter_connect/5
    (stdlib 3.12.1) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: nil

[... repeat former block * 4]

** (MatchError) no match of right hand side value: {:error, "killed"}
    (plausible 0.0.1) lib/plausible_release.ex:56: anonymous fn/2 in Plausible.Release.createdb/0
    (elixir 1.10.3) lib/enum.ex:2111: Enum."-reduce/3-lists^foldl/2-0-"/3
    (plausible 0.0.1) lib/plausible_release.ex:55: Plausible.Release.createdb/0
    (stdlib 3.12.1) erl_eval.erl:680: :erl_eval.do_apply/6
    (elixir 1.10.3) lib/code.ex:341: Code.eval_string_with_error_handling/3

In the beginning the server couldn't even bind to the requested IPv6 address. So I instructed it to bind on IPv4 in two ways like this in clickhouse-config.xml

<yandex>
    ...
    <listen_host>127.0.0.1</listen_host> // <listen_host>0.0.0.0</listen_host>
    ...
</yandex>

Due to the sparse log of where it tried to connect I set the upstream manually like this in plausible-conf.env. Still no luck.

CLICKHOUSE_DATABASE_URL=http://plausible_events_db:8123/plausible_events_db

Mismatch between docs and repository for GeoIP config

Submitting here since this is not a support request.

In the GeoIP section, the documentation calls the configuration variables GEOIP_ACCOUNT_KEY and GEOIP_LICENSE_KEY, whereas in this repository they are called GEOIPUPDATE_ACCOUNT_ID and GEOIPUPDATE_LICENSE_KEY respectively.

Fail to start plausible service: driver failed programming external connectivity

When launching the docker-compose up --detach command on current head 09fb07e I end up with an error related to ports.

$ docker-compose up --detach
Removing hosting_plausible_1
Starting hosting_mail_1                ... done
Starting hosting_plausible_db_1        ... done
Starting hosting_plausible_events_db_1 ... done
Starting 08bc5c668828_hosting_plausible_1 ... error

ERROR: for 08bc5c668828_hosting_plausible_1  Cannot start service plausible: driver failed programming external connectivity on endpoint 08bc5c668828_hosting_plausible_1 (35456500b7f62f11d746ef8e6ff73a321e38abf7342a3904d0b83631f6f0c701): Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use

ERROR: for plausible  Cannot start service plausible: driver failed programming external connectivity on endpoint 08bc5c668828_hosting_plausible_1 (35456500b7f62f11d746ef8e6ff73a321e38abf7342a3904d0b83631f6f0c701): Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use
ERROR: Encountered errors while bringing up the project.

I feared it was due to my host port 8000 being in use first (preventing the guest 80 mapping to it) but even freeing my host port 8000 didn't help.
The error code being about port 80, I assume it's an issue on guest side but I'm not knowledgeable enough in docker to figure this error out.

Thanks in advance for your help.

Existing installation fails to start because Postgres 14 refuses to load Postgres 12 files.

The postgres database is no longer supported by postgres 14.

I can only get my installation to boot by changing to version 12 in the docker-compose.yml file.

https://github.com/plausible/hosting/blob/master/docker-compose.yml#L9

  plausible_db:
    # supported versions are 12, 13, and 14
    #image: postgres:14-alpine
    image: postgres:12-alpine
root@analytics:~# docker logs 9186dfbb124d #postgres:14-alpine

PostgreSQL Database directory appears to contain a database; Skipping initialization

2023-04-15 15:07:35.529 UTC [1] FATAL:  database files are incompatible with server
2023-04-15 15:07:35.529 UTC [1] DETAIL:  The data directory was initialized by PostgreSQL version 12, which is not compatible with this version 14.5.

It seems like version 14.5 of this postres docker image has dropped backwards support for 12.

bytemark/smtp container is outdated and abandoned

There are several problems with the bytemark/smtp container used for e-mail:

  • It's running Debian 9 which has been deprecated in 2020
  • It doesn't support ARM64
  • It's maintainer, Bytemark hosting, is unresponsive and seems to have abandoned the image

May I suggest switching to another Exim relay Docker image that is well maintained like devture/exim-relay.

ARM64 Support

Leaving this here in case anyone stumbles across this issue. I was able to successfully self-host plausible on an arm64 based Oracle Compute Instance by modifying the docker-compose.

More information on the Discussion plausible/analytics#903 (comment)

In the docker-compose just replace:

  • bytemark/smtp with navanchauhan/smtp (I built a multi-arch version of the original docker file)
  • plausible/analytics with justsky/analytics (They built and pushed a multi-arch version, will not be required if plausible officially starts supporting multi-arch builds)
  • yandex/clickhouse-server:21.3.2.5 with clickhouse/clickhouse-server:22.4.2.1

I did not open a PR because it will be only useful after plausible starts publishing official multi-arch images. plausible/analytics#1287 A simple edit in the GitHub Actions workflow will allow for that

Postgres Version in docker-compose.yml breaks everything

I've seen the latest change committed and merged in a735885 from #16, which is in my opinion a breaking-change and a bad decision:

-    image: postgres:12
+    image: postgres:latest # or 13

Based on the commit, the description was:

By switching to the latest or 13 version, the plausible_db container will no more complain
about the wrong postgres version and shut down. This resolved my error, when i 
implemented this docker-compose into my own docker-compose.

I don't understand the reasoning. Specially this commit introduces three negative problematic aspects:

  1. When new major releases are published from postgres, this could introduce incompatibility with Plausible. Bleeding edge is not always the best choice.
  2. When new major releases are published, this will cause incompatibility with existing database files, as no automated upgrade is performed.
  3. An upgrade is always one-way, and should be planned and not automatically rolled out.

All three are breaking changes, rendering the whole setup unstable, unreliable and unpredictable.

I've just merged the suggested change into my config, and then Postgres did not want to start:

$ docker-compose logs -f plausible_db
Attaching to plausible_plausible_db_1
plausible_db_1         |
plausible_db_1         | PostgreSQL Database directory appears to contain a database; Skipping initialization
plausible_db_1         |
plausible_db_1         | 2020-12-05 16:27:42.359 UTC [1] FATAL:  database files are incompatible with server
plausible_db_1         | 2020-12-05 16:27:42.359 UTC [1] DETAIL:  The data directory was initialized by PostgreSQL version 12, which is not compatible with this version 13.1 (Debian 13.1-1.pgdg100+1).

tl;dr: Using postgres:latest is a terrible idea and makes the plausible stack unpredictable. It does seem introduce the issue the author seems wanted to fix actually? (Also, why was this commit even merged?)

Custom subdomains return SSL errors

Hey there,

thanks for this great example repo.
I used this as the basis for our self-hosted Plausible installation and it works like a treat.

I encountered one problem with the custom subdomains though.
When calling the "custom." subdomain I always receive SSL Errors.
This is the output of a Curl request to the "custom." subdomain:

* Connected to custom.plausible.domain (Plausible IP) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/cert.pem
  CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS alert, internal error (592):
* error:14004438:SSL routines:CONNECT_CR_SRVR_HELLO:tlsv1 alert internal error
* Closing connection 0
curl: (35) error:14004438:SSL routines:CONNECT_CR_SRVR_HELLO:tlsv1 alert internal error

EDIT: I am using the provided Caddy reverse proxy.

Instruction check fail. The CPU does not support SSE4.1 instruction set.

Hi,
I have buy a server on Kimsufi. But I have the following error during docker-compose up:

plausible_events_db_1  | Instruction check fail. The CPU does not support SSE4.1 instruction set.
plausible_events_db_1  | Instruction check fail. The CPU does not support SSE4.1 instruction set.

And so hosting_plausible_1 and hosting_plausible_events_db_1 exited. The CPU is an Intel Atom N2800.
Thanks.

Release tags

Please consider using release tags, then people can get notified when a new release is ready and update in time.

Database plausible_events_db doesn't exist

version: "3.8"
services:
  mail:
    image: bytemark/smtp:latest
    env_file:
      - plausible-conf.env
    networks:
      - internal
    labels:
      - traefik.enable=false

  plausible_db:
    image: postgres:latest
    volumes:
      - db-data:/var/lib/postgresql/data
    environment:
      - POSTGRES_PASSWORD=postgres
    networks:
      - internal
    labels:
      - traefik.enable=false

  plausible_events_db:
    image: yandex/clickhouse-server:21.3.2.5
    volumes:
      - event-data:/var/lib/clickhouse
      - ./clickhouse/clickhouse-config.xml:/etc/clickhouse-server/config.d/logging.xml:ro
      - ./clickhouse/clickhouse-user-config.xml:/etc/clickhouse-server/users.d/logging.xml:ro
    ulimits:
      nofile:
        soft: 262144
        hard: 262144
    networks:
      - internal
    labels:
      - traefik.enable=false

  plausible:
    image: plausible/analytics:latest
    command: sh -c "sleep 10 && /entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh db init-admin && /entrypoint.sh run"
    depends_on:
      - plausible_db
      - plausible_events_db
      - mail
    ports:
      - 8000
    env_file:
      - plausible-conf.env
    networks:
      - traefik-public
      - internal
    deploy:
      labels:
        - traefik.enable=true
        - traefik.constraint-label=traefik-public
        - traefik.http.routers.plausible.rule=Host(`site`)
        - traefik.http.routers.plausible.entrypoints=https
        - traefik.http.services.plausible.loadbalancer.server.port=8000
        - traefik.http.routers.plausible.tls=true
        - traefik.http.routers.plausible.tls.certresolver=le

volumes:
  db-data:
    driver: local
  event-data:
    driver: local
  geoip:
    driver: local

networks:
  traefik-public:
    external: true
  internal:
    external: false

2022.07.11 09:51:18.477067 [ 51 ] {} DynamicQueryHandler: Code: 81, e.displayText() = DB::Exception: Database plausible_events_db doesn't exist, Stack trace (when copying this message, always include the lines below):

  1. DB::DatabaseCatalog::assertDatabaseExistsUnlocked(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) const @ 0xeb0668a in /usr/bin/clickhouse
  2. DB::DatabaseCatalog::assertDatabaseExists(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) const @ 0xeb06522 in /usr/bin/clickhouse
  3. DB::Context::setCurrentDatabase(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) @ 0xeaa3cb1 in /usr/bin/clickhouse
  4. DB::HTTPHandler::processQuery(DB::Context&, DB::HTTPServerRequest&, DB::HTMLForm&, DB::HTTPServerResponse&, DB::HTTPHandler::Output&, std::__1::optionalDB::CurrentThread::QueryScope&) @ 0xf845fda in /usr/bin/clickhouse
  5. DB::HTTPHandler::handleRequest(DB::HTTPServerRequest&, DB::HTTPServerResponse&) @ 0xf84a8ee in /usr/bin/clickhouse
  6. DB::HTTPServerConnection::run() @ 0xf8d35ff in /usr/bin/clickhouse
  7. Poco::Net::TCPServerConnection::start() @ 0x11f7ccbf in /usr/bin/clickhouse
  8. Poco::Net::TCPServerDispatcher::run() @ 0x11f7e6d1 in /usr/bin/clickhouse
  9. Poco::PooledThread::run() @ 0x120b4df9 in /usr/bin/clickhouse
  10. Poco::ThreadImpl::runnableEntry(void*) @ 0x120b0c5a in /usr/bin/clickhouse
  11. start_thread @ 0x9609 in /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
  12. __clone @ 0x122293 in /usr/lib/x86_64-linux-gnu/libc-2.31.so
    (version 21.3.2.5 (official build))
    ^C * Terminal will be reused by tasks, press any key to close it.

City level data?

How can I use city level data from MaxMinds?

I tried this in the geoip environment:

  - GEOIPUPDATE_EDITION_IDS=GeoLite2-City

And this in the plausible environment:

  - GEOLITE2_COUNTRY_DB=/geoip/GeoLite2-City.mmdb

But only see country level data in my dashboard. Am I missing a configuration option? Or is this level of detail a potential new feature/enhancement?

Great job! Many thanks for this alternative platform!

Email not working and no way of debugging

I'm trying to setup plausible to send weekly and monthly reports. I added the relevant variables but I don't receive the emails.

I couldn't find any way to send an email immediately, and I don't really want to wait 1 week between retries 😊

Here's my conf:

MAILER_EMAIL=[email protected]
SMTP_HOST_ADDR=smtp.mailgun.org
SMTP_HOST_PORT=465
SMTP_USER_NAME=[email protected]
SMTP_USER_PWD=supersecurepassword
SMTP_HOST_SSL_ENABLED=true
SMTP_RETRIES=2

Warning about Postgres ports being exposed

There should be some documentation or warning about the Postgres ports being exposed (and maybe suggest changing password the postgres password).

I brought the docker compose up to test and got caught out by this issue docker-library/postgres#664. Docker opens up the ports within iptables and combine this with the weak default password. I'm sure others might make the same configuration mistake.

The ports don't actually need to be exposed in the compose file as the other containers use the docker network?

plausible.js script broken

Thanks for the nice work with Plausible! We really like the clean approach.

We are trying to use the hosted version of Plausible but ran into a few issues. Setup itself was relatively easy with Docker, but integrating it with our website caused some issues. I'm breaking these down into seperate issues.

We have several issues with the plausible.js script.

  1. Initially the admin UI gave a link to http://ourserver/js/plausible.js. This didn't work because the BASE_URL wasn't respected in the script, it was hardcoded to localhost.
  2. Using the custom domain option in the admin UI gave us a different snippet path: http://ourserver/js/index.js. This doesn't exist at all.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.