Set up your Own Gateway

Public OSS Gateway

CESS provides a public Object Storage Service Gateway:

Address:http://deoss-pub-gateway.cess.cloud/

Account:cXhwBytXqrZLr1qM5NHJhCzEMckSTzNKw17ci2aHft6ETSQm9

💁‍♂️ If you are using the public Object Storage Service, you can skip the following sections in this chapter.

⚠️ When using the public gateway, there might be failures due to network instability. You can follow the steps below to deploy your own Object Storage Service Gateway.

Setting up your own OSS Gateway

Configuration requirements

System configuration: Linux-amd64

Golang version: Go1.19 or above

⚠️ The following commands are executed with root privileges, if the prompt Permission denied appears, you need to switch to root privileges, or add sudo at the top of these commands.

Basic environment

For the Debian and ubuntu families of linux systems:

apt install git curl wget vim util-linux -y

For the Fedora, RedHat and CentOS families of linux systems:

yum install git curl wget vim util-linux -y

Firewall set up

By default, DeOSS uses port 8080 to listen for incoming connections and internally uses port 4001 for p2p communication, if your platform blocks these two ports by default, you may need to enable access to these port.

ufw

For hosts with ufw enabled (Debian, Ubuntu, etc.), you can use the ufw command to allow traffic to flow to specific ports. Use the following command to allow access to a port:

ufw allow 8080
ufw allow 4001

firewall-cmd

For hosts with firewall-cmd enabled (CentOS), you can use the firewall-cmd command to allow traffic on specific ports. Use the following command to allow access to a port:

firewall-cmd --get-active-zones

This command gets the active zone(s). Now, apply port rules to the relevant zones returned above. For example if the zone is public, use

firewall-cmd --zone=public --add-port=4001/tcp --permanent
firewall-cmd --zone=public --add-port=8080/tcp --permanent

Note that permanent makes sure the rules are persistent across firewall start, restart or reload. Finally reload the firewall for changes to take effect.

firewall-cmd --reload

iptables

For hosts with iptables enabled (RHEL, CentOS, etc.), you can use the iptables command to enable all traffic to a specific port. Use the following command to allow access to a port:

iptables -A INPUT -p tcp --dport 4001 -j ACCEPT
iptables -A INPUT -p tcp --dport 8080 -j ACCEPT
service iptables restart

Generate Binary Program

Method1:download directly

Execute the following cmd to download:

wget https://github.com/CESSProject/DeOSS/releases/download/v0.3.4/deoss

Add execution privilege:

chmod +x deoss

💁‍♂️If you have successfully downloaded using Method 1, you can skip Method 2.

Method 2: Compile from source code

Install Golang

DeOSS requires Go 1.20 or higher, See the official Golang installation instructions.

Open go module:

go env -w GO111MODULE="on"

Users in China can add go proxy to speed up the download:

go env -w GOPROXY="https://goproxy.cn,direct"

Check the Golang version to verify whether the installation is successful:

go version

Compile source code

Clone DeOSS source code and generate deoss binary program after compilation:

git clone https://github.com/CESSProject/DeOSS.git
cd cess-oss/
go build -o deoss cmd/main.go
chmod +x deoss

Configuration file

Generate profile template in the current directory:

./deoss config

By default, DeOSS uses conf.yaml in the current directory as the runtime configuration file.

You can also specify the configuration file location using -c or -- config.

⚠️ the configuration file cannot be missing.

Open and modify conf.yaml:

vim conf.yaml

The content of the configuration template is as follows:

# The rpc endpoint of the chain node
Rpc:
  - "wss://testnet-rpc0.cess.cloud/ws/"
  - "wss://testnet-rpc1.cess.cloud/ws/"
  - "wss://testnet-rpc2.cess.cloud/ws/"
# Bootstrap Nodes
Boot:
  - "_dnsaddr.bootstrap-kldr.cess.cloud"
# Account mnemonic
Mnemonic: "xxx xxx ... xxx"
# Service workspace
Workspace: /
# P2P communication port
P2P_Port: 4001
# Service listening port
HTTP_Port: 8080

Rpc:The node address of the CESS chain. You can set up your own chain node or use the RPC addresses we provide:

Public RPC Address1:wss://testnet-rpc0.cess.cloud/ws/

Public RPC Address2:wss://testnet-rpc1.cess.cloud/ws/

Public RPC Address3:wss://testnet-rpc2.cess.cloud/ws/

Boot:The bootstrap node address in the P2P network. The official bootstrap node address provided by CESS is:

_dnsaddr.bootstrap-bucket.cess.cloud

Mnemonic:The mnemonic of your wallet account. Please refer to the CESS wallet for wallet acquisition. This account is used to pay the Gas fee for blockchain transactions.

Workspace:The directory where data is stored, including logs, caches, uploaded or downloaded files, etc.

P2P_Port: The port for P2P communication, default is 4001.

HTTP_Port: The port for user access to the deoss service, default is 8080.

⚠️After modification, please save the configuration file.

Run DeOSS

Running DeOSS in the background:

nohup ./deoss run 2>&1 &

After running successfully, you can share the wallet address and IP address with other users, who can use your gateway to send HTTP requests.

Other operations

Check deoss status:

./deoss stat

Exit deoss:

./deoss exit

Last updated