Question

Photo of Mark Coveny

0

Deploying RockRMS on AWS with RDS

Hello,


I'm new to developing with Asp.net core and I'm not familiar with Web Forms, but I'm looking to deploy RockRMS in AWS with their MySQL flavor Aurora. I can't find any articles or walkthroughs on using MySQL for this application so I downloaded the source files, but the connection string setup is different than what I'm used to. I'm used to seeing something like:

Startup.cs

services.AddDbContext<AppDbContext>(options =>
                    options.UseMySql(
                        Configuration.GetConnectionString("MySQL")));


User Secrets

"ConnectionStrings": {
    "MySQL": "Server=localhost;user id=root;password=<password>;port=3306;Database=<database>"
  }

dbcontext

using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Pomelo.EntityFrameworkCore.MySql;using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Pomelo.EntityFrameworkCore.MySql;

public AppDbContext(DbContextOptions<AppDbContext> options)

            : base(options)

        {

        }

public DbSet<AppUser> AppUser { get; set; }

blah blah


I see the rock.data.DbContext.cs and rock.data.RockContext.cs file so I should be able to swap out "nameOrConnectionString" with "MySQL" right? Then I'd need to add "using Pomelo.EntityFrameworkCore.MySql;" and that should be good to go right? The DbContext looks different

public DbContext( string nameOrConnectionString ) : base( nameOrConnectionString ) { }

but this part from the RockContext looks familiar to me but the notes indicate that it's just for something other than the default connection string:

public RockContext( string nameOrConnectionString )
            : base( nameOrConnectionString )
        {
        }


The app.config file is a bit confusing for me. There seems to be one for each project and some reference to the database in different ways. Will I need to edit all of these? I see in rock.app.config references entity frameworks  I assume this section is where I would set up the DB service and change it to MySQL right?

  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>

In RockWeb.App_Code.Startup.cs I would need to add the service I think, but I don't see any services set up in here.


I'm also seeing several references in the RockWeb.Bin.EntityFramework.xml to "nameOrConnectionString" that I assume would need to be changed as well?

 

Lastly, I don't see a way to manage secrets in this version. How do you control sensitive information like the connection string password information at?


Any help would be appreciated. The church that I'm working with was hit with a rather large bill for licensing of SQL in Azure, and they'd like to do a proof of concept for running this in AWS on RDS, and I'd like to see if I can get Aurora working as it's much cheaper than SQL RDS. So any help would be appreciated.


Thanks in advance for being understanding that I'm new to this.

