Hashemian Blog
Web, Finance, Technology

Windows MySQL Full Backup Batch Script With Compression And Versioning

by @ 12:14 pm
Filed under: computers — Tags:

We have a Windows Server running multiple WordPress sites on MySQL. We've always relied on plugins such as BackWPup to handle backups. But because multiple users have access to and maintain these sites, it's difficult to make sure that the backup plugins remain untouched and continue to function properly.

For that reason I decided to use a separate script on the Windows Server to nightly backup all the databases in one shot and then have another process pick up the backup files and store them remotely.

A simple .bat file running nightly did the job. the script also includes compression and versioning and it keeps n versions of the backups, deleting the older ones at the end of the run.

Of course there's more to a site backup than  just the database, such as files and settings, but this script only focuses on the databases. I trust with some small tweaks this script can be used for MariaDB and/or in Linux.


Migrating To Cloud, Digital Ocean, Cloudflare

by @ 4:14 pm
Filed under: computers,email,internet,technology,web — Tags: , , , ,

When I started this site decades ago, I followed the usual path at that time to launch sites, shared hosting. There were many vendors to choose from but nothing like the quantity and diversity of what’s available today. I registered the domain, settled on a small vendor for $5/month, got my cPanel and terminal login and off I went.

My server didn’t have much processing juice, storage, and bandwidth compared to today’s levels but plenty enough to host my website and email and other services within the same account. Things were running smoothly but as you’d guess, the account eventually started to push the envelope with the hosting limitations and over the next few years I migrated from vendor to vendor in the perpetual quest for more resources and better prices.

Still all this time I was a slave to the hosting companies and their rules. If my services were abused by outsiders my account was suspended. If my site was spamvertized, my account was suspended. They’d change prices, modify account agreements, deprecate services, migrate servers, upgrade products, get merged or acquired and I had to go with the flow.

So a few years ago I finally decided to give self-hosting a try. I signed up for Comcast Business with static IP addresses, got a decent used computer and migrated all the services to a corner of my home. I was paying more for business Internet at home but I was saving on hosting costs.

Self-hosting Server at Home

This arrangement worked fine for many years but there were downsides too and with the passage of time those downsides became more prominent. To cite a few,

  • Being in a residential zone, power outages are inevitable and my puny UPS couldn’t handle long blackouts, such as those arising from intense storms.
  • Computers and equipment crash or power may be cut because of workers or a tripped breaker. If there’s no one at home to power up the equipment, services would remain offline.
  • The ambient temperature must be kept at a reasonable level. That means running the A/C on hot days even if no one is at home.
  • Hardware failures would mean outages until parts could be replaced and of course a good backup strategy is a must.
  • Software updates are necessary to support the latest or minimum required protocols or to patch vulnerabilities. For example making sure that TLS1.2 or IPv6 are supported or patch for Shellshock or Heartbleed bugs.
  • Monitoring and battling abusers and hackers become a daily stressful job.
  • With the static IP, it becomes impossible to be even slightly anonymous while surfing, unless one pays for a separate internet service.

In short, self-hosting became way too onerous and the cloud had finally reached a robust point where migrating back to providers could be a prudent move once again.

The first service to be migrated was email. I have covered the email migration to Google Workspaces in a previous post and have not looked back. The stress relief was almost immediate.

A few months later it was time to migrate the web services. For hosting I chose Digital Ocean. I had used Digital Ocean before for my day job and was impressed with their facilities and prices. Unlike the bigger players in the cloud space such as AWS or Azure that can inundate users with options, Digital Ocean has simple and straight forward options and pricing to choose from. I quickly set up a droplet (their parlance for a virtual server), transferred the files over, tested the web services, fixed the errors and incompatibilities and finally put the server into production. (My referral link, Get $100 credit with Digital Ocean.)

Shutting down the home server for the last time was a bitter sweet moment but there was no turning back and there was a tremendous feeling of relief.

