I released PiCluster last week and wanted to show how to run the Scality S3 server with it using Docker. Scality S3 is an open-source object storage server. PiCluster is a simple and lightweight container management and orchestration framework that I wrote in Node.js. Besides running containers, PiCluster can also perform health checks on applications to ensure that a service is actually running. Before we begin, I am assuming that you already have Docker installed. Lets get started by downloading PiCluster.
First, click here to download the zip file and extract it. Next, navigate to the Docker subdirectory and create an empty folder called s3.
Creating the Scality S3 Server Dockerfile
Now, we will need to create a file called Dockerfile inside the s3 folder so PiCluster can build the image later. Let’s begin by saving and examining the contents in this section to Dockerfile:
Per the Dockerfile, the container will be built using the base Ubuntu image from the registry. The remaining lines in the file will install Node.js, set a few environment variables for the storage locations, and pull the S3 server code from the Scality Git repository.
Configuring PiCluster to run Scality
Now use your favorite text editor and edit config.json in the PiCluster directory and replace all the text with the information below.
As you can see the the config, this is a single node setup where everything is configured to run on localhost.
Before proceeding, please have the latest version of Node.js installed. Done? Great! Now use npm to install the modules. From a terminal, cd into the server, agent, and web directories one at a time and run “npm install”. When npm is finished running for all three directories, it is time to start each service in the background per the instructions below.
Access the Web Console
If you got this far, it is time to access the web console and build the image! In your browser, navigate to to http://127.0.0.1:3003 and login with the default credentials of admin/admin.
(If you see any heartbeat errors, ignore them. I will go over that later)
To build the image:
Now the image should be building in the background and it may take a while. You can check the status of the tasks by clicking on “Operations -> Running Containers”. When they are done, you can create and start the container by clicking create.
The container should be running now. To verify, click on “Operations -> Running Containers”.
Great S3 is running! Now I will need to modify /etc/hosts and connect to the s3 server with an S3 client per my previous post.
Since PiCluster created the image and can now control the s3 container, let’s test out the heartbeat feature. From the terminal type: “docker stop s3” to stop the s3 container. After ten seconds, the s3 container should be automatically started by PiCluster per the heartbeat interval defined in config.json. To verify that s3 is running, return to “Operations -> Running Containers” to see the s3 container is running.
To do a manual heartbeat, return to the PiCluster web interface and click “Operations -> Heartbeat” and then go to “Operations -> Running Containers” to see the running containers.
I hope that you enjoyed reading about how to run the Scality S3 server on PiCluster. Although this was a single node demo of PiCluster, I think it is a good way to test it out before you begin orchestrating containers across multiple nodes.