Odroid HC2 NAS with "extras"

This is somewhat of an admission of failure. You can't easily pigeon-hole everything, and most real projects use commercial software, homebrew, and hardware all at once. So, for you makers out there (including me) - this is where to put whole projects that don't fit well in the other forums.

Odroid HC2 NAS with "extras"

Postby Doug Coulter » Sat Sep 08, 2018 10:14 am

I guess I'm never quite satisfied...I want NAS setups that are reliable, draw as close to no power as possible, and since they're on and drawing power, maybe can do some other useful stuff with their idle cycles. If your NAS has any performance to speak of...it's going to have idle cycles a lot of the time. It's going to need them pushing stuff at wire speed, but then there's the other 23+ hours in a day.

I got unhappy with that synology for various reasons - they purport to support that "other stuff" but it's a pretty big fail unless you want to magically become expert in their stripped down and heavily modified (so you can't break it - or fix it either) linux. And they really want you to use DDNS, be online...kinda IoT "we want to be your man in the middle" vibe. That's a nope. Raid isn't really the answer to reliability in my use-case and takes forever to build or scrub. What if their box fails? Their custom raid setup is now useless bits I can't recover, and RAID never did protect from fat finger.

Finally there's cheap hardware out there that kinda fits the bill for what I want. A little more power than a Raspberry pi, but FAST. This would be the Odroid HC series. 1 Gb ethernet, built in SATA, nice package with heatsink (passive)...and compatible with the Odroid XU4, which I have, and which is a bonus to getting set up.
Here's the thing: https://www.hardkernel.com/main/product ... 1505170472
Amazon has these too, at a somewhat higher price (but shipping..). It's a nifty little box. 8 cores, 2 gB ram, 2 gHz clock...fast.

