Commit 842c2dcb authored by sonicaj's avatar sonicaj

Setup filecoin deployment

parent 5b5fe22a
Chia Network Filecoin Network
===== =====
[CHIA](https://www.chia.net/) is a new blockchain and smart transaction platform that is easier to use, more efficient, and secure. Filecoin is a peer-to-peer network that stores files on the internet, with built-in economic incentives to ensure files are stored reliably over time.
groups: groups:
- name: "Storage" - name: "Storage"
description: "Configure Storage for Chia" description: "Configure Storage"
- name: "Farmr.net Configuration" - name: "Environment Variables"
description: "Configure farmr.net support"
- name: "Chia Environment Variables"
description: "Set the environment that will be visible to the container" description: "Set the environment that will be visible to the container"
- name: "Networking" - name: "Networking"
description: "Configure networking for Chia container" description: "Configure networking"
portals: portals:
web_portal: web_portal:
...@@ -19,106 +17,92 @@ portals: ...@@ -19,106 +17,92 @@ portals:
path: "/kb/truepool-docker-image/" path: "/kb/truepool-docker-image/"
questions: questions:
- variable: farmr_env
label: "Enable 'farmr.net' support"
group: "Farmr.net Configuration"
description: "Configure 'farmr.net' support for chia"
schema:
type: string
default: "off"
enum:
- value: "off"
description: "OFF"
- value: "farmer"
description: "FARMER"
- value: "harvester"
description: "HARVESTER"
- variable: appVolumeMounts - variable: appVolumeMounts
label: "Chia Storage" label: "Storage"
group: "Storage" group: "Storage"
schema: schema:
type: dict type: dict
attrs: attrs:
- variable: config - variable: data
label: "Configuration Volume" label: "Lotus Data Volume"
schema: schema:
type: dict type: dict
attrs: attrs:
- variable: datasetName - variable: datasetName
label: "Configuration Volume Dataset Name" label: "Lotus Data Volume Dataset Name"
schema: schema:
type: string type: string
hidden: true hidden: true
$ref: $ref:
- "normalize/ixVolume" - "normalize/ixVolume"
show_if: [["hostPathEnabled", "=", false]] show_if: [["hostPathEnabled", "=", false]]
default: "config" default: "lotus"
editable: false editable: false
- variable: mountPath - variable: mountPath
label: "Configuration Mount Path" label: "Lotus Data Mount Path"
description: "Path where the volume will be mounted inside the pod" description: "Path where the volume will be mounted inside the pod"
schema: schema:
type: path type: path
hidden: true hidden: true
editable: true editable: false
default: "/data" default: "/var/lib/lotus"
- variable: hostPathEnabled - variable: hostPathEnabled
label: "Enable Custom Host Path for Chia Configuration Volume" label: "Enable Custom Host Path for Lotus Data Volume"
schema: schema:
type: boolean type: boolean
default: false default: false
show_subquestions_if: true show_subquestions_if: true
subquestions: subquestions:
- variable: hostPath - variable: hostPath
label: "Host Path for Chia Configuration Volume" label: "Host Path for Lotus Data Volume"
schema: schema:
type: hostpath type: hostpath
required: true required: true
- variable: plots - variable: parameterCache
label: "Plot Volume" label: "Filecoin Parameter Cache Volume"
schema: schema:
type: dict type: dict
attrs: attrs:
- variable: datasetName - variable: datasetName
label: "Plots Volume Name" label: "Parameter Cache Volume Name"
schema: schema:
type: string type: string
hidden: true hidden: true
$ref: $ref:
- "normalize/ixVolume" - "normalize/ixVolume"
show_if: [["hostPathEnabled", "=", false]] show_if: [["hostPathEnabled", "=", false]]
default: "plots" default: "parameter_cache"
editable: false editable: false
- variable: mountPath - variable: mountPath
label: "Plots Mount Path" label: "Parameter Cache Mount Path"
description: "Path where the volume will be mounted inside the pod" description: "Path where the volume will be mounted inside the pod"
schema: schema:
type: path type: path
hidden: true hidden: true
editable: false editable: true
default: "/plots" default: "/var/tmp/filecoin-proof-parameters"
- variable: hostPathEnabled - variable: hostPathEnabled
label: "Enable Custom Host Path for Chia Plots Volume" label: "Enable Custom Host Path for Parameter Cache Volume"
schema: schema:
type: boolean type: boolean
default: false default: false
show_subquestions_if: true show_subquestions_if: true
subquestions: subquestions:
- variable: hostPath - variable: hostPath
label: "Host Path for Chia Plots Volume" label: "Host Path for Parameter Cache Volume"
schema: schema:
type: hostpath type: hostpath
required: true required: true
- variable: extraAppVolumeMounts - variable: extraAppVolumeMounts
label: "Chia Extra Host Path Volumes" label: "Extra Host Path Volumes"
group: "Storage" group: "Storage"
schema: schema:
type: list type: list
items: items:
- variable: extraAppVolume - variable: extraAppVolume
label: "Chia Host Path Volume" label: "Host Path Volume"
description: "Add an extra host path volume for chia application" description: "Add an extra host path volume"
schema: schema:
type: dict type: dict
attrs: attrs:
...@@ -136,8 +120,8 @@ questions: ...@@ -136,8 +120,8 @@ questions:
required: true required: true
- variable: environmentVariables - variable: environmentVariables
label: "Environment Variables for Chia" label: "Environment Variables"
group: "Chia Environment Variables" group: "Environment Variables"
schema: schema:
type: list type: list
default: [] default: []
...@@ -165,18 +149,10 @@ questions: ...@@ -165,18 +149,10 @@ questions:
required: true required: true
attrs: attrs:
- variable: nodePort - variable: nodePort
label: "Node Port to use for Chia" label: "Node Port to use for Filecoin"
schema:
type: int
min: 8000
max: 65535
default: 8444
required: true
- variable: farmerPort
label: "Farmer Port to use for Chia"
schema: schema:
type: int type: int
min: 8000 min: 8000
max: 65535 max: 65535
default: 8447 default: 9665
required: true required: true
...@@ -26,14 +26,10 @@ spec: ...@@ -26,14 +26,10 @@ spec:
mountPath: {{ $hostPathConfiguration.mountPath }} mountPath: {{ $hostPathConfiguration.mountPath }}
{{ end }} {{ end }}
ports: ports:
- name: chia-network - name: fil-network
protocol: TCP protocol: TCP
containerPort: 8444 containerPort: 1234
hostPort: null hostPort: 1234
- name: chia-farmer
protocol: TCP
containerPort: 8447
hostPort: null
{{ $envList := (default list .Values.environmentVariables) }} {{ $envList := (default list .Values.environmentVariables) }}
{{ $envList = mustAppend $envList (dict "name" "keys" "value" "/plots/keyfile") }} {{ $envList = mustAppend $envList (dict "name" "keys" "value" "/plots/keyfile") }}
{{ $envList = mustAppend $envList (dict "name" "farmr" "value" $.Values.farmr_env) }} {{ $envList = mustAppend $envList (dict "name" "farmr" "value" $.Values.farmr_env) }}
......
apiVersion: batch/v1
kind: Job
metadata:
name: "pre-install"
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-weight": "1"
"helm.sh/hook-delete-policy": hook-succeeded
spec:
template:
metadata:
name: "pre-upgrade-hook2"
spec:
restartPolicy: Never
containers:
- name: {{ .Chart.Name }}-generate-mnemonic
{{ include "common.containers.imageConfig" .Values.image | nindent 8 }}
volumeMounts:{{ include "common.storage.configureAppVolumeMountsInContainer" .Values | nindent 10 }}
- name: generate-mnemonic-configmap
mountPath: /generate_entrypoint.sh
readOnly: true
subPath: entrypoint.sh
command:
- "/generate_entrypoint.sh"
volumes: {{- include "common.storage.configureAppVolumes" .Values | nindent 8 -}}
- name: generate-mnemonic-configmap
configMap:
defaultMode: 0700
name: "generate-mnemonic-config-map"
apiVersion: v1
kind: ConfigMap
metadata:
name: "generate-mnemonic-config-map"
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-weight": "-1"
"helm.sh/hook-delete-policy": hook-succeeded
data:
entrypoint.sh: |-
#!/bin/sh
if [ ! -e /plots/keyfile ]; then
/chia-blockchain/venv/bin/python3 -c "from chia.util.keychain import generate_mnemonic;print(generate_mnemonic())" > /plots/keyfile;
fi
...@@ -2,10 +2,7 @@ ...@@ -2,10 +2,7 @@
{{ $svc := .Values.service }} {{ $svc := .Values.service }}
{{ $ports := list }} {{ $ports := list }}
{{ if ge ($svc.nodePort | int) 9000 }} {{ if ge ($svc.nodePort | int) 9000 }}
{{ $ports = mustAppend $ports (dict "name" "chia-network" "port" $svc.nodePort "nodePort" $svc.nodePort "targetPort" 8444) }} {{ $ports = mustAppend $ports (dict "name" "fil-network" "port" $svc.nodePort "nodePort" $svc.nodePort "targetPort" 8444) }}
{{ end }}
{{ if ge ($svc.farmerPort | int) 9000 }}
{{ $ports = mustAppend $ports (dict "name" "chia-farmer" "port" $svc.farmerPort "nodePort" $svc.farmerPort "targetPort" 8447) }}
{{ end }} {{ end }}
{{ $params := . }} {{ $params := . }}
{{ $_ := set $params "commonService" (dict "type" "NodePort" "ports" $ports ) }} {{ $_ := set $params "commonService" (dict "type" "NodePort" "ports" $ports ) }}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment