Skip to content

Run NooBaa in Docker

Guy Margalit edited this page Jun 30, 2020 · 16 revisions

WARNING: THIS IS AN EXPERIMENTAL FEATURE ! ! !

Please open issues on bugs, questions or suggestions - thanks.

This script runs noobaa containers in docker.

Prepare container images

NOOBAA_CORE_IMAGE=noobaa/noobaa-core:5.4.0
NOOBAA_DB_IMAGE=centos/mongodb-36-centos7

docker pull $NOOBAA_CORE_IMAGE
docker pull $NOOBAA_DB_IMAGE

Prepare network

docker network create --driver bridge noobaa-net

Run noobaa-db

docker run --name noobaa-db \
    --net noobaa-net \
    --detach \
    -e MONGODB_ADMIN_PASSWORD=admin \
    -e MONGODB_USER=noobaa \
    -e MONGODB_PASSWORD=noobaa \
    -e MONGODB_DATABASE=nbcore \
    $NOOBAA_DB_IMAGE

Run noobaa-core

docker run --name noobaa-core \
    --net noobaa-net \
    --detach \
    -p 8080:8080 \
    -p 8443:8443 \
    -p 8444:8444 \
    -p 8445:8445 \
    -p 8446:8446 \
    -p 60100:60100 \
    -e MONGODB_URL=mongodb://noobaa:noobaa@noobaa-db/nbcore \
    -e CONTAINER_PLATFORM=DOCKER \
    -e JWT_SECRET=123 \
    -e SERVER_SECRET=123 \
    -e "AGENT_PROFILE={ \"image\": \"$NOOBAA_CORE_IMAGE\" }" \
    -e DISABLE_DEV_RANDOM_SEED=true \
    -e ENDPOINT_FORKS_NUMBER=1 \
    -e OAUTH_AUTHORIZATION_ENDPOINT= \
    -e OAUTH_TOKEN_ENDPOINT= \
    -e NOOBAA_SERVICE_ACCOUNT= \
    -e CONTAINER_CPU_REQUEST= \
    -e CONTAINER_MEM_REQUEST= \
    -e CONTAINER_CPU_LIMIT= \
    -e CONTAINER_MEM_LIMIT= \
    $NOOBAA_CORE_IMAGE

Create system

curl http://127.0.0.1:8080/rpc -d '{ "api": "system_api", "method": "create_system", "params": { "name": "demo", "email": "demo@noobaa.com", "password": "DeMo1" }}' > noobaa-create-system-tokens.json
# get the token
NOOBAA_AUTH_TOKEN=$(jq -r .reply.token noobaa-create-system-tokens.json)
# test the token
curl http://127.0.0.1:8080/rpc -sd '{"api":"auth_api","method":"read_auth","auth_token":"'$NOOBAA_AUTH_TOKEN'"}' | jq

Run noobaa-endpoint

docker run --name noobaa-endpoint \
    --net noobaa-net \
    --detach \
    -p 6001:6001 \
    -p 6443:6443 \
    -e CONTAINER_PLATFORM=DOCKER \
    -e DISABLE_DEV_RANDOM_SEED=true \
    -e ENDPOINT_FORKS_NUMBER=1 \
    -e 'MGMT_ADDR=wss://noobaa-core:8443' \
    -e 'MD_ADDR=wss://noobaa-core:8444' \
    -e 'BG_ADDR=wss://noobaa-core:8445' \
    -e 'HOSTED_AGENTS_ADDR=wss://noobaa-core:8446' \
    -e 'MONGODB_URL=mongodb://noobaa:noobaa@noobaa-db/nbcore' \
    -e VIRTUAL_HOSTS= \
    -e REGION=region1 \
    -e ENDPOINT_GROUP_ID=group1 \
    -e LOCAL_MD_SERVER=true \
    -e LOCAL_N2N_AGENT=true \
    -e JWT_SECRET=123 \
    -e NOOBAA_DISABLE_COMPRESSION=false \
    -e "NOOBAA_AUTH_TOKEN=$NOOBAA_AUTH_TOKEN" \
    -e CONTAINER_CPU_REQUEST= \
    -e CONTAINER_MEM_REQUEST= \
    -e CONTAINER_CPU_LIMIT= \
    -e CONTAINER_MEM_LIMIT= \
    $NOOBAA_CORE_IMAGE \
    /noobaa_init_files/noobaa_init.sh init_endpoint

Connect using S3

alias s3="AWS_ACCESS_KEY_ID=123 AWS_SECRET_ACCESS_KEY=abc aws --endpoint-url=http://127.0.0.1:6001 s3"
s3 ls
s3 ls --recursive first.bucket
s3 cp --recursive images/ s3://first.bucket/images/
s3 ls --recursive first.bucket

Open management console

open http://127.0.0.1:8080

Run storage agent on local volume

TODO let us know if you're interested

Clone this wiki locally