My previous post was about using Cloud Explorer with the Scality S3 server. After I published that post, I thought it would be informative to go one step further and explain how I use the S3 server in homeduction (applications run at home in production). My homeduction environment consists of four Raspberry Pi’s running Docker that power this WordPress blog and many other applications . My goal is to add an S3 server to store the images for this blog and anything else that I can come up with.
Let’s begin by saving and examining the following 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, pull the S3 server code from the Scality Git repository, modify the local and specified region names for my domain, and upload a file with access and secret keys for me to use in an S3 application.
Now let’s create a new file (authdata.json) per the snippet below and configure the user information and S3 credentials.
In authdata.json, simply modify the name, email, access, and secret key values above to what you want. The access and secret key values is what your S3 application will use to connect to the S3 server. I just put in a random alpha-numeric string for both entries. When the Docker image is built, it will overwrite the existing default and insecure authdata.json file in the configuration directory.
Now let’s build the image from the Dockerfile and run it:
The above “docker run” command uses the volume arguments (-v) to store the files and metadata on the node itself. I added both of the directories to a Git repository for version control and easier migration to another node if needed. The Docker container should be up and running in a few minutes and listening on port 8000. I exposed the port on my home router so I can access it externally from anywhere.
For S3 clients to resolve buckets, your domain name needs a DNS wildcard address. I added a wildcard entry for my domain (*.linux-toys.com) from my domain name provider’s website. With all that done, I can now begin to configure an S3 application. I setup Cloud Explorer just like I did in the previous post, but did not have to worry about modifying /etc/hosts because DNS is being used.
I serve the images on this blog by uploading them to a bucket and setting the permission to public:
In WordPress I can click “Add Media”, paste the link, and then it will be inserted into the blog post.
I hope that you enjoyed this post and learned how to setup Scality S3 for homeduction use. I am always thinking of ways that I can improve my home setup with solutions like Scality. The limit is your imagination regarding what you can do with object storage. Try your best to be creative in finding new ways to make homeduction great again.