Archive | Technology

29 September 2018 ~ 0 Comments

Stuck in WHM/cPanel Upgrade Loop with Easy Apache 4

I ran into this issue and did a lot of digging to find a solution and had a hard time finding one so hopefully this post is hopeful on the rare chance you come across this problem.

Recently I deployed a new cloud server however the hosting company deployed a very old version of WHM, version 42 (11.42), to be exact.

I started running the updates for this to get it up to it’s most recent version, and ultimately was blocked to update EasyApache to EA4 from EA3.

I ran the migrate script as shown on their website:

/usr/local/cpanel/scripts/migrate_ea3_to_ea4 --run

This ran without issue and I continued on the upgrade train with destination 74 (you could have at least pretended to laugh).

All continued to run smooth through version 66, then I reached a block stating my version of ea-apache24-runtime-config was outdated and needed to be updated.

Easy enough, right? I mean, easy is in the name.. well.. not exactly, anticipating a simple yum update I was met with a response ‘No Packages Marked For Update.’

I went through the various steps of making sure that the repo was correct and checking the installed packages, a yum clean all followed with another update, and nothing seemed to work.

I went even so far as to force reinstall cpanel through upcp when it occurred to me, duh, to force reinstall easyapache 4.

The package version when I ran the migration script at version 50 whatever was of course outdated, and cpanel had loaded a new one but it was not installed.

Resolving this problem was as simple as:

/usr/local/cpanel/scripts/migrate_ea3_to_ea4 --run --reinstall

This installed the latest version of EA4 and allowed me continue my cpanel updates.

Hope this helps someone!

Continue Reading

22 March 2018 ~ 0 Comments

ASP.NET Core 2 Not Seeding? Try this!

ASP.NET Core 2 Not Seeding? Try this!

I had recently created a fairly decently sized application, consisting of about a dozen models, a handful of controllers and a heaping serving of views.  Now, the standard school of thought for seeding data into the database is to create a class in your models and call it in your program startup.  You then have your seeding object check each table for data and insert data as needed.

This has worked for me for the most part, until this project.

I wish I had taken screenshots of the errors, but unfortunately I did not. I was having a lot of problems with concurrency, a second operating started on this project, or that the object has been disposed.

I toyed with it for hours trying to get everything to work properly, sometimes one of the sets of data would seed and other times others would seed, and it even seemed to vary depending on the speed of the system I was using.  I tried breaking everything out into individual methods, awaitng tasks in async methods, and countless re-ordering to try and get the most complete version of the data I could, I even ended up presenting the project with slightly incomplete data as the non-fatal error occurred again during the presentation.  Thankfully nobody knew ahead what I had intended the end result to be, so it went completely unnoticed.  But I knew.

I believe the culprit to be The Async methods required by Identity to create user accounts, roles, and assign roles.  I found the positioning of these seemed to have the most impact on which sets of data would generate errors.

The solution came to me randomly, but is quite simple and could potentially be a better way to seed data than the way I was taught in college and discussed earlier.

It’s a very simple solution, just place your seed data and checks in the constructors for your repositories.   After I split up the data into the repositories the database was seeding flawlessly.  It solved concurrency issues since it was only inserting when the repo object was instantiated rather than all the data nearly simultaneously.

In practice it functions exactly the same way that seeding the data would through a specific seeding class, in that you would have it check the table for entries and then generate them.  Of course, if you don’t need initial data for any of the tables then you won’t have to worry about seeding those tables.

Lastly, as a simple reminder, your seed data will is semi-permanent in an application so it may be worthwhile to make it something meaningful as opposed to just hollow test strings.

Let me know in the comments if this information is useful to you, or if you have anything to add or any other methods for seeding data that myself and other readers may not be familiar with.  Thanks!


Continue Reading