Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plausible can't record or show visits on Dashboard #201

Open
satonotdead opened this issue Dec 16, 2024 · 5 comments
Open

Plausible can't record or show visits on Dashboard #201

satonotdead opened this issue Dec 16, 2024 · 5 comments

Comments

@satonotdead
Copy link

Moved to CE recently and dashbord stopped updating or logging visits on websites.

That's what I get from logs:

plausible_events_db-1  |  [ 1 ] {} <Warning> Context: Delay accounting is not enabled, OSIOWaitMicroseconds will not be gathered. You can enable it using `echo 1 > /proc/sys/kernel/task_delayacct` or by using sysctl.
plausible_events_db-1  |  [ 1 ] {} <Error> Application: Disabling cgroup memory observer because of an error during initialization: Code: 107. DB::Exception: Cannot find cgroups v1 or v2 current memory file. (FILE_DOESNT_EXIST), Stack trace (when copying this message, always include the lines below):
plausible_events_db-1  | 
plausible_events_db-1  | 0. DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0x000000000cbc851b
plausible_events_db-1  | 1. DB::Exception::Exception<>(int, FormatStringHelperImpl<>) @ 0x00000000076614c3
plausible_events_db-1  | 2. DB::CgroupsMemoryUsageObserver::CgroupsMemoryUsageObserver(std::chrono::duration<long long, std::ratio<1l, 1l>>) @ 0x000000000cce452e

Could be related to a wrong configuration in Nginx?

proxy_cache_path /var/run/nginx-cache/jscache levels=1:2 keys_zone=jscache:100m inactive=30d  use_temp_path=off max_size=100m;

server {
        listen 443 ssl http2;
        server_name stats.mydomain.com;
        include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

       resolver 9.9.9.9;
    set $plausible_script_url https://stats.mydomain.com/js/script.js; # Change this if you use a different variant of the script
    set $plausible_event_url https://stats.mydomain.com/api/event;

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

    location = /js/script.js {
        proxy_pass $plausible_script_url;
        proxy_set_header Host stats.mydomain.com;


        # Tiny, negligible performance improvement. Very optional.
        proxy_buffering on;

        # Cache the script for 6 hours, as long as plausible.io returns a valid response
        proxy_cache jscache;
        proxy_cache_valid 200 6h;
        proxy_cache_use_stale updating error timeout invalid_header http_500;

        # Optional. Adds a header to tell if you got a cache hit or miss
        add_header X-Cache $upstream_cache_status;
    }

    location = /api/event {
        proxy_pass $plausible_event_url;
        proxy_set_header Host stats.mydomain.com;
        proxy_buffering on;
        proxy_http_version 1.1;

        proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Host  $host;
    }

        add_header X-Content-Type-Options nosniff;
        add_header X-XSS-Protection "1; mode=block";
        add_header Referrer-Policy "no-referrer-when-downgrade" always;
        add_header Content-Security-Policy "default-src * data: 'unsafe-eval' 'unsafe-inline'" always;
        add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;


#    ssl_certificate /etc/letsencrypt/live/stats.mydomain.com/fullchain.pem; # managed by Certbot
#    ssl_certificate_key /etc/letsencrypt/live/stats.mydomain.com/privkey.pem; # managed by Certbot

    ssl_certificate /etc/letsencrypt/live/stats.mydomain.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/stats.mydomain.com/privkey.pem; # managed by Certbot

location = /robots.txt {
  add_header  Content-Type  text/plain;
  return 200 "User-agent: *\nDisallow: /\n";
}

location ~ ^/.* {
        proxy_pass http://127.0.0.1:8000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Upgrade $http_upgrade;
        proxy_http_version 1.1;
}

}

docker-compose.yml:

    image: postgres:16-alpine
    restart: always
    volumes:
      - db-data:/var/lib/postgresql/data
    environment:
      - POSTGRES_PASSWORD=postgres
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      start_period: 1m

  plausible_events_db:
    image: clickhouse/clickhouse-server:24.3.3.102-alpine
    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
#      - ./hosting/clickhouse/clickhouse-config.xml:/etc/clickhouse-server/config.d/logging.xml:ro
#      - ./hosting/clickhouse/clickhouse-user-config.xml:/etc/clickhouse-server/users.d/logging.xml:ro
      - event-data:/var/lib/clickhouse
      - event-logs:/var/log/clickhouse-server
      - ./clickhouse/logs.xml:/etc/clickhouse-server/config.d/logs.xml:ro
      # This makes ClickHouse bind to IPv4 only, since Docker doesn't enable IPv6 in bridge networks by default.
      # Fixes "Listen [::]:9000 failed: Address family for hostname not supported" warnings.
      - ./clickhouse/ipv4-only.xml:/etc/clickhouse-server/config.d/ipv4-only.xml:ro
    ulimits:
      nofile:
        soft: 262144
        hard: 262144
    healthcheck:
      test: ["CMD-SHELL", "wget --no-verbose --tries=1 -O - http://127.0.0.1:8123/ping || exit 1"]
      start_period: 1m

  plausible:
#    image: plausible/analytics:v2.1.4
    image: ghcr.io/plausible/community-edition:v2.1.4
    restart: always
    environment:
      - DISABLE_REGISTRATION=true
    command: sh -c "sleep 10 && /entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh run"
    depends_on:
      plausible_db:
        condition: service_healthy
      plausible_events_db:
        condition: service_healthy
#      - mail
    volumes:
      - plausible-data:/var/lib/plausible
    ulimits:
      nofile:
        soft: 65535
        hard: 65535
    ports:
      - 127.0.0.1:8000:8000
    env_file:
      - .env

volumes:
  db-data:
#    driver: local
  event-data:
#    driver: local
  event-logs:
  plausible-data:


@ruslandoga
Copy link
Contributor

👋 @satonotdead

The plausible_events_db-1 warning shouldn't cause any problems.

@ruslandoga ruslandoga reopened this Dec 24, 2024
@ruslandoga ruslandoga closed this as not planned Won't fix, can't repro, duplicate, stale Dec 24, 2024
@satonotdead
Copy link
Author

satonotdead commented Dec 26, 2024

Hello, my issue is not solved. What can be wrong with my instance if it don't record visits? Tried from different devices and IPs.

I just opened a new one, please keep this one opened until it get resolved because it improves their visibility.

@ruslandoga
Copy link
Contributor

ruslandoga commented Dec 27, 2024

👋 @satonotdead

Right now there isn't enough information to know why records are not recorded. Please share all available docker compose logs, and docker ps -a, and docker stats --no-stream, and the response from POST /event in the browser and your .env with secrets redacted.

@ruslandoga
Copy link
Contributor

Note also that if you are moving from a pre-v2 version, you need to perform a data migration.

@ruslandoga
Copy link
Contributor

ruslandoga commented Dec 27, 2024

And you could also try setting up a new instance following the quick-start guide: https://github.com/plausible/community-edition#quick-start If it works out, it might be easier to backtrack from a working setup to find the problems in your current one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants