Synology provided me the opportunity to test a NAS device: the DS212j. In the next couple of weeks, I will write a review of this device split over a number of blog posts. It will be a rather untraditional NAS review, because I will also spend time looking at its features for running .NET and PHP code, how easily it can run developer tools and finally I will have a look at the SDK.
- The Synology DS212j
- Setting up a Development environment on the NAS
- Running custom .NET/PHP/… code (this article)
- A look at the DSM4.1 SDK
In this third part of the review of the Synology DS212j, we will have a look at the device its capabilities to host custom written software. The DSM operating system is in essence a Linux based operating system powered by the well-known Apache web server. This means that most of your software should run without glitches. The only differences between the DS212j and traditional servers are the different CPU architecture (ARM vs. x86) and the fact that the device is using an embedded (and thus slower) processor.
Please note: the high-end devices of Synology are equipped with more powerful Intel processors.
I will mainly concentrate on the hosting of web based applications, although nothing prevents you from running custom console applications on the device as well.
One of the optional packages that can be installed on the DSM OS is a DNS server. End users should never be confronted with IP addresses of computers. They should use human readable domain names. If you do not already have a DNS server on your local network, I highly recommend setting this up on the DS212j. This way, you can give nice domain names to all your applications hosted on the DS212j.
I choose to create a master zone called “intranet”. In this master zone, I created all the necessary resource records for my hosting needs.
Please note: once you have set up the DS212j as the DNS server for your network, you are not restricted to using it solely for assigning domain names to the NAS itself. You can use it to assign domain names to any device in your network.
Out of the box the DSM OS comes equipped with the Apache web server and support for PHP. By using the package center, support for various other programming languages (Python, Perl and Mono) can easily be added.
Furthermore support for MySQL databases is available and the phpMyAdmin management can be installed for easy database management. No other databases are available in package center.
Uploading web applications
Uploading a web application to the NAS is easy. It is sufficient to copy the web application to a subdirectory of the special “web” share on the NAS by FTP, Windows networking or WebDAV.
Optionally, virtual directories can be created using the configuration panel of the DSM OS.
.NET (with Mono)
Thanks to the Mono project, the DS212j has the ability to run .NET software. Unfortunately, the version of Mono available in the package center is still version 2.11. This version does not yet include support for ASP.NET MVC 4.0.
From Mono 3.0 onwards, the Mono developers bundled the open source ASP.NET MVC framework of Microsoft. So .NET developers are currently restricted to using ASP.NET 3.5 Webforms features. Let’s all hope Synology will update the Mono package in the near future 🙂
I created a couple of test ASP.NET applications and most basic features seem to work without real issues as long as you stick to ASP.NET 3.5. I was not able to easily deploy ASP.NET 4.0 applications (Mono complained about various issues with my web.config).
Publishing from Visual Studio 2010/2012
Visual Studio provides the possibility to publish web applications straight from the IDE to a web server. In order to publish to the DSM OS you must ensure that FTP is activated on the NAS. Once this is the case, you can configure Visual Studio by right clicking on the project node and selecting the “Publish…” option.
In the Publish screen you can create a new publish profile for the NAS as shown on the screenshots below.
You can also use the web.config transformation mechanism to modify the web.config for the release build if other settings are required on the DSM OS. You could also whish create a dedicated build configuration for publishing to the NAS.
For more information, please see the following MSDN links:
The DSM OS offers out of the box a fully functioning PHP 5.3.21 environment. Unlike the limited .NET hosting support offered through Mono, the PHP support is 100% the same as on any other Linux server. This means that most of your applications can run on the DS212j with no or minor modifications.
I am by no means a PHP expert, but during this part of the review I used the opportunity to develop a simple mobile web application in jQuery Mobile and PHP. I encountered no issue at all to migrate the app from my Windows machine to the DSM. The entire application continued to function correctly.
Depending on the requirements, the DS212j can be a great hosting environment for running your own (web) applications. It comes with support for most of the programming languages you expect to have on a Linux server. Just keep in mind that the NAS is powered with an ARM CPU optimized for low power consumption. Do not expect to see the same performance as offered by modern computers or servers.