Showing posts from 2019

Gitlab: Local Continuous Integration with Docker & Dotnetcore

Started this in the beginning of the year...
   On a Friday night, I spent my time working up til 6 in the morning on this. Probably the most difficult but simple process I've completed. Still proud that I completed it in a single night despite all the challenges. Some of which actually helped me create a solution more professional in my opinion. Meaning I didn't just create a work around. For example in my research I found other developers using scp (secure copy in linux) with sshpass which isn't problem when deploying remotely. However I needed to do it locally. So for me using an ssh really seems waste for internal Processing. At the time creating this solution though I didn't care I need something fast. I should also note I'm not using docker to host my aspnetcore app but using the gitlab-runner in docker. 

Update to now
I've come a long way now to where creating task runners is a lot easier and I'm spinning them up specifically for each project need. Whe…

NLog Killing Aspnet Core Application

Awhile back I moved to a new location for storing my server and for the most part things went smoothly. Didn't have any issues with my local DNS or emails, however I did encountered one issue. The issue was Recycled Motors where the application would boot but instantly fail. Which didn't create any logs or errors for me to look. So it took me a few weeks along with everything else going on to figure this one out. I spend a little too much time looking into my network and the bind9 configs because I know it had to do with my configs. Originally I was on a 10.0.10.x network but with the I.P. the modem only allowed the regular 192.168.1.x ip address. Eventually I figured out the issue, being my NLog config itself. I have it writing in a database where I list the ip address explictly.
I completely forget about this since it was just a quick thing I added a few weeks before the move and I still have it pointed to localhost in the appsettings.json


Use different environment …

.NET Core Docker Image for SPA Applications

If your looking to get CI/CD up and running with a SPA Application I recommend this setup. This article is based on Aspnet Core 2.1 and up. If you read the docker docs on the 2.1 version of dotnet core you will see they removed nodejs, which breaks a bunch of stuff if your using dotnet core with either Angular2 or Reactjs. I currently use gitlab-runners but with the volumes config to publish my sites.

Notes from Dotnet
Using NodeJS in microsoft/aspnetcore-build, but this is missing from dotnet/core/sdk:2.1. What should I do?
You can either install NodeJS by adding a few lines of code to your Dockerfile that download and extract NodeJS, or you can use the multi-stage feature of Docker and the official NodeJS images. Sample code to install NodeJS on your own: # set up nodeENV NODE_VERSION 8.9.4 ENV NODE_DOWNLOAD_SHA 21fb4690e349f82d708ae766def01d7fec1b085ce1f5ab30d9bda8ee126ca8fc RUN curl -SL "${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.gz" --out…

Randomly Return Rows in EFCore with Postgresql

Currently working on a random list motorcycles to display on my front. At the moment don't have any priority listening on my site for clients other than the list of bikes I'm trying to sell personally as a source of income. For now this is what I did and its just these two parts to get things going.

something.OrderBy(r =>Guid.NewGuid()).Take(3) If you don't already have the extension this command will check and install for you.


Entity Framework: ToListAynsc & WhereAsync

When upgrading aspnet mvc applications I like to take a look on how I can convert the api's to async. This sometimes is really easy but as things get more complex my queries do as well. So this is a list of ways you can form a where clause on top your async but note not all solutions take advantage of it.
Notes on EFCore Entity Framework Core provides a set of asynchronous extension methods that can be used as an alternative to the LINQ methods that cause a query to be executed and results returned. Examples include ToListAsync(), ToArrayAsync(), SingleAsync(), etc. There are not async versions of LINQ operators such as Where(...), OrderBy(...), etc. because these methods only build up the LINQ expression tree and do not cause the query to be executed in the database. a collection by an async result, built an extension method called WhereAsync.publicstatic async Task<IEnumerable…