diff --git a/.github/workflows/build-deploy-aks.yml b/.github/workflows/build-deploy-aks.yml index 750432daccc..07e2e01cc35 100644 --- a/.github/workflows/build-deploy-aks.yml +++ b/.github/workflows/build-deploy-aks.yml @@ -56,3 +56,4 @@ jobs: kubectl apply -f k8s/deployment.yaml kubectl apply -f k8s/service.yaml kubectl apply -f k8s/blockscout.yaml + kubectl apply -f k8s/blockscout-service.yaml diff --git a/.github/workflows/deploy-to-aks.yml b/.github/workflows/deploy-to-aks.yml index 6d1099b3cc2..a177745ad90 100644 --- a/.github/workflows/deploy-to-aks.yml +++ b/.github/workflows/deploy-to-aks.yml @@ -30,8 +30,13 @@ jobs: az login --service-principal --username $DOSPN_CLIENT_ID --password $DOSPN_CLIENT_SECRET --tenant $DOSPN_TENANT_ID az aks get-credentials --resource-group gethdevnetrg --name gethdevnetaks - - name: Deploy to AKS + - name: Deploy PostgreSQL to AKS + run: | + kubectl apply -f k8s/postgresql.yaml + + - name: Deploy Blockscout to AKS run: | kubectl apply -f k8s/deployment.yaml kubectl apply -f k8s/service.yaml kubectl apply -f k8s/blockscout.yaml + kubectl apply -f k8s/blockscout-service.yaml diff --git a/docker-compose.yml b/docker-compose.yml index 00b964dfcc9..343d6ea19e3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,6 +4,7 @@ services: geth: image: "${DOCKER_HUB_USERNAME}/go-ethereum:latest" ports: + - "80:8545" - "8545:8545" - "8546:8546" - "30303:30303" diff --git a/k8s/blockscout-service.yaml b/k8s/blockscout-service.yaml new file mode 100644 index 00000000000..6fe35a914b6 --- /dev/null +++ b/k8s/blockscout-service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: blockscout-service +spec: + selector: + app: blockscout + ports: + - protocol: TCP + port: 4000 + targetPort: 4000 + type: LoadBalancer diff --git a/k8s/blockscout.yaml b/k8s/blockscout.yaml index fd084d98f7b..560a07eb490 100644 --- a/k8s/blockscout.yaml +++ b/k8s/blockscout.yaml @@ -17,3 +17,26 @@ spec: image: blockscout/blockscout:latest ports: - containerPort: 4000 + resources: + limits: + memory: "2Gi" + cpu: "1" + requests: + memory: "1Gi" + cpu: "0.5" + env: + - name: DATABASE_URL + valueFrom: + secretKeyRef: + name: postgresql-secret + key: DATABASE_URL + - name: SECRET_KEY_BASE + valueFrom: + secretKeyRef: + name: postgresql-secret + key: SECRET_KEY_BASE + - name: ETHEREUM_JSONRPC_HTTP_URL + valueFrom: + secretKeyRef: + name: postgresql-secret + key: ETHEREUM_JSONRPC_HTTP_URL diff --git a/k8s/deployment.yaml b/k8s/deployment.yaml index fa20a56b9fe..f564fd66d9f 100644 --- a/k8s/deployment.yaml +++ b/k8s/deployment.yaml @@ -16,4 +16,23 @@ spec: - name: go-ethereum image: nikolaivanovj/go-ethereum:latest ports: - - containerPort: 80 + - containerPort: 8545 + - containerPort: 8546 + - containerPort: 30303 + - containerPort: 30303 + command: + - "geth" + - "--http" + - "--http.addr" + - "0.0.0.0" + - "--http.port" + - "8545" + - "--http.api" + - "web3,eth,net" + - "--ws" + - "--ws.addr" + - "0.0.0.0" + - "--ws.port" + - "8546" + - "--ws.api" + - "web3,eth,net" diff --git a/k8s/postgresql.yaml b/k8s/postgresql.yaml new file mode 100644 index 00000000000..06ffdebcbfb --- /dev/null +++ b/k8s/postgresql.yaml @@ -0,0 +1,48 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: postgresql +spec: + replicas: 1 + selector: + matchLabels: + app: postgresql + template: + metadata: + labels: + app: postgresql + spec: + containers: + - name: postgresql + image: postgres:latest + ports: + - containerPort: 5432 + env: + - name: POSTGRES_USER + valueFrom: + secretKeyRef: + name: postgresql-secret + key: POSTGRES_USER + - name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + name: postgresql-secret + key: POSTGRES_PASSWORD + - name: POSTGRES_DB + valueFrom: + secretKeyRef: + name: postgresql-secret + key: POSTGRES_DB +--- +apiVersion: v1 +kind: Service +metadata: + name: postgresql-service +spec: + selector: + app: postgresql + ports: + - protocol: TCP + port: 5432 + targetPort: 5432 + type: ClusterIP diff --git a/k8s/service.yaml b/k8s/service.yaml index bc693cf19e9..5b2c0909afe 100644 --- a/k8s/service.yaml +++ b/k8s/service.yaml @@ -6,7 +6,24 @@ spec: selector: app: go-ethereum ports: - - protocol: TCP + - name: http + protocol: TCP port: 80 - targetPort: 80 + targetPort: 8545 + - name: json-rpc + protocol: TCP + port: 8545 + targetPort: 8545 + - name: websocket + protocol: TCP + port: 8546 + targetPort: 8546 + - name: p2p-tcp + protocol: TCP + port: 30303 + targetPort: 30303 + - name: p2p-udp + protocol: UDP + port: 30303 + targetPort: 30303 type: LoadBalancer