Skip to main content

Remilia: My cheap little home server

·1381 words·7 mins
Blog Computers Linux Homeserver
Table of Contents

For a long time I’ve really wanted to have a proper server for redundant storage of my precious media, serving said media, and also doing some additional services that I don’t want to rely on third parties for.

And now, when I’m a responsible adult, I can finally build myself a proper(-ish) server, that can sattisfy my needs, and is not just a bunch of Raspberry Pi (first generation ones) stuck together with duct tape by a schoolboy with too much time on his hands.

The platform 💻
#

As a platform I wanted to buy something like a retired office workstation, with Skylake or newer chip. Why? Well, because:

  • These machines are usually really cheap
  • They are usually very reliable
  • Most of them use 12VO power supplies
    • Which, while may be a bottleneck for using one as a workstation/gaming PC, is perfect for a cheap server considering that they’re very efficient when compared to a cheap ATX PSUs.
  • Skylake and newer chips support higher C-States, and so should be more economical when idling.

And, I was happy to find a Fujitsu Esprimo P557 “workstation” with:

  • Intel Pentium G4560, a Kaby Lake 2C/4T chip, with Intel HD 610 graphics.
  • 4GB of DDR4 memory running at 2400MHz
  • 128GB Samsung NVMe SSD, does not really matter since it’s mostly a boot drive.
  • DVD-RAM drive by Hitachi. Not very interesting.
  • 1Gb Ethernet by Realtek, again, nothing special.

This PC cost me 50€ to buy, with additional 16€ for shipping from Germany, which is not a bad deal.

Order of the PC

The setup ✨
#

Software 💿
#

Of course, the first thing I did was install my Linux distro of choice, in my case it’s OpenSUSE Leap 15.5, with all the necessary packages.

I’ve created an Ansible playbook for server provisioning. It was my first experience with Ansible, and my playbook is very rough, but at least it’s easy to understand.

The main playbook is very simple, and does not do much:

- name: Setup for Remilia server
  hosts: remilia
  become: true

  pre_tasks:
    - name: Variables
      ansible.builtin.include_vars:
        vars.yml

  roles:
    - docker
    - ssh
    - smb

  tasks:
    - name: Add user "hikkamorii" to docker group
      ansible.builtin.user:
        name: hikkamorii
        groups: docker
        append: true
  tasks:
    - name: Get Netdata kickstart script
      copy:
        src: scripts/netdata-kickstart.sh
        dest: /tmp/netdata-kickstart.sh

    - name: Install Netdata
      command: sh /tmp/netdata-kickstart.sh --stable-channel --disable-telemetry
      args:
        creates: /etc/netdata

That’s because most of the services are running inside docker containers:

  1. Create a dir for each container in /tmp/
- name: "Tmp dir for docker compose"
  ansible.builtin.file:
    path: "/tmp/{{ item }}"
    state: directory
    owner: hikkamorii
    group: docker
    mode: '0644'
    recurse: true
  with_items: "{{ docker_containers_compose }}"
  1. Create and copy docker-compose.yml file
  • It will be created based on the xxx-dc.yml.j2 file, into which variables from the role will be populated to the docker-compose.yml
- name: "Copy Docker Compose file"
  template:
     src: "{{ docker_compose_scripts }}/{{ item }}-dc.yml.j2"
     dest: "/tmp/{{ item }}/docker-compose.yml"
  with_items: "{{ docker_containers_compose }}"

- name: Set permissions for docker compose file
  ansible.builtin.file:
    path: "/tmp/{{ item }}/docker-compose.yml"
    owner: hikkamorii
    group: docker
    mode: '0644'
  with_items: "{{ docker_containers_compose }}"
  1. We can actually deploy the container
- name: Deploy Docker Compose
  docker_compose:
    project_src: "/tmp/{{ item }}/"
    project_name: "{{ item }}"
    state: present
  with_items: "{{ docker_containers_compose }}"

Note how I used with_items: "{{ docker_containers_compose }}", this means steps will run for each container specified in role’s array docker_containers_compose

P.S. If anyone has better idea for iterating over array, tell me because that’s the best I’ve come up with.


As for other roles, there's not much to say, because they're basically copying configs.

Hardware ⚙️
#

