Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. .Net Core 2.2.3 with Angular, preparing for Docker Container Deployment with MongoDB running in a container, all Linux going crazy

.Net Core 2.2.3 with Angular, preparing for Docker Container Deployment with MongoDB running in a container, all Linux going crazy

Scheduled Pinned Locked Moved ASP.NET
dockercsharpsysadminmongodbhelp
3 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jkirkerx
    wrote on last edited by
    #1

    This is my learning project in which I wrapped Angular 7 in .Net Core. I'm in the process of preparing the project to run in a Docker Container and connect to MongoDB that runs in a Docker Container. So I had rewrite the project so it's knows if it's running in a Docker container or just running in IIS, and for development and production environments. Accomplishments: Figured out how to edit the Dockerfile, and inject 2 PFX files into the .Net Core container for portable SSL. Figured out the port mapping on 5000, 5001, 44367, and how not to load Kestrel for development, yet load it for production. I got my Docker-Compose dialed in to create MongoDB V4.08, the static data volume, bridge network to talk to the .Net Core container. Created a a dual appSettings.json for production and development. Got the user secrets going, but haven't figured out the Kestrel part yet. So far so good. But I'm getting some crazy erratic results ... It's like it's stuck in a build and won't update. The project always displays data from a mongo database on on another server from previous builds. I can't get the connection string to work with the user name and password under SHA-1 using the C# Mongo Drivers, but it works without credentials, I think that's my problem. I go to debug to confirm that it detected the Docker Container, but I can't hit the break-point, yet project.dll symbols are loaded. It's just gotten to the point where I'm going around in circles, and need to confirm some code before I change good code. On the data, I can Roto3T into each Mongo and see the data I created which is all different. In startup, I read the appSettings.development.json file and add 1 more option called IsContained, which is what I was trying to hit in the break-point. If I set this extra option here, I should be able to read it in my DBContext? What I did was try and read the Environment Variable since I wasn't able to confirm the option. But would SETTINGS contain that option?

    // Configure our Program Settings to replace Web.Config
    services.Configure(Configuration.GetSection("Settings"));
    services.Configure(
    options =>
    {
    options.MongoDB.Connection = Configuration.GetSection("MongoDB:Connection").Value;
    options.MongoDB.Database = Configuration.GetSection("MongoDB:Database").Value;
    options.MongoDB.Container = Configuration.GetSection("MongoDB.Container").Value;
    options.MongoDB.IsContained = Configuration["DOTNET_RUNNING_I

    J 2 Replies Last reply
    0
    • J jkirkerx

      This is my learning project in which I wrapped Angular 7 in .Net Core. I'm in the process of preparing the project to run in a Docker Container and connect to MongoDB that runs in a Docker Container. So I had rewrite the project so it's knows if it's running in a Docker container or just running in IIS, and for development and production environments. Accomplishments: Figured out how to edit the Dockerfile, and inject 2 PFX files into the .Net Core container for portable SSL. Figured out the port mapping on 5000, 5001, 44367, and how not to load Kestrel for development, yet load it for production. I got my Docker-Compose dialed in to create MongoDB V4.08, the static data volume, bridge network to talk to the .Net Core container. Created a a dual appSettings.json for production and development. Got the user secrets going, but haven't figured out the Kestrel part yet. So far so good. But I'm getting some crazy erratic results ... It's like it's stuck in a build and won't update. The project always displays data from a mongo database on on another server from previous builds. I can't get the connection string to work with the user name and password under SHA-1 using the C# Mongo Drivers, but it works without credentials, I think that's my problem. I go to debug to confirm that it detected the Docker Container, but I can't hit the break-point, yet project.dll symbols are loaded. It's just gotten to the point where I'm going around in circles, and need to confirm some code before I change good code. On the data, I can Roto3T into each Mongo and see the data I created which is all different. In startup, I read the appSettings.development.json file and add 1 more option called IsContained, which is what I was trying to hit in the break-point. If I set this extra option here, I should be able to read it in my DBContext? What I did was try and read the Environment Variable since I wasn't able to confirm the option. But would SETTINGS contain that option?

      // Configure our Program Settings to replace Web.Config
      services.Configure(Configuration.GetSection("Settings"));
      services.Configure(
      options =>
      {
      options.MongoDB.Connection = Configuration.GetSection("MongoDB:Connection").Value;
      options.MongoDB.Database = Configuration.GetSection("MongoDB:Database").Value;
      options.MongoDB.Container = Configuration.GetSection("MongoDB.Container").Value;
      options.MongoDB.IsContained = Configuration["DOTNET_RUNNING_I

      J Offline
      J Offline
      jkirkerx
      wrote on last edited by
      #2

      Well I figured out a few things today. My crazy issues came from the Angular wrapped in .Net Core project image that I started with. There's a file called app.constants in Angular and a class called Configuration that is used to set the url to services in Angular to call .Net Core API's, and all the calls where going to my production server. Thus the wrong data. I just changed that file and now I can hit the breakpoints. Now I'm calling API services in the Dockerized container; I think I can fix it now that I can walk the code. It's a start in the right direction now.

      If it ain't broke don't fix it Discover my world at jkirkerx.com

      1 Reply Last reply
      0
      • J jkirkerx

        This is my learning project in which I wrapped Angular 7 in .Net Core. I'm in the process of preparing the project to run in a Docker Container and connect to MongoDB that runs in a Docker Container. So I had rewrite the project so it's knows if it's running in a Docker container or just running in IIS, and for development and production environments. Accomplishments: Figured out how to edit the Dockerfile, and inject 2 PFX files into the .Net Core container for portable SSL. Figured out the port mapping on 5000, 5001, 44367, and how not to load Kestrel for development, yet load it for production. I got my Docker-Compose dialed in to create MongoDB V4.08, the static data volume, bridge network to talk to the .Net Core container. Created a a dual appSettings.json for production and development. Got the user secrets going, but haven't figured out the Kestrel part yet. So far so good. But I'm getting some crazy erratic results ... It's like it's stuck in a build and won't update. The project always displays data from a mongo database on on another server from previous builds. I can't get the connection string to work with the user name and password under SHA-1 using the C# Mongo Drivers, but it works without credentials, I think that's my problem. I go to debug to confirm that it detected the Docker Container, but I can't hit the break-point, yet project.dll symbols are loaded. It's just gotten to the point where I'm going around in circles, and need to confirm some code before I change good code. On the data, I can Roto3T into each Mongo and see the data I created which is all different. In startup, I read the appSettings.development.json file and add 1 more option called IsContained, which is what I was trying to hit in the break-point. If I set this extra option here, I should be able to read it in my DBContext? What I did was try and read the Environment Variable since I wasn't able to confirm the option. But would SETTINGS contain that option?

        // Configure our Program Settings to replace Web.Config
        services.Configure(Configuration.GetSection("Settings"));
        services.Configure(
        options =>
        {
        options.MongoDB.Connection = Configuration.GetSection("MongoDB:Connection").Value;
        options.MongoDB.Database = Configuration.GetSection("MongoDB:Database").Value;
        options.MongoDB.Container = Configuration.GetSection("MongoDB.Container").Value;
        options.MongoDB.IsContained = Configuration["DOTNET_RUNNING_I

        J Offline
        J Offline
        jkirkerx
        wrote on last edited by
        #3

        I got the SSL/TLS working today with a self contained certificate within the project running in Docker for Windows, and it connects to my MongoDB as well. It took lots of research on Kestrel and how it works. The part that sucks is that all of the examples are for developing and not production and actual deployment. Just finding the nomenclature for searching was difficult as well. But it involves certificate pinning and how to run a container with Kestrel and https. So this segways to another question that I will post.

        If it ain't broke don't fix it Discover my world at jkirkerx.com

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups