Skip to content
This repository has been archived by the owner on Apr 26, 2019. It is now read-only.

Commit

Permalink
Merge pull request #381 from status-im/develop
Browse files Browse the repository at this point in the history
Deploy Week 13 2018
  • Loading branch information
martinklepsch authored Mar 28, 2018
2 parents 0b0fb50 + dd700ab commit b76ad70
Show file tree
Hide file tree
Showing 68 changed files with 2,933 additions and 847 deletions.
48 changes: 48 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Clojure CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-clojure/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/clojure:lein-2.8.1-browsers

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/postgres:9.4
- image: circleci/postgres:9.6
environment:
- POSTGRES_USER=commiteth
- POSTGRES_DB=commiteth

working_directory: ~/repo

environment:
LEIN_ROOT: "true"
# Customize the JVM maximum heap limit
JVM_OPTS: -Xmx3200m

steps:
- checkout

# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "project.clj" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- run: lein deps

- save_cache:
paths:
- ~/.m2
key: v1-dependencies-{{ checksum "project.clj" }}

- run: echo $ETH_WALLET_JSON > $ETH_WALLET_FILE

# run tests!
- run: lein test
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ node_modules
/config-prod.edn
/config-dev.edn
/config-test.edn
/src/java
28 changes: 28 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
This document describes process guidelines to be followed when contributing to Status Open Bounty repo.

