Almost home server or tale about All-in-one, which could

Prologue


Looking ahead a bit, I’ll say that this is one of those stories about finding solutions that balance between costs and functionality and sharing experience with others in order to save time and nerves. Perhaps someone will see in the article a new application to the server that he currently has. In no case do I pretend to be an expert opinion in any of the topics discussed below and I will be glad to constructive criticism. The word “almost” appears in the title for the reason that, in my understanding, the device has gone beyond the server framework with which I imagine them. For those who are not interested in the way, but interested in the result - the dry residue with conclusions at the end of the article.

This saga began the summer before last, when I, having become very sick, was left at home alone with my bronchitis and a terrible desire to do something warm, lamp-like and cozy - to please myself. The idea of ​​centralizing many very useful functionalities in one device has long ripened in my head, so it was decided to move in this direction (and at the same time to deepen my knowledge in the * nix sphere, because until that moment they all came down to picking DD-WRT on their router). By the end of the day, the high level design of the requirements for the device was ready and in its initial form looked like this:

1) Silence - as an acoustic engineer by training, distorts me from this term, so we will stop at the fact that I should not hear the device from a distance of 1 m.

2) Dimensions- everything should fit in a shelf 160 mm high, there were no special restrictions on the length and width.

3) Give access to my 2 TB (at that time) screw with the main machine turned off - access should be for devices both inside the network (phone and laptop) and outside (working machine). Since I did not want to reinstall the software on the main machine, the critical requirement was to mount the disk as samba balls - as the same Disc D: that it was before.

4) The ability to raise your site for utilitarian needs - notifications of friends and acquaintances about new music arrivals on my FTP.

5) The ability to download torrents 24/7, again without turning on the BB .

After realizing the requirements, I began to look quite logically at NAS's and similar devices. But it turned out that in addition to an unsatisfactory pricing policy, this class of devices has for me personally a whole bunch of disadvantages: noisy fans, low processor power on board, large dimensions, limited functionality of the firmware and / or the inability to change it, etc. Raspberry-PI and others like that were dropped due to availability issues, too narrow platform specialization and poor cost-benefit ratio (bang for the buck, to put it another way).

Having studied the market a little more, I realized that I needed to build something of my own on x86. And once you have already assembled a full-fledged PC, then the list of initial requirements has begun to grow exponentially. But in order not to confuse the reader completely, I will try to tell you first about the evolution of iron, and then about software.

Iron


First, an audit was made of everything that was at hand - in order to know what to build on. She showed the presence of only one free DDR3 bracket for 2 gigabytes and the old Kingston SSD remaining at 64 GB after the upgrade. Total, it was necessary to determine the platform and cooling. Since the BB is based on the Core 2500K, for the purpose of interchangeability (and just because I wanted to), a stone for 1155 and an inexpensive Mini-ITX board were chosen. Especially without bothering and reading the tests of budget stones and boards, Celeron G530 and AsRock H67M-ITX were bought. At that time, all this cost ~ $ 150, which was quite invested in the budget of a mediocre NAS.

With cooling, everything was more complicated. I wanted to do something half passive in the spirit of the hulls with built-in fins or so. For this, an aluminum profile and at least an aluminum sheet were purchased. Initially, it was planned to make common ground for the processor and the hard drive with the case with blackjack and heat pipes and an external radiator that would be glued to the case through the thermal pad and blown by an external 120 mm. low speed fan. But then it was decided to abandon this venture mainly due to time limitations and I began to search for the proper housing for my setup, while simultaneously sorting out the software part. There was a problem in front of me: the screw, which was planned to be used as the main storage, was packed in Scythe Quiet Drive, which cope with the functions of cooling and noise reduction on a solid 5-ku. But at the same time, finding a compact case that would combine a 5 "bay, mini-ITX format and at the same time possess the right dimensions turned out to be an overwhelming task: all candidate cases had either a full-format power supply, or a lot of free space inside and an uncomfortable layout, or costing absolutely insane money. Omitting the details of emotional throwing and searching, I’ll say that for about half a year the server existed in the more than budget DTS mini-ITX CS23 package, which was bought to build the setup for at least something. or a lot of free space inside and an uncomfortable layout, or they cost absolutely insane money. Omitting the details of emotional throwing and searching, I’ll say that for about half a year the server existed in the more than budget DTS mini-ITX CS23 package, which was bought to build the setup at least for something. or a lot of free space inside and an uncomfortable layout, or they cost absolutely insane money. Omitting the details of emotional throwing and searching, I’ll say that for about half a year the server existed in the more than budget DTS mini-ITX CS23 package, which was bought to build the setup at least for something.

