Skip to content

Commit

Permalink
Deploy to mainnet (#544)
Browse files Browse the repository at this point in the history
* avoid statefulsets update errors on actions runs refs #535. (#536)

* deprecate demux service. refs #538 (#540)

* add handler url from env var & other minor bug fixes (#542)

* Add missing env var to config map (#543)

* add handler url from env var & other minor bug fixes

* add missing env var

* fix: update some env vars

* fix: update some env vars

* fix: replace .env values with the previous ones

Co-authored-by: Andres Gomez <[email protected]>
Co-authored-by: JustinCast <[email protected]>
  • Loading branch information
3 people authored Apr 22, 2021
1 parent 8aa4300 commit 5033347
Show file tree
Hide file tree
Showing 15 changed files with 179 additions and 236 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/push-master-environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,24 @@ jobs:
DB_SCHEMA: ${{ secrets.DB_SCHEMA }}
EOS_API_ENDPOINT: https://bp.cryptolions.io
VIRTUAL_HOST: 0.0.0.0
VIRTUAL_PORT: "3005"
VIRTUAL_PORT: "9090"
# hasura
HASURA_GRAPHQL_DATABASE_URL: ${{ secrets.HASURA_GRAPHQL_DATABASE_URL }}
HASURA_GRAPHQL_MIGRATIONS_DIR: /hasura-migrations
HASURA_GRAPHQL_ADMIN_SECRET: ${{ secrets.HASURA_GRAPHQL_ADMIN_SECRET }}
HASURA_GRAPHQL_UNAUTHORIZED_ROLE: ${{ secrets.HASURA_GRAPHQL_UNAUTHORIZED_ROLE }}
HASURA_GRAPHQL_ACTION_BASE_URL: ${{secrets.HASURA_GRAPHQL_ACTION_BASE_URL}}
# pgweb
DATABASE_URL: ${{ secrets.DATABASE_URL }}

- name: Deploy kubernetes files
uses: Consensys/kubernetes-action@master
- name: Setup and deploy kubernetes environment
uses: steebchen/kubectl@master
env:
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
NAMESPACE: mainnet-eosrate
K8S_BUILD_DIR: build_k8s
with:
args: apply -f build_k8s -n mainnet-eosrate
args: version && make deploy-kubernetes

- name: Create Release
id: create_release
Expand Down
16 changes: 7 additions & 9 deletions .github/workflows/push-staging-environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,21 @@ jobs:
DB_SCHEMA: ${{ secrets.DB_SCHEMA }}
EOS_API_ENDPOINT: https://jungle3.cryptolions.io
VIRTUAL_HOST: 0.0.0.0
VIRTUAL_PORT: "3005"
VIRTUAL_PORT: "9090"
# hasura
HASURA_GRAPHQL_DATABASE_URL: ${{ secrets.HASURA_GRAPHQL_DATABASE_URL }}
HASURA_GRAPHQL_MIGRATIONS_DIR: /hasura-migrations
HASURA_GRAPHQL_ADMIN_SECRET: ${{ secrets.HASURA_GRAPHQL_ADMIN_SECRET }}
HASURA_GRAPHQL_UNAUTHORIZED_ROLE: ${{ secrets.HASURA_GRAPHQL_UNAUTHORIZED_ROLE }}
HASURA_GRAPHQL_ACTION_BASE_URL: ${{secrets.HASURA_GRAPHQL_ACTION_BASE_URL}}
# pgweb
DATABASE_URL: ${{ secrets.DATABASE_URL }}

- name: Deploy kubernetes files
uses: Consensys/kubernetes-action@master
- name: Setup and deploy kubernetes environment
uses: steebchen/kubectl@master
env:
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
NAMESPACE: jungle-eosrate
K8S_BUILD_DIR: build_k8s
with:
args: apply -f build_k8s -n jungle-eosrate

# - name: Verify deployment
# id: verify_deployment
# run: |
# kubectl rollout status deployment/hapi
args: version && make deploy-kubernetes
11 changes: 6 additions & 5 deletions docker-compose.staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ services:
context: ./services/hapi
dockerfile: Dockerfile
volumes:
- ./services/hapi:/opt/application
- /opt/application/node_modules
- ./services/hapi:/opt/application
- /opt/application/node_modules
ports:
- '3005:3005'
- "3005:9090"
environment:
VIRTUAL_HOST: 0.0.0.0
VIRTUAL_PORT: 3005
VIRTUAL_PORT: 9090
DB_USER: user
DB_PASSWORD: pass
DB_PORT: 5432
Expand All @@ -49,7 +49,7 @@ services:
EOS_API_ENDPOINT: "https://jungle.eosio.cr"

depends_on:
- postgres
- postgres

demux:
container_name: eosrate_demux
Expand Down Expand Up @@ -91,6 +91,7 @@ services:
HASURA_GRAPHQL_MIGRATIONS_DIR: /hasura-migrations
VIRTUAL_HOST: staging.eosrate.io
VIRTUAL_PORT: 8088
HASURA_GRAPHQL_ACTION_BASE_URL: http://hapi:9090
volumes:
- ./services/hasura/migrations:/hasura-migrations # mount hasura migrations folder
command:
Expand Down
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ services:
- ./services/hapi:/opt/application
- /opt/application/node_modules # prevents host/container conflicts
ports:
- "3005:3005"
- "3005:9090"
environment:
VIRTUAL_HOST: 0.0.0.0
VIRTUAL_PORT: 3005
VIRTUAL_PORT: 9090
DB_USER: user
DB_PASSWORD: pass
DB_PORT: 5432
Expand Down Expand Up @@ -92,8 +92,8 @@ services:
environment:
HASURA_GRAPHQL_DATABASE_URL: postgres://user:pass@postgres:5432/eosrate?sslmode=disable
HASURA_GRAPHQL_MIGRATIONS_DIR: /hasura-migrations
HASURA_GRAPHQL_ADMIN_SECRET: "${HASURA_GRAPHQL_ADMIN_SECRET}"
HASURA_GRAPHQL_UNAUTHORIZED_ROLE: "${HASURA_GRAPHQL_UNAUTHORIZED_ROLE}"
HASURA_GRAPHQL_ACTION_BASE_URL: http://hapi:9090

volumes:
- ./services/hasura/migrations:/hasura-migrations # mount hasura migrations folder
command:
Expand Down
1 change: 1 addition & 0 deletions kubernetes/configmaps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ data:
HASURA_GRAPHQL_MIGRATIONS_DIR: "${HASURA_GRAPHQL_MIGRATIONS_DIR}"
HASURA_GRAPHQL_ADMIN_SECRET: "${HASURA_GRAPHQL_ADMIN_SECRET}"
HASURA_GRAPHQL_UNAUTHORIZED_ROLE: "${HASURA_GRAPHQL_UNAUTHORIZED_ROLE}"
HASURA_GRAPHQL_ACTION_BASE_URL: "${HASURA_GRAPHQL_ACTION_BASE_URL}"
---
apiVersion: v1
kind: ConfigMap
Expand Down
50 changes: 25 additions & 25 deletions kubernetes/cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,29 @@ spec:
template:
spec:
containers:
- name: hapi-cronjob
image: ${DOCKER_REGISTRY}/${IMAGE_NAME_HAPI}:${VERSION}
args:
- /bin/sh
- -c
- /usr/bin/node /opt/application/src/libs/sync-bps.js; /usr/bin/node /opt/application/src/libs/sync-proxies.js
env:
- name: DB_HOST
value: postgres
- name: DB_NAME
value: eosrate
- name: DB_PASSWORD
value: pass
- name: DB_PORT
value: "5432"
- name: DB_SCHEMA
value: public
- name: DB_USER
value: user
- name: EOS_API_ENDPOINT
value: https://bp.cryptolions.io
- name: VIRTUAL_HOST
value: 0.0.0.0
- name: VIRTUAL_PORT
value: "3005"
- name: hapi-cronjob
image: ${DOCKER_REGISTRY}/${IMAGE_NAME_HAPI}:${VERSION}
args:
- /bin/sh
- -c
- /usr/bin/node /opt/application/src/libs/sync-bps.js; /usr/bin/node /opt/application/src/libs/sync-proxies.js
env:
- name: DB_HOST
value: postgres
- name: DB_NAME
value: eosrate
- name: DB_PASSWORD
value: pass
- name: DB_PORT
value: "5432"
- name: DB_SCHEMA
value: public
- name: DB_USER
value: user
- name: EOS_API_ENDPOINT
value: https://bp.cryptolions.io
- name: VIRTUAL_HOST
value: 0.0.0.0
- name: VIRTUAL_PORT
value: "9090"
restartPolicy: Never
44 changes: 0 additions & 44 deletions kubernetes/demux-deployment.yaml

This file was deleted.

13 changes: 0 additions & 13 deletions kubernetes/demux-service.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ deploy-kubernetes: $(K8S_BUILD_DIR)
-n $(NAMESPACE) || echo "SSL cert already configured.";
@echo "Applying kubernetes files..."
@for file in $(shell find $(K8S_BUILD_DIR) -name '*.yaml' | sed 's:$(K8S_BUILD_DIR)/::g'); do \
kubectl apply -f $(K8S_BUILD_DIR)/$$file -n $(NAMESPACE); \
kubectl apply -f $(K8S_BUILD_DIR)/$$file -n $(NAMESPACE) || echo "${file} Cannot be updated."; \
done

build-docker-images: ##@devops Build docker images
Expand Down
2 changes: 1 addition & 1 deletion services/frontend/.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
REACT_APP_GRAPHQL_HTTP_URL=https://graphql-jungle.eosrate.io/v1alpha1/graphql
REACT_APP_GRAPHQL_HTTP_URL=https://graphql-jungle.eosrate.io/v1/graphql
REACT_APP_API_URL=https://jungle.eosio.cr
REACT_APP_GRAPHQL_WS_URL=wss://graphql-jungle.eosrate.io/v1alpha1/graphql
REACT_APP_EOS_API_URL=https://jungle.eosio.cr
Expand Down
4 changes: 2 additions & 2 deletions services/frontend/.env.staging
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
REACT_APP_GRAPHQL_HTTP_URL=https://graphql-jungle.eosrate.io/v1alpha1/graphql
REACT_APP_GRAPHQL_HTTP_URL=https://graphql-jungle.eosrate.io/v1/graphql
REACT_APP_API_URL=https://jungle.eosio.cr
REACT_APP_GRAPHQL_WS_URL=wss://graphql-jungle.eosrate.io/v1alpha1/graphql
REACT_APP_GRAPHQL_WS_URL=wss://graphql-jungle.eosrate.io/v1/graphql
REACT_APP_EOS_API_URL=https://jungle.eosio.cr
REACT_APP_EOS_API_HOST=jungle.eosio.cr
REACT_APP_EOS_API_PORT=443
Expand Down
8 changes: 2 additions & 6 deletions services/frontend/src/services/graphql.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,13 @@ import { InMemoryCache } from 'apollo-cache-inmemory'

// Create an http link:
const httpLink = new HttpLink({
uri:
process.env.REACT_APP_GRAPHQL_HTTP_URL ||
'http://localhost:8088/v1alpha1/graphql',
uri: process.env.REACT_APP_GRAPHQL_HTTP_URL,
credentials: 'same-origin'
})

// Create a WebSocket link:
const wsLink = new WebSocketLink({
uri:
process.env.REACT_APP_GRAPHQL_WS_URL ||
'ws://localhost:8088/v1alpha1/graphql',
uri: process.env.REACT_APP_GRAPHQL_WS_URL,
options: {
reconnect: true
}
Expand Down
2 changes: 1 addition & 1 deletion services/hapi/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const Hapi = require('@hapi/hapi')

const init = async () => {
const server = Hapi.server({
port: VIRTUAL_PORT || 3005,
port: VIRTUAL_PORT || 9090,
host: VIRTUAL_HOST || '0.0.0.0'
})

Expand Down
1 change: 1 addition & 0 deletions services/hasura/migrations/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HASURA_GRAPHQL_ACTION_BASE_URL=http://hapi:9090
Loading

0 comments on commit 5033347

Please sign in to comment.