📜 ⬆️ ⬇️

Home almost server or tale about All-in-one, which could

Prologue


Looking ahead, I will say that this is one of those stories about finding solutions, balancing between costs and functionality and sharing experience with the rest, 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 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 path, but the result is interesting - a dry residue with conclusions at the end of the article.

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

1) Noiselessness - as an engineer-acoustics by education, distorts me from this term, so let us dwell on the fact that I should not hear the device from a distance of 1 m.

2) Dimensions - everything should fit in a shelf with a height of 160 mm, there were no special restrictions on the length and width.
')
3) To give access to my 2 TB (at that time) screw with the main machine turned off - access should be for devices both within the network (telephone 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 - notifying friends and acquaintances about new music arrivals on my FTP.

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

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

After studying a little more market, I realized that I need to collect something of their own on x86. And since already collecting a full-fledged PC, then the list of initial requirements began to grow exponentially. But in order not to confuse the reader completely, I will try to first talk about the evolution of iron, and only then about software.

Iron


First, a revision was made of everything that was at hand - in order to know what to push off from. It showed the presence of only one free strip of DDR3 for 2 gigabytes and the remaining one after the upgrade of the old SSD Kingston 64 GB. Total, it was necessary to determine the platform and cooling. Since the Core 2500K stands on the BB, for the sake of interchangeability (and just because it wanted to), a 1155 stone and an inexpensive Mini-ITX board were chosen. Especially not bothering and reading the tests of budget stones and boards, were bought Celeron G530 and AsRock H67M-ITX. At that time, all this cost about $ 150, which was fully invested in the budget of the average 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 was purchased. It was originally planned to make points of contact for the processor and the hard drive with the case with blackjack and heat pipes and the external radiator, which would be glued to the case through the thermal pad and blown with an external 120 mm. fan at low revs. But then it was decided to abandon this venture mainly due to time constraints and I started searching for the proper package for my setup, in parallel with 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 coped with cooling and noise reduction functions into a solid 5-ku. But at the same time, finding a compact case that would combine a 5 "compartment, mini-ITX format and at the same time had the right size turned out to be daunting: all the candidate cases had either a full-format power supply unit, or a lot of free space inside and an uncomfortable layout, or costing absolutely irresponsible money. Lowering the details of soul-searching and searching, I will say that for about six months the server existed in more than a budget DTS mini-ITX CS23 package, which was purchased to build at least something.

But, as usual, the desire for improvement and the desire to squeeze all that stuff into a really compact case took over: it was decided to make a compact case with air cooling and an external power supply unit that would satisfy all my requirements. And somehow a small chelendzh appeared by itself - to do all this without preliminary drawings for the day. I can’t call myself a mod mod, but I can call a veteran of this business, as I started 8-9 years ago from mods from the series “slot lighting in a three-inch drive”. But this corps 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 body does not allow me to put a banal shame for what I did, because at every stage of the work I had to endure the flow of mate and fierce hatred from the inner perfectionist. Please never repeat such experiments if there is no experienced psychologist nearby.

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





Dimensions: 250x200x150mm. (DHA). Inside, all the walls are plastered with a budget Shumkov for a car for cutting high frequencies and the remnants of the upper center, which make their way out of the case with a screw. The external power supply unit was never found separately from the case, so the DTS E-3001 case was purchased, which became a donor of 60 watts power supply units and parts of the platform for mounting the motherboard.

At that time, the temperature statistics inside the case left much to be desired: a box cooler + a dense arrangement of elements + an air cushion created inside the shelf where the case was placed + stringent noise requirements (and, as a result, low fan speeds) gave 63-65 degrees at full CPU load or 49-51 in idle time, even though almost the entire chassis is blown out at 120 speeds at low revs. Since, as a consequence of the problem I described in the Soft section below, the stone changed from the Celeron G530 to a slightly hotter Core Core i3-3225, it was necessary to find a way out of the situation. As it turned out, there were few alternatives in the low-profile segment of the budget segment, but there were only a few decent ones. The choice fell on the Arctic Freezer 11 LP, and this is what I got: in the summer in a room without air conditioning in a simple 43-44 degrees, and under load the temperature did not exceed 57 degrees. This is much more like a temperature regime for long-term 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 still exists. But all this would be just research on the subject of housing for a mini-PC, if not for the software.

Soft


Initially, the question of choosing a software platform was not - it was decided to use Ubuntu because of its widespread popularity (and I just wanted to see what it was). I chose the desktop version for the reason that at this stage I planned to use the server as a media player connected to a 47 "panel, so as not to switch on the BB once again. At that time, just 12.04 LTS was released, so I was immediately approached and familiarized.

The acquaintance was immediately overshadowed by decent Unity brakes through 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 completely predictable. But here I encountered the following problems: tearing when watching a video that was missing from the unit and periodic artifacts when watching the video by mplayer using hardware decoding through the integrated Intel HD3000. Mplayer was chosen because of the simplicity, speed, the presence of any kind of software for remote control for Android and, most importantly, minimal use of processor resources. A few hourly google showed that in both problems I am not alone. And if the first one was solved using the vaapi-gl codec instead of the default vaapi, then the solution for the second was not found by me. Different sources sounded different opinions about the causes: from the curves mesa drivers, to the curves of instructions for hardware decoding of video in the processor. The latter were favored by comparing the HD3000 and HD4000 images, where artifacts were absent with identical settings of mplayer. In the end, this fact (and a small shortage of processor power) was the impetus for a transfer to the Core i3-3225.

SSHMote (now Project Coversal) is still used as a remote control for watching videos, which in addition to the mass of advantages has one huge disadvantage - when using SSH, connection to a lost session is impossible (or I didn’t find how to do it, although I picked it decently). In practice, this means that if for some reason (the phone closed the application to free up memory, the connection with the router was lost, etc.) the SSH session was terminated, 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 manage it, because when you open a new session through SSHMote, a new window opens and you get two videos from which we can manage one.

In process of evolution of my hotelok to a server the new functionality was drilled. In order not to bother with the description of all ordeals, I’d better go through the list in detail, touching on the main problems in implementing this or that functionality:

1) NAS - storage shared by samba. Ideal measurements on copying from the balls and on it I will not specifically bring, I'd rather say that according to the experience of using Spark with TP-Link 1043ND, and then with ASUS RT-AC68U I never rested on the disk speed, according to subjective sensations.