Now, you can in fact just download OpenMediaVault and put it on an SD card, set it up like this (it's picky about doing things in order) and be done if you want basically the same stuff as a synology but more flexible - a more or less pure NAS. These guys also have snarky support forums (you're holding it wrong)...the stuff works (and I'm using one out of my 4 setups), but...totally dedicated to the one thing. Which is fine if you just want the one thing. They did a decent job if you don't get any of their add-ons or plugins, which tend towards flaky. They even do a decent remapping of things such that most of the writing to the SD card instead goes to a ramdisk. So, not super bad, just not quite what I want here. In theory you can run scripts on these, from a cron job...I haven't tried that yet, and am not sure how you'd debug those.

You might want to look at this link, which I should have posted earlier in this thread, before doing the rest, but hey...I'm human. viewtopic.php?f=59&t=1111&p=6527#p6527

So....why not just put a real linux on one, and have it your way all the way? That's what I've been up to, and it's looking good. I got a distro for arm and odroid (which even has a kind of retarded Mate desktop) and got that going on an XU4 - which has niceties like, you know, a video output...but as soon as I got xtightvnc and pals going there, jumped to the HC2 hardware and did the rest headless. Geting xtightvnc to reliably start once and only once...in the presence of systemd, is kind of a trick, and I'd never have managed without a gui while setting it up. It's only a different technique than anything else on linux, ever...
And in this thread, I'm going to detail how I did, what I did, with tips and links so you could too. This all came out really nice.

I have them:
Full linux with desktop remote via VNC (SSH works too).
MySQL (actually Mariadb but we won't quibble)
phpbbBB - yep, the same software that runs this board
phpMyAdmin - for the database
Nginx - nice web server, with (obviously) fastcgi for php - and for perl, which was a little trickier (I have a script somewhere)
And some add ons I thought were cool. For example, I'm not using phpbb here for a grocery list (but it would fit) - I'm using it to back up my work, my thoughts, do useful things in the middle of the night (down and uploads come to mind, as well as "layered deep backup between NAS instances".
So the limitations of phpBB started to chafe - it has some limits, which you can change up to the limits php itself has - and no, changing the .ini doesn't fix it - on handling huge files (like a backup of the NAS distro I built). So...workarounds for things like that.
Of course, since there was one heck of a lot of tweaking to do here (no, not the popular usage, I don't do drugs) - I also added my usual tools my muscle memory works well with.

Example - why does every rev of every distro seem to have to rewrite and rename the basic text editor, putting the functions in a different place where they work a little differently? Crap on that - I use the "obsolete since no one's fixing what ain't broken anymore" Gedit. One example of many, I'll get into that further down-thread. YMMV as always, the point of this exercise is to have it YOUR way (nope, not fast food either), whatever way that is.

I understand why people like Synology or OpenMediaVault do things the way they do - reduce the adjustments and options, and there are fewer ways for lusers to break it - no knobs, no maladjustment, just hold it right and cram yourself into that mold. Cuts support way down. Since with my user hat on, their suport is useless anyway, why not have no support but my own - but get what I want?

This is long for one post, and sadly, almost info free. I'll be putting the rest down-thread.

Teaser - here's the desktop of one of them with the other shares mounted on it too (that deep multi location backup enabler I mentioned), the Remmina viewer, and the webmin webpage it emits (among several others, but only one screen in a screenshot, right?).
OdroidNAS.png
What I see on my comfy couch. You wouldn't want to be where this thing actually is.


So, something to do with all those 4tB disks I took out of the synology (after backing it up, of course).
Posting as just me, not as the forum owner. Everything I say is "in my opinion" and YMMV -- which should go for everyone without saying.
User avatar
Doug Coulter
 
Posts: 3515
Joined: Wed Jul 14, 2010 7:05 pm
Location: Floyd county, VA, USA

Re: Odroid HC2 NAS with "extras"

Postby Donovan Ready » Sat Sep 08, 2018 1:44 pm

So the limitations of phpBB started to chafe - it has some limits, which you can change up to the limits php itself has - and no, changing the .ini doesn't fix it - on handling huge files (like a backup of the NAS distro I built). So...workarounds for things like that.


Me, too. phpmyadmin chokes when I try to back up the database, so I'll use mysqldump to export it. I'm offline permanently now, but a friend wants to resurrect the Joint after he gets up to speed on Linux.

That might take him a bit. My phpBB version is obsolete now, but it's so customized that even the developer forum guys tell me I'm on my on. And I didn't document many of the changes I made to the core files...

Bad Donovan. :oops:
Donovan Ready
 
Posts: 239
Joined: Thu Apr 17, 2014 1:22 pm
Location: Austin, Texas

Re: Odroid HC2 NAS with "extras"

Postby Doug Coulter » Sat Sep 08, 2018 1:49 pm

Hmmm, not sure how to instruct how to do this totally headless, though I'm sure it's possible using the uart<>usb converter from hardkernel and pure command line.
I don't work that way myself - if something doesn't work, the lack of discoverability and diagnostics at that level mean you're pretty much staring over for each mistake. And due to things changing over time, there's plenty of wrong information at the tip of a google search (for example, all the things superseded by systemd, and the workarounds that used to work but don't anymore...while systemd itself now works lots better.).

I used a distro from here, in my case the XU4 one, as that's what I did a lot of the setup on. Once I had a few things going and VNC, well, the same SD card plugs right into an HC2 or HC1 and works fine.
https://www.armbian.com/download/?tx_maker=hardkernel
Of course you'll want to do the usual apt-get update and apt-get upgrade stuff (sudo...).

At any rate, you're going to need some things on top of the basic distro.
At the very least, I get tightncserver (sudo apt-get tightvncserver), but usually a number of other goodies. But till I get that discoverable GUI...it's too slow for me.
You can start this from a terminal (that uart mentioned above)...or ssh I suppose (once you find the IP address on your lan), but that's a pain longer term.
Since I'm not too worried about security inside my lan (if you're in, there are other issues...) I just autostart it at boot. From then on you can get the rest done via
Remmina or other VNC viewer on some other machine in comfort.
But you're going to need to autostart it. And as it turns out, that's hard due to the depth it gets into things on the system - systemd blows up, other autostarts get in an infinite loop, it's a pain to get going that first time. To spare y'all a ton of searching and trying things that aren't going to work...you need to create a desktop file and put it in /home/odroid/.config/autostart and in this case I named it tightvnc.desktop.
Code: Select all
[Desktop Entry]
Type=Application
Name=tightvnc
Comment=vnc server
Exec=vncserver :1
Startup Notify=false

You can add other command line options to taste here...the defaults worked for me, and I set Remmina to look at the :1 desktop, 16 bit color, and medium for normal use and all the screenshots here - it's fine and actually about as fast as "being there".

Once I get a desktop, whew, I immediately use the terminal (!) to install a few things:
sudo apt-get synaptic cpanminus
From there you can stage into the other stuff. While in theory it's possible to give this a long list and get it all, I've had issues with long lists and applications that would like to pop up a configuration screen that can't when in the middle of such a list - which is a disaster if they use passwords and you can't find the default one.
I always add my little-system text editor of choice, gedit and some plugins, but it's not really super better than all the rest, just familiar.
While I get a bunch of other stuff usually, I leave any list of that for later - for now let's get the basic stuff going on.
My setup looks like this:
NAS_VNC.png
Seen on my living room machine


Yes, bad Donovan - but I'm just as guilty and am attempting to either atone for my sins here, or at least prevent the worst by documenting as much as I can remember off-site...that workaround for huge files might interest you when I get there and this one is using the new phpBB - but there's even a trick in NGINX you have to do or it won't install...see pic above - someone thought that since they didn't fall over, they knew all about bikes...
Donovan - there appears to be a limit in php itself on really big (GB) uploads - no matter what you set php.ini for (and now there are three of those due to FPM, CGI, CLI) - as well as the one in phpBB. Looks like it's because it uses ram to hold files till the upload is complete - the writers couldn't figure out how to use a temp file.
Posting as just me, not as the forum owner. Everything I say is "in my opinion" and YMMV -- which should go for everyone without saying.
User avatar
Doug Coulter
 
Posts: 3515
Joined: Wed Jul 14, 2010 7:05 pm
Location: Floyd county, VA, USA

Re: Odroid HC2 NAS with "extras"

Postby Donovan Ready » Sat Sep 08, 2018 2:09 pm

Yes, I found that out. The server used to have 8Gb of RAM, but because of hardware failures due to my use of a 24 year old machine, we had to downgrade.. I guess I could move the drive to another machine to do it, but I'm gonna bull through with what I have right now.

After it quits raining...
Donovan Ready
 
Posts: 239
Joined: Thu Apr 17, 2014 1:22 pm
Location: Austin, Texas

Re: Odroid HC2 NAS with static IP

Postby Doug Coulter » Sat Sep 08, 2018 4:36 pm

Every distro seems a little different on this one...and init system changes have made it more "interesting" as in the Chinese curse. At least naming the interfaces after some modifcation of the MAC of the interface has come...and thank $diety - gone. Not sure if we'll be as lucky with all the UUID and PARTUUID junk to ID disk drives. Sounded like a good idea at the time, I'm sure but...copy an image of one of these little guys, transplant to a new box, and BOTH of those things are a disaster - those disk UUID's aren't only in /etc/fstab - they are in obscure boot stuff too...and ethernet interface names...lots of obscure places too...
I guess I'm warning you that this might not be true forever, but here's how it works on the armbian and raspian distros just now to set a static IP. First edit /etc/network/interfaces to look like this (using whatever IPs you want, of course, this is my LAN).
Code: Select all
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
auto eth0
iface eth0 inet static
   address 192.168.1.242
   netmask 255.255.255.0
   gateway 192.168.1.1

Now, this works and it gets that IP statically (but I still run my landns daemons too). But apparently it now ignores the gateway line, and my notes say:
Code: Select all
!!!!!!!!!!!!!************!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
/etc/resolv.conf was a link that's gone after you do /etc/network/interfaces
you need to make a file same path that has something like
nameserver 192.168.1.1
in it.  Else after setting static IP above, your machine can't find DNS.

Else it can't find the internet. Which in my case is bad, as I want these to be able to download or upload big stuff without having to have some big power hungry machine on - living on solar and batteries will give you a couple of new priorities, particularly if you also have a connection so slow that uploading a decent youtube clip, as I do, can take more than a day.

NGINX turned out to be "interesting" to put in, due to changes in other stuff and various assumptions made by the people who wrote some of the php stuff (apache makes some assumptions for those beginners that NGINX does not - you have to tell it undisciplined beginners are around).
I wrote a script to put it in, but have had to update a couple of things after using it, so I'm going to post that after I fix the script too...phpBB won't install without a workaround in NGINX sites-available, and CGI's for perl and php also need a little diddling. Then its merely tons faster, safer and lower footprint generally than apache, which kinda matters in the little machines. While it is it's own world, it's a much easier to learn from scratch world than Apache is - lots less junk has accumulated around it. I'll try to get that in the next post. I also managed to get it to serve huge files as downloads - however, only from the same machine.
If I could get, say phpbb to call out to a CGI I wrote to upload big files...it'd be perfect. However, on my LAN, it's not really an issue other than convenience, as the whole point of the NAS is to share things - and the directory that holds the downloadable files is one of those things. It would be nice, though, to have it kinda one click and generate a link for ya.
I just don't feel like learning a fractal of bad design this year. Sorry.
I have diddled some of it in the raspberry pi web cam interface, but....yuck. I washed up after!
Posting as just me, not as the forum owner. Everything I say is "in my opinion" and YMMV -- which should go for everyone without saying.
User avatar
Doug Coulter
 
Posts: 3515
Joined: Wed Jul 14, 2010 7:05 pm
Location: Floyd county, VA, USA

Re: Odroid HC2 NAS with NGINX

Postby Doug Coulter » Mon Sep 10, 2018 11:57 am

Around here is where it begins to get a little tricky...not NGINX itself, it's pretty simple and straight ahead. But getting CGI's to work right, and PHP in particular, was a bit of a challenge, enough that I wrote a script to do it. Basically, one typo brings it all down....
Sadly, due to the interactions between PHP and the rest of the universe, one script can't do it all - different ones for different platforms are needed - and that one goes stale on system updates anyway.
This is because to "make things simple" PHP packages for linux no longer have the version number in the package name for apt-get or synaptic - it's just php-this or that. Fine. But the daemons that do the CGI - which is pretty much all PHP is ever used for - still do have the version encoded in things you pass the CGIs to from NGINX...so you have to notice that there's this difference between 5.x, 7.0, 7.2 and adjust the NGINX configuration accordingly as otherwise, PHP CGI's won't run.
And despite how nasty PHP is, we like things like phpMyAdmin and pbpBB (which is what this board runs on for example) so we want it to work - we just don't like getting inside it if we don't have to ourselves.

So, I'm going to pass out a script that works now - but explain how to make it work later and on different platforms as that will inevitably be required and is already true here since PC's are on PHP 7.2, and ARM is on 7.0 and nope they aren't compatible in a couple of ways. Not only that, phpBB isn't compatible with either on NGINX as is, taking advantage of something odd built into Apache only - like there aren't other webservers out there and like the systemd guys are "WONT_FIX" about it - that's on you. Us. So, I fixed it, and here's how.

NGINXInstallPC.tar.gz
I know, it's named wrong now - events overtook me
(11.87 KiB) Downloaded 277 times


Here's a script and supporting files that install NGINX, the basic CGI stuff, and my LANDNS stuff that broadcasts "my" IP on the LAN and listens for same, updating the /etc/hosts file - this works when samba, netbios, arp/rarp and avahi all fail, so I find it handy. You can edit the script of course to not put those in.

The script was originally the PC version, but since I wrote it, ARM caught up to PHP7.0 and the PC has moved on to 7.2 - I should know better than to have used the PC name internally in this collection...but I didn't know better.

This will install NGINX, the PHP CGI junk, and the perl CGI junk. It will create a tiny website in /var/www/html you can surf to on localhost/ or from elsewhere in your LAN. It doesn't have all the bells and whistles at this point - but it is enough to check if the two CGI languages work, and until they do, there's no point in progressing.

The only configuration I've needed to change for NGINX is provided her as boilerplate, and it goes to /etc/nginx/sites-available/default - this is the one you'll edit. The major built in boiler plate is elsewhere and I've never had to edit it, though I've looked at it.

This one is missing the fix for the phpBB install, detailed in the next post, the phpMyAdmin install, and the workaround I came up with to handle huge files in the local phpBB board, using the share for storage (this is STILL a "network attached storage" - it just has added benefits).

If one of the CGI languages doesn't work, fix it before moving on - nothing else is going to work if you don't. The main thing I've run into here other than dumb typos, which the script will help you avoid, is php versioning - see the default file for that.

Once we have a working web server (and for non CLI lovers - VNC) - and this one seems best for this platform - we can go places and do fun things...
Posting as just me, not as the forum owner. Everything I say is "in my opinion" and YMMV -- which should go for everyone without saying.
User avatar
Doug Coulter
 
Posts: 3515
Joined: Wed Jul 14, 2010 7:05 pm
Location: Floyd county, VA, USA

Re: Odroid HC2 NAS with "extras"

Postby Doug Coulter » Mon Sep 10, 2018 1:36 pm

Here is the actual /etc/nginx/sites-available/default file I have in use currently - take a look and we can go over it to try and impart some understanding of what needs to be there. This has been repeatedly edited from the default default file, so some commented out examples are in there too - and like a lot of things, the comment character is #.

Code: Select all
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Default server configuration
#
server {
   listen 80 default_server;
   listen [::]:80 default_server;

   # SSL configuration
   #
   # listen 443 ssl default_server;
   # listen [::]:443 ssl default_server;
   #
   # Note: You should disable gzip for SSL traffic.
   # See: https://bugs.debian.org/773332
   #
   # Read up on ssl_ciphers to ensure a secure configuration.
   # See: https://bugs.debian.org/765782
   #
   # Self signed certs generated by the ssl-cert package
   # Don't use them in a production server!
   #
   # include snippets/snakeoil.conf;

   root /var/www/html;

   # Add index.php to the list if you are using PHP
   index index.html index.php index.cgi index.htm;

   server_name _;

   location / {
      # First attempt to serve request as file, then
      # as directory, then fall back to displaying a 404.
      try_files $uri $uri/ =404;
   }
   location  /forum/install/app.php {
      try_files $uri $uri/ /forum/install/app.php?$query_string;
   }

   location ^~ /boardfiles/ {
      root /share/bb/;
      try_files $uri $uri/ =404;
   }

   # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
   #
   location ~ \.php$ {
      include snippets/fastcgi-php.conf;
   #
   #   # With php7.0-cgi alone:
   #   fastcgi_pass 127.0.0.1:9000;
   #   # With php7.0-fpm:
      fastcgi_pass unix:/run/php/php7.0-fpm.sock;
   }

    location ~ \.pl|.cgi$ {
        try_files $uri =404;
        gzip off;
        fastcgi_pass 127.0.0.1:8999;
#        fastcgi_pass unix:/var/run/fcgiwrap.socket;

        fastcgi_index index.pl;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
include /etc/nginx/fastcgi.conf;
    }

   # deny access to .htaccess files, if Apache's document root
   # concurs with nginx's one
   #
   location ~ /\.ht {
      deny all;
   }
}


# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
#   listen 80;
#   listen [::]:80;
#
#   server_name example.com;
#
#   root /var/www/example.com;
#   index index.html;
#
#   location / {
#      try_files $uri $uri/ =404;
#   }
#}


The relevant part of this are between lines 16 (the server declaration) and line 86, the final closing } on that. This would be a lot shorter if there weren't a lot of commented out samples in here too - I was lazy, they might be handy someday, why not leave them in?

NGINX is used by the big boys for all kinds of things, precisely because it's not complex, heavy, and convoluted like Apache. It knows how to serve static files, and that's about it - makes it a good fast load balancer, or a forwarder to other stuff, which is how it's used here for non-static content. Just pass off some url's to other stuff, take whatever they output and serve it to the requestor. Simples. While there is ability to do SSL and HTTPS, I'm not using it, there's no authorization hooks other than what the served stuff provides for itself, no multi layers, no build in CGI junk - it just moves bits and we are done. I like that...kinda the unix philosophy - do one thing, but do it well.

The listen directives on the next couple of lines tell it what ports to listen on - pretty straight forward.

A little further down (line 36 if you're following along in a text editor) is the root directive - this tells it where the main root directory to serve is - it's effectively a chroot jail kind of thing unless you add more directives. Simples...any attempt to pass in a url outside this will fail, unless there's another root directive allowing it.

Line 39 defines what some default index files might be named at the root. They are checked in the order specified here - you can have more than one index file, but only serve whichever one matches what you passed in, or whichever it finds first from this list if you don't pass something in. Nice.

Line 41 names the server - here we don't care, but put in some silly default.
Lines 43-47 are the crux of the default biscuit - define what to serve from root as static files.

Lines 48-50 rewrite a request but just for one php file - the install for phpbb, a one use thing - because they couldn't tel the difference between a post and a get on this one part of their code. Go figure. Apache does a lot of oddball magic on things like this that NGINX doesn't waste your resources on unless you tell it to, and this is the only thing I've run into that needs this. But WONT_FIX. So...we fix ourselves.

Lines 52-55 let us serve some files from a specific spot outside the normal chroot jail....this is my workaround to let this serve files as downloads that are far larger than PHP can hack - things like whole linux distros. This is on my lan after all, and I'm using the board there to document my own junk, with working examples, and for this, download and upload time don't matter (else I'd transport it all up here). This specifies a directory on my local share partition, under which whatever url link you specify will have the file. Since I used "boardfiles" as an exact pattern match to avoid accidentally matching other stuff, a url like ./boardfiles/somefile will actually be found at /share/bb/boarfiles due to this. To put files in there, at present, I just stuff them into the right place in the /share world, and bingo. Later I hope to integrate this with the PHP board stuff itself, maybe calling out to some more reasonable language to handle uploads and create a proper uri, but now I'm just doing it by hand - it's not needed all that often. Note the location directive has a root directive *inside it* which only applies if the location regex matches.
This is how the chroot is broken out of. Kind of interesting in that the heirarchy isn't fixed. If something is an exact match in the nginx version of regex, then we just do that and look no further. If it's a wildcard kind of match - like the cgi's, it will keep looking, and choose the best/longest match.

Lines 59-66 are where things get interesting due to PHP and linux not playing nice these days. Note there's a version number in the socket cgi's are passed to.
This is a PHP thing, since they realized that they'd borked back compatibility. The one thing this scheme buys the user is that you can now run more than one version of PHP and direct various things to the one that is compatible with the application. Linux will just install php - and get whatever that particular distro thinks is the best - in this case it's 7.0 but has changed (PC are on 7.2 at the time of this writing, on the same distro otherwise).

Lines 68-78 are the perl CGI handling. This is not quite like mod_perl in apache, but it does seem close enough to be snappy-quick even on an ARM,

The rest deny access to (nonexistant here) htaccess files in case you have legacy apache stuff hanging around.

That's a lot of typing for me at one go. But compare to the Apache Dox...this is pretty simple at least for me, by comparison.
Posting as just me, not as the forum owner. Everything I say is "in my opinion" and YMMV -- which should go for everyone without saying.
User avatar
Doug Coulter
 
Posts: 3515
Joined: Wed Jul 14, 2010 7:05 pm
Location: Floyd county, VA, USA

Re: Odroid HC2 NAS with MySQL

Postby Doug Coulter » Wed Sep 12, 2018 9:19 am

Or actually, mariaDB is what you get when you install MySQL, but that's fine - it's very compatible.
What HAS changed, and where it becomes a bit tricky, is getting it to be usable. MySQL used to prompt for a root password on install. That's gone now, and the default is ??? - random GUID from ??? and you'll never guess it. So it goes in dead and utterly unusable instead of insecure. Great. You need this for all the other goodies too - so it's a critical path. I had written a script to put it and some friends in, but this defeats my script, so, here we go, the hard way.

I use synaptic myself, but you can do the sudo apt-get dance. I just like the gui on synaptic as I can see the related utilities I also want to add without having to memorize all their names.

After you install it - and any client tools you might want, you'll need at least the mysql command line client - you have to jigger it to put in a root@localhost password so you can do, well, anything at all - without this, it's a dead piece of code eating ram and cycles that no one can use. I guess it keeps the unwashed at bay.

I visited several links on how to fix it, and frankly, there is more than one version dependent way and I wound up trying a few. If my memory is right, this link
has it for the current setup: https://www.digitalocean.com/community/ ... sql-server
Digital Ocean often has good answers for what it's worth - they get paid when the stuff you rent from them works - so they have a reason to help. Follow the money!

Abstracted, you have to do a special start of MysqlD without any security at all, do your diddling, and then use it normally.
Copied from that link:
sudo mysqld_safe --skip-grant-tables&
sudo mysql --user=root mysql
mysql> update user set authentication_string=PASSWORD('new-password') where user='root';
flush privileges;
quit
sudo service mysql restart
sudo mysql -u root -p
(you'll be asked for the new password you put in above dc)
exit
And then:
sudo mysql_secure_installation

This pretty much blew my goal of making this all scriptable for y'all and myself...there's other tweaking that a script makes easier, if for no other reason than there's a lot of typing where a typo might not generate a warning - things just don't work.
Posting as just me, not as the forum owner. Everything I say is "in my opinion" and YMMV -- which should go for everyone without saying.
User avatar
Doug Coulter
 
Posts: 3515
Joined: Wed Jul 14, 2010 7:05 pm
Location: Floyd county, VA, USA

Re: Odroid HC2 NAS with "extras"

Postby Doug Coulter » Wed Sep 12, 2018 9:51 am

Now that we have a database engine, we can add the things that depend on it, and manage it.
Two decent ways to manage a (probably small) database are phpMyAdmin, and Webmin. I generally have both, but usually use phpMyAdmin for management and debugging my LAN of things programs that feed and read their databases, and Webmin for general sysadmin of DB and lots of other stuff - when I don't just use VNC or SSH (rare, I feel blind with CLI only).
The php stuff assumes Apache and mysql, mostly, so we get to tweak a little to use this better stuff most effectively.

To put in webmin, I use the instructions here and go ahead in install the dependencies mentioned first. It seems to go in very easily and just work, the only
caveat being that it serves HTTPS with its own server but doesn't have the usual certificates, generating a warning in Chrome...I just ignore that since it's on the lan anyway - and remember that it's serving on port 10000 (see screenshot)
Webmin_SQL.png
Webmin running here, showing the sql manager page

You can add the nifty plugin for NGINX from inside the webmin configuration page. Neat.
Webmin manages this, samba shares, NGINX, NFS shares...and a lot of other stuff easier and better than most of the other tools, including the ones that "come with" the other apps. It "just knows" the syntaxes....


Putting in phpMyAdmin is fairly straightforward - sudo apt-get phpmyadmin or use synaptic, but...we want to serve it via NGINX since we don't have apache.
It will ask, just don't select anything, we'll fix that up shortly. All we have to do is create a symbolic link under the web root that points to it. I of course add a link to that on the index page the NGINX install script puts in. I'm not a sophisticated web developer at all - I barely do HTML the hard way, I'm sure most here have or know of much better tools than I use for that. The main reason I put in a sample set of pages and links is to let you (and me) be sure you got the install working...

Digital Ocean again has the easiest and best instructions.
The only change I had to make is to add /html to the end of the link location as that's where our root is.
After this, you can surf to localhost/phpmyadmin and it should fly. I of course added a link to the local homepage.

You will need this or some other way of doing database management to make some changes, else the new phpBB won't go in and work (note caps in the name, I messed that up at first and it cost me an hour...)
Posting as just me, not as the forum owner. Everything I say is "in my opinion" and YMMV -- which should go for everyone without saying.
User avatar
Doug Coulter
 
Posts: 3515
Joined: Wed Jul 14, 2010 7:05 pm
Location: Floyd county, VA, USA

Re: Odroid HC2 NAS with "extras"

Postby Doug Coulter » Sat Sep 15, 2018 11:29 am

Well, I'm really enjoying building up a "knowledge base" on my own share here - if events permit, I may put it online for all (probably using another, better web host).
I'm liking the newest version of phpbb, which is fast even on an Odroid - essentially a couple generation old phone SOC.
I am using version 3.2.2 as shown here in the screenshot from VNC of the web root on the box.
HCWebRoot.png
What my lan web presence setup looks like to itself

phpBB installed fine once I'd done the fix in the /etc/nginx/sites-available/default file shown above. Of course, you have to have put in MySQL or the moral equivalent as well first, I don't think it can install that on its own. Then you have to do the usual setup of phpbb with an admin user which at least a few people here will know about. There's plenty of online help for that.
The local site looks like this, and it's for my own internal sysadmin and programming info at the moment - not many posts as it's new just now.
I'm planning on using it for a version control system, much to the disgust of a friend who wrote his own, which is only slightly less weird and hard to use than git, and completely inappropriate for what I do myself - I like using phpBB as I can put in all the critical "what was I thinking" stuff more easily and obviously, and by using a regular thread I have the whole history I can revert to should I (happens really rarely) need to revert.
And in the next thread over, I can have code samples to steal from - my own 'stackXXX" kinda stuff, but specialized for my own interests and issues. I have some hundreds MB reserved for this kind of thing, and also access to the entire 4TB drive for "side loaded" files in the main share the board can cause to be downloaded to the surfer by clicking a link. Could be worse.
So the front page of that looks like this:
HC23BB.png
Should look a little familiar to the denizens here.

I even just learned how to make this stream my own video content back to me...and with the real compact ones I can make with vokoscreen, I might even use that.
There are times where showing how it works when it's right - or just how to hold your mouth when doing something, is valuable.

I wanted to be able to upload some fairly decent size files in phpBB, as well as handle large ones in phpMyAdmin, which required a couple changes to the /etc/php/7.0/fpm/php.ini file. Note that there are three (!?!) files named this these days, part of that fractal of design - one for cli, one for cgi (slow) and one for fpm (fast page manager?) - and fpm is the one we're using for the php apps/pages.
It looks like this now:
php.ini
won't fit as a code window
(69.34 KiB) Downloaded 295 times


Well, that's ugly. What you have to actually change are below, and what I changed them to.
max_execution_time = 360
post_max_size = 256M
upload_max_filesize = 200M
Which now shows on phpinfo() (one one of the sample cgi's I put in the nginx install script) that you can upload 200 meg files...we'll see.

I'm going to make a demo video on how cool this is from the pov of myself as a luser. It IS pretty cool.
And, using whatever method - straight VNC and editing, or webmin stuff - I can now make it mount other LAN shares, back itself up, back them up, and other useful things automatically at 3 am or whatever...which is a lot harder to do with the off the shelf shares "solutions".

Till I get the video made and up here - here's the star of this show - I have 3 of these...I'm going to use disk drive #4 as an offline/offsite backup (Well, a different building anyway).
20180916-HC2-1.jpg
An odroid HC2 all set up. These stack FWIW.

I guess I'll also share the tricks to have these mount one another for backing each other up...I'm doing a setup a lot like timeshift in linux (or time machine in apple, if I understand that one). Automated. Even Gb ethernet seems slow when there are TB involved...


TODO:
Look at sql slave setup to backup fusorpi in realtime from a remote location. Have done this before with other stuff, but always-on nature of this would make it a lot nicer. Alternatively, the fusorpi could just use this db as the data source name directly and offload the pi of database duty.
Posting as just me, not as the forum owner. Everything I say is "in my opinion" and YMMV -- which should go for everyone without saying.
User avatar
Doug Coulter
 
Posts: 3515
Joined: Wed Jul 14, 2010 7:05 pm
Location: Floyd county, VA, USA

Next

Return to Combined projects

Who is online

Users browsing this forum: No registered users and 4 guests