Mark

  • Photo of Daniel Hazelbaker

    0

    Hi Mark, Rock only supports SQL Server. Unfortunately it will not work with MySQL or any other database.

    It _will_ work with any version of SQL Server (LocalDB, Express, Standard, Developer, etc) - it just has to be a flavor of the official Microsoft SQL Server due to a number of features provided only by SQL Server that Rock uses.

    • Daniel Hazelbaker

      Also, the normal way to deploy Rock in Azure is a single VM for the IIS server and then to use Azure SQL Database - this eliminates the SQL licensing issues and also allows you to quickly scale the SQL database up and down as needed.

  • Photo of Mark Coveny

    0

    Well, that's disheartening. Are there any plans to modernize the app from Web Forms to Core?

  • Photo of Justin Eveland

    0

    Hey Mark - 

    For what it's worth, I had initially set us up on AWS using RDS for the database service. The Azure SQL offering was cheaper and scaling up/down is pretty simple comparatively. Even if Rock updates to eventually run on .NET Core, it won't likely break away from requiring Microsoft SQL Server as the DB provider. If the church is 501c3, they could qualify for some savings by utilizing a grant from Microsoft for non-profits. They give $1500/year for Azure AD and $3500/year for everything else.

  • Photo of Mark Coveny

    0

    Well, the church in question got hit with a bill for 2k a month for two servers. From the sound of what Danial was saying I guess if they had gone with Azure's managed SQL it would have been cheaper. I ran the numbers for AWS to have an IIS server and SQL RDS and I can get them in around $310 a month (It's $4,860) if they pay for the 1-year reserve upfront costs. After the 2k in credits (down to $2,4860) AWS gives non-profits that puts it at around $200 a month for the largest recommended sizing for RockRMS IIS and SQL RDS. (assuming that's the only thing they are deploying) 


    That's just on this workload, and they have another 40 servers they'd like to move to the cloud. Every price comparison I've done between AWS and Azure, AWS has been dramatically cheaper. So even if they 5k credit would "win" for just this one case, I feel confident that AWS will be cheaper as more servers are added and the numbers ran. Full disclosure though, I don't know what their current Azure deployment looks like, I was just asked to do a proof of concept to get RockRMS working on AWS, and do some price calculations. 

  • Photo of Daniel Hazelbaker

    0

    It would unfortunately require a complete rewrite. .NET Core is a very different beast from .NET Framework/Web Forms, despite the similar names. As Justin mentioned, even if Rock is eventually rewritten to support Core, it would probably still require SQL Server. There are a number of geo spatial features that SQL Server has that other open source database systems just don't have yet. As well as other features that are being used that either don't exist in MySQL/PostgreSQL or behave differently enough that they just couldn't be used.

    A .NET core version _is_ something that has been discussed, but it's not on any roadmap that I'm aware of. The only way to do that kind of migration would completely break backwards compatibility which means every single plugin would cease functioning and have to be rewritten from scratch as well.

    It is worth noting, that whether you are on Azure or AWS, if they are looking at around $310/mo, they are probably WAY over pricing their server - unless they are a HUGE church. For reference, I ran a Rock install (personal website) on Azure VM + Azure SQL at for $30/mo for over a year. This was using the B1S VM and the S10 SQL instance. Yes, it was slow, but it ran just fine once Rock was initialized. I wouldn't recommend cheapstaking that much on the VM for a production database, but I would think you could easily run Rock on far cheaper than the prices you are seeing. The nice thing about cloud is that you can start small and scale up as needed. So you could easily setup a much smaller VM + SQL, run it for a few days keeping an eye on performance data and scale up bit by bit until you find a good compromise between cheap and performant.

  • Photo of Mark Coveny

    0

    I just went by max recommended size because they have 150k in records. (which is more than 15,000+ which is the largest recommended size) I did tell them that the 1TB on the IIS server seemed way overboard to me, even if the 1TB on the database could be right. (I don't know what they currently have this was just a proof of concept, and basic cost analysis) 

  • Photo of Justin Eveland

    0

    Wow, a 2k bill for running 2 servers does seem like something wasn't sized right.

    Our problem with RDS (from what I remember) is that they did away with the BYOL model (well, M$FT did away with it, likely due to pushing customers toward Azure), so the cost of licensing SQL Server had to be absorbed into the RDS subscription. At the time (about 9 months ago), I couldn't get us below ~$500/month with RDS due to that limitation. And that was on the smallest VM setup.

    It should be noted that the recommendations in the guide are pretty out of date, and are definitely overkill. I don't think the recommended sizes are based on cloud VM setups, they were more geared toward an on-prem situation from what I've heard. We have somewhere around 250k people records in our DB and it's been mostly comfortable running an Azure SQL with the S3 size (250GB / 100 DTUs / $150/month) as we've been training staff in our test environment. The VM is sized at Standard B2s (2 vcpus, 4 GB memory) and CPU has never been taxed more than 20-30% even with ~100 staff in at the same time. Most of the workload resides in the database, so if you get that sized appropriately you'll be good. As a bonus, Azure SQL keeps 35 days of point-in-time restores available *by default* if you're on a standard tier subscription. For most churches, it's really advantageous to just roll with Azure SQL versus running a VM+SQL Server.

    If you're interested, there's a #hosting channel in Rock's community Rocket Chat. If you have other questions people might be more responsive to weigh in with their experiences there.

  • Photo of Mark Coveny

    0

    The 2k bill seemed high to me, and I can only assume from the previous comments that they spun up an MS SQL instance rather than using managed SQL and that's the reason it was so expensive, but again I wasn't brought in until afterwards to do a cost analysis for AWS.


    If I could go 2 vCPU /8 GB RAM on both the ISS and the AWS SQL RDS that would cut the costs in half, and with the credit, I think that would be free if I downsized the amount of storage on the IIS server. (and maybe the SQL RDS instance storage might need it to make it free I'd have to do the math) At the smaller sizing, AWS is comparable in cost, and they already have had a bad experience with Azure.