I’ve an issue with the cron jobs not always running as the Hyper-V VM doesn’t always update its system time when waking from sleep.
Once way to fix it, as I’ve tried all flavours of ntp configuration, is to have the cron jobs run multiple times in the day, as opposed to once per day.
Would this cause problems?
The send-invoices command can be run as often as you’d like, the send-reminders command can only be run once per day.
Darn it. I’ll need to fix the time on the hyper-v instance on wake.
Why is a server going to sleep in the first place? Is it something Hyper-V does by default?
Its on a host OS that sleeps after in activity (its a bit of an odd setup for testing purposes).
When the host OS goes to sleep, Hyper-V suspends the guest OS (where IN is installed). Upon wake, the guest OS resumes and will therefore assume the time is still that time when it suspecnded - its doesn’t seem to have access to the BIOS clock.
Hyper-V is supposed to keep the guest OS in time with the host OS, but no matter what you do with NTP etc, it can take sometimes 30 mins to correct itself, I’ve observerd.
So if I wake the PC to run the cron jobs, they don’t run as the guest OS is running behind.
One solution I can think of it getting the host OS to run a scheduled task to trigger a time reset on the guest OS, but it seems a bit of a hack for something that should correct itself.
Now you can see why I’m looking at using a raspberry Pi - although I have concerns about the reliability of an SD card longer term.
Might be easier to just run a headless VM under VirtualBox on something that stays running. Then you can just set it up and forget about it.
I’ve got one setup with 2 cores and 2gb of RAM (running Ubuntu Server) on my desktop PC. It runs in the background and I never even know it’s there, even if I’m running a game or editing stuff in Audition/Premiere/AfterEffects. I’ve also gotten it running just fine. But I’ve also played around with installing it on a barebones Debian system, and it happily runs on a single core with a single gb of RAM.
If you’re gonna get it running on a Pi, maybe you could setup MySQL to have the DB on an external USB drive, so save wear and tear on the SD card?
My ideal solution would be a mini (fanless) pc running Ubuntu and Invoice Ninja, with a backup to NAS. Whilst I like the convenience of VM’s, I’m concerned about having too many eggs in one basket should there be a disk error. Also trying to be as energy efficient as I can and not have the PC on all the time.
With the RaspberryPi3B+ you can now boot directly off a usb SSD, which would solve my concern about running all off an SD card. However, I’m still not sure about Raspbian - more comfortable using Ubuntu directly with known libraries, updates etc. but that isn’t available from an authorised source for Pi 3B+ yet.
Clearly I’m not sure what the heck I’m doing, but trying to find a mini pc that runs standard Ubuntu server doesn’t seem to be very obvious. I’m not sure which are the reputable brands these days.
In the meantime I’ve added a cron job to the VM to restart ntp service every minute. Not sure if that will work.
To avoid disk errors, you could have a separate drive/partition dedicated to nothing but the VM, and have that backed up on a regular basis.
As for Raspbian, it and Ubuntu are both based on Debian, so most packages can be installed through apt the same way, as long as there are ARM builds in the repositories.
If you’re looking for something x86, you’re going to be spending more, but there are definitely options. Take a look at the Via ARTiGO A1300 (the A1250 is a good deal less, but isn’t fanless). It’s a fanless x86 mini that’s designed for digital signage and 24/7 operation. A bit pricey (and it looks like you’ll need to supply the RAM and storage), but that could fit the bill. Just install Ubuntu Server on that, get IN up and going, then you can stick it somewhere out of the way and forget about it. Then when you need to actually change/update something, just login via SSH instead of plugging in a display and keyboard.
You could go with an x86 single-board like a UDOO, but like the Pi, those seem to be meant more for hobbyist/development usage rather than production. You’d still need a case and storage, and I’d be worried about long-term usage just like I would a Pi.
In the end though, even though you’re trying to be energy efficient, for something that’s a server, you really do want to leave it running.
Thanks - I’m going to take a look at the Via ARTiGO range, not heard of them before. I also came across the Intel NUC kits and mini pc’s - perhaps the i5 processor may be a good option, although they are with fans. I’ll do some research.
The cron job to restart ntp every minute appears to be working, the send-invoices and send-reminders has run today on time, although this isn’t the ideal solution.
NUC’s are okay for desktop use, and would probably work well, they just seem way overpowered (with a price to match) for what you want to do. Whereas VIA has been around long enough to be firmly established in the low-power/embedded segment, and is fanles (at least the A1300 is, anyway). Just make sure the one you decide on is actually x86, as they have several ARM models as well (although installing Debian on those should be easier than getting a command-line only system up and running on a Pi).