mastodon / chart

Helm chart for Mastodon deployment in Kubernetes
GNU Affero General Public License v3.0
158 stars 92 forks source link

mastodon.local isn't working #16

Closed tomtom94 closed 1 year ago

tomtom94 commented 1 year ago

Hello

Everything has been well started

$ helm install --namespace mastodon --create-namespace my-mastodon ./ -f dev-values.yaml 
NAME: my-mastodon
LAST DEPLOYED: Tue Dec 13 14:27:42 2022
NAMESPACE: mastodon
STATUS: deployed
REVISION: 1
NOTES:
1. Get the application URL by running these commands:
  https://mastodon.local/
Every 2,0s: kubectl get services --namespace mastodon                                                                                                  MacBook-Pro-de-Thomas.local: Tue Dec 13 14:48:29 2022

NAME                                        TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)             AGE
my-mastodon-elasticsearch                   ClusterIP   10.97.3.138      <none>        9200/TCP,9300/TCP   20m
my-mastodon-elasticsearch-coordinating-hl   ClusterIP   None             <none>        9200/TCP,9300/TCP   20m
my-mastodon-elasticsearch-data-hl           ClusterIP   None             <none>        9200/TCP,9300/TCP   20m
my-mastodon-elasticsearch-ingest-hl         ClusterIP   None             <none>        9200/TCP,9300/TCP   20m
my-mastodon-elasticsearch-master-hl         ClusterIP   None             <none>        9200/TCP,9300/TCP   20m
my-mastodon-postgresql                      ClusterIP   10.111.193.172   <none>        5432/TCP            20m
my-mastodon-postgresql-hl                   ClusterIP   None             <none>        5432/TCP            20m
my-mastodon-redis-headless                  ClusterIP   None             <none>        6379/TCP            20m
my-mastodon-redis-master                    ClusterIP   10.109.210.218   <none>        6379/TCP            20m
my-mastodon-redis-replicas                  ClusterIP   10.104.27.210    <none>        6379/TCP            20m
my-mastodon-streaming                       ClusterIP   10.107.169.110   <none>        4000/TCP            20m
my-mastodon-web                             ClusterIP   10.98.188.14     <none>        3000/TCP            20m

But https://mastodon.local/ isn't working.

Don't we need to expose something via kubectl ? or add the domain in our /etc/hosts ?

How to aim the ingress mastodon.local ?

deepy commented 1 year ago

Out of curiosity, why are you using dev-values.yaml instead of creating a custom file based on values.yaml (and using your own domain)?

As for exposing it, the chart includes an ingress which is how you normally expose things. And yes, you need the hostname to resolve correctly.

But for https://mastodon.local/ to work a bunch of things need to work, "doesn't work" helps nothing unfortunately. We need to know what you tried and what error you got from it.

But in short, if you do a curl --insecure --resolve mastodon.local:443:ipofyouringressgoeshere https://mastodon.local/ you should see it working.

If it doesn't work, you need to fix your ingress controller or loadbalancer

tomtom94 commented 1 year ago

I got absolutly no error, just trying to launch the stuff on local with Kubernetes context docker-desktop. This is also why I am using dev-values.yaml I can't run thousands of replica with my old Mac.

Vagrant has already added a line (I think) in my /etc/hosts which I cared to put it in commentary.

# 192.168.42.42  mastodon.local  # VAGRANT: 408beca20e98763f06ebdacc60eb324e (default) / 189f42df-f8e4-4c1b-84d2-6aaab0f1894e

when you say curl --insecure --resolve mastodon.local:443:ipofyouringressgoeshere https://mastodon.local/ where is this ipofyouringressgoeshere ?

$ kubectl get ingress --all-namespaces
NAMESPACE   NAME          CLASS    HOSTS            ADDRESS   PORTS     AGE
mastodon    my-mastodon   <none>   mastodon.local             80, 443   5m28s

There is no IP right here.

deepy commented 1 year ago

Fair enough about the replicas, but there's still things you need to change in values.yaml for the setup to work, the dev-values is used just to run tests and the tests don't care about a lot of things that you're probably going to care about.

Anyways, if you want to run Mastodon or play around with it and don't have a multi-node cluster the Docker image is your best bet, Kubernetes just adds a lot of complexity that you don't really need.

But if you want to run this chart you're going to need to setup some things in your (single-node) cluster. First of all, you're going to need an ingress controller, my personal favourite is ingress-nginx but any ingress controller will work.

Then you're going to need a LoadBalancer or some other way of exposing your ingress to the world.

And since you run on a Mac you'll have a better time if you use a postgres running outside of Kubernetes

tomtom94 commented 1 year ago

I fell into the trap using straight the dev-values.yaml.

I am graduated by the CNCF

Running your stuff in the cloud, I estimate it at almost 200€ per month.

Kubernetes is the best way to save money.

Is my estimation right ? Are there customers monetizing your stuff ?

Thanks a lot for your replies, and perhaps you'll hear about me quite soon for the production mode values.yaml, if needed.

Good job.

deepy commented 1 year ago

As for saving money, well, it depends.

As for running it in the cloud, my setup has more redundancy than it needs but gets by using less than 8GB of RAM, so setting up a cluster just for Mastodon is going to be a lot more expensive than setting up an EC2 instance.

For a single-user instance the Kubernetes chart is probably way more than you need, I imagine that the only time you'd save money on using the chart is when you have a lot of users in the same timezone and can scale sidekiq up and down to meet demand. (But at that scale, some things in the chart will start to fall apart on their own already)

In short, for mastodon, unless you already have a cluster running then no it's not the best way to save money, in fact running in Kubernetes is right now the most expensive option and is the hardest to scale properly :-)