-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dag inspector #65
base: main
Are you sure you want to change the base?
Dag inspector #65
Changes from 75 commits
365a5ee
287ae9a
6e7825c
3a7ec86
1223fc3
268a104
1736b2d
91303e8
3517caf
4ad6d95
815a633
6e347df
7f5d48c
b576c44
df0c7e2
02f43ec
948b209
c1910bc
4d9c892
d8161eb
9be238c
c54e52d
128ef9c
4f937ee
1991b4b
2286eaf
70704aa
057b9c0
2883212
185b3c6
dfb03f4
ca5ef6b
a455f5f
50ed2f8
fd67cbb
107ed19
0ccccbe
28dea17
860ab0c
43ed6bb
33ff998
cbba8a2
5e40cd5
c66a0fb
9533817
0cc2200
5f94f5e
b1fcd27
ce6c784
d568d08
f1a00ee
94e4f3e
62b1f1d
15fdd63
9ed9e7c
99f28a8
102ffaa
b178572
d8b2cdf
45cbed2
e5a3fbe
3ea2504
809d225
b13b7e2
6d86d28
ba505fe
a96df94
57aa506
16060d1
fc6373a
7ef85fb
7ec7a2b
0f18c96
42e7009
4fe719d
5c04432
82b0dbd
feb9555
4ba90d0
d8bbc67
b20fb4d
258f43c
9a804b6
b1633d2
942bf87
0df6e41
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ jobs: | |
id: docker_meta | ||
uses: crazy-max/ghaction-docker-meta@v1 | ||
with: | ||
images: starcoin/starcoin_indexer,ghcr.io/starcoinorg/starcoin_indexer | ||
images: starcoin/starcoin_indexer | ||
tag-sha: true | ||
- name: Set up Docker Buildx | ||
uses: docker/[email protected] | ||
|
@@ -33,12 +33,6 @@ jobs: | |
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GIT_PACKAGE_TOKEN }} | ||
- name: maven-settings-xml-action | ||
uses: whelk-io/maven-settings-xml-action@v18 | ||
with: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ jobs: | |
id: docker_meta | ||
uses: crazy-max/ghaction-docker-meta@v1 | ||
with: | ||
images: starcoin/starcoin_scan,ghcr.io/starcoinorg/starcoin_scan | ||
images: starcoin/starcoin_scan | ||
tag-sha: true | ||
- name: Set up Docker Buildx | ||
uses: docker/[email protected] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
# starcoin-search | ||
# stc-scan | ||
Established some independent handles for indexing data with scan to customize statistics data for swap, used in conjunction with the [swap-stat-api](https://github.com/Elements-Studio/swap-stat-api) repository. | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,63 @@ | ||||||
# How to build local environment | ||||||
|
||||||
## 1. Install "Docker" and "Docker Compose" | ||||||
## 2. Run the command to start the database and components | ||||||
```bash | ||||||
docker-compose up | ||||||
``` | ||||||
## 3. Start starcoin-index project | ||||||
|
||||||
### Config the startup environment variable | ||||||
```dotenv | ||||||
HOSTS=localhost | ||||||
NETWORK=halley # select which network to scan | ||||||
BG_TASK_JOBS=dag_inspector | ||||||
TXN_OFFSET=0 | ||||||
BULK_SIZE=100 | ||||||
STARCOIN_ES_PWD= | ||||||
STARCOIN_ES_URL=localhost | ||||||
STARCOIN_ES_PROTOCOL=http | ||||||
STARCOIN_ES_PORT=9200 | ||||||
STARCOIN_ES_USER= | ||||||
SWAP_API_URL=https://swap-api.starswap.xyz | ||||||
SWAP_CONTRACT_ADDR=0x8c109349c6bd91411d6bc962e080c4a3 | ||||||
DS_URL=jdbc:postgresql://localhost/starcoin | ||||||
DB_SCHEMA=halley | ||||||
DB_USER_NAME=starcoin | ||||||
DB_PWD=starcoin | ||||||
PROGRAM_ARGS= | ||||||
# auto_repair 9411700 | ||||||
``` | ||||||
|
||||||
### Configuration Elasticsearch template | ||||||
[IMPORTANT!!] Make sure your template has added to Elastic search service before add data, including component template and index template to ES. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct verb form for better readability. The sentence structure in the instruction about adding templates to Elasticsearch is awkward and the verb form is incorrect. - [IMPORTANT!!] Make sure your template has added to Elastic search service before add data, including component template and index template to ES.
+ [IMPORTANT!!] Make sure your template is added to the Elasticsearch service before adding data, including the component template and index template. Committable suggestion
Suggested change
ToolsLanguageTool
|
||||||
Following file: [[es_pipeline.scripts](..%2Fkube%2Fmappings%2Fes_pipeline.scripts)] | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix typographical error in URL. There's a typographical error with double dots in the URL which might lead to a broken link. - Following file: [[es_pipeline.scripts](..%2Fkube%2Fmappings%2Fes_pipeline.scripts)]
+ Following file: [[es_pipeline.scripts](../kube/mappings/es_pipeline.scripts)] Committable suggestion
Suggested change
ToolsLanguageTool
|
||||||
|
||||||
1. Open the 'Kibana' site has been started in the docker-compose environment, usually the url is http://localhost:5601 | ||||||
2. Navigate to 'Dev Tools' | ||||||
3. Follow the instructions in the file of giving above to add the template to ES | ||||||
|
||||||
### Add SQL tables for network | ||||||
[IMPORTANT!!] Add the [tables](../starcoin-indexer/deploy/create_table.sql) for the network you want to scan, including main, barnard, halley, etc. | ||||||
|
||||||
## 4. Start starcoin-scan-api project | ||||||
|
||||||
### Config the startup enviroment variable | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Start sentences with a verb for clarity. Similar to a previous comment, the heading should start with a verb to improve clarity. - ### Config the startup enviroment variable
+ ### Configure the startup environment variables Committable suggestion
Suggested change
ToolsLanguageTool
Markdownlint
|
||||||
```dotenv | ||||||
STARCOIN_ES_URL=localhost | ||||||
STARCOIN_ES_PROTOCOL=http | ||||||
STARCOIN_ES_PORT=9200 | ||||||
STARCOIN_ES_USER= | ||||||
STARCOIN_ES_INDEX_VERSION= | ||||||
STARCOIN_ES_PWD= | ||||||
MAIN_DS_URL=jdbc:postgresql://localhost/starcoin?currentSchema=main | ||||||
BARNARD_DS_URL=jdbc:postgresql://localhost/starcoin?currentSchema=barnard | ||||||
HALLEY_DS_URL=jdbc:postgresql://localhost/starcoin?currentSchema=halley | ||||||
DS_URL=jdbc:postgresql://localhost/starcoin | ||||||
STARCOIN_USER_DS_URL="jdbc:postgresql://localhost/starcoin?currentSchema=starcoin_user" | ||||||
DB_USER_NAME=starcoin | ||||||
DB_PWD=starcoin | ||||||
``` | ||||||
|
||||||
### Add SQL tables for network | ||||||
[IMPORTANT!!] Add the [tables](../starcoin-scan-api/deploy/create_table.sql) for the network you want to scan, including main, barnard, halley, etc. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# This composer file is used to configure the local environment for debugging | ||
version: '3.8' | ||
|
||
services: | ||
elasticsearch: | ||
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.2 | ||
container_name: elasticsearch | ||
environment: | ||
- node.name=elasticsearch | ||
- cluster.name=docker-cluster | ||
- discovery.type=single-node | ||
- bootstrap.memory_lock=true | ||
- "ES_JAVA_OPTS=-Xms512m -Xmx512m" | ||
ulimits: | ||
memlock: | ||
soft: -1 | ||
hard: -1 | ||
volumes: | ||
- esdata:/usr/share/elasticsearch/data | ||
ports: | ||
- "9200:9200" | ||
|
||
hazelcast: | ||
image: hazelcast/hazelcast:latest | ||
container_name: hazelcast | ||
ports: | ||
- "5701:5701" | ||
environment: | ||
- HZ_CLUSTERNAME=stcscan-hazelcast-cluster | ||
- HZ_NETWORK_JOIN_MULTICAST_ENABLED=false | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里是个分布式锁?咱们项目里是哪里需要用到? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这个是scan-api中用到的 |
||
- HZ_NETWORK_JOIN_TCPIP_ENABLED=true | ||
- HZ_NETWORK_JOIN_TCPIP_MEMBERS=hazelcast | ||
- HZ_CACHE_CODE_CACHE_STATISTICS_ENABLED=true | ||
- HZ_CACHE_CODE_CACHE_EVICTION_SIZE=10000 | ||
- HZ_CACHE_CODE_CACHE_EVICTION_MAX_SIZE_POLICY=ENTRY_COUNT | ||
- HZ_CACHE_CODE_CACHE_EVICTION_EVICTION_POLICY=LFU | ||
- HZ_CACHE_SESSION_STATISTICS_ENABLED=true | ||
- HZ_CACHE_SESSION_EVICTION_SIZE=50000 | ||
- HZ_CACHE_SESSION_EVICTION_MAX_SIZE_POLICY=ENTRY_COUNT | ||
- HZ_CACHE_SESSION_EVICTION_EVICTION_POLICY=LRU | ||
|
||
kibana: | ||
image: docker.elastic.co/kibana/kibana:7.17.2 | ||
container_name: kibana | ||
environment: | ||
ELASTICSEARCH_URL: http://elasticsearch:9200 | ||
ELASTICSEARCH_HOSTS: http://elasticsearch:9200 | ||
ports: | ||
- 5601:5601 | ||
depends_on: | ||
- elasticsearch | ||
|
||
postgresql: | ||
image: postgres:13.2 | ||
container_name: postgres_db | ||
environment: | ||
POSTGRES_USER: starcoin | ||
POSTGRES_PASSWORD: starcoin | ||
POSTGRES_DB: starcoin | ||
volumes: | ||
- db_data:/var/lib/postgresql/data | ||
ports: | ||
- 5432:5432 | ||
|
||
volumes: | ||
esdata: | ||
driver: local |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: allow-access-pg-from-vega | ||
namespace: default | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app: postgres-service | ||
policyTypes: | ||
- Ingress | ||
ingress: | ||
- from: | ||
- namespaceSelector: | ||
matchLabels: | ||
name: starcoin-vega | ||
--- | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: allow-access-es-from-vega | ||
namespace: default | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app: elasticsearch | ||
policyTypes: | ||
- Ingress | ||
ingress: | ||
- from: | ||
- namespaceSelector: | ||
matchLabels: | ||
name: starcoin-vega | ||
|
||
|
||
--- | ||
# Postgres service for starcoin-api | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: allow-access-pg-from-api | ||
namespace: default | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app: postgres-service | ||
policyTypes: | ||
- Ingress | ||
ingress: | ||
- from: | ||
- namespaceSelector: | ||
matchLabels: | ||
name: starcoin-api | ||
|
||
--- | ||
# Elasticsearch service for starcoin-api | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: allow-access-es-from-api | ||
namespace: default | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app: elasticsearch | ||
policyTypes: | ||
- Ingress | ||
ingress: | ||
- from: | ||
- namespaceSelector: | ||
matchLabels: | ||
name: starcoin-api | ||
|
||
--- | ||
# Default namespace access for elasticsearch | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: allow-internal-elasticsearch | ||
namespace: default | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app: elasticsearch | ||
policyTypes: | ||
- Ingress | ||
ingress: | ||
- from: | ||
- podSelector: {} | ||
ports: | ||
- protocol: TCP | ||
port: 9200 |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,110 @@ | ||||||
# elasticsearch-deployment.yaml | ||||||
apiVersion: apps/v1 | ||||||
kind: Deployment | ||||||
metadata: | ||||||
name: elasticsearch | ||||||
spec: | ||||||
replicas: 1 | ||||||
selector: | ||||||
matchLabels: | ||||||
app: elasticsearch | ||||||
template: | ||||||
metadata: | ||||||
labels: | ||||||
app: elasticsearch | ||||||
spec: | ||||||
initContainers: | ||||||
- name: init-permissions | ||||||
image: busybox | ||||||
command: [ "sh", "-c", "chown -R 1000:1000 /usr/share/elasticsearch/data" ] | ||||||
volumeMounts: | ||||||
- name: es-data | ||||||
mountPath: /usr/share/elasticsearch/data | ||||||
containers: | ||||||
- name: elasticsearch | ||||||
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.0 | ||||||
resources: | ||||||
requests: | ||||||
cpu: "1" | ||||||
memory: "4Gi" | ||||||
limits: | ||||||
cpu: "2" | ||||||
memory: "6Gi" | ||||||
ports: | ||||||
- containerPort: 9200 | ||||||
name: http | ||||||
- containerPort: 9300 | ||||||
name: transport | ||||||
volumeMounts: | ||||||
- name: es-data | ||||||
mountPath: /usr/share/elasticsearch/data | ||||||
- name: elasticsearch-config | ||||||
mountPath: /usr/share/elasticsearch/config/elasticsearch.yml | ||||||
subPath: elasticsearch.yml | ||||||
env: | ||||||
- name: discovery.type | ||||||
value: single-node | ||||||
- name: ELASTIC_USERNAME | ||||||
valueFrom: | ||||||
secretKeyRef: | ||||||
name: elasticsearch | ||||||
key: username | ||||||
- name: ELASTIC_PASSWORD | ||||||
valueFrom: | ||||||
secretKeyRef: | ||||||
name: elasticsearch | ||||||
key: password | ||||||
Comment on lines
+51
to
+62
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Use a dedicated secret for Elasticsearch credentials While using secrets for storing credentials is good practice, it's better to use a dedicated secret for Elasticsearch credentials to enhance security and maintain a clear separation of concerns. Create a new secret specifically for Elasticsearch: apiVersion: v1
kind: Secret
metadata:
name: elasticsearch-credentials
type: Opaque
data:
username: <base64-encoded-username>
password: <base64-encoded-password> Then update the valueFrom:
secretKeyRef:
- name: elasticsearch
+ name: elasticsearch-credentials
key: username Make the same change for the password environment variable. |
||||||
volumes: | ||||||
- name: es-data | ||||||
persistentVolumeClaim: | ||||||
claimName: es-pvc | ||||||
- name: elasticsearch-,.ujv config | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix typo in volume name There is a typo in the volume name - - name: elasticsearch-,.ujv config
+ - name: elasticsearch-config Committable suggestion
Suggested change
|
||||||
configMap: | ||||||
name: elasticsearch-config | ||||||
--- | ||||||
# Elasticsearch Configuration | ||||||
apiVersion: v1 | ||||||
kind: ConfigMap | ||||||
metadata: | ||||||
name: elasticsearch-config | ||||||
data: | ||||||
elasticsearch.yml: | | ||||||
xpack.security.enabled: true | ||||||
xpack.license.self_generated.type: basic | ||||||
network.host: 0.0.0.0 | ||||||
--- | ||||||
# Elasticsearch Persistent Volume | ||||||
apiVersion: v1 | ||||||
kind: PersistentVolume | ||||||
metadata: | ||||||
name: es-pv | ||||||
spec: | ||||||
capacity: | ||||||
storage: 80Gi | ||||||
accessModes: | ||||||
- ReadWriteOnce | ||||||
hostPath: | ||||||
path: /mnt/data/es | ||||||
--- | ||||||
# Elasticsearch Persistent Volume Claim | ||||||
apiVersion: v1 | ||||||
kind: PersistentVolumeClaim | ||||||
metadata: | ||||||
name: es-pvc | ||||||
spec: | ||||||
accessModes: | ||||||
- ReadWriteOnce | ||||||
resources: | ||||||
requests: | ||||||
storage: 80Gi | ||||||
--- | ||||||
# Elasticsearch Service | ||||||
apiVersion: v1 | ||||||
kind: Service | ||||||
metadata: | ||||||
name: elasticsearch | ||||||
spec: | ||||||
ports: | ||||||
- port: 9200 | ||||||
selector: | ||||||
app: elasticsearch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Start sentences with a verb for clarity.
The heading "Config the startup environment variable" should start with a verb to improve clarity and readability.
Committable suggestion
Tools
LanguageTool
Markdownlint