Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
c985acf
chore: Jenkins X build pack
faisalthaheem Mar 25, 2022
eb92e48
feat: added git ignore
faisalthaheem Mar 25, 2022
866705d
chore: updated dockerfile cmd
faisalthaheem Mar 25, 2022
912e540
feat: addded project requirements
faisalthaheem Mar 25, 2022
fafb15c
chore: updated cpu requests
faisalthaheem Mar 25, 2022
d48cb3b
feat: Dockerized app
faisalthaheem Mar 25, 2022
703f2e0
feat: parameterized through env variables
faisalthaheem Mar 31, 2022
6893785
feat: chart customization
faisalthaheem Mar 31, 2022
233c977
chore: bot secrets
faisalthaheem Apr 1, 2022
d2b03ec
fix: paths
faisalthaheem Apr 1, 2022
5cef569
fix: restore service values
faisalthaheem Apr 1, 2022
cc9bf25
feat: added promethus stats
faisalthaheem Apr 1, 2022
4a8537d
chore: fix arg length (addr len) to 48
faisalthaheem Apr 1, 2022
fb4f6bd
fix: indent
faisalthaheem Apr 1, 2022
0a59e14
fix: invalid tag removed
faisalthaheem Apr 1, 2022
4f5dbc8
fix: config map
faisalthaheem Apr 1, 2022
c6dbe26
fix: env list update
faisalthaheem Apr 1, 2022
c79a19e
fix: rectified env list
faisalthaheem Apr 1, 2022
312e3e4
fix: names updated
faisalthaheem Apr 1, 2022
60bb2f7
fix: dedicated config
faisalthaheem Apr 1, 2022
91c012f
fix: variables to strings
faisalthaheem Apr 1, 2022
fe566d0
fix: disabled dynamic env
faisalthaheem Apr 1, 2022
bf1ce4c
fix: env variables adjusted
faisalthaheem Apr 1, 2022
0931bd6
chore: adjust limits
faisalthaheem Apr 1, 2022
9743eb7
chore: Disable resources
faisalthaheem Apr 1, 2022
637a37a
fix: removed comments
faisalthaheem Apr 1, 2022
8430e59
fix: remove resources
faisalthaheem Apr 1, 2022
81f9f43
fix: Remove empty key
faisalthaheem Apr 1, 2022
e72a0c5
fix: restore limits
faisalthaheem Apr 1, 2022
a91cfd8
fix: limits
faisalthaheem Apr 1, 2022
b981460
fix: error removeal
faisalthaheem Apr 1, 2022
8892bff
feat: throttle by discord username
faisalthaheem Apr 4, 2022
bc8dfdf
fix: removed emoticon
faisalthaheem Apr 4, 2022
a801370
feat: author mention in denials
faisalthaheem Apr 4, 2022
c8c0711
fix: added space between mention and message
faisalthaheem Apr 4, 2022
0a2556f
chore: adapted for agung network
faisalthaheem Apr 7, 2022
8a0b35e
feat: supress parallel requests
faisalthaheem Apr 14, 2022
4612540
fix: encoding before hashing
faisalthaheem Apr 14, 2022
1e32e0f
fix: convert to string
faisalthaheem Apr 14, 2022
7fc3772
rollback.
faisalthaheem Apr 14, 2022
e99f100
chore: fix the lock
faisalthaheem Apr 14, 2022
4689544
chore: revert
faisalthaheem Apr 14, 2022
9e6aaff
Add multiple faucets/library upgrade/Refine code
Feb 17, 2023
2a0db1f
Extract constant
Feb 20, 2023
24a1956
Extract to env variable
Feb 20, 2023
7307a71
Merge pull request #2 from peaqnetwork/feat/1203993808049736_allow_mu…
sfffaaa Feb 22, 2023
4ddffb2
add: configmap for multinode
niazhussain Feb 27, 2023
2c40771
enable triger on master
niazhussain Feb 27, 2023
550b64f
Merge pull request #3 from peaqnetwork/CI/1204022126062597_add-new-va…
niazhussain Feb 27, 2023
f94a3c1
Fix errors
Feb 27, 2023
238f553
Merge pull request #4 from peaqnetwork/feat/1203993808049736_emergenc…
niazhussain Feb 27, 2023
04410d1
ci-fix: pipeline regenrate
niazhussain Jun 30, 2024
1f2a854
Merge pull request #5 from peaqnetwork/ci/30062024_migration-to-new-ci
niazhussain Jun 30, 2024
374c451
chore: Jenkins X build pack
pow-devops2020 Jun 30, 2024
27b44a6
ci-fix: pipelines re-configuration
niazhussain Jun 30, 2024
9938f09
Merge pull request #6 from peaqnetwork/ci/30062024_re-configure-pipel…
niazhussain Jun 30, 2024
9eb03b0
ci-fix: configmap fix
niazhussain Jun 30, 2024
21f5f19
Merge pull request #7 from peaqnetwork/ci/30062024_re-configure-pipel…
niazhussain Jun 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.lighthouse
charts/*
preview/*
test-net-faucet-bot-config.yaml
test-net-faucet-bot-secret.yaml
156 changes: 156 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
test-net-faucet-bot-config.yaml
test-net-faucet-bot-secret.yaml
agung-faucet-bot-config.yaml
agung-faucet-bot-secret.yaml
41 changes: 41 additions & 0 deletions .lighthouse/jenkins-x/pullrequest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
creationTimestamp: null
name: pullrequest
spec:
pipelineSpec:
tasks:
- name: from-build-pack
resources: {}
taskSpec:
metadata: {}
stepTemplate:
image: uses:jenkins-x/jx3-pipeline-catalog/tasks/python/pullrequest.yaml@versionStream
name: ""
resources:
# override limits for all containers here
limits: {}
workingDir: /workspace/source
steps:
- image: uses:jenkins-x/jx3-pipeline-catalog/tasks/git-clone/git-clone-pr.yaml@versionStream
name: ""
resources: {}
- name: jx-variables
resources: {}
# # override requests for the pod here
# requests:
# cpu: 400m
# memory: 512Mi
- name: build-python-unittest
resources: {}
- name: check-registry
resources: {}
- name: build-container-build
resources: {}
- name: promote-jx-preview
resources: {}
podTemplate: {}
serviceAccountName: tekton-bot
timeout: 12h0m0s
status: {}
47 changes: 47 additions & 0 deletions .lighthouse/jenkins-x/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
creationTimestamp: null
name: release
spec:
pipelineSpec:
tasks:
- name: from-build-pack
resources: {}
taskSpec:
metadata: {}
stepTemplate:
image: uses:jenkins-x/jx3-pipeline-catalog/tasks/python/release.yaml@versionStream
name: ""
resources:
# override limits for all containers here
limits: {}
workingDir: /workspace/source
steps:
- image: uses:jenkins-x/jx3-pipeline-catalog/tasks/git-clone/git-clone.yaml@versionStream
name: ""
resources: {}
- name: next-version
resources: {}
- name: jx-variables
resources: {}
# override requests for the pod here
# requests:
# cpu: 400m
# memory: 512Mi
- name: build-python-unittest
resources: {}
- name: check-registry
resources: {}
- name: build-container-build
resources: {}
- name: promote-changelog
resources: {}
- name: promote-helm-release
resources: {}
- name: promote-jx-promote
resources: {}
podTemplate: {}
serviceAccountName: tekton-bot
timeout: 12h0m0s
status: {}
16 changes: 16 additions & 0 deletions .lighthouse/jenkins-x/triggers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: config.lighthouse.jenkins-x.io/v1alpha1
kind: TriggerConfig
spec:
presubmits:
- name: pr
context: "pr"
always_run: true
optional: false
source: "pullrequest.yaml"
postsubmits:
- name: release
context: "release"
source: "release.yaml"
branches:
- ^main$
- ^master$
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM python:3.8

WORKDIR /app

COPY ["requirements.txt", "/app/"]
RUN pip install -r requirements.txt

COPY ["app/faucet.py", "/app/"]

WORKDIR /app
ENTRYPOINT ["python"]
CMD ["faucet.py"]
4 changes: 4 additions & 0 deletions OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
approvers:
- faisalthaheem
reviewers:
- faisalthaheem
6 changes: 6 additions & 0 deletions OWNERS_ALIASES
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
aliases:
- faisalthaheem
best-approvers:
- faisalthaheem
best-reviewers:
- faisalthaheem
56 changes: 46 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,54 @@ This bot is a really simple bot without security or threshold. It's used to send

## How to use :

- create a discord bot
- create a substrate address
- configure :
A configmap named "test-net-faucet-bot-config" can be used to override the default values as specified in the following table
Please adapt to your target namespace

```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: test-net-faucet-bot-config
namespace: jx-devbr
data:
DISCORD_BOT_TOKEN: very
FAUCET_MNEMONIC: charm
```
TOKEN = 'Your_Discord_Bot_Token'
```
```
faucet_mnemonic = 'Your Substrate Mnemonic'
```


Default values are as follows

|Key|Description|
|---|---|
|DISCORD_BOT_TOKEN|The secret bot token to use for connecting to discord|
|NODE_RPC|wss://wss.test.peaq.network,wss://wss2.test.peaq.network|
|FAUCET_MNEMONIC|use the value from subkey generate,use the value from subkey2 generate|
|TOKENS_TO_SEND|1000000000000000000|
|TOKENS_DECIMAL|1000000000000000000|
|TOKEN_SYMBOL|PEAQ|
|ISSUE_INTERVAL|5|
|REDIS_IP|127.0.0.1|
|REDIS_PORT|6379|
|PROMETHEUS_PORT|8080|


Additionally a secret must be created under the name of "test-net-faucet-bot-secret" containing the bot token and key mnemonic.
Remember to change the DISCORD_BOT_TOKEN and FAUCET_MNEMONIC variable's data to actual values.
Use the following command to encode to base64

```bash
#encode with disabled line wrapping
echo -n 'secret here' | base64 -w 0
```
# usually you run it on the same server than the node
node_rpc = "http://127.0.0.1:9933"

```yaml
apiVersion: v1
data:
DISCORD_BOT_TOKEN: bXlwYXNzd29yZA==
FAUCET_MNEMONIC: bXlwYXNzd29yZA==
kind: Secret
metadata:
name: test-net-faucet-bot-secret
namespace: jx-devbr
type: Opaque
```
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
run.sh
Loading