Docker Development

SuDSuD Member Posts: 102
Hi Experts,

I need suggestion on a Development environment setup for more than 2 developer.
Scenario:
We have a Azure VM and a Container is setup there with Latest BC insider image of V17.
Now i want to give access to 2-3 developers target to that BC Container from there local system.
I want to give them access of Everything that they can do from their local system like if they have installed Docker Container on their local system. Debugging, Development.

Now what steps do i need to follow to give them access for development targeting that Azure VM Docker container.

NOTE : I can access Webclient of that BC Container from my local system. Let say port is opened for accessing webclient outside the server.

Thanks
SUD

Answers

  • SanderDkSanderDk Member Posts: 497
    Hi Sud,
    Perhaps you can find inspiration in what we do:

    At my company we have created a server which have docker running, the server host multiple BC instances in different docker images.
    Then we have created a Application Request Routing (ARR) to forward the traffic to different containers depending on the URL provided by the developer/consultants.
    Every container is created with a script that added the developers user account to the specific BC instances. So every container we create will have the correct account added (With Powershell and AzureAD)
    Then the developers can access both the web clients and the web service used by VSCode.

    This is what we do, perhaps it does not meet your requirements :smile:
    For help, do not use PM, use forum instead, perhaps other people have the same question, or better answers.
  • SuDSuD Member Posts: 102
    First of all thanks @SanderDk for your reply!!

    Ok so i got some help from your answer here and was able to setup the dev environment.

    Below are some of my other questions, help me if you know.

    When we creates a new container it automatically takes the ServerInstance name BC, right?
    So i just want to change that name into my own name like BCDEV, BCPROD.

    I want to specify PublicWebBaseUrl to other than this ContainerName/BC while creating docker container so that my debugger instance would open the link that i want to. When developing from local environment.

    Do you know how to update existing images from insider builds without creating a new container with new image? Because if i create new container then the data that we created earlier for our testing will wipe out. And we have to create data again.

    We are actually developing the things for our product which is parallel depend on events that we getting from MS in insider builds on the basis of our request.
    So whenever they release new events in Master branch then we have to update images.

    I hope you understand my concern.

    Thanks
    SUD
  • SanderDkSanderDk Member Posts: 497
    Hi @SuD
    Why do you want to change the server instead of just create different containers with name PROD,DEV and so on? It is a lot easier to just create more containers and you do not need to change publicwebbaseUrl.

    If you really want to change the name, then you properly will need to write some PowerShell to run in your container to create a new service instance with your required settings.
    We actually have a whole Post-Container creating script to manage our required setting on the container.

    To keep the data while updating your build, you can do a couple of things (depending on your setup):
    1. The thing we have do is we keep all of the development database on a single SQL server and the different docker images are using the database from the SQL server, that way it also does not matter if a container breaks, I can in a few seconds have a new container runner the exact build. (https://freddysblog.com/2019/11/04/using-sql-server-on-the-host/)

    2. You could also extract the database from the docker image by export a bak file from the container (I would not recommend this because then you will need to secured that the SQL server in different build is comparable with your bak file)

    If you do not have a lot of data you could also extract the data throw configuration package (https://docs.microsoft.com/en-us/powershell/module/microsoft.dynamics.nav.management/import-navconfigurationpackagefile?view=businesscentral-ps-16)


    For help, do not use PM, use forum instead, perhaps other people have the same question, or better answers.
  • SuDSuD Member Posts: 102
    Thanks @SanderDk
    Using SQL server on host system is a good idea.
    But in that case i believe we have available scripts that can attach that host database instance, Server, Database Name to a NewContainer, right? Can you please share if you have those?

    regarding first query!!
    Below is the scenario.

    1. Container A
    WebClient URL would be like http://A/BC
    2. Container B
    WebClient URL would be like http://B/BC

    But now let say, i want to route outside requests to these containers then.
    My machine's public IP is 10.2.3.4 would route transfer requests to BC instance but system will confuse for which BC insatnce it is looking for because public IP would be same for container. And requests only target to this url http://10.2.3.4/BC, now here BC is for which container instance.

    Now if i set publicDNSName then i can route requests to different different container perfectly. like for container A , abcd.google.com and for B xyz.google.com.

    But when VSCode opens debugger instance while pressing F5 then it picks URL from PublicWebBaseUrl from Server configuration. And in that parameter i have URL like containername/BC so it would always opens url like http://A/BC and that would be not accessible from my system. So if somehow i can set this PublicWebBaseURl to other than the default one then i can route the debugger instance to the actual oine

    Thanks
    SUD
  • SanderDkSanderDk Member Posts: 497
    @SuD
    Actually you do not need a new script, if you go to the link I attached earlier freddys blog, you will find information on how to use a host SQL server, when you have complete these steps it is a simple as to added this in your script:
    New-BCContainer `
            -databaseServer 'host.containerhelper.internal' `
            -databaseInstance '' `
            -databaseName $db `
            -databaseCredential $dbcredentials `
    

    Regrading your scenario, I do not know if can accomplice this with changing BC instance name/DNS, you could try it :smile:

    We took a different approach to handle this, we create URL rewrite with a ARR Proxy on the host server (without changing in docker images) (https://docs.microsoft.com/en-us/iis/extensions/configuring-application-request-routing-arr/creating-a-forward-proxy-using-application-request-routing) that way we did not need to do a lot of changes in the docker images (This too can be handle by PowerShell ;-) )
    For help, do not use PM, use forum instead, perhaps other people have the same question, or better answers.
  • mkulikmkulik Member Posts: 1
    Hello @SuD and @SanderDk.
    I was hoping that either of you could share a copy of a working web.config that handles the rewrite rules for the forwarding mentioned at the beginning of this thread. I have been working on it for quite a while and though I have the URLs and redirects finally working correctly, I am still stuck in a login loop on the 1st page, even though BC events says that my login was successful. I suspect there are other rules (related to JS maybe) that I am missing.

    Thanks for your help in advance!
Sign In or Register to comment.