But, as usual, the craving for improvements and the desire to squeeze all this stuff into a really compact case prevailed: it was decided to make a compact case with air cooling and an external power supply that would satisfy all my requirements. And somehow a small challenge drew itself - to do all this without preliminary drawings for the day. I can’t call myself a seasoned modder, but I can call it a veteran, since I started 8-9 years ago with mods from the series “slot illumination in a three-inch drive”. But this building was my first (and last) brainchild, which was assembled without prior planning and, as they say, “by eye”. The photo of the insides of the case does not allow me to lay out a banal shame for what I did, because at each stage of the work I had to endure the flow of obscene and fierce hatred from the internal perfectionist. You are welcome,

With grief, I finished the assembly of the body in half and pasted it with a black matte automotive film, I received the following:





Dimensions: 250x200x150mm. (DHA). Inside, all the walls are glued with a budget Shumka for a car to cut off high frequencies and the remnants of the upper middle, which break through from the body with a screw. An external power supply was never found separately from the case, therefore, the DTS E-3001 case was purchased, which became a donor of a 60-watt PSU and parts of the platform for mounting the motherboard.

At that time, the temperature statistics inside the case left much to be desired: a boxed cooler + dense layout of elements + an air bag created inside the shelf where the case was placed + strict noise requirements (and, as a result, low fan speeds) gave 63-65 degrees at full loading the processor or 49-51 in idle time, even despite the purge of almost the entire body of the 120th at reduced speeds. Since the stone changed from Celeron G530 to a bit hotter under load of Core i3-3225 due to the problem described by me below in the “Software” section, it was necessary to look for a way out of the situation. As it turned out, there were not so few alternatives in the low-profile budget segment, but only a few were worthy. The choice fell on Arctic Freezer 11 LP, and here's what I got: in the summer in a room without air conditioning in idle time 43-44 degrees, and under load the temperature did not exceed 57 degrees. This was already much more like temperature for continuous continuous use.

Later the hard drive was replaced with 3 TB WD NAS series, an external USB 3.0 card reader was added, the RAM was expanded to 8 GB, and in this configuration my home processor exists to this day. But all this would be just research on the case for a mini-PC, if not for software.

Software


Initially, there was no question of choosing a software platform - it was decided to use Ubuntu due to its popularity and popularity (and I just wanted to see what it is). I chose the Desktop version due to the fact that already at this stage I planned to use the server as a media player connected to the 47 "panel so as not to turn on the BB again. At that time, 12.04 LTS just came out, so I immediately rolled it and got acquainted.

Acquaintance was immediately overshadowed by decent Unity brakes via VNC with a bad channel. And since server management was meant only remotely and not only from the internal network, the decision to transfer to Gnome was quite predictable. But here I ran into such problems: tearing when watching a video that was not available on the unit and periodic artifacts when watching a video by mplayer using hardware decoding via the integrated Intel HD3000. Mplayer was chosen because of its simplicity, speed, the presence of any software for the remote control for Android, and most importantly - the minimum use of processor resources. A few hours of googling showed that I am not alone in both problems. And if the first was solved using the vaapi-gl codec instead of the default vaapi, then the solution for the second was never found by me. Different sources sounded different opinions about the reasons: from crooked mesa drivers, to crooked instructions for hardware video decoding in the processor. In favor of the latter, a comparison of the HD3000 and HD4000 pictures, where artifacts were absent with identical mplayer settings, spoke. In the end, this fact (and a slight lack of processor power) was the impetus for the transfer to the Core i3-3225.

SSHMote (now Project Coversal) is still used as a remote control for watching videos, which, in addition to a lot of advantages, has one huge drawback - when using SSH, connecting to a lost session is impossible (or I did not find how to do it, although I picked it up decently). In practice, this means that if for some reason (the phone closed the application to free memory, lost connection with the router, etc.) the SSH session was broken, you have to connect to the server via VNC or again SSH, close the application and reopen again. Or watch a video without the ability to control it, because when you open a new session through SSHMote, a new window opens and we get two videos from which we can control one.

As my Wishlist evolved, new functionality was sawn to the server. In order not to bother with a description of all the ordeals, it’s better to go through the list in detail, touching upon the main problems in implementing this or that functional:

1) NAS - the storage is shared by samba. I won’t specifically give the ideal measurements for copying from balls to it, I’ll better say that from the experience of using it with TP-Link 1043ND, and then with ASUS RT-AC68U, I never rested on disk speed, according to subjective feelings.

2) Torrent rocking- almost the only point with which there were no problems at all. Transmission-gtk + TransGui to access it + Remote Transmission for Android. The latter, however, has several nuances, and among them is the inability to add downloads to a folder other than the default on the server.

3) FTP - no surprises here: vsftpd + pam authentication. But, as it turned out, setting it up as needed turned out to be problematic. Apparently, no one but me had the idea of ​​such a perverted form of use:

anonymous access - the user is locked into the pub folder with read only privileges;

access with login and password - the user has access to all FTP - income and pub folders with full access rights to both folders (here the problems started).

Most likely I had (and have) failures in understanding the principle of vsftpd restriction of rights, but in order to configure this scheme the way it works, it took me half a day, and to be completely honest, I still do not understand why it worked with just those settings.