The final piece of this project came with the addition of Cloudflare. Essentially Cloudflare is a web acceleration and SSL/TLS termination service and they have a lot of free services for the small operators. A few noteworthy advantages of Cloudflare are,

  • IPv6 reach. If a website is only available on IPv4, suddenly it’ll be accessible to all IPv6 clients as well.
  • Powerful and flexible firewalling and security capabilities, including DDoS handling.
  • Latest TLS and HTTP protocols.
  • Powerful web caching and acceleration features with automatic CDN.
  • Reliable and fast DNS hosting.
  • Web analytics.

A few months have now passed since I moved my server to the cloud and perhaps the only regret is not doing it sooner. I am saving money by using less power at home, terminating the static IP’s, and downgrading to lower internet speed. But more importantly I am saving my sanity by drastically reducing the stress of maintaining my own server.

Also, with the static IP’s gone, I can now replace the Comcast assigned cable modem with my own modem and hopefully save even more money every month. But that’s another project and maybe another post.

JAMstack - How To Make The Web Slower

by @ 10:47 am
Filed under: web — Tags: ,

Starting a few years ago everywhere you look, sites are getting updated with a new approach known as JAMstack. JAM, initials for JavaScript, API, and Markup is lauded as more revolutionary, more scalable, speedier, and more flexible than the older style website development.

Some of these claims may be true but for the most part the web crowd has drunk the Kool-Aid and has jumped on the bandwagon, lest be accused of being stuck in the 90's.

Think back about how websites used to work. User accessed a page, the server at the other end, hunted and gathered the data, formatted the page, and threw it back at the browser. It was basically a bit of a delay with a blank page and then an immediate fulfillment. Yes, the designs were sometimes ugly, the fonts were small, and there wasn't much white space but everything was there.

Look at how modern sites work today. There is a shorter initial delay, but the page only fills in with a bunch of inane placeholders. These are a collection of gray boxes, spinning bullets, or wavy bars but there's nothing in them until the browser goes out and fetches the data to fill these placeholders and at times that job seems to take an eternity.

I used to login to my banking site, click on links and the pages would almost immediately return filled with all the necessary info. Now I login and wait and wait and wait for each section to fill in while looking at a bunch of useless spinners and gray boxes.

Call me old-fashioned, and I won't deny it, but is this really called progress? Couldn't we have just cleaned up the pages with better design, more white space, and more appealing fonts using newer styling techniques, instead of creating this monstrosity?

Of course we all want to brag about how our sites are designed using the latest versions of React, Angular, Node.js, and Flask. Weren't JQuery and CSS good enough for us? Did we really need to push a ton of junk into the browser in the name of client-side rendering?

The difference between the old and new sites wasn't as stark to me until I was tasked with migrating my company's CRM platform from Goldmine to Salesforce.com. Salesforce users can operate the site in two distinct formats. The Classic format and the new JAMstack format, known as Lightning Experience which users are slowly being pushed into.

I started out with the classic version. It looks dated but it's fast and responsive. It does the job and does it quickly. But knowing that the classic version will eventually be retired I forced myself to use the lightning version. Compared to classic, lightning is slow and clunky. The pages start with a big spinner, then switch to smaller spinners and then more spinners inside of those and you wait and wait until all the data loads. Then you notice that all the data hasn't loaded because as you scroll down you are confronted with more, you guessed it, spinners. But the design is something else. There are bears dancing, tigers prancing, butterflies fluttering their wings in blue skies with puffy clouds roaming everywhere. I don't know if I'm using a CRM platform or looking at a caricatured Bob Ross painting.

Now I have nothing against cartoon characters zipping around. The lightning experience is an experience alright and admittedly the design is actually pretty nice but anything but lightning fast once you've used the classic version.

You could say that I'm nostalgic for the old days of Perl CGI, and perhaps that's true a little. But I'm actually more nostalgic for how much faster the web used to be at one time, slow modem baud rates notwithstanding. But this is the state of the web as we have today. It has been decided that JAMstack is the way to go even if it's at the speed of molasses, or should I say, JAM.

Powered by

Read Financial Markets  |   Home  |   Blog  |   Web Tools  |   News  |   Articles  |   FAQ  |   About  |   Privacy  |   Contact
Donate Bitcoin: 1GfrF49zFWfn7qHtgFxgLMihgdnVzhE361
© 2001-2022 Robert Hashemian   Powered by Hashemian.com