Skip to content
This repository has been archived by the owner on Dec 31, 2024. It is now read-only.

Commit

Permalink
Merge pull request #546 from Giveth/develop
Browse files Browse the repository at this point in the history
Release 2021 Jul 4
  • Loading branch information
aminlatifi authored Jul 12, 2021
2 parents 2e511d7 + 566157d commit 2bd3a9e
Show file tree
Hide file tree
Showing 45 changed files with 1,277 additions and 107 deletions.
34 changes: 28 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Welcome to the server code for Giveth's [dapp](https://github.com/Giveth/giveth-
```
cd feathers-giveth
```
5. Make sure you have [NodeJS](https://nodejs.org/) (v8.4.0 or higher), [yarn](https://www.yarnpkg.com/) (v0.27.5 or higher), and npm (5.4.1 or higher) installed.
5. Make sure you have [NodeJS](https://nodejs.org/) (v10.24.0 or higher), [yarn](https://www.yarnpkg.com/) (v0.27.5 or higher), and npm (5.4.1 or higher) installed.
6. Install dependencies from within feathers-giveth directory:
```
npm install
Expand Down Expand Up @@ -83,7 +83,10 @@ The configuration param `blockchain.nodeUrl` is used to establish a connection.
```
ipfs daemon
```
5. Run db migration files ( if this the first time you want to start application, it's not needed to run migrations)
```
./node_modules/.bin/migrate-mongo up
```
5. Start your app
```
Expand Down Expand Up @@ -120,9 +123,11 @@ The `feathers-giveth/scripts` directory contains a few scripts to help developme
* `confirm.js` - confirms any payments that are pending in the vault
* `makeUserAdmin.js` - make a user admin
## Testing
Simply run `yarn test` and all your tests in the `test/` directory will be run.
Simply run `yarn test` and all your tests in the `/src` directory will be run.
It's included some integration tests so for running tests, you need to run a mongodb in your local system (on port 27017)
## Debugging
Expand All @@ -136,15 +141,21 @@ Each of these services are available via rest or websockets:
```
campaigns
dacs
communities
donations
donationsHistory
milestones
traces
uploads
users
emails
homePaymentsTransactions
subscriptions
```
If the server is using default configurations, you can see data for any of these services through your web browser at `http://localhost:3030/SERVICE_NAME`
PS: For accessing all features like creating `communities` and `campaigns` it's suggested to
make `isAdmin` field true, for your user in you local MongoDb
## Production
Expand Down Expand Up @@ -172,7 +183,7 @@ module.exports = {
],
};
```
PS: It's good to see [Github Actions config](./.github/workflows/CI-CD.yml) to better understanding of deploy structure
## RSK
1. You will need to download the [rsk node](https://github.com/rsksmart/rskj/wiki/Install-RskJ-and-join-the-RSK-Orchid-Mainnet-Beta). After installing, you will run the node w/ the `regtest` network for local development.
Expand Down Expand Up @@ -203,6 +214,17 @@ module.exports = {
yarn start:rsk
```
## Audit Log
The Audit log system logs every Create, Update, Patch and
Remove on **Campaigns**, **Traces**, **Events**, **Users**,
**PledgeAdmins**, **Communities**, **Donations**
For enabling audit log locally you should change `enableAuditLog`
in config to `true`, then
* cd elk
* docker-compose up
And then after logging in `localhost:5601` with user:`elastic`, password: `changeme`
you can see the logs
## Help
Expand Down
9 changes: 8 additions & 1 deletion config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,5 +171,12 @@
"dappMailerSecret": "xxMv8a13I3YOZSKq9XmX285N0o4m1qHyKjgQWb2g83daGtPI4VmEw7dImu8kvO2ovG4EMC1bvjO906o365BaJBZtArpnxJCoYsCJ",
"minimumPayoutUsdValue": 2,
"givethAccounts": [],
"enablePayoutEmail": true
"enablePayoutEmail": true,
"elasticSearchUrl": "http://localhost:9200/entities/_doc",
"elasticSearchUsername": "elastic",
"elasticSearchPassword": "changeme",
"enableAuditLog": false,
"enableSentryMonitoring": false,
"sentryDsn": "",
"segmentApiKey": ""
}
2 changes: 2 additions & 0 deletions elk/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ELK_VERSION=7.13.1
ELASTIC_SEARCH_PASSWORD=changeme
12 changes: 12 additions & 0 deletions elk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## Installation
The Dockerfiles, docker-composes and configs are inspired from this repository
https://github.com/deviantony/docker-elk

## Run
docker-compose up

## Usage
After running docker-compose you will see :
* **Kibana:** localhost:5601
* **Elastic search:** localhost:9200

51 changes: 51 additions & 0 deletions elk/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
version: '3.2'

services:
elasticsearch:
build:
context: elasticsearch/
args:
ELK_VERSION: $ELK_VERSION
volumes:
- type: bind
source: ./elasticsearch/elasticsearch.yml
target: /usr/share/elasticsearch/config/elasticsearch.yml
read_only: true
- type: volume
source: elasticsearch
target: /usr/share/elasticsearch/data
ports:
- "9200:9200"
- "9300:9300"
environment:
ES_JAVA_OPTS: "-Xmx256m -Xms256m"
ELASTIC_PASSWORD: $ELASTIC_SEARCH_PASSWORD
# Use single node discovery in order to disable production mode and avoid bootstrap checks.
# see: https://www.elastic.co/guide/en/elasticsearch/reference/current/bootstrap-checks.html
discovery.type: single-node
networks:
- elk

kibana:
build:
context: kibana/
args:
ELK_VERSION: $ELK_VERSION
volumes:
- type: bind
source: ./kibana/kibana.yml
target: /usr/share/kibana/config/kibana.yml
read_only: true
ports:
- "5601:5601"
networks:
- elk
depends_on:
- elasticsearch

networks:
elk:
driver: bridge

volumes:
elasticsearch:
7 changes: 7 additions & 0 deletions elk/elasticsearch/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ARG ELK_VERSION

# https://www.docker.elastic.co/
FROM docker.elastic.co/elasticsearch/elasticsearch:${ELK_VERSION}

# Add your elasticsearch plugins setup here
# Example: RUN elasticsearch-plugin install analysis-icu
13 changes: 13 additions & 0 deletions elk/elasticsearch/elasticsearch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
## Default Elasticsearch configuration from Elasticsearch base image.
## https://github.com/elastic/elasticsearch/blob/master/distribution/docker/src/docker/config/elasticsearch.yml
#
cluster.name: "docker-cluster"
network.host: 0.0.0.0

## X-Pack settings
## see https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-xpack.html
#
xpack.license.self_generated.type: basic
xpack.security.enabled: true
xpack.monitoring.collection.enabled: true
7 changes: 7 additions & 0 deletions elk/kibana/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ARG ELK_VERSION

# https://www.docker.elastic.co/
FROM docker.elastic.co/kibana/kibana:${ELK_VERSION}

# Add your kibana plugins setup here
# Example: RUN kibana-plugin install <name|url>
13 changes: 13 additions & 0 deletions elk/kibana/kibana.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
## Default Kibana configuration from Kibana base image.
## https://github.com/elastic/kibana/blob/master/src/dev/build/tasks/os_packages/docker_generator/templates/kibana_yml.template.ts
#
server.name: kibana
server.host: 0.0.0.0
elasticsearch.hosts: [ "http://elasticsearch:9200" ]
monitoring.ui.container.elasticsearch.enabled: true

## X-Pack security credentials
#
elasticsearch.username: elastic
elasticsearch.password: changeme
Loading

0 comments on commit 2bd3a9e

Please sign in to comment.