4) Radio- it was originally planned to use IDJC in conjunction with icecast2 for broadcasting music, but IDJC behaved badly and ate memory, so it was replaced by a banal, but faultless and undemanding to mpd resources. It is simple as a corner of the house and performs only one function - to broadcast the playlist outside the apartment, where everyone from my friends can hear it. I didn’t take the metrics (although I should, of course), but with a good gigabit channel 20-30 peers, the server pulls without any major changes to the processor load.

5) Photo Bank- I have long wanted to merge my photo into the storage without the participation of the main machine and, preferably, me too. To do this, a simple script was written on the bash, which is tied to incrond. Both CF cards were registered in fstab for static mounting in the same folders. After I insert the card into the incrond card reader, which monitors the appearance of one of the two folders, my script starts working. For proper timing, I had to add a pause of 5 seconds. The script copies all the photos from the card to a folder of the form ../Foto/Unsorted/dd.mm.yyyy and then removes them from the card.

6) Virtual machines- in order for me to always have a Win7 x64 machine with the necessary software installed on it, I decided to raise one using Virtual Box. After forwarding the ports on the router, I got a kind of proxy with which I can do what I need, if this is not allowed on the network I'm on. Everything went smoothly with the exception of one moment, on which I just spat and postponed its solution until better times: it is impossible to correctly automatically turn off the machine when the server reboots. Having looked at all sorts of solutions through scripts in the rc folders, I realized that most likely the problem was in the rights, but I couldn’t understand what was wrong with them. Since I overload the server, to put it mildly infrequently, the solution to the problem was postponed until about 2017.

7) Game server- periodically rise on demand server CS 1.6 and LFD2. They start absolutely without problems with a half kick.

8) Video player - using a bunch of mplayer2-vaapi + SSHMote. Both work flawlessly, except for the nuances with control that were described earlier. The percentage of processor load when playing the heaviest rips FullHDx60FPS - 3-4%. Among the shortcomings of such a setup, it is worth noting the almost complete impossibility of working with playlists: if the ability to download only the entire folder and navigation on this list will be only forward and backward - and then blindly. A specific file from a folder can be selected only in the single-file playback mode.

9) Music player- VLC is used in conjunction with Remote for VLC for android. As for me, this is the best option - a convenient widget for the remote control, support for everything you can expect from an audio player and there are no problems with reconnecting sessions.

10) Web server - apache + Joomla is used for the reason "The simpler the better." On the Internet, a lot of manuals on how to raise such a configuration, I took the first one I got. Both sites that are spinning on the server are utilitarian in nature and the number of unique visits does not exceed 10-20 per month for two.

11) Perforce P4 server - a free version of P4 for 20 workspaces was chosen as vcs for its microprojects, without limitation on the number of files. Here, too, everything is transparent - everything is configured and working, you can say “out of the box”.

12) Games - as it turned out, the HD4000 is enough to play something undemanding, without interfering with the functioning of all other services. As a proof of concept, Jets'n'Guns, re-purchased on Steam, resubmitted, connecting one of two xbox wireless receivers to the server.

The research plans are mainly in the direction of a smart home:

13) Video surveillance - I would like to stream to the server from the camera, which will show the parking lot and also install video eyes.

14) GPS statistics - in warm time I go to work mainly on a bike, in winter I drive a car, I'm going to put GPS trackers on both of them. I would like to gash a variety of samples on routes to places and other things. Just for fun.

fifteen)Device management - in the remote control from the TV, the battery cover is broken off, because of this it is constantly buggy. In the remote control from the receiver, there are always dead batteries and you have to get up and adjust the volume manually. Since none of this is included in my plans, when I brought myself tea and tuned in to watch a movie on my bed, I had to look for a way out of the situation. And for now, he is alone: ​​a remote USB IR transceiver + software that can be trained once with all the signals from all the remote controls - and then do whatever you want with them through a smartphone.

16) Updating music on the phone- when the phone connects to the home network, the samba server automatically starts on it and shares the phone’s memory card. I wanted to write a script that, if something new appeared in the music folder on the server, it would automatically upload this new to the phone in the New folder, after deleting the oldest of the subfolders in this folder, if there is not enough space for downloading. Thus, it is supposed to automatically rotate the music on the phone almost without my participation - you just need to remotely put the torrent to download and upon arrival home everything will happen by itself.

17) Whatever comes to mind - ...

conclusions


The article turned out to be a bit messy and not as focused as we would like, but still I hope that I managed to convey the main points. At the moment, my “almost server” has paid off with interest: for money comparable to a good NAS, I got much more functionality than the best representatives of this class of devices could provide. And the best part is that there is enough headroom for expanding this functionality for my needs and will not have to be spent on upgrading the basic elements for at least another year or two, or even more. It was also possible to achieve the “invisibility” of the device in everyday life - due to its small size it is almost not visible among other things in the cabinet and is completely inaudible even with my sensitive ears.

Thank you for your attention, I am waiting for criticism, feedback and suggestions in the comments.

Also popular now: