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

analytics.dwyl.com 502 -> Please Investigate πŸ” πŸ•΅οΈ πŸ™ #12

Open
nelsonic opened this issue Sep 11, 2024 · 15 comments
Assignees
Labels
BLOCKED :fire: Core team's HIGHEST priority, blocking critical work bug Suspected or confirmed bug (defect) in the code chore a tedious but necessary task often paying technical debt priority-1 Highest priority issue. This is costing us money every minute that passes. research Research required; be specific T25m Time Estimate 25 Minutes tech-debt A feature/requirement implemented in a sub-optimal way & must be re-written technical A technical issue that requires understanding of the code, infrastructure or dependencies

Comments

@nelsonic
Copy link
Member

Just tried to view the analytics to grab a screenshot for the issue/task I'm preparing #11
and it's 502-ing ... πŸ˜•
https://analytics.dwyl.com/
image

@nelsonic nelsonic added bug Suspected or confirmed bug (defect) in the code BLOCKED :fire: Core team's HIGHEST priority, blocking critical work technical A technical issue that requires understanding of the code, infrastructure or dependencies tech-debt A feature/requirement implemented in a sub-optimal way & must be re-written research Research required; be specific T25m Time Estimate 25 Minutes chore a tedious but necessary task often paying technical debt priority-1 Highest priority issue. This is costing us money every minute that passes. labels Sep 11, 2024
@nelsonic
Copy link
Member Author

@iteles is aware of and is going to help on this. πŸ‘Œ

@nelsonic
Copy link
Member Author

This is a blocker for our work-work.

@LuchoTurtle
Copy link
Member

LuchoTurtle commented Sep 12, 2024

I restarted all the containers and it's back up again - https://analytics.dwyl.com/.

But I wanted to check for the files and there should be a plausible folder in the droplet (as it was cloned from git).

image

I wonder what happened to it, can't find it in the VM :/

@iteles
Copy link
Member

iteles commented Sep 12, 2024

I forgot my necessary hardware to sort this from the forest this morning but will be home in the afternoon and it's my top priority. Grateful restarting the containers worked πŸ‘Œ

@LuchoTurtle
Copy link
Member

