# Bee deployment fast cycle
In order to simplify and shorten the feedback loop when developing bee and/or smart contract functionality we introduce a handy way to deploy a small cluster on your local machine.
Once the changes are ready to be tested against a larger cluster you can deploy it using the `bee-load-test` repository.
## Example scenario
Let's say you deployed your local cluster and want to test some new changes in smart contracts.
Deploy the smart contracts to the local geth node (url: 'http://geth-swap.localhost'):
```
npx hardhat run deploy/deploy.ts --network geth
```
This will print out the new contract addresses
Paste the addresses into the corresponding fields in the `~/.beekeeper/local.yaml`
If you made any changes to the bee code as well run `make beelocal OPTS='skip-vet' ACTION=build`
This will build the new image and put it into the local registry.
Run these commands:
```
beekeeper delete bee-cluster --cluster-name local
beekeeper create bee-cluster --cluster-name local
```
They will bring down and back up your bee instances (with the new image & configuration) but without impacting your `geth node`
## Local deployment
You need recent versions of docker and helm installed.
### commands
To install the local cluster run this command from the root of the `bee` folder:
`make beelocal OPTS='skip-vet'`
- To uninstall the instances from the cluster use `ACTION=uninstall`
- To shut down cluster use `ACTION=stop`
- To remove it clean use `ACTION=destroy`
In order the change the configuration (bzz token address and geth url) of your local cluster modify the respective values in your `~/.beekeeper.yml` file.
To change the configuration values of the bee update `~/.beekeeper/local.yaml`
### Testing the changes to the `docker-setup-contracts` project
- build, tag and push the new `docker-setup-contracts` image locally
```
docker build -t k3d-registry.localhost:5000/setup-contracts:local .
docker push k3d-registry.localhost:5000/setup-contracts:local
```
- use the image and tag in the create cluster command:
`make beelocal OPTS='skip-vet' SETUP_CONTRACT_IMAGE=k3d-registry.localhost:5000/setup-contracts SETUP_CONTRACT_IMAGE_TAG=local`
### Possible issues
- Improper configuration in `~/.beekeeper.yml` could result it network routing issues, a solution would be to back-up the existing configuration file and re-run the command (the command will fetch the latest configuration file from git).
- Helm version can be an issue, make sure you run version >= 3.9
- If you used older versions of `beelocal` you might want to get rid of old volumes/containers:
```
docker volume rm $(docker volume ls -q)
docker rm $(docker ps -a -q)
```
## AWS Deployment
From the `bee-load-test` folder:
- make sure that the configuration file reflects the parameters of the cluster you want to deploy
```
$ cat .env
export AWS_ACCOUNT_ID=7*********5
export BOOTNODE_REPLICA=1 #MAX 1
export GATEWAY_REPLICA=0 #MAX 10
export FULL_REPLICA=10 #MAX 100
export LIGHT_REPLICA=0 #MAX 20
```
- to use a custom bee image update the `image.repository` in the `helmsman-dsf/init.yml` file
- to use a custom smart contract tag update the `imageSetupContract.tag` value in `helm-values/geth.yml`
- to change the bee configuration values update the `beeConfig` params of `helm-values/bee.yml`
### commands
- to install the cluster run `NAMESPACE=my-halloween-namespace ./install.sh init`
- to uninstall the cluster run `NAMESPACE=my-halloween-namespace ./uninstall.sh init`