Skip to content

Commit

Permalink
feature: add a doc about how to install golang supernode
Browse files Browse the repository at this point in the history
Signed-off-by: Starnop <[email protected]>
  • Loading branch information
starnop committed Jun 20, 2019
1 parent 8a048f9 commit cbe1eb2
Show file tree
Hide file tree
Showing 2 changed files with 137 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/en-us/userguide/install_server.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Nginx|0.8+
3. Build the Docker image.

```sh
make build-supernode
make build-supernode-java
```

4. Obtain the latest Docker image ID of the SuperNode.
Expand Down Expand Up @@ -93,7 +93,7 @@ Nginx|0.8+

**Tip:** The path of the Nginx configuration file is something like `src/supernode/src/main/docker/sources/nginx.conf`.

```
```conf
server {
listen 8001;
location / {
Expand Down
135 changes: 135 additions & 0 deletions docs/en-us/userguide/install_server_go.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Installing Dragonfly Server

This topic explains how to install the Dragonfly server with **Golang version**.

**NOTE**: The Golang version supernode is **not ready for production usage**. However, you can use it more easily in your test environment.

## Context

Install the SuperNodes in one of the following ways:

- Deploying with Docker: Recommended for quick local deployment and test.
- Deploying with physical machines: Recommended for production usage.

## Prerequisites

When deploying with Docker, the following conditions must be met.

Required Software | Version Limit
---|---
Git|1.9.1+
Docker|1.12.0+

When deploying with physical machines, the following conditions must be met.

Required Software | Version Limit
---|---
Git|1.9.1+
Golang|1.10.2+
Nginx|0.8+

## Procedure - When Deploying with Docker

### Get Supernode image

You can build your own supernode image.

1. Obtain the source code of Dragonfly.

```sh
git clone https://github.com/dragonflyoss/Dragonfly.git
```

2. Enter the project directory.

```sh
cd Dragonfly
```

3. Build the Docker image.

```sh
TAG="test"
make docker-build-supernode DF_VERSION=$TAG
```

4. Obtain the latest Docker image ID of the SuperNode.

```sh
docker image ls|grep 'supernode' |awk '{print $3}' | head -n1
```

Or you can get it from [DockerHub](https://hub.docker.com/) directly.

1. Obtain the latest Docker image ID of the SuperNode.

```sh
docker pull supernode:0.4.0
```

### Start the SuperNode

**NOTE**: Replace ${supernodeDockerImageId} with the ID obtained at the previous step.

```sh
docker run -d --name dfsupernode -p 8002:8002 -v /home/admin/supernode:/home/admin/supernode ${supernodeDockerImageId} --advertise-ip=127.0.0.1 --download-port=8001
```

## Procedure - When Deploying with Physical Machines

1. Obtain the source code of Dragonfly.

```sh
git clone https://github.com/dragonflyoss/Dragonfly.git
```

2. Enter the project directory.

```sh
cd Dragonfly
```

3. Compile the source code.

```sh
make build-supernode && make install
```

4. Start the SuperNode.

```sh
supernode --home-dir=/home/admin/supernode --port=8002 --advertise-ip=127.0.0.1 --download-port=8001
```

5. Add the following configuration items to the Nginx configuration file.

```conf
server {
listen 8001;
location / {
# Must be ${supernode.baseHome}/repo
root /home/admin/supernode/repo;
}
}
```

6. Start Nginx.

```sh
sudo nginx
```

## After this Task

- After the SuperNode is installed, run the following commands to verify if Nginx and **Supernode** are started, and if Port `8001` and `8002` are available.

```sh
telnet 127.0.0.1 8001
telent 127.0.0.1 8002
```

- Install the Dragonfly client and test if the downloading works.

```sh
dfget --url "http://${resourceUrl}" --output ./resource.png --node "127.0.0.1:8002"
```

0 comments on commit cbe1eb2

Please sign in to comment.