Once I got my hard drives: 2x2TB Seagate Skyhawks. I’ve installed them and setup a RAID1 array with mdadm, that was easy to do with YaST partitioner. Each of the drive cost me 75€.

I’ve later added SSDs, one brand new 1TB Crucial BX500, and another BX500 from my desktop, and that’s when I experienced my first problem. SSD cost me 71€.

Order for additional parts

Both of the arrays I formated as BTRFS.

I’ve also initially installed my spare 16GB of DDR4 RAM instead of stock 4GB, just because I had it at hand, but that caused problems later. Regardless, it was basically free for me.

I’ve also added some mods to the case:

  1. I’ve added felt feet to the bottom of the case to, hopefully, isolate it from environment vibrations.
  2. I’ve put HDDs on screws with rubber gaskets. Honestly, it does not look like it will work, but at least I got some screws.
  3. I’ve added bunch of air filters on every hole, because the location it’s in is very dusty.

So, in total my setup comes to:

  • Platform: 70€
  • HDDs: 150€
  • SSDs: 71€ (since I bought only one)
  • RAM: FREE! (would probably be around 40€ for 2x8GB sticks, or even less if you’d be okay with settling with 2x4GB)

The problems 😢
#

Motherboard having 3 SATA ports only
#

Interestingly, while this workstation has at least 4 SATA power cables, it actually has only 3 SATA data ports, which is really unfourtunate, and forced me to run one of my SSDs from front USB3 port. That was not ideal, but since it’s an SSD, I don’t really worry about it dying or something. Good thing is that since it’s a full size PC, you can find an HBA for cheap.

For an HBA, I bought myself a cheap ASM1166 based card, since it was recommended as a cheap, efficient and widely available option that solved all my storage issues. That is +20€ to the cost of my setup, but at least now I can connect up to 9 SATA drives (3 internal + 6 on the HBA) if I really wanted to.

HBA Listing

Seems like the RAM I installed was overheating.
#

It’s really hard to rule out this issue, since RAM temps are not logged, and it’s very unlikely for RAM in stock profile to overheat just by itself (meaning you can’t reproduce this issue purely by running Memtestx86), and what’s worse, I had same problem on my desktop, back to back, so I blamed my distro at first, but after I replaced the 145W monster I had in my desktop, and put back the stock 4GB stick of RAM in the server, I’ve yet to experience a random KP. For those who’re curious, no, I could not use the spare RAM in my desktop, because my desktop has ECC RAM.

Later, I’ve got a stick of RAM from my friend, who was upgrading to AM5, that has a very cool(no pun intended) heatsink. Now the system runs with 8GB of RAM, and does not experience crashes.

My self-hosted services 🌐
#

So far I’ve created:

  • SMB Server: maybe later I’ll move to NFS, considering I barely use Windows.
  • Jellyfin: for enjoying my media library anywhere
    • Tip: do NOT use HDD for Jellyfin metadata, HDDs just can’t reliably serve all this data, and your server will be unbearably slow.
  • Kavita: actually a pretty cool selfhosted book library, which I mostly use for reading manga.
  • OwnCloud: for managing data… in the cloud… Nothing special here.
  • Gittea: for storing my code privately.
  • Netdata: for monitoring system status remotely. I, however, don’t use their cloud features, and use only Web UI and Telegram Bot integration.
  • And some other services I prefer to keep private.

Running costs 💶
#

Currently, my server usually idles at about 20 - 25W, which is not that good, but not bad either.

With that power consumption, and based on the logs from Tooya smart socket, on average my server consumes about 0.5 - 0.6kWh/day, which we can round up to 16kWh/month.

Consumption

I have a flexible electricity plan, so the price for unit differs for me all the time drastically, but the worst case scenario, where we assume during the whole month electricity was 0.30€/kWh, it would cost about 4.8€/month to run one.

But fortunately for me, electricity is often cheaper, about 0.08 - 0.16€/kWh, which means that usually it would cost me from 1.28€ - 2.56€/month to run! That is pretty economical!

Electricity Prices

Edit: After running the server for a couple of months, the consumption was just a bit over 17kWh/month, which is more then predicted, and so adjusted to that:

  • With electricity costing 0.30€/kWh, monthly cost is about 5.1€/month
  • With electricity costing 0.08 - 0.16€/kWh, monthly cost is 1.36€ - 2.72€/month