Skip to content

Commit

Permalink
feat: deploy faucet (#10580)
Browse files Browse the repository at this point in the history
Co-authored-by: Mitch <[email protected]>
  • Loading branch information
alexghr and just-mitch authored Dec 11, 2024
1 parent 0be44b2 commit 09e95a1
Show file tree
Hide file tree
Showing 16 changed files with 542 additions and 291 deletions.
124 changes: 124 additions & 0 deletions spartan/aztec-network/templates/faucet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "aztec-network.fullname" . }}-faucet
labels:
{{- include "aztec-network.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.faucet.replicas }}
selector:
matchLabels:
{{- include "aztec-network.selectorLabels" . | nindent 6 }}
app: faucet
template:
metadata:
labels:
{{- include "aztec-network.selectorLabels" . | nindent 8 }}
app: faucet
spec:
serviceAccountName: {{ include "aztec-network.fullname" . }}-node
{{- if .Values.network.public }}
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
{{- end }}
volumes:
- name: config
emptyDir: {}
- name: scripts
configMap:
name: {{ include "aztec-network.fullname" . }}-scripts
- name: scripts-output
emptyDir: {}
initContainers:
{{- include "aztec-network.serviceAddressSetupContainer" . | nindent 8 }}
- name: wait-for-dependencies
image: {{ .Values.images.curl.image }}
command:
- /bin/sh
- -c
- |
source /shared/config/service-addresses
cat /shared/config/service-addresses
echo "Awaiting ethereum node at ${ETHEREUM_HOST}"
until curl -s -X POST -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}' \
${ETHEREUM_HOST} | grep -q reth; do
echo "Waiting for Ethereum node ${ETHEREUM_HOST}..."
sleep 5
done
echo "Ethereum node is ready!"
volumeMounts:
- name: config
mountPath: /shared/config
- name: scripts
mountPath: /shared/scripts
containers:
- name: faucet
{{ include "aztec-network.image" . | nindent 10 }}
volumeMounts:
- name: config
mountPath: /shared/config
command:
- "/bin/bash"
- "-c"
- |
source /shared/config/service-addresses
cat /shared/config/service-addresses
node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js start --faucet --faucet.apiServer --faucet.apiServerPort {{ .Values.faucet.apiServerPort }}
env:
- name: AZTEC_PORT
value: "{{ .Values.faucet.service.nodePort }}"
- name: L1_CHAIN_ID
value: "{{ .Values.ethereum.chainId }}"
- name: MNEMONIC
value: "{{ .Values.aztec.l1DeploymentMnemonic }}"
- name: FAUCET_MNEMONIC_ACCOUNT_INDEX
value: "{{ .Values.faucet.accountIndex }}"
- name: FAUCET_L1_ASSETS
value: "{{ .Values.faucet.l1Assets }}"
- name: LOG_JSON
value: "1"
- name: LOG_LEVEL
value: "{{ .Values.faucet.logLevel }}"
ports:
- name: http
containerPort: {{ .Values.faucet.service.nodePort }}
protocol: TCP
resources:
{{- toYaml .Values.faucet.resources | nindent 12 }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "aztec-network.fullname" . }}-faucet
labels:
{{- include "aztec-network.labels" . | nindent 4 }}
spec:
type: ClusterIP
selector:
{{- include "aztec-network.selectorLabels" . | nindent 4 }}
app: faucet
ports:
- protocol: TCP
port: {{ .Values.faucet.service.nodePort }}
targetPort: {{ .Values.faucet.service.nodePort }}
{{- if and (eq .Values.faucet.service.type "NodePort") .Values.faucet.service.nodePort }}
nodePort: {{ .Values.faucet.service.nodePort }}
{{- end }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "aztec-network.fullname" . }}-faucet-api
labels:
{{- include "aztec-network.labels" . | nindent 4 }}
spec:
type: ClusterIP
selector:
{{- include "aztec-network.selectorLabels" . | nindent 4 }}
app: faucet
ports:
- protocol: TCP
port: {{ .Values.faucet.apiServerPort }}
targetPort: {{ .Values.faucet.apiServerPort }}
10 changes: 10 additions & 0 deletions spartan/aztec-network/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -240,3 +240,13 @@ proverBroker:
jobs:
deployL1Verifier:
enable: false

faucet:
replicas: 1
service:
nodePort: 8085
apiServerPort: 8086
accountIndex: 0
l1Assets: ""
logLevel: ""
resources: {}
10 changes: 8 additions & 2 deletions yarn-project/aztec-faucet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"main": "dest/bin/index.js",
"type": "module",
"bin": "./dest/bin/index.js",
"exports": {
".": "./dest/index.js"
},
"typedocOptions": {
"entryPoints": [
"./src/bin/index.ts"
Expand Down Expand Up @@ -65,14 +68,17 @@
"@aztec/ethereum": "workspace:^",
"@aztec/foundation": "workspace:^",
"@aztec/l1-artifacts": "workspace:^",
"@koa/cors": "^5.0.0",
"koa": "^2.14.2",
"koa-cors": "^0.0.16",
"koa-bodyparser": "^4.4.1",
"koa-router": "^12.0.0",
"viem": "^2.7.15"
"viem": "^2.7.15",
"zod": "^3.23.8"
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@types/jest": "^29.5.0",
"@types/koa-bodyparser": "^4.3.12",
"@types/node": "^18.7.23",
"jest": "^29.5.0",
"ts-node": "^10.9.1",
Expand Down
Loading

0 comments on commit 09e95a1

Please sign in to comment.