Skip to content

Commit

Permalink
dev2master (#225)
Browse files Browse the repository at this point in the history
* App: Support new subscriptions module (#220)

* app: support new subscriptions module

* shared: add fs import on artifacts

* shared: fix artifacts paths generation

* chore: changed URLs from *.eth.aragon.network to *.backend.aragon.org

* removing heartbeat (#223)

* removing heartbeat

* [cicd] updates github container registry
removes deployment step

Co-authored-by: Mathias Scherer <[email protected]>

* [cicd] adds workflow for rinkeby image (#224)

Co-authored-by: Facu Spagnuolo <[email protected]>
Co-authored-by: Martynas Prokopas <[email protected]>
Co-authored-by: Ramon Canales <[email protected]>
  • Loading branch information
4 people authored Oct 14, 2021
1 parent 3a9b0e6 commit b8f57c3
Show file tree
Hide file tree
Showing 20 changed files with 135 additions and 304 deletions.
19 changes: 4 additions & 15 deletions .github/workflows/mainnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,29 @@ on:
- v*
env:
# This is a base repository and we use ${GITHUB_REF##*/} to set the version of the container
REPO: docker.pkg.github.com/aragonone/court-backend/mainnet
REPO: ghcr.io/aragonone/court-backend/mainnet

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: docker login docker.pkg.github.com -u $GITHUB_ACTOR -p ${{secrets.GITHUB_TOKEN}}
- run: docker login ghcr.io -u $GITHUB_ACTOR -p ${{secrets.GITHUB_TOKEN}}
- run: .github/scripts/docker-build.sh $REPO ${GITHUB_SHA}

test:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- run: docker login docker.pkg.github.com -u $GITHUB_ACTOR -p ${{secrets.GITHUB_TOKEN}}
- run: docker login ghcr.io -u $GITHUB_ACTOR -p ${{secrets.GITHUB_TOKEN}}
- run: .github/scripts/test/run.sh $REPO:${GITHUB_SHA}

release:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v2
- run: docker login docker.pkg.github.com -u $GITHUB_ACTOR -p ${{secrets.GITHUB_TOKEN}}
- run: docker login ghcr.io -u $GITHUB_ACTOR -p ${{secrets.GITHUB_TOKEN}}
- run: .github/scripts/docker-release.sh $REPO:${GITHUB_SHA} $REPO:${GITHUB_REF##*/}
- run: .github/scripts/docker-release.sh $REPO:${GITHUB_SHA} $REPO:latest

deploy:
runs-on: ubuntu-latest
needs: release
steps:
- uses: actions/checkout@v2
- run: .github/scripts/kubectl-config.sh ${{secrets.KUBE_CA}} ${{secrets.KUBE_SERVER}} ${{secrets.KUBE_TOKEN}}
- run: .github/scripts/kubectl-set-image.sh court-backend $REPO:${GITHUB_REF##*/}
- run: .github/scripts/kubectl-wait-ready.sh court-backend
# wait 10 sec for k8s to reroute ingress and check app endpoint
- run: sleep 10 && curl --fail https://court-backend-app.eth.aragon.network
39 changes: 39 additions & 0 deletions .github/workflows/rinkeby.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Testnet CI/CD
on:
push:
branches:
# Executes on any non master commit, but release and deploy steps only run on development
# This is useful to see if tests are passing during PR review
- '**'
- '!master'
paths-ignore:
- 'monitoring/**'
- 'emails/**'
env:
# This is a base repository and we use ${GITHUB_SHA} to set the version of the container
REPO: docker.pkg.github.com/aragonone/court-backend/rinkeby

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: docker login docker.pkg.github.com -u $GITHUB_ACTOR -p ${{secrets.GITHUB_TOKEN}}
- run: .github/scripts/docker-build.sh $REPO ${GITHUB_SHA}

test:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- run: docker login docker.pkg.github.com -u $GITHUB_ACTOR -p ${{secrets.GITHUB_TOKEN}}
- run: .github/scripts/test/run.sh $REPO:${GITHUB_SHA}

release:
if: github.ref == 'refs/heads/development'
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v2
- run: docker login docker.pkg.github.com -u $GITHUB_ACTOR -p ${{secrets.GITHUB_TOKEN}}
- run: .github/scripts/docker-release.sh $REPO:${GITHUB_SHA} $REPO:latest
28 changes: 5 additions & 23 deletions .github/workflows/testnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ on:
- 'emails/**'
env:
# This is a base repository and we use ${GITHUB_SHA} to set the version of the container
REPO: docker.pkg.github.com/aragonone/court-backend/testnet
REPO: ghcr.io/aragonone/court-backend/testnet

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: docker login docker.pkg.github.com -u $GITHUB_ACTOR -p ${{secrets.GITHUB_TOKEN}}
- run: docker login ghcr.io -u $GITHUB_ACTOR -p ${{secrets.GITHUB_TOKEN}}
- run: .github/scripts/docker-build.sh $REPO ${GITHUB_SHA}

test:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- run: docker login docker.pkg.github.com -u $GITHUB_ACTOR -p ${{secrets.GITHUB_TOKEN}}
- run: docker login ghcr.io -u $GITHUB_ACTOR -p ${{secrets.GITHUB_TOKEN}}
- run: .github/scripts/test/run.sh $REPO:${GITHUB_SHA}

release:
Expand All @@ -35,23 +35,5 @@ jobs:
needs: test
steps:
- uses: actions/checkout@v2
- run: docker login docker.pkg.github.com -u $GITHUB_ACTOR -p ${{secrets.GITHUB_TOKEN}}
- run: .github/scripts/docker-release.sh $REPO:${GITHUB_SHA} $REPO:latest

deploy:
if: github.ref == 'refs/heads/development'
runs-on: ubuntu-latest
needs: release
steps:
- uses: actions/checkout@v2
- run: .github/scripts/kubectl-config.sh ${{secrets.KUBE_CA}} ${{secrets.KUBE_SERVER}} ${{secrets.KUBE_TOKEN}}
- run: .github/scripts/kubectl-set-image.sh court-backend-rinkeby $REPO:${GITHUB_SHA}
- run: .github/scripts/kubectl-set-image.sh court-backend-staging $REPO:${GITHUB_SHA}
- run: .github/scripts/kubectl-set-image.sh court-backend-ropsten $REPO:${GITHUB_SHA}
- run: .github/scripts/kubectl-wait-ready.sh court-backend-rinkeby
- run: .github/scripts/kubectl-wait-ready.sh court-backend-staging
- run: .github/scripts/kubectl-wait-ready.sh court-backend-ropsten
# wait 10 sec for k8s to reroute ingress and check app endpoint
- run: sleep 10 && curl --fail https://court-backend-app-rinkeby.eth.aragon.network
- run: curl --fail https://court-backend-app-staging.eth.aragon.network
- run: curl --fail https://court-backend-app-ropsten.eth.aragon.network
- run: docker login ghcr.io -u $GITHUB_ACTOR -p ${{secrets.GITHUB_TOKEN}}
- run: .github/scripts/docker-release.sh $REPO:${GITHUB_SHA} $REPO:latest
13 changes: 10 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
"author": "Aragon One",
"license": "GPL-3.0-or-later",
"private": true,
"workspaces": [
"packages/*"
],
"devDependencies": {
"lerna": "^3.14.1"
},
Expand All @@ -17,5 +14,15 @@
"start:services:dev": "lerna run --scope=@aragonone/court-backend-services --concurrency=1 --stream start:dev",
"test:server": "lerna run --scope=@aragonone/court-backend-server --concurrency=1 --stream test",
"test:services": "lerna run --scope=@aragonone/court-backend-services --concurrency=1 --stream test"
},
"workspaces": {
"packages": [
"packages/*"
],
"nohoist": [
"@aragon/minime",
"@aragon/court",
"@aragonone/precedence-campaign-arbitrable"
]
}
}
8 changes: 4 additions & 4 deletions packages/app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ This is a React app that aims to serve a UI to read data from an Aragon Court in

You can find the following deployed instances

1. [Mainnet](https://court-backend-app.eth.aragon.network/)
1. [Rinkeby](https://court-backend-app-rinkeby.eth.aragon.network/)
1. [Staging](https://court-backend-app-staging.eth.aragon.network/)
1. [Ropsten](https://court-backend-app-ropsten.eth.aragon.network/)
1. [Mainnet](https://court-app.backend.aragon.org/)
1. [Rinkeby](https://court-app-rinkeby.backend.aragon.org/)
1. [Staging](https://court-app-staging.backend.aragon.org/)
1. [Ropsten](https://court-app-ropsten.backend.aragon.org/)

### Setup

Expand Down
4 changes: 0 additions & 4 deletions packages/app/src/actions/court.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,8 @@ const CourtActions = {
subscriptions {
id
currentPeriod
feeAmount
feeToken
periodDuration
prePaymentPeriods
resumePrePaidPeriods
latePaymentPenaltyPct
governorSharePct
}
modules {
Expand Down
93 changes: 7 additions & 86 deletions packages/app/src/actions/subscriptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ const SubscriptionsActions = {
subscriptionPeriod (id: "${id}") {
id
feeToken
feeAmount
collectedFees
balanceCheckpoint
totalActiveBalance
accumulatedGovernorFees
jurorClaims {
id
juror { id }
Expand All @@ -23,19 +25,6 @@ const SubscriptionsActions = {

const { subscriptionPeriod: period } = result
dispatch(SubscriptionsActions.receivePeriod(period))

const courtAddress = await CourtActions.findCourt()
if (await Network.isCourtAt(courtAddress)) {
const court = await Network.getCourt(courtAddress)
const { balanceCheckpoint, totalActiveBalance } = await court.getPeriod(id)
period.balanceCheckpoint = balanceCheckpoint
period.totalActiveBalance = totalActiveBalance
} else {
period.balanceCheckpoint = 'cannot be fetched'
period.totalActiveBalance = 'cannot be fetched'
}

dispatch(SubscriptionsActions.receivePeriod(period))
} catch(error) {
dispatch(ErrorActions.show(error))
}
Expand All @@ -49,97 +38,29 @@ const SubscriptionsActions = {
subscriptionPeriods (orderBy: createdAt, orderDirection: desc) {
id
feeToken
feeAmount
collectedFees
balanceCheckpoint
totalActiveBalance
accumulatedGovernorFees
createdAt
}
}`)

const { subscriptionPeriods: periods } = result
dispatch(SubscriptionsActions.receiveAllPeriods(periods))

const courtAddress = await CourtActions.findCourt()
if (await Network.isCourtAt(courtAddress)) {
const court = await Network.getCourt(courtAddress)
for (const period of periods) {
const { balanceCheckpoint, totalActiveBalance } = await court.getPeriod(period.id)
period.balanceCheckpoint = balanceCheckpoint
period.totalActiveBalance = totalActiveBalance
dispatch(SubscriptionsActions.receiveAllPeriods(periods))
}
} else {
for (const period of periods) {
period.balanceCheckpoint = 'cannot be fetched'
period.totalActiveBalance = 'cannot be fetched'
}
dispatch(SubscriptionsActions.receiveAllPeriods(periods))
}
} catch(error) {
dispatch(ErrorActions.show(error))
}
}
},

findAllSubscribers() {
return async function(dispatch) {
try {
const result = await Network.query(`{
subscribers {
id
subscribed
paused
lastPaymentPeriodId
previousDelayedPeriods
}
}`)
dispatch(SubscriptionsActions.receiveAllSubscribers(result.subscribers))
} catch(error) {
dispatch(ErrorActions.show(error))
}
}
},

findModule() {
return async function(dispatch) {
try {
const result = await Network.query(`{
subscriptionModules (first: 1) {
id
currentPeriod
feeAmount
feeToken
periodDuration
prePaymentPeriods
resumePrePaidPeriods
latePaymentPenaltyPct
governorSharePct
totalPaid
totalDonated
totalCollected
totalGovernorShares
}
}`)
dispatch(SubscriptionsActions.receiveModule(result.subscriptionModules[0]))
} catch(error) {
dispatch(ErrorActions.show(error))
}
}
},

receiveAllSubscribers(list) {
return { type: ActionTypes.RECEIVE_SUBSCRIBERS, list }
},

receiveAllPeriods(list) {
return { type: ActionTypes.RECEIVE_SUBSCRIPTION_PERIODS, list }
},

receivePeriod(period) {
return { type: ActionTypes.RECEIVE_SUBSCRIPTION_PERIOD, period }
},

receiveModule(module) {
return { type: ActionTypes.RECEIVE_SUBSCRIPTION_MODULE, module }
},
}

export default SubscriptionsActions
3 changes: 0 additions & 3 deletions packages/app/src/actions/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,12 @@ export const RECEIVE_DRAFTS_LIST = 'RECEIVE_DRAFTS_LIST'
export const RECEIVE_TRANSFERS = 'RECEIVE_TRANSFERS'
export const RECEIVE_BALANCES = 'RECEIVE_BALANCES'

export const RECEIVE_SUBSCRIBERS = 'RECEIVE_SUBSCRIBERS'
export const RECEIVE_SUBSCRIPTION_MODULE = 'RECEIVE_SUBSCRIPTION_MODULE'
export const RECEIVE_SUBSCRIPTION_PERIOD = 'RECEIVE_SUBSCRIPTION_PERIOD'
export const RECEIVE_SUBSCRIPTION_PERIODS = 'RECEIVE_SUBSCRIPTION_PERIODS'

export const RECEIVE_ADMIN = 'RECEIVE_ADMIN'
export const RESET_ADMIN = 'RESET_ADMIN'
export const RECEIVE_ADMIN_TOKEN = 'RECEIVE_ADMIN_TOKEN'
export const RESET_ADMIN_TOKEN = 'RESET_ADMIN_TOKEN'
export const RECEIVE_ADMIN_ADMINS = 'RECEIVE_ADMIN_ADMINS'
export const RECEIVE_ADMIN_REVEALS = 'RECEIVE_ADMIN_REVEALS'
export const RECEIVE_ADMIN_USERS = 'RECEIVE_ADMIN_USERS'
Expand Down
2 changes: 0 additions & 2 deletions packages/app/src/components/core/App.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import RevealsList from '../admin/RevealsList.react'
import EmailsForm from '../admin/EmailsForm.react'
import PeriodsList from '../subscriptions/PeriodsList.react'
import PeriodDetail from '../subscriptions/PeriodDetail.react'
import SubscribersList from '../subscriptions/SubscribersList.react'
import JurorsList from '../jurors/JurorsList.react'
import JurorDetail from '../jurors/JurorDetail.react'
import JurorDraftsList from '../jurors/JurorDraftsList.react'
Expand Down Expand Up @@ -55,7 +54,6 @@ class App extends React.Component {
<Route path="/jurors/:address/staking" component={JurorStakingList}/>
<Route path="/jurors/:address/accounting" component={JurorAccountingList}/>
<Route path="/drafts/" component={DraftsList}/>
<Route path="/subscribers/" component={SubscribersList}/>
<Route path="/periods/" component={PeriodsList}/>
<Route path="/period/:id" component={PeriodDetail}/>
<Route path="/anj-balances/" exact component={ANJBalancesList}/>
Expand Down
1 change: 0 additions & 1 deletion packages/app/src/components/core/Navbar.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export default class Navbar extends React.Component {
<Link to="/disputes">Disputes</Link>
<Link to="/jurors">Jurors</Link>
<Link to="/drafts">Drafts</Link>
<Link to="/subscribers">Subscribers</Link>
<Link to="/periods">Periods</Link>
<Link to="/anj-balances">ANJ</Link>
{ admin.id && this._buildLoggedInItems() }
Expand Down
4 changes: 0 additions & 4 deletions packages/app/src/components/court/CourtConfig.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,7 @@ export default class CourtConfig extends React.Component {
<h3>Subscriptions</h3>
<p>Current period: {subscriptions.currentPeriod}</p>
<p>Period duration: {subscriptions.periodDuration} court terms</p>
<p>Fee amount: {fromWei(subscriptions.feeAmount.toString())}</p>
<p>Fee token: {subscriptions.feeToken}</p>
<p>Pre payment periods: {subscriptions.prePaymentPeriods}</p>
<p>Resume pre paid periods: {subscriptions.resumePrePaidPeriods}</p>
<p>Late payment penalty pct: % {subscriptions.latePaymentPenaltyPct}</p>
<p>Governor share pct: % {subscriptions.governorSharePct}</p>

<h3>Modules</h3>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ export default class PeriodDetail extends React.Component {
{ !period.id ? 'Loading...' :
<div>
<p>Fee token: {period.feeToken}</p>
<p>Fee amount: {fromWei(period.feeAmount)}</p>
<p>Balance checkpoint: {period.balanceCheckpoint ? period.balanceCheckpoint : 'loading...'}</p>
<p>Total active balance: {period.totalActiveBalance ? fromWei(period.totalActiveBalance) : 'loading...'}</p>
<p>Balance checkpoint: {period.balanceCheckpoint}</p>
<p>Total active balance: {period.totalActiveBalance}</p>
<p>Collected fees: {fromWei(period.collectedFees)}</p>
<p>Claims: {this.state.period.jurorClaims.length === 0 && 'None'}</p>
<ul>{this._buildClaimsList()}</ul>
Expand Down
Loading

0 comments on commit b8f57c3

Please sign in to comment.