Skip to content

Instantly share code, notes, and snippets.

@IgorShadurin
Last active July 15, 2021 11:07
Show Gist options
  • Save IgorShadurin/ed828b21e5904b3ad65b69e22e117e17 to your computer and use it in GitHub Desktop.
Save IgorShadurin/ed828b21e5904b3ad65b69e22e117e17 to your computer and use it in GitHub Desktop.
Fast Fairdrive + Fairstack spin up

How to install?

0 - Ensure that you have installed (docker, git, wget). Check that ports 3000, 1633, 1634, 1635 are available.

1 - One-liner for installing FairDrive and FairStack

wget https://gist.github.com/IgorShadurin/ed828b21e5904b3ad65b69e22e117e17/raw/36ac2396c7ea371559202df35108ec4b74a3e9d4/docker-compose.yml && docker-compose up

2 - Open http://localhost:3000 in your browser

How to fund your node with test tokens?

Wait message about funding like that "bee-1_1 | time="2021-07-10T18:51:54Z" level=warning msg="get your Goerli ETH and Goerli BZZ now via the bzzaar at https://bzz.ethswarm.org/?transaction=buy&amount=10&slippage=30&receiver=0xab0a2e21e53889481b2af53950baa0f530d58c55". Wallet in this example is 0xab0a2e21e53889481b2af53950baa0f530d58c55.

Copy wallet from YOUR logs.

Open official SWARM faucet https://discord.com/channels/799027393297514537/841664915218628619 and fund your wallet with 10 gBzz + 0.5 gEth from https://faucet.goerli.mudit.blog/

If Docker with bee + fairos closed before you fund, please run "docker compose up" again.

Wait until bee will deploy cheqbook and this message appears "fairos_1 | time="2021-07-10T19:30:11Z" level=info msg="fairOS-dfs API server listening on port: 9090""

Open http://localhost:9090 in your browser and you can see few lines with information about fairOS. These lines will appear only after chequbook deployment.

Deployment to Docker Hub

Dockerfile-fairdrive is used for deployment fairdrive to Docker Hub.

Before deployment, clone fairdrive repo, install deps with yarn, do some actions to prepare for build (create .env for example), build it.

Put Dockerfile-fairdrive as Dockerfile to /app folder

To deploy project for multiplatforms run it:

docker buildx build --push --platform linux/arm/v7,linux/arm64/v8,linux/amd64 --tag fairdatasociety/fairdrive .

version: '3'
services:
bee-1:
image: ethersphere/bee:0.5.2
restart: unless-stopped
environment:
- BEE_API_ADDR
- BEE_BLOCK_TIME
- BEE_BOOTNODE
- BEE_BOOTNODE_MODE
- BEE_CLEF_SIGNER_ENABLE=false
- BEE_CLEF_SIGNER_ENDPOINT=http://clef-1:8550
- BEE_CONFIG
- BEE_CORS_ALLOWED_ORIGINS
- BEE_DATA_DIR
- BEE_CACHE_CAPACITY
- BEE_DB_OPEN_FILES_LIMIT
- BEE_DB_BLOCK_CACHE_CAPACITY
- BEE_DB_WRITE_BUFFER_SIZE
- BEE_DB_DISABLE_SEEKS_COMPACTION
- BEE_DEBUG_API_ADDR
- BEE_DEBUG_API_ENABLE
- BEE_GATEWAY_MODE
- BEE_GLOBAL_PINNING_ENABLE
- BEE_FULL_NODE
- BEE_NAT_ADDR
- BEE_NETWORK_ID
- BEE_P2P_ADDR
- BEE_P2P_QUIC_ENABLE
- BEE_P2P_WS_ENABLE
- BEE_PASSWORD=test
- BEE_PASSWORD_FILE
- BEE_PAYMENT_EARLY
- BEE_PAYMENT_THRESHOLD
- BEE_PAYMENT_TOLERANCE
- BEE_POSTAGE_STAMP_ADDRESS
- BEE_RESOLVER_OPTIONS
- BEE_STANDALONE
- BEE_SWAP_ENABLE
- BEE_SWAP_ENDPOINT=https://goerli.infura.io/v3/ae35ce6e195f44ff9d15cfca5de4ad21
- BEE_SWAP_FACTORY_ADDRESS
- BEE_SWAP_LEGACY_FACTORY_ADDRESSES
- BEE_SWAP_INITIAL_DEPOSIT
- BEE_SWAP_DEPLOYMENT_GAS_PRICE
- BEE_TRACING_ENABLE
- BEE_TRACING_ENDPOINT
- BEE_TRACING_SERVICE_NAME
- BEE_TRANSACTION
- BEE_VERBOSITY
- BEE_WELCOME_MESSAGE
- BEE_MAINNET
ports:
- "${API_ADDR:-1633}${BEE_API_ADDR:-:1633}"
- "${P2P_ADDR:-1634}${BEE_P2P_ADDR:-:1634}"
- "${DEBUG_API_ADDR:-127.0.0.1:1635}${BEE_DEBUG_API_ADDR:-:1635}"
volumes:
- bee-1:/home/bee/.bee
command: start
fairos:
image: fairdatasociety/fairos-dfs:latest
restart: unless-stopped
ports:
- '9090:9090'
command: --cors-origins "http://localhost:3000" --beeHost "bee-1" --cookieDomain "localhost"
volumes:
- fairos-1:/root/.fairOS/dfs
depends_on:
- bee-1
fairdrive:
image: fairdatasociety/fairdrive:latest
restart: unless-stopped
ports:
- '3000:80'
depends_on:
- fairos
volumes:
bee-1:
fairos-1:
# before running this Dockerfile, please run 'yarn' && 'yarn build'
# because build process for 3 platforms is too long and too frquently broken by network issues
FROM node:16 as builder
WORKDIR /app
COPY build ./
COPY . .
FROM nginx:1.21.1-alpine
COPY --from=builder /app/build /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment