﻿# SeaweedFS

> [HTML Version](seaweedfs.html)

In this article, we’ll see how to install SeaweedFS as an S3 object storage solution for BRIX. The article covers installing SeaweedFS in a single-node, single-disk (SNSD) configuration. This configuration does not provide additional reliability or availability beyond that provided by the basic storage volume (RAID, LVM, ZFS, etc.).



Before installation, please review the following information:



- SeaweedFS licensing in the [official documentation](https://seaweedfs.com/docs/deploy/).

- Supported SeaweedFS versions and other requirements in [System requirements for BRIX On-Premises](elma365-enterprise-on-premises.md#s3).

- Infrastructure options for running the BRIX system for [Prepare BRIX On-Premises infrastructure](infrastructure-preparation.md).



The installation consists of several steps:



1. [Install Docker and Docker Compose](#docker).

2. [Install SeaweedFS](#install).

3. [Install the MC Client](#mc-client).

4. [Start the SeaweedFS service](#start-service).

5. [Configure a connection to SeaweedFS](#connection).

6. [Create a bucket](#bucket).

7. [Connect to SeaweedFS](#seaweed-connect).



## Step 1: Install Docker and Docker Compose



To install SeaweedFS, you will need the following tools:



- Docker. Install according to the instructions for your operating system on the [official website](https://docs.docker.com/engine/install/).

- Docker Compose. Install according to the instructions for your operating system on the [official website](https://docs.docker.com/compose/install).



## Step 2: Install SeaweedFS



1. Create a directory to mount the disk:

````
mkdir -p /opt/seaweedfs/data/

2. ````
Create a `docker-compose.yml` file:

````
version: "3.9"  
services:  
  seaweedfs:  
    image: chrislusf/seaweedfs:4.06  
    command: >  
        server   
        -ip.bind=0.0.0.0   
        -s3   
        -s3.config=/etc/seaweedfs/s3.json   
        -s3.port=8333  
    ports:  
      - "8333:8333"  
    volumes:  
      - /opt/seaweedfs/data/:/data  
      - /opt/seaweedfs/s3.json:/etc/seaweedfs/s3.json:ro  
    restart: unless-stopped  
    healthcheck:  
      test: \["CMD", "curl", "-f", "http://localhost:9333/cluster/status"\]  
      interval: 30s  
      timeout: 10s  
      retries: 3

3. ````
Create the `/opt/seaweedfs/s3.json` file:

````
\{  
  "identities": \[  
    \{  
      "name": "admin",  
      "credentials": \[  
        \{  
          "accessKey": "brix365user",  
          "secretKey": "SecretPassword"  
        \}  
      \],  
      "actions": \["Admin", "Read", "Write"\]  
    \}  
  \]  
\}

````


Configuring TLS/SSL in SeaweedFS

  
To enable TLS/SSL support in SeaweedFS:



1. Save the certificate file and private key file in the `/opt/seaweedfs/certs` directory.

2. Rename the server certificate file to `cert.pem`.

3. Rename the private key file to `key.pem`.

4. When using self-signed certificates, save the root CA file in the `/opt/seaweedfs/certs` directory.

````
version: "3.9"  
services:  
  seaweedfs:  
    image: chrislusf/seaweedfs:4.06  
    command: >  
        server   
        -ip.bind=0.0.0.0   
        -s3  
        -s3.https.port=8443  
        -s3.cacert.file=/etc/seaweedfs/certs/ca.pem  
        -s3.cert.file=/etc/seaweedfs/certs/cert.pem  
        -s3.key.file=/etc/seaweedfs/certs/key.pem  
    ports:  
      - "8443:8443"  
    volumes:  
      - /opt/seaweedfs/data/:/data  
     - /opt/seaweedfs/s3.json:/etc/seaweedfs/s3.json:ro  
     - /opt/seaweedfs/certs:/etc/seaweedfs/certs:ro  
    restart: unless-stopped  
    healthcheck:  
      test: \["CMD", "curl", "-f", "http://localhost:9333/cluster/status"\]  
      interval: 30s  
      timeout: 10s  
      retries: 3
````

````


## Step 3: Install the MC Client



Download the latest stable [SeaweedFS Client](https://min.io/docs/minio/linux/reference/minio-mc.html) binary and install it on your system:

````
wget https://dl.min.io/client/mc/release/linux-amd64/mc  
chmod +x mc  
sudo mv mc /usr/local/bin/

````


## Step 4: Start the SeaweedFS service



Run the manifest:

````
docker-compose -f docker-compose.yml up -d

## ````


## Step 5: Configure a connection to SeaweedFS



Create an alias for SeaweedFS:

````
/usr/local/bin/mc alias set seaweedfs http://SeaweedFS.your\_domain:8333 brix365user SecretPassword

````


## Step 6: Create a bucket



**Important**: Bucket names in S3 must follow the format **s3brix365\***. In the example of this article, the bucket name is **s3brix365**, the user is **brix365user**, and the password is **SecretPassword**. When setting this up, configure this information according to your organization's security policy.



Examples of bucket names: **s3brix365**; **s3brix365-dev**; **s3brix365-prod**.



For BRIX operation create a bucket named **s3brix365** using the command:

````
/usr/local/bin/mc mb -p seaweedfs/s3brix365 --region=eu-central-1

````


## Step 7: Connect to SeaweedFS



Parameters for connecting to SeaweedFS:

- `address`: `seaweedfs.your\_domain:8333`.

- `bucket`: `s3brix365`.

- `region`: `eu-central-1`.

- `access key ID`: `brix365user`.

- `secret access key`: `SecretPassword`.

- `upload method`: `PUT`.

- `enable SSL`: `No`.



If SeaweedFS is waiting for a TLS/SSL connection, set the `enable SSL` parameter to `Yes`.

