如何在自定义 VPS 上安装 Hasura 平台?

How to install Hasura Platform on custom VPS?

我想为小项目试用 Hasura 平台。 我对服务器的地理位置有限制,所以Digital Ocean不适合。

您可以使用 kubeadm and then setup Hasura on that Kubernetes Cluster by following the guide here.

在 VPS(比如 运行 Ubuntu)上安装 Kubernetes

示例 custom-cluster.yaml 可能如下所示:

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 回答的实现

至 VPS 1 核,2 Gb,Ubuntu 16.04 x86_64

discussion on Discord

VPS:

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

安装Docker:

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

安装 Kubernetes (已在 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

检查:kubectl get all --namespace=kube-system

在本地机器上:

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

设置 Kubernetes 上下文:

 export KUBECONFIG=~/k8s/admin.conf

检查:

kubectl get nodes

获取 <kube-context> 用于自定义-cluster.yaml:

 kubectl config current-context

安装hasura集群:

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

将集群添加到项目:

hasura cluster add --file custom-cluster.yaml