2) Torrent rocking chair - almost the only item 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 impossibility of adding a download to a folder other than the default on the server.

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

anonymous access - the user is logged into the pub folder with read only rights;

access with login and password - the user has access to the entire FTP - income and pub folders with full access rights in both folders (this is where the problems started).

Most likely I had (and have) failures in understanding the principle of limiting vsftpd rights, but in order to set up 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 exactly with these settings.

4) Radio - it was originally planned to use IDJC in conjunction with icecast2 to broadcast music, but IDJC behaved poorly and ate the memory, so it was replaced with a banal, but reliable and undemanding to mpd resources. It is simple as a corner of the house and performs only one function - broadcasting a playlist outside the apartment, where everyone from my acquaintances can hear it. I did not remove the metrics (although it would have been necessary, of course), but with a good gigabit channel, 20-30 peers are pulling the server without any serious changes in the processor load.

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

6) Virtual machines - in order that I always had a Win7 x64 machine on hand with the necessary software installed on it, I decided to raise it with the help of Virtual Box. After port forwarding on the router, it turned out to be some kind of proxy, with which I can do what I need, if this is not allowed in the network in which I am. Everything went smoothly with the exception of one point, which I just spat and postponed his decision until better times: it is impossible to automatically automatically redeem the machine when the server is restarted. After reviewing all sorts of solutions through scripts in rc folders, I realized that, most likely, the problem was in the rights, but I could not understand them so specifically. Since the server is overloaded to say the least infrequently, the solution to the problem was postponed by about 2017.

7) Game server - CS 1.6 and LFD2 servers periodically rise on demand. Start absolutely no problem with half a pint.

8) Vidioplayer - a bunch of mplayer2-vaapi + SSHMote is used. Both work flawlessly, except for the nuances with management, which were described earlier. The percentage of CPU usage when playing the heaviest FullHDx60FPS rips is 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 navigating through this list will only be forward-backward - and then blindly. A specific file from the 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 handy widget for remote control, support for everything that can be expected from an audio player and there are no problems with reconnecting sessions.

10) Web server - apache + Joomla is used because of “The simpler, the better.” On the Internet, a lot of manuals on how to raise such a configuration, I used the first available. Both sites that revolve 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 - the free version of P4 for 20 workspaces with no limit on the number of files was selected as vcs for their micro projects. Here, too, everything is transparent - everything is configured and works, you can say "out of the box."

12) Games - as it turned out, HD4000 is enough to play at something undemanding, without interfering with the functioning of all other services. As a proof of concept, I rewrote Jets'n'Guns, bought on an incentive, by connecting one of the two xbox wireless receiver to the server.

The survey plans mainly to the side of a smart home:

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

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

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

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

17) Whatever comes to mind - ...

findings


The article turned out a bit messy and not as focused as we would like, but I still hope that it was possible to convey the main points. At the moment, my “almost server” has paid for itself with a vengeance: for money comparable to a good NAS, I got 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 you don’t have to spend on upgrading the main elements for at least another year or two, or even more. It was also possible to achieve "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 unheard of even with my sensitive ears.

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

Source: https://habr.com/ru/post/236967/


All Articles