How to install Hasura Platform on custom VPS?

9/24/2018

I want to try Hasura Platform for small project. I have a limitation on the geographical location of the server, so Digital Ocean is not suitable.

-- Alukos
hasura
kubernetes
vps

2 Answers

10/12/2018

Implementation of @Shahidh's answer

to VPS 1 Core, 2 Gb, Ubuntu 16.04 x86_64

discussion on Discord

VPS:

ssh root@<your-vps-public-ip>

Install Docker:

apt-get update && apt-get install -qy docker.io

Install Kubernetes (was tested on v1.10)

:

apt-get update && apt-get install -y apt-transport-https curl

curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -

cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF

apt-get update
apt-get install -qy kubelet=1.10.11-00 kubeadm=1.10.11-00 kubectl=1.10.11-00
apt-mark hold kubelet kubeadm kubectl

kubeadm init --pod-network-cidr=10.244.0.0/16 \
--apiserver-advertise-address=<your-vps-public-ip> \
--kubernetes-version=1.10.11

export KUBECONFIG=/etc/kubernetes/admin.conf

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/bc79dd1505b0c8681ece4de4c0d86c5cd2643275/Documentation/kube-flannel.yml

kubectl taint nodes --all node-role.kubernetes.io/master-

mkdir -p /data/hasura-data

Check: kubectl get all --namespace=kube-system

On local machine:

 mkdir ~/k8s/
 scp root@<you-vps-public-ip>:/etc/kubernetes/admin.conf ~/k8s/

set Kubernetes context:

 export KUBECONFIG=~/k8s/admin.conf

check:

kubectl get nodes

get <kube-context> for custom-cluster.yaml:

 kubectl config current-context

install hasura cluster:

 cd <project-directory>
 hasura cluster install \
 --file custom-cluster.yaml \
 --domain=<your-vps-public-ip>.xip.io

add cluster to project:

hasura cluster add --file custom-cluster.yaml
-- Alukos
Source: StackOverflow

9/24/2018

You can install Kubernetes on a VPS (say running Ubuntu) using kubeadm and then setup Hasura on that Kubernetes Cluster by following the guide here.

A sample custom-cluster.yaml might look like this:

name: '<cluster-name>'
alias: '<cluster-alias>'
kubeContext: '<kube-context>'
config:
  namespace: hasura
  configmap: controller-conf
infra:
  provider: custom
metadata:
  namespaces:
    hasura: hasura
    user: default
  gateway:
    ports:
    - name: http
      port: 80
      protocol: TCP
      targetPort: 80
    - name: https
      port: 443
      protocol: TCP
      targetPort: 443
    - name: ssh
      port: 2022
      protocol: TCP
      targetPort: 22
    selector:
      app: gateway
    externalIPs: ["<your-vps-public-ip>"]
  postgres:
    volume:
      hostPath:
        path: '/data/hasura-data'
      name: postgres-pv
  filestore:
    volume:
      hostPath:
        path: '/data/hasura-data'
      name: filestore-pv
  sessionStore:
    volume:
      hostPath:
        path: '/data/hasura-data'
      name: redis-pv
-- Shahidh
Source: StackOverflow