Synology on Rails Part V: Automate the Rest

6 September 2024 about a 1 minute read

When last we left our intrepid heroes, the final couple of steps of the Rails app deployment to a Synology NAS were still manual. It still took mouse clicks in the Container Manager to pull the image from the registry and rebuild the Project.

Good News, Everyone!

Pivot Luke Winikates has put together the SynoCtl project which can drive the Synology DSM via its own API. He snooped the http traffic from the web UI, checked out some other “let’s automate DSM” projects (the project page has some good references), and got to work. The result is a Golang SDK and an executable that I was able to use in my rake tasks to automate the remaining deploy steps.

What’s New?

I’ve updated the rake tasks project to use synoctl. There are now rake tasks for pulling the image into the Container Manager Project and rebuilding/restarting the Project.

Synoctl requires more configuration values than I had, which made the tasks more messy. Thanks to some inspiration from Bradley Schaefer, I moved to an RSpec-like configuration in a separate file.

Lastly, I added a namespace for the tasks. Which meant a bit more explanation in the README. And,yes, I’ve already moved another app to using this file.

Now with one rake command and a few minutes, we can deploy a new version of a Rails app to the Synology Container Manager and get it restarted. This is a happy place to be.

ps: Big thanks to Luke and Bradley!


This article is part of the series Synology on Rails and is tagged with web development, ruby, rails, software engineering, and deployment.