I believe this this may have been a resource management issue (it's running on the cheapest machine possible in Droplet).

image

It's running normally (with a low number of visitors) but the memory is at over 70%. If there's a spike of user activity, memory consumption may increase and can cause the VM to crash, which is the likeliest scenario (the logs indicated connection errors with the app server, which may have been lost because one container may have "blew up").

Ever since restarting, it's working normally.

@nelsonic
Copy link
Member Author

nelsonic commented Nov 5, 2024

Still getting 502:
image

@nelsonic
Copy link
Member Author

A week later still 502:
image

Guessing it's a resource issue.

@nelsonic nelsonic pinned this issue Nov 12, 2024
@LuchoTurtle
Copy link
Member

I'll take a look later. Tho I feel like it's a memory issue. Plausible recommends 2GB of RAM, and I chose the cheapest droplet. Should I upgrade?

@nelsonic
Copy link
Member Author

It's nuts to me that Plausible needs 2GB of RAM to run a service that gets a few tens/hundreds of requests per day! 🀯
There must be a memory leak that is causing it to crash. πŸ€¦β€β™‚οΈ
In terms of the value of our Time ⏳ == πŸ’Έ ... we should just upgrade (double the cost) to $12/month:

image

But I'm not super happy about how the default Plausible instance is deployed and will need to revisit it in future. πŸ’­
Specifically: want(ed) Plausible to use the Managed Postgres instance on DigitalOcean not have all the stack on the same Droplet. πŸ™ƒ
I get that from a performance and "simplicity" perspective it makes sense to deploy on one instance.
But then when it crashes and burns there is no backup for the data! πŸ€¦β€β™‚οΈ

@LuchoTurtle
Copy link
Member

LuchoTurtle commented Nov 12, 2024

If that's the case, I'll try to spin up a PostgreSQL instance separate. I've never done a managed instance in DigitalOcean, so it may be a good time to learn. πŸ‘Œ

The problem is how, because the way docker compose for the Community Version is laid out, it assumes everything goes to the same VM. So I'll probably have to do some tweaking

I'm sorting through some stuff, but I'll take a look at it once done

@nelsonic
Copy link
Member Author

We already have the Managed Postgres: https://cloud.digitalocean.com/databases/38253546-fe28-4a33-9a44-cb175b6f698f?i=933568
image

But it's not currently used for anything cause I hit a brick wall with connecting to it from Fly.io: dwyl/learn-devops#93 (comment)

@LuchoTurtle
Copy link
Member

LuchoTurtle commented Nov 14, 2024

I don't know if something's changed since last time I accessed the server but I can't seem to do it now.

image

I always get this error, even after regenerating my ssh key. Even on my terminal:

[email protected]: Permission denied (publickey).

I get this error.

Can I destroy and build a droplet from scratch?

@LuchoTurtle
Copy link
Member

In order to not do that (so you wouldn't have to change the domain CNAME records again), I restarted the droplet, set a new root password and enabled ssh properly again.

https://www.digitalocean.com/community/questions/i-have-port-22-operation-timed-out-on-my-droplets

Sent the new pw thru Signal

@LuchoTurtle
Copy link
Member

image

It should now be working.

I had to reset the Droplet because I couldn't connect to it through ssh. So I booted the recovery console and reset the password. I've sent all the credentials for both the server and https://analytics.dwyl.com/sites to @nelsonic .

Regarding deployment, I was considering using the PostgreSQL instance Nelson mentioned. However, I went against it because:

  • unless PostgreSQL is being used for other applications, it is more expensive. See the images below:

PostgreSQL instance
Screenshot 2024-11-14 at 04 23 23

Droplet
Screenshot 2024-11-14 at 04 23 50

PostgreSQL alone is 15 dollars. The cheapest droplet (if we were to run the Plausible Elixir App there) is 7 dollars. This would mean 22 dollars to run everything.
But even then, the bottleneck is with Clickhouse. According to Plausible:

  • CPU must support SSE 4.2 or NEON instruction set or higher (required by ClickHouse).
  • At least 2 GB of RAM is recommended for running ClickHouse and Plausible without fear of OOMs.

Therefore, it is much simpler to run everything in a single machine (to maintain/upgrade in the future, since we just need to run a command) instead of separating into two different machines (which is harder to implement). Additionally, it is cheaper to run everything in a single Droplet that is more powerful. I chose a Basic with Premium AMD, which runs for 14 dollars per month. It should work like this (and it has more storage than the PostgreSQL instance too - 25gb over 15gb.

@nelsonic you can delete the PostgreSQL instance if you want to, to save some bucks. I think running everything in the same Droplet is easier to manage in the long run πŸ‘Œ

If everything's oki doki, feel free to close the issue πŸ™

@nelsonic
Copy link
Member Author

Using Clickhouse for a site that gets <100 views per day is like using a Lambo to go grocery shopping. πŸ™ƒ #overkill
Thanks for investigating this and doing the thorough write-up. ✍️ πŸ‘Œ
DigitalOcean is silly expensive for these smaller projects. πŸ’Έ πŸ”₯
Currently investigating hetzner dwyl/learn-devops#97 ref: dwyl/mvp#488 (comment)

If I'm able to deploy Postgres Cluster on hetzner and the MVP via Kamal: dwyl/mvp#488 πŸ’­ (thoughts?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BLOCKED :fire: Core team's HIGHEST priority, blocking critical work bug Suspected or confirmed bug (defect) in the code chore a tedious but necessary task often paying technical debt priority-1 Highest priority issue. This is costing us money every minute that passes. research Research required; be specific T25m Time Estimate 25 Minutes tech-debt A feature/requirement implemented in a sub-optimal way & must be re-written technical A technical issue that requires understanding of the code, infrastructure or dependencies
Projects
None yet
Development

No branches or pull requests

3 participants