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

时间:2018-09-24 06:26:35

标签: kubernetes vps hasura

我想尝试Hasura Platform用于小型项目。 我对服务器的地理位置有限制,因此Digital Ocean不适合。

2 个答案:

答案 0 :(得分:2)

@Shahidh的答案的实现

到VPS 1 Core,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

为custom-cluster.yaml获取<kube-context>

 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

答案 1 :(得分:0)

您可以使用kubeadm在VPS上安装Kubernetes(例如运行Ubuntu),然后按照指南here在该Kubernetes群集上设置Hasura。

示例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