-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Peer Network is a blockchain-integrated social network where users post content, earn tokens, Chat, and importantly (Monetize Participation).
The system is made up of multiple coordinated repositories:
| Component | Description |
|---|---|
peer_backend |
Main GraphQL API: users, content, chat, wallet, moderation |
peer_backend_CI/CD |
Main DevOps repository |
peer_cd |
This repo |
Each client connects to the backend via GraphQL, and the backend handles blockchain interaction and rewards.
This repo is to facilitate automatic updates to the other back-end servers from DevOps. This allows DevOps to push to this repo and have those changes apply to the testing environment of Peer. There is a webhook monitoring this repo for any pushs to dev branch. The main branch pushes to production (when verified).
The setup of the repo is part of how the webhook work and the placement of the scrips from DevOps.
Each directory has a point where the code is copied (rsync) remotely or locally.
Each directory contains a project. The project needs to have all of the files: data, config, scripts, environment, and other. One can have sub-directories in there as well (examples above). If you have files that should not be versioned (.env or secrets), then document them in the wiki or have a text explaining what files do what. Please be clear in what you want so we can help make your project work.
As of 04.08.2025 The directory structure is:
βββ mintbot
βΒ Β βββ scripts
βΒ Β βββ secrets
βββ monitoring-stack
βΒ Β βββ postman_collection
βΒ Β βββ scripts
βββ peer_cd_test_deploy
βββ php-webhook
βββ Python3_webhooK
Here is an example of tracked directories. For mintbot there is a large set of logs that are not versioned, but need to be known. Logs is a important part of the project and needs to be noted.
βββ mintbot
βΒ Β βββ logs
βΒ Β βΒ Β βββ mint_20250728094801
βΒ Β βΒ Β βββ mint_20250728111201
βΒ Β βΒ Β βββ mint_20250728111501
...
βΒ Β βΒ Β βββ mint_20250809100001
βΒ Β βΒ Β βββ mint_20250810100001
βΒ Β βΒ Β βββ mint_20250811100001
βΒ Β βββ scripts
βΒ Β βββ secrets
| Project | Description |
|---|---|
- mintbot
|
Mining token system check runs once a day at 10:00 CET |
- monitor-stack
|
Postman check for the backend updates |
- php_webhook
|
PHP Datebase monitor |
- Python3_webhook & peer_cd_test_deploy
|
This is the deployment code for Peer CD |
These directories contain the webhook for this repo. The webhook listens for a "push" to Github. Then the script sorts the target directory and then calls the peer test and deploy script to perforem unit tests (Linting for now) and rsync to the remote servers. The (local server is beta_testing jumphost) is is where a local copy of of this repo and active scripts resides.
- Contact the Administrator of the repo.
- Explain what is needed with the new project.
- Limitation: The source code needs to be in a single parent directory, other child directories can be used.
- The target location will be needed.
- Logs placement need to be defined (
var/log/...) or in the project directory.
- Create new directory in the repo.
- Add code
- Create wiki page detailed the functions of the project, any extra dependencies needed, and extra useful information.
- Push to
dev - Deploy and test.
To have pushes to this repo to be be 'pushed' to the repected servers. This CD will be split between
- Main
- This brach will push changes for monitoring Prod systems
- Dev
- This brach will push to the testing envirnment
DevOps then can push to Dev easily and can test there changes. When all parties are happy then a merge to Main and push to effect Prod.
The /opt/application/ directory
.
βββ LICENSE
βββ Python3_webhooK (main webhook for the infrasctuture)
βΒ Β βββ Beta_test_Py3_webhook.py
βΒ Β βββ Beta_test_Py3_webhook2.py (current)
βββ README.md
βββ monitoring-stack (DevOps monitoring)
βΒ Β βββ postman_collection
βΒ Β βΒ Β βββ postman_collections.json
βΒ Β βΒ Β βββ postman_environment.json
βΒ Β βββ scripts
βΒ Β βββ monitor_api.sh
βΒ Β βββ monitor_api_py.ph
βββ payload.json (test .json)
βββ peer_cd_test_deploy (Where the test and deploy scripts are located)
βΒ Β βββ Beta_test_deploy.py (Called from Python3_webhook2.py)
βΒ Β βββ test_bash.sh
βΒ Β βββ test_php.sh
βΒ Β βββ test_python.sh
βββ php-webhook (update the backend)
βΒ Β βββ deploy-backend.sh
βΒ Β βββ peer-deploy-hook.php
βββ restart-php.sh
βββ update-database.sh
There is are ssh-keys to allow the transfer to the update to the remote servers. rsync-key
This key will only push github changes to the needed places.
Please edit this file to add and or change target servers and endpoints. There are 2 sections for this test and deploy:
| Target Project Entry | example values |
|---|---|
| Key | Value |
| 'source_dir' | 'Python3_webhook' |
| 'target_server' | 'local' or hostname 'monitor' |
| 'target_path' | '~/myenv/peer_cd/Python3_webhook' |
| 'user' | 'ubuntu' |
| 'ip' | None, or IP of the target server |
| 'description' | 'Python webhook to local server' |
| 'excludes' | [] or [ '.env','secrets/','logs/', or other ] |
| Test settings | Notes |
|---|---|
| Key | Value |
| 'enabled' | 'True' or 'False' |
| 'extension' | what file type to test |
| 'test command | file to run (a bash script that runs python to test syntax) |
| 'timeout' | number of seconds to wait |
{
"DEPLOYMENT_MAPPINGS": {
"Python3_webhook": {
"source_dir": "Python3_webhook",
"target_server": "local",
"target_path": "~/myenv/peer_cd/Python3_webhook",
"user": "ubuntu",
"ip": null,
"_note": "** For local deployment **",
"description": "Python webhook to local server",
"excludes": []
},
"peer_cd_test_deploy": {
"source_dir": "peer_cd_test_deploy",
"target_server": "local",
"target_path": "/opt/application/peer_cd_test_deploy",
"user": "ubuntu",
"ip": null,
"_note": "** For local deployment **",
"description": "Test deployment files to local server",
"excludes": []
},
"monitoring-stack": {
"source_dir": "monitoring-stack",
"target_server": "monitor",
"target_path": "/home/ubuntu/peer_cd/monitoring-stack",
"user": "ubuntu",
"ip": "172.16.0.20",
"_note": "For Test Monitor",
"description": "Monitoring stack to monitor server",
"excludes": []
},
"mintbot": {
"source_dir": "mintbot",
"target_server": "monitor",
"target_path": "/home/ubuntu/peer_cd/mintbot",
"user": "ubuntu",
"ip": "172.16.0.20",
"_note": "For Test Monitor",
"description": "Monitoring for gem token queries",
"excludes": [
".env",
"secrets/*",
"logs/*"
]
},
"php-webhook": {
"source_dir": "php-webhook",
"target_server": "deploy-server",
"target_path": "/home/ubuntu/deploy-scripts",
"user": "ubuntu",
"ip": "172.16.10.194",
"_note": "For Test Backend",
"description": "PHP webhook to deploy server",
"excludes": []
}
},
"TEST_CONFIGS": {
"python": {
"enabled": true,
"extension": ".py",
"command": ["bash", "test_python.sh"],
"timeout": 60
},
"php": {
"enabled": true,
"extension": ".php",
"command": ["bash", "test_php.sh"],
"timeout": 60
},
"bash": {
"enabled": true,
"extension": ".sh",
"command": ["bash", "test_bash.sh"],
"timeout": 60
}
}
}