CI/CD & Hosting

CI/CD & Hosting

I am using Microsoft Azure to host my applications. Which is be the default choice in the .Net space.

The code base comes with a github workflow to automatically deploy to production on any push to master.

I wont say that I have weighed it against many alternatives. It just works.
To set this app you need 3-4 services.

5 Minute Hosting on Railway

I checked out some easier hosting options and found https://railway.app (opens in a new tab)

Railway is a really easy point and click host where you can link your github repository and create a postgres database within a couple of minutes.
It's free to start. No credit card required. I also think everything up to 5$ a month is free.

There is a Dockerfile at the root of the solution that will automatically be picked up by railway.

Railway will automatically redeploy your app, whenever you push changes to the github repository.

How To

  1. Link your github repository (It will automatically build, deploy and start)
  2. Go to Settings => Networking => Public Networking and add a free ssl domain
  3. Right click to create a postgres database
  4. Adjust the "ConnectionString" environment variable (in your appsettings or wherever) with the values from the "Variables" tab.
    Youre gonna need hostname, port, username, password and database.

I don't know about the cost this is gonna incurr yet. But it is marketed as the "easy, cheap, fast, getting started hosting option for side projects".
I've moved 2 of my low traffic apps over and will monitor the situation. I hope its less than 5$.

It looks like a really good solution to just get something out there quickly, before you move onto the heavier azure / aws services, should your app take off.

Azure Services

External Services

To fully get started you also need to set up your accounts with the external service providers.

  • Azure (opens in a new tab) - Cloud provider to make all of the above work in the first place.
  • Stripe (opens in a new tab) - Payment provider. You need an account and a product. The documentation is pretty good and they have an extensive test environment. They take a percentage of your sales.
  • Sendgrid (opens in a new tab) - Email provider. Sends out your emails, tells you which didnt get received, which got opened etc. Free for 100 Emails a day.

Final Thoughts

It sounds complicated at first, but its really just 3 services that you can't get around with any real application, hosted anywhere.

Your api. Your database. Your storage.

Azure and github are also pretty well integrated.
If you set up a web app, it will automatically ask for your github account, link the accounts, drop a secret into your account, set up a github workflow.

Again this is just my set up and completely optional. You can run .net anywhere, you can host your database and files anywhere.

I will look into setting up a full docker image to maybe make deployment more flexible, easier and cheaper.
I will also look into setting all of these services up in a template so you (and me) dont have to do click ops anymore.