DEV Community

Alexandr K
Alexandr K

Posted on • Updated on

How to deploy Ember app to kubernetes

As part of my unfinished project observerio I were working on my first ember dashboard and when I finished to work on prototype, decided to deploy it as pod in kubernetes cluster in digitalocean. Why kubernetes probably it's saving a lot of time if you are solo developer and don't have enough money to support the non profitable idea.

On the first deploy I found that it was pretty easy to build released version of ember app but on open the dashboard in browser I found that my routing is not working properly. After googling the solution someone suggested to change nginx settings on serve ember app.

Docker.released used by pod:

FROM alpine:3.6

COPY dist/ /app

WORKDIR /app

CMD ["tail", "-f", "/dev/null"]

Enter fullscreen mode Exit fullscreen mode

How to change nginx settings? I started to think about it. I didn't know internal stuff in k8s and the next step for me was to explore a bit the containers from running processes in kubernetes cluster. In ingress pod I found the nginx template that used on serving my ember pod.

nginx.tmpl

To make sure that I would have the same template as installed ingress container, I copied nginx.tmpl from the container and placed there(line: 458):

{{ if and (eq $path "/") (eq $server.Hostname "observer.rubyforce.co") }}
            try_files $uri $uri/ /index.html?/$request_uri;
{{ end }}
Enter fullscreen mode Exit fullscreen mode

Then changed ingress controller to use the new template via config map, example of Deployment

Probably it could be helpful for someone as well.

Thanks for reading!

Top comments (0)