diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..f10a6b0
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,3 @@
+docker-compose.yml
+Dockerfile
+Jenkinsfile
diff --git a/.gitignore b/.gitignore
index 0e3eb68..39c20db 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,4 +23,7 @@ profiles.clj
.idea
resources/contracts
node_modules
-.DS_Store
+/config-prod.edn
+/config-dev.edn
+/config-test.edn
+/src/java
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..ce2947a
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,30 @@
+FROM clojure as builder
+
+WORKDIR /tmp
+
+RUN wget -O /usr/local/bin/solc https://github.com/ethereum/solidity/releases/download/v0.4.15/solc-static-linux
+RUN chmod +x /usr/local/bin/solc
+
+RUN wget https://github.com/web3j/web3j/releases/download/v2.3.0/web3j-2.3.0.tar
+RUN tar -xf web3j-2.3.0.tar
+RUN cp -r web3j-2.3.0/* /usr/local/
+
+
+COPY . /usr/src/app
+WORKDIR /usr/src/app
+
+ENV LEIN_SNAPSHOTS_IN_RELEASE=1
+
+
+RUN lein less once
+RUN lein uberjar
+
+
+FROM clojure
+WORKDIR /root/
+
+COPY --from=builder /usr/src/app/target/uberjar/commiteth.jar .
+
+CMD [""]
+ENTRYPOINT ["/usr/bin/java", "-Duser.timezone=UTC", "-Dconf=config-test.edn", "-jar", "/root/commiteth.jar"]
+
diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644
index 0000000..ec6b860
--- /dev/null
+++ b/Jenkinsfile
@@ -0,0 +1,35 @@
+#!/usr/bin/env groovy
+
+node('linux') {
+checkout scm
+
+def dockerreponame = "statusim/openbounty-app"
+
+ try {
+ stage('Build & push') {
+
+ GIT_COMMIT_HASH = sh (script: "git rev-parse --short HEAD | tr -d '\n'", returnStdout: true)
+
+ docker.withRegistry('https://index.docker.io/v1/', 'dockerhub-statusvan') {
+ def openbountyApp = docker.build("${dockerreponame}:${env.BUILD_NUMBER}")
+ openbountyApp.push("${env.BRANCH_NAME}")
+ if (env.BRANCH_NAME == 'develop') {
+ openbountyApp.push("develop")
+ } else if (env.BRANCH_NAME == 'master') {
+ openbountyApp.push("master")
+ } else {
+ println "Not named branch have no custom tag"
+ }
+ }
+
+ }
+
+ stage('Deploy') {
+ build job: 'status-openbounty/openbounty-cluster', parameters: [[$class: 'StringParameterValue', name: 'DEPLOY_ENVIRONMENT', value: "dev"], [$class: 'StringParameterValue', name: 'BRANCH', value: env.BRANCH_NAME]]
+ }
+
+ } catch (e) {
+ // slackSend color: 'bad', message: REPO + ":" + BRANCH_NAME + ' failed to build. ' + env.BUILD_URL
+ throw e
+ }
+}
\ No newline at end of file
diff --git a/README.md b/README.md
index eedcafd..98216f5 100644
--- a/README.md
+++ b/README.md
@@ -1,15 +1,14 @@
-# Commiteth
+# Status Open Bounty
-Allows you to set bounties for Github issues, paid out in Ether.
+Allows you to set bounties for Github issues, paid out in Ether or any ERC-20 token.
More information:
-http://wiki.status.im/proposals/commiteth/
+https://wiki.status.im/Status_Open_Bounty
-Live beta version:
+Live production version:
https://openbounty.status.im
The `master` branch is automatically deployed here.
-
Live testnet (Ropsten) version:
https://openbounty.status.im:444
The `develop` branch is automatically deployed here.
@@ -17,10 +16,28 @@ The `develop` branch is automatically deployed here.
## Prerequisites
-You will need [Leiningen](https://github.com/technomancy/leiningen) 2.0 or above installed.
+You will need [Leiningen](https://github.com/technomancy/leiningen) 2.0 or above installed. Also, make sure that you have [wkhtmltoimage](https://wkhtmltopdf.org/downloads.html) available in your PATH. On macOS, it can be installed via `brew cask install wkhtmltopdf`.
### PostgreSQL
+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
+```
+
+
Make sure you install [PostgreSQL](https://www.postgresql.org/) and properly set it up:
```
@@ -36,9 +53,40 @@ Solidity compiler [0.4.15](https://github.com/ethereum/solidity/releases/tag/v0.
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.
-## Running
+## Application config
-Make sure `env/dev/resources/config.edn` is correctly populated.
+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:
+
+Key | Description
+--- | ---
+dev | Currently specifies whether Swagger UI endpoints should be added to routes
+port | HTTP port for the Ring web app
+nrepl-port | nREPL port for development
+jdbc-database-url | PostgreSQL database URL. For instance, URL to local db would be `jdbc:postgresql://localhost/commiteth?user=commiteth&password=commiteth`
+server-address | URL and port of local server that can be resolved from public internet. It will be used as a redirect URI during GitHub OAuth authorization process
+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`
+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
+github-user | GitHub username for bot account. It is used for posting bounty comments
+github-password | GitHub password for bot account
+webhook-secret | Secret string to be used when creating a GitHub App
+user-whitelist | Set of GitHub user/org IDs to be whitelisted. E.g. `#{"status-im" "your_org"}`
+testnet-token-data | Token data map, useful if there are Geth connectivity problems
+
+## GitHub integration
+Open Bounty uses both OAuth App and GitHub App integration.
+
+### OAuth App
+Follow the steps [here](https://developer.github.com/apps/building-oauth-apps/creating-an-oauth-app/). Specify the value of `:server-address` as "Homepage URL", and `:server-address` + `/callback` as "Authorization callback URL". Be sure to copy Client ID and Client Secret values in the config file.
+
+### 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".
+
+## Running
Lauch a local geth node with the bot account unlocked:
@@ -121,6 +169,10 @@ 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).
+
## License
Licensed under the [Affero General Public License v3.0](https://github.com/status-im/commiteth/blob/master/LICENSE.md)
diff --git a/doc/cookbook.md b/doc/cookbook.md
new file mode 100644
index 0000000..e76ad48
--- /dev/null
+++ b/doc/cookbook.md
@@ -0,0 +1,18 @@
+# Cookbook
+
+Here some common tasks/issues are listed along with their solutions.
+
+## Change config and restart the service
+ - ssh to the host running commiteth
+ - go to `/opt/commiteth` for prod or `/opt/commiteth-test` for test environment.
+ - there edit `config.edn`
+ - restart the service with `sudo service commiteth-test restart`
+
+## Manually add a GitHub repo to SOB app
+Sometimes SOB will not
+ - connect to Postgres instance. Get DB name and username/password from respective `config.edn` (see previous answer). These are set in `:jdbc-database-url` field.
+ - execute the query, e.g.
+```
+insert into repositories(repo_id,user_id,owner,repo,hook_id,state,hook_secret,owner_avatar_url) values(116971984,447328, 'aragon', 'aragon-monthly', 0, 2, '', 'https://avatars1.githubusercontent.com/u/24612534?v=4');
+```
+Note that the value for repo_id field is GitHub's internal repo ID. One way of obtaining it is navigating to `api.github.com/repos/:owner/:repo_name`, e.g. `https://api.github.com/repos/aragon/aragon-monthly`.
diff --git a/doc/testing.md b/doc/testing.md
index a3e59d0..f9dc7a1 100644
--- a/doc/testing.md
+++ b/doc/testing.md
@@ -10,7 +10,7 @@ For testing you will need:
* a Github account with administrative access to one or more repositories
* for approving bounty payouts you will additionally need access to an Ethereum wallet. So far, Mist and [MetaMask](https://metamask.io/) have been used, but anything that provides the web3 javascript interface should work.
-The developers can be reached on the `#commiteth` channel in the [Status slack](http://slack.status.im/).
+The developers can be reached on the `#openbounty` channel in the [Status slack](http://slack.status.im/).
### Signing up
@@ -29,13 +29,9 @@ You should now see `Bounties`, `Activity`, `Repositories` and `Manage Payouts` t
### Creating bounty issues
-Before you can create bounties, you need to have administrative access to one or more GitHub repositories. These can be either in the scope of your personal user account or in the scope of a Github orgnazation.
+Before you can create bounties, you need to add Open Bounty GitHub App to your account or repos. Go to https://github.com/apps/status-open-bounty-app-test (or link to another GitHub App you've created for testing, as described in the [README](README.md) and click Install. Specify whether access to all org repos or specific repos is granted. This will install webhooks for SOB in your repos.
-* click the `Repositories` tab
-* click on the button `Enable Github Account`
-* If you have 1 or more Organisation repositories then grant Organisation access to each of them by clicking on the button `Grant`
-* grant Status Open Bounty the needed addtional permissions for managing repository webhooks, adding and modifying comments by clicking on the button `Authorize status-open-bounty`
-* now you should see your repositories on the `Repositories` tab, click `Add` on one. If your account isn't whitelisted you will see instructions how to request an access. If your account is whitelisted then new `bounty` label will become available in the GitHub repository's labels and a new webhook should now exist for the repository.
+* Request for your account to be whitelisted. Contact [Riot](https://chat.status.im) for more information
* now, add the `bounty` label to a new or an existing issue. This should cause Status Open Bounty to post a new comment for the issue containing an image with text `Deploying contract, please wait`
* once the contract has been mined, the comment will be updated to contain the bounty contract's address and a QR code
@@ -60,6 +56,14 @@ To remove issue from the Bounties list you can close it in GitHub.
### Reporting bugs
-All bugs should be reported as issues in the [CommitETH Github repository](https://github.com/status-im/commiteth/issues).
+All bugs should be reported as issues in the [OpenBounty Github repository](https://github.com/status-im/open-bounty/issues).
Please first check that there is not already a duplicate issue. Issues should contain exact and minimal step-by-step instructions for reproducing the problem.
+
+### Status Open Bounty end-to-end tests
+
+Framework for testing located in: `open-bounty/test/end-to-end`
+
+Full installation and configuring manual: [Status Open Bounty end-to-end tests](https://wiki.status.im/Status_Open_Bounty_end-to-end_tests)
+
+Currently supports local and Jenkins environment running (you can find example of JenkinsFile in `open-bounty/test` )
diff --git a/env/dev/clj/user.clj b/env/dev/clj/user.clj
index e45e943..b318a86 100644
--- a/env/dev/clj/user.clj
+++ b/env/dev/clj/user.clj
@@ -1,13 +1,14 @@
(ns user
(:require [mount.core :as mount]
- [commiteth.figwheel :refer [start-fw stop-fw cljs]]
- commiteth.core))
+ [commiteth.figwheel :refer [start-fw stop-fw cljs]]))
(defn start []
- (mount/start-without #'commiteth.core/repl-server))
+ (require 'commiteth.core)
+ (mount/start-without (ns-resolve 'commiteth.core 'repl-server)))
(defn stop []
- (mount/stop-except #'commiteth.core/repl-server))
+ (require 'commiteth.core)
+ (mount/stop-except (ns-resolve 'commiteth.core 'repl-server)))
(defn restart []
(stop)
diff --git a/env/dev/resources/config.edn b/env/dev/resources/config.edn
index 1ee9264..571a6ae 100644
--- a/env/dev/resources/config.edn
+++ b/env/dev/resources/config.edn
@@ -11,16 +11,18 @@
:eth-password "XXX"
;; RPC URL to ethereum node to be used
- :eth-rpc-url "http://localhost:8547"
+ :eth-rpc-url "http://localhost:8545"
:eth-wallet-file "/some/location"
;; address of token registry to be used
- :tokenreg-addr "0x..."
+ ;; this is the default value for ropsten
+ :tokenreg-addr "0x7d127a3e3b5e72cd8f15e7dee650abe4fcced2b9"
;; format of tokenreg records' base field, possible values :status, :parity
- :tokenreg-base-format :parity
+ :tokenreg-base-format :status
;; address of factory contract used for deploying bounty contracts
- :contract-factory-addr "0x..."
+ ;; this is the default value for ropsten
+ :contract-factory-addr "0x3B9A3c062Bdb640b5039C0cCda4157737d732F95"
;; commiteth-test-tpatja
:github-client-id "CLIENT ID"
@@ -43,5 +45,7 @@
;; needeed when :hubspot-contact-create-enabled
:hubspot-api-key "xxxxxxx-xxxx-x-xxxx-xxxx"
+ :user-whitelist #{}
+
;; used for blacklisting tokens from token registry data
:token-blacklist #{}}
diff --git a/env/dev/resources/logback.xml b/env/dev/resources/logback.xml
index f569fce..a4f8cc5 100644
--- a/env/dev/resources/logback.xml
+++ b/env/dev/resources/logback.xml
@@ -33,7 +33,11 @@