* feat: new Price Oracle bytecode * refactor: remove file smth.txt * feat: new PostageStamp contract * feat: change contract deploy workflow * feat: bee-1.0.0-rc2 compatible runner * feat: build from source (#47) * feat: extend build-envrionment.sh with building bee image from source * ci: new workflow option parameter - beeVersionAsCommitHash * fix(ci): try to overwrite BEE_VERSION sys variable * fix: do not export BEE_VERSION after env build * fix(ci): run build-environment without source command * fix(ci): try to retrieve built BEE_VERSION value * fix: save build BEE_VERSION value * fix(ci): retrieve built image tag in the last step * refactor: echoerr * refactor(ci): export sys variables * feat: disable warmup time (#46) * feat: disable warmup time * fix: place warmup-time to the correct place * fix: put quote back where it truly belongs * feat: state commit (#45) * refactor: remove payment treshold option because it causes performance issues * docs: design planned parameters for the new build workflow * feat: build environment with traffic gen option * fix(log): rephrase traffic gen log * feat: special bee version tagging when state commit happens * build: new env variable STATE_COMMIT * ci: STATE_COMMIT * feat: state commit scripts * refactor: destroy containers after state producing * refactor: remove unnecessary echo * fix: blockchain version at state commit * build: bumo bee-js version * build: update package-lock * fix: fixes * ci: build environment workflow with state commit * refactor: buy larger stamp * fix: publish workflow * refactor: increase stamp depth * fix: bee version fetch at commit * refactor: start containers normally instead of ephemeral for debugging * fix(ci): add chown for bee user on bee-data-dirs in order to write bee state * fix: try out the permission on bee data dir with 777 chmod * fix(ci): give folder permission in the build environment phrase * refactor(ci): raise sleep between uploads in order to generate cheques * refactor: wait 11 secs after batch purchase * fix: commit version tag string true instead of boolean * fix: add state commit check for set COMMIT_VERSION_TAG * chore: bump bee version Co-authored-by: Cafe137 <77121044+Cafe137@users.noreply.github.com>
Bee Factory
This project builds up a test environment with Bee clients and with a test blockchain. The created environment is runnable on local machine as well.
All services run in Docker containers only.
Currently, the repository supports running Bee nodes up to 5 by default.
Usage
The whole Bee environment (with blockchain) can be started by running one script, but for that you need to have the necessary Docker images, which is possible to build yourself by running some scripts
First you may want to set all global variables that the scripts will use. For that, there is a .env file which contains all necessary variables that you need.
set -a && source ./scripts/.env && set +a
If you do not set these global variables, the scripts will use those which are available in the .env file.
Setup the environment
Create the common Docker network for the environment with
./scripts/network.sh
To start the blockchain, run the following command in the root directory of the project:
./scripts/blockchain.sh
After that, it's possible to deploy Swarm smart contracts
npm run migrate:contracts
Before you start the Bee nodes with the deployed Swap Factory, you have to fund your overlay addresses of your Bee nodes for the successful start. The supply.js script can fund the addresses which are defined in bee-overlay-addresses.json file. To run this script just execute
npm run supply
and the configured accounts will get 1 ether and 100 BZZ Token.
After all above went successfully you can start the Bee nodes
./scripts/bee.sh start --workers=4
OR it is possible to build docker images on a desired state, so that a fresh environment can be started on each run.
Build Docker Images
Basically, a full-featured Bee environment has 2 types of Docker image:
- Bee images: Bee clients with pre-defined keys (and optionally including the state which you nodes have in its data-dirs)
./scripts/bee-docker-build.sh
- Blockchain image: Ganache blockchain which you may want to take a snapshot of after the contracts are deployed and the pre-defined Bee client keys are funded already.
./scripts/blockchain-docker-build.sh
Run Environment
If you have all Docker images that your environment file requires, start the Bee cluster
./scripts/environment.sh start
Pull images
Bee Factory can build images for CIs, but it is also possible to pull image to your computer as well.
For that you have to login to the Github docker registry with
docker login docker.pkg.github.com
it will ask for your GitHub username and for the password. For the latter you can generate a Personal Access Token.
The suggested permissions for the token are read:org and read:packages.
Utilities
It is possible to generate random traffic in your cluster:
$ npm run gen:traffic
The script is in an infinite loop, so if you want to stop the generation you have to terminate it manually in your terminal by pressing Ctrl^C.
If you don't specify any parameters it will produce 400 chunks/0.5 sec that the script tries to upload on the http://localhost:1633 - that is the binded port of the queen node if you orchestrated the environment with the envrionment.sh.
The following way you can pass parameter
- MIN_CHEQUE_NUMBER - Minimum required cheques for Bee under the given BEE_DEBUG_API_URL. If -1 then it does not check for cheques [Number,Default:-1]
- BEE_API_URL;BEE_DEBUG_API_URL - Bee API and Debug API URL separated by semicolon. The random data will sent to the Bee API URL, and the generated cheques will be checked on the Bee Debug URL. The two URLs should belong to different Bee clients as the generated data will propagate from that client to the network. [string,Default:'http://localhost:1633;http://localhost:11635']
$ npm run gen:traffic -- <MIN_CHEQUE_NUMBER> <BEE_API_URL;BEE_DEBUG_API_URL> <BEE_API_URL;BEE_DEBUG_API_URL> (...)
e.g.
$ npm run gen:traffic -- 2 http://localhost:1633;http://localhost:11635
With the example above, random data will be generated until minimum two cheques will generated on Bee client that serves debug endpoint http://localhost:11635