First, make sure to familiarize yourself with the [README](https://github.com/status-im/open-bounty/blob/develop/README.md) and [Testing](https://github.com/status-im/open-bounty/blob/develop/doc/testing.md) documents in order to setup the project properly.

# Issues
- Issues should have type, priority and size (difficulty) assigned via corresponding labels
- Issue descriptions should include the following fields:
- **Summary**
- **Type**
- (*Features or enhancements only*) **User story**
- (*Bugs only*) **Expected behavior**
- (*Bugs only*) **Actual behavior**
- **Additional information**

# Pull requests
- Branch names should include:
- prefixes indicating issue type (`bug`, `feature`, `doc`, `test`)
- short description in lisp-case
- and include associated issue number

For instance, `bug/messy-problem-#1234`
- Start the title of the PR with [FIX #NNN], where #NNN is the issue number
- Always include `Status:` in the PR description to indicate whether PR is `WIP` or `Finished`.
- PR description should include the following sections:
- **Summary**
- **Notes**
- **Status**
- Merges into `develop` branch should be approved by at least 1 person, into `master` - by 2.
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ RUN lein uberjar
FROM clojure
WORKDIR /root/

RUN apt-get update
RUN apt-get -y install xvfb
RUN apt-get -y install wkhtmltopdf

COPY --from=builder /usr/src/app/target/uberjar/commiteth.jar .
COPY html2png.sh .

CMD [""]
ENTRYPOINT ["/usr/bin/java", "-Duser.timezone=UTC", "-Dconf=config-test.edn", "-jar", "/root/commiteth.jar"]
Expand Down
8 changes: 6 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,15 @@ def dockerreponame = "statusim/openbounty-app"
}

stage('Deploy') {
build job: 'status-openbounty/openbounty-cluster', parameters: [[$class: 'StringParameterValue', name: 'DEPLOY_ENVIRONMENT', value: "dev"], [$class: 'StringParameterValue', name: 'BRANCH', value: env.BRANCH_NAME]]
if ( currentBuild.rawBuild.getCauses()[0].toString().contains('UserIdCause') ){
build job: 'status-openbounty/openbounty-cluster', parameters: [[$class: 'StringParameterValue', name: 'DEPLOY_ENVIRONMENT', value: "dev"], [$class: 'StringParameterValue', name: 'BRANCH', value: env.BRANCH_NAME]]
} else {
echo "No deployment on automatic trigger, go to Jenkins and push build button to deliver it."
}
}

} catch (e) {
// slackSend color: 'bad', message: REPO + ":" + BRANCH_NAME + ' failed to build. ' + env.BUILD_URL
throw e
}
}
}
101 changes: 67 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Status Open Bounty
[![Riot Chat Badge](https://img.shields.io/badge/join%20%23openbounty-riot-green.svg)](https://chat.status.im/#/room/#openbounty:status.im)

Allows you to set bounties for Github issues, paid out in Ether or any ERC-20 token.

Expand All @@ -13,6 +14,16 @@ Live testnet (Ropsten) version:
https://openbounty.status.im:444
The `develop` branch is automatically deployed here.

## Table of contents
- [Prerequisites](#prerequisites)
- [Application config](#application-config)
- [GitHub integration](#github-integration)
- [Contracts](#contracts)
- [Running](#running)
- [Testing](#testing)
- [More info](#more-info)



## Prerequisites

Expand All @@ -23,36 +34,10 @@ You will need [Leiningen](https://github.com/technomancy/leiningen) 2.0 or above
Make sure you install [PostgreSQL](https://www.postgresql.org/) and properly set it up:

```
sudo -u postgres psql -c "CREATE USER commiteth WITH PASSWORD 'commiteth';"
sudo -u postgres createdb commiteth
```

## Running

Launch following commands each in its own shell:

```
lein run
lein figwheel
lein less auto
psql postgres -c "CREATE USER commiteth WITH PASSWORD 'commiteth';"
psql postgres -c "CREATE DATABASE commiteth;"
```


Make sure you install [PostgreSQL](https://www.postgresql.org/) and properly set it up:

```
sudo -u postgres psql -c "CREATE USER commiteth WITH PASSWORD 'commiteth';"
sudo -u postgres createdb commiteth
```

### solc

Solidity compiler [0.4.15](https://github.com/ethereum/solidity/releases/tag/v0.4.15) is required and needs to be in $PATH.

### web3j

Web3j [2.3.0](https://github.com/web3j/web3j/releases/tag/v2.3.0) is required and the command line tools need to be in $PATH.

## Application config

Make sure to create `/config-dev.edn` and populate it correctly, which is based on `env/dev/resources/config.edn`. Description of config fields is given below:
Expand All @@ -68,6 +53,7 @@ eth-account | Ethereum account ID for the bot
eth-password | Ethereum account password for the bot
eth-rpc-url | RPC URL to Ethereum node, e.g. Geth. Either local or remote
eth-wallet-file | Location of wallet file. If Geth is run with the parameters as given below, it will reside under `$HOME/.ropsten/keystore`
offline-signing | Specifies whether to sign transactions locally before sending. Default is true. Set to false when connecting to local Geth node that unlocks accounts
tokenreg-base-format | Should be set to `:status`
github-client-id | Related to OAuth. Copied from GitHub account Settings->Developer settings->OAuth Apps
github-client-secret | Related to OAuth. Copied from GitHub account Settings->Developer settings->OAuth Apps
Expand All @@ -86,22 +72,52 @@ Follow the steps [here](https://developer.github.com/apps/building-oauth-apps/cr
### GitHub App
Follow the steps [here](https://developer.github.com/apps/building-github-apps/creating-a-github-app/). Be sure to specify `:server-address` + `/webhook-app` as "Webhook URL", and `:webhook-secret` as "Webhook Secret".

## Contracts

All information related to development of OpenBounty smart contracts can be found in [`contracts/`](/contracts/)

## Running

Lauch a local geth node with the bot account unlocked:
### Ethereum node
There are two options for connecting to an Ethereum node: either run a local node with an unlocked account, or connect to a remote Geth node or Infura. We will be connecting to Ropsten which is a test Ethereum network.

#### Local

In order to launch a local geth node with the bot account unlocked issue the following command:

```
#!/bin/bash
geth --fast --testnet --cache=1024 --datadir=$HOME/.ropsten --verbosity 4 --port 50100 --ipcpath ~/.ropsten/geth.ipc --rpc --rpcaddr 127.0.0.1 --rpcport 8545 --rpcapi db,eth,net,web3,personal --rpccorsdomain "https://wallet.ethereum.org" --unlock "0xYOUR_ADDR" --password <(echo "YOUR_PASSPHRASE")
```

#### Remote
Register at [Infura](https://infura.io/signup). You will receive an email with provider URLs. Paste an URL for the Ropsten network into `config.edn` under `:eth-rpc-url` key, and set `:offline-signing` to true.


### CSS auto-compilation
Launch the following command in a separate shell:

```
lein less auto
```

Next you want to start a REPL on the backend and the frontend.
### Solidity compilation
Invoke `build-contracts` Leiningen task to compile Solidity files into Java classes:
```
lein build-contracts
```

### Clojure app without REPL
Launch following commands each in its own shell:

```
lein run
lein figwheel
```

### Clojure app with REPL

You'll have to start a REPL on the backend and the frontend.

```
lein repl
Expand Down Expand Up @@ -131,7 +147,10 @@ To create a standalone uberjar:
lein uberjar
```

This creates `target/uberjar/commiteth-<git-sha>.jar`
This creates `target/uberjar/commiteth.jar`. You can run it with the following command from within project root:
```
java -Dconf=<path_to_config.edn> -jar target/uberjar/commiteth.jar
```


## Testing
Expand Down Expand Up @@ -160,7 +179,21 @@ lein with-profile test figwheel devcards

Open http://localhost:3449/cards.html

### Update landing page
### CircleCI

We use CircleCI to run unit tests. The following env vars need to be set for this to work:

> These env vars override configuration parameters that are usually set using the `config.edn` file.
- `ETH_ACCOUNT` - as in `config.edn`
- `ETH_PASSWORD` - as in `config.edn`
- `ETH_RPC_URL` - as in `config.edn`
- `ETH_WALLET_FILE` - as in `config.edn`
- `ETH_WALLET_JSON` - contents of this will be written to `ETH_WALLET_FILE`

:bulb: Ideally we'd create those parameters in a script. PR welcome.

## Update landing page

Landing page is static and different CSS and JS due to time constraints.

Expand All @@ -170,8 +203,8 @@ Landing page is static and different CSS and JS due to time constraints.
This copies over necessary artifacts to `resources` dir.


### Troubleshooting
See the [Cookbook](doc/cookbook.md).
## More info
Detailed information on code structure, troubleshooting, etc. can be found [here](doc/README.md).

## License

Expand Down
31 changes: 31 additions & 0 deletions contracts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# OpenBounty Contracts

This directory contains all the underlying smart contracts used by the OpenBounty platform.

- A script `contracts/build.sh` is part of this repository and can be used to
compile the contracts and copy Java interfaces into `src/java/`.

In order to run the script the following dependencies have to be met:

- [solc](#solc)
- [web3j](#web3j)

### solc

Solidity compiler [0.4.15](https://github.com/ethereum/solidity/releases/tag/v0.4.15) is required and needs to be in $PATH.
Detailed [installation instructions for various platforms](https://solidity.readthedocs.io/en/develop/installing-solidity.html) can be found in the official Solidity documentation.

```
brew install https://raw.githubusercontent.com/ethereum/homebrew-ethereum/de1da16f7972a899fc8dd1f3f04299eced6f4312/solidity.rb
brew pin solidity
```

### web3j

Web3j [2.3.0](https://github.com/web3j/web3j/releases/tag/v2.3.0) is required and the command line tools need to be in $PATH.
Installation instructions for the command line tools can be found in the [Web3j Command Line Tools documentation](https://docs.web3j.io/command_line.html).

```
brew install https://raw.githubusercontent.com/web3j/homebrew-web3j/881cf369b551a5f2557bd8fb02fa8b7b970256ca/web3j.rb
brew pin web3j
```
File renamed without changes.
9 changes: 9 additions & 0 deletions doc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Table of contents

- [Testing guide](testing.md)
- [Troubleshooting](cookbook.md)
- [Deployment flow](deployment_flow.md)
- [Development workflow](development_workflow.md)
- [Deployment flow](deployment_flow.md)
- [Payout flow](payout_flow.md)
- [Common sync issues](sync_issues.md)
31 changes: 31 additions & 0 deletions doc/core_testing_workflow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Testing pull requests in Open Bounty

All new functionality and features both are being delivered by pull requests (hereinafter PRs).
How to test PR? Steps below could help a bit!

### Prerequisites
Requirements for PRs to be tested:
* should be in `To test` column in `Pipeline For Pull Requests` project
* should be updated to last develop. If button `Update` is avaivable on particular PR, click it and wait until it will be built.
* shouldn't have conflicts with `develop` branch
* should have a successful build in Jenkins [status-openbounty-app](https://jenkins.status.im/job/status-openbounty/job/status-openbounty-app/view/change-requests/)


### Deployment
In order to deploy feature to [testing env](https://testing.openbounty.status.im/) you should **rebuild** PR you are about to test (all open PRs are in [Jenkins](https://jenkins.status.im/job/status-openbounty/job/status-openbounty-app/view/change-requests/)).

When PR is successfully build and deployed, [testing env](https://testing.openbounty.status.im/) with deployed PR is accessible in 2-3 mins.

Only one at one time PR can be deployed on [testing env](https://testing.openbounty.status.im/)

Fresh develop branch with last changes is deployed automatically on [staging env](https://openbounty.status.im:444)

### Testing
1) Move appropriate PR card to IN TESTING on the [Board](https://github.com/status-im/open-bounty/projects/3) and let people know you are on it - assign it to yourself! :)
2) Сheck the functionality current PR fixes / delivers (positive/negative tests related to the feature). In curtain cases it's worth to look in 'Files changed' tab in GitHub to check the list of what was changed to get understanding of the test coverage or "weak" places that have to be covered. Ask PR-author in #openbounty channel in slack what was changed if it's not clear from the notes in PR.
3) Check reasonable regression using [SOB-general test suite](https://ethstatus.testrail.net/index.php?/suites/view/27&group_by=cases:section_id&group_order=asc)
4) No issues? Perfect! Put appropriate label to the PR (`Tested - OK`), merge it to develop (using `Rebase-Merge`) and move the PR instance to `Merged to develop`.
5) Found issues? Check for duplicates before adding one. Hint: make sure the issue is really introduced by current PR - check latest `develop` branch on [staging env](https://openbounty.status.im:444) . Issue exists in develop? Check existing issues list and make sure you are not adding duplicates before creating your own bug :)
**All PR-specific issues should be added as comments to tested PR.**
Once all issues are logged put label `Tested-issues` to the PR and notify developer that there are several problems that are preventing the PR to merge. Move the PR to `Reviewing, waiting for contributor` on the board if PR is developed by external contributor, and to `Developing` - if it is presented by core contributor.

Loading

0 comments on commit b76ad70

Please sign in to comment.