Skip to content

Commit

Permalink
🎉 Begin a project
Browse files Browse the repository at this point in the history
  • Loading branch information
Ferenc Sárai authored and Ferenc Sárai committed Oct 30, 2023
0 parents commit 8249a4c
Show file tree
Hide file tree
Showing 9 changed files with 725 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "bee-keyvalue Dockerfile",
"build": {
"context": "..",
"dockerfile": "../Dockerfile"
},
"forwardPorts": [1633, 1635, 3000],
"customizations": {
"vscode": {
"extensions": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}
},
"postStartCommand": "./start.sh"
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
node_modules
nohup.out
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# bee: 1.16.1, typescript

FROM node:18

RUN npm install --global @ethersphere/swarm-cli && \
npm install --global typescript && \
npm install --global ts-node

RUN apt-get update && \
apt-get install -y curl && \
apt-get install -y alien && \
rm -rf /var/lib/apt/lists/*

RUN curl -o /tmp/bee.rpm -L "https://github.com/ethersphere/bee/releases/download/v1.16.1/bee-1.16.1.aarch64.rpm" && \
cd /tmp && alien -d bee.rpm && \
dpkg -i /tmp/bee_1.16.1-2_arm64.deb && \
rm /tmp/bee.rpm && \
rm /tmp/bee_1.16.1-2_arm64.deb

EXPOSE 1633 1635 3000
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Bee key-value store example

## run

### npm install

```bash
npm install
```

### example

```bash
ts-node src/index.sh
```

## starting Bee in devcontainer.json

__devcontainer.json:__

```bash
"postStartCommand": "./start.sh"
```

__start.sh:__
- npm install
- It starts the Bee in dev mode with cors=*; the Bee output is in the nohup.out file
- Purchases a stamp
- Add the stamp value to the STAMP environment variable, which the index.ts file loads.
- Starts the index.ts

```bash
npm install
nohup bash -c 'bee dev --cors-allowed-origins="*" &'
sleep 3
STAMP=$(swarm-cli stamp buy --yes --depth 20 --amount 10000000 | grep "Stamp ID:" | cut -d " " -f 3)
echo $STAMP
export STAMP
echo "export STAMP='$STAMP'" >> ~/.bashrc
ts-node src/index.ts
```
Loading

0 comments on commit 8249a4c

Please sign in to comment.