Using AdvaniaGIT – FTP server for teams

So, you are not the only one in your company doing development, right?

Essential part of being able to develop C/AL is to have a starting point.  That starting point is usually where you left of last time you did some development.  If you are starting a task your starting point may just be the localized release from Microsoft.

A starting point in AdvaniaGIT is a database backup.  The database backup can contain data and it should.  Data to make sure that you as a developer can do some basic testing of the solution you are creating.

AdvaniaGIT has a dedicated folder (C:\AdvaniaGIT\Backup) for the database backups.  That is where you should put your backups.

If you are working in teams, and even if not you might not want to flood your local drive with database backups.  That is why we configure an FTP server in C:\AdvaniaGIT\Data\GITSetting.json.

{
    "ftpServer":  "ftp://ftp02.hysing.is/",
    "ftpUser":  "ftp_sourcetree",
    "ftpPass":  "*****",
    "licenseFile":  "Advania.flf",
    "workFolder":  "C:\\NAVManagementWorkFolder\\Workspace",
    "patchNoFunction":  "Display-PatchDayNo",
    "defaultDatabaseServer":  "localhost",
    "defaultDatabaseInstance":  "",
    "objectsNotToDelete":  "(14125500..14125600)",
    "sigToolExecutable":  "C:\\Program Files (x86)\\Windows Kits\\10\\bin\\x64\\signtool.exe",
    "codeSigningCertificate":  "CodeSign_Certificate.pfx",
    "codeSigningCertificatePassword":  "****",
    "setupPath":  "setup.json",
    "objectsPath":  "Objects",
    "deltasPath":  "Deltas",
    "reverseDeltasPath":  "ReverseDeltas",
    "extensionPath":  "Extension1",
    "imagesPath":  "Images",
    "screenshotsPath":  "ScreenShots",
    "permissionSetsPath":  "PermissionSets",
    "addinsPath":  "Addins",
    "languagePath":  "Languages",
    "tableDataPath":  "TableDatas",
    "customReportLayoutsPath":  "CustomReportLayouts",
    "webServicesPath":  "WebServices",
    "binaryPath":  "Binaries",
    "testObjectsPath":  "TestObjects",
    "datetimeCulture":  "is-IS",
    "NewSyntaxPrefix":  "NewSyntax",
    "targetPlatform":  "DynamicsNAV",
    "VSCodePath":  "AL"
}

When we start an action to build NAV development environment the AdvaniaGIT tools searches for a database backup.

The search is both on C:\AdvaniaGIT\Backup and also on the root of the FTP server.

Using the function Get-NAVBackupFilePath to locate the desired backup file it will search based on these patterns.

    $FilePatterns = @(
        "$($SetupParameters.navRelease)-$($SetupParameters.projectName).bak",
        "$($SetupParameters.navRelease)/$($SetupParameters.navVersion)/$($SetupParameters.projectName).bak",
        "$($SetupParameters.navRelease)/$($SetupParameters.projectName).bak",
        "$($SetupParameters.navRelease)-$($SetupParameters.navSolution).bak"
        "$($SetupParameters.navRelease)/$($SetupParameters.navVersion)/$($SetupParameters.navSolution).bak",
        "$($SetupParameters.navRelease)/$($SetupParameters.navSolution).bak")

The navRelease is the year (2016,2017,…).  The navVersion is the build (9.0.46045.0,9.0.46290.0,10.0.17972.0,…)

The projectName and navSolution parameters are defined in Setup.json (settings file) in every GIT branch.

{
  "branchId": "3ba8870a-0274-4162-8ea2-66e314bb3e34",
  "navSolution":  "IS",
  "storeAllObjects":  "true",
  "navVersion":  "9.0.48992.0",
  "projectName": "ADIS",
  "baseBranch": "IS",
  "uidOffset": "10000200",  
  "objectProperties": "true",
  "datetimeCulture":  "is-IS"
}

Combining these values we can see that the search will be done with these patterns.

    $FilePatterns = @(
        "2016-ADIS.bak",
        "2016/9.0.48992.0/ADIS.bak",
        "2016/ADIS.bak",
        "2016-IS.bak"
        "2016/9.0.48992.0/IS.bak",
        "2016/IS.bak")

And these file patterns are applied both to C:\AdvaniaGIT\Backup and to the FTP server root folder.  Here are screenshots from our FTP server.

Looking into the 2017 folder

And into one of the build folders

My local backup folder is simpler

This should give you some idea on where to store your SQL backup files.

 

 

Using AdvaniaGIT – Docker Containers

There is a new kid in town.  His name is Docker.

Microsoft is saying:

We are currently investigating how we can use Docker for deploying NAV. For test purposes we have created a Docker Container Image with the NAV Developer Preview, which you can try out.

Docker Containers is a technology where you, instead of virtualizing the entire machine, only virtualize the services and share resources from the host computer. Read more about it here: https://www.docker.com/what-docker

Read more about how to get started with Docker here: https://docs.docker.com/docker-for-windows/install/

So what does this mean?

We can install NAV environments as container both in Azure and on premise.  We can have multiple NAV versions to work with without having to install, so there is no conflict.  We can also get access to container images that are still in preview.

Note what Microsoft says, they are investigating.  The NAV Container Image service is not public yet.  You need authentication to get access.  This project has a place on GitHub.  To get access please contact Microsoft or send me a line and I will point you in the right direction.

The easiest way to get started is to try the NAV Developer Preview template on Azure,  http://aka.ms/navdeveloperpreview.  This will give you a full development environment for NAV Extension2.0 using VS Code.

It should be straight forward to install AdvaniaGIT on top of the NAV Developer Preview and start from there.  We can also start from Azure template called “Windows Server 2016 Datacenter – with Containers”.

The local option is to install Docker on our Windows laptop.  If you would like to use Docker on your laptop you need to change one setting after installation.  You need to switch to Windows containers.  Your laptop will most likely restart during installation and configuration of Docker so make sure to have your work saved.

If you are planning to run a Docker-Only environment you don’t need to install NAV.  Still there are prerequisite components that you must install.  These components can be found on the NAV DVD folder “Prerequisite Components”.  From the “Microsoft SQL Server” folder install sqlncli64.msi and ReportBuilder3.msi.  From the “Microsoft Visual C++ 2013” folder install vcredist_x64.exe.  From the “Microsoft Visual Studio 2010 Tools for Office Redist” install vstor_redist.exe.  From the “Microsoft Report Viewer” folder install both SQLSysClrTypes.msi and ReportViewer.msi.  You should now be ready for the next step.

So, let’s get started

In your C:\AdvaniaGIT\Data folder open DockerSettings.json

{
  "RepositoryPath": "navdocker.azurecr.io",
  "RepositoryUserName": "7cc3c660-fc3d-41c6-b7dd-dd260148fff7",
  "RepositoryPassword": "access_key_for_the_repository"
}

That’s all.  Your are now ready to use Docker with AdvaniaGIT.  Make sure to always have the latest version of AdvaniaGIT installed.

You can even use the “devpreview” build of NAV TENERIFE to do vNext development both in C/AL and AL.

Stay tuned, the AdvaniaGIT journey will continue…

Using AdvaniaGIT – How to configure licenses

When NAV environments are built a development license is uploaded to the development database.

Make sure to save your development licenses in your AdvaniaGIT license folder.

There are two ways to configure which license is used.  First with the “licenseFile” property of GITSettings.json in your AdvaniaGIT data folder.

{
  "ftpServer": "ftp://ftp02.hysing.is/",
  "ftpUser": "ftp_sourcetree",
  "ftpPass": "******",
  "licenseFile": "Advania.flf",
  "workFolder": "C:\\AdvaniaGIT\\Workspace",
  "patchNoFunction": "Display-PatchDayNo",
  "defaultDatabaseServer": "localhost",
  "defaultDatabaseInstance": "",
  "objectsNotToDelete": "(14125500..14125600)",
  "sigToolExecutable": "C:\\Program Files (x86)\\Windows Kits\\10\\bin\\x64\\signtool.exe",
  "codeSigningCertificate": "",
  "codeSigningCertificatePassword": "",
  "setupPath": "setup.json",
  "objectsPath": "Objects",
  "deltasPath": "Deltas",
  "reverseDeltasPath": "ReverseDeltas",
  "extensionPath": "Extension1",
  "imagesPath": "Images",
  "screenshotsPath": "ScreenShots",
  "permissionSetsPath": "PermissionSets",
  "addinsPath": "Addins",
  "languagePath": "Languages",
  "tableDataPath": "TableDatas",
  "customReportLayoutsPath": "CustomReportLayouts",
  "webServicesPath": "WebServices",
  "binaryPath": "Binaries",
  "targetPlatform": "DynamicsNAV",
  "VSCodePath": "AL",
  "NewSyntaxPrefix": "NewSyntax"
}

Just specify the file name in the license folder.

The license configured in GITSettings.json will be used as default for all builds.  However, as mentioned earlier, every settings in GITSettings.json can be overwritten by the settings in each branch.

The settings file in each branch is named according to the “setupPath” parameter in GITSettings.json.  If we take a look at the setup.json file for my G/L Source Names solution.

{
  "branchId": "479e77f3-031a-49fe-bb6a-314464c6a9a8",
  "navVersion": "10.0.15052.0",
  "navSolution": "W1",
  "projectName": "GLSOURCENAMES",
  "baseBranch": "master",
  "storeAllObjects": "false",
  "uidOffset": "70009200",  
  "licenseFile": "Kappi.flf",
  "versionList": "GLSN10.0",
  "objectProperties": "true",
  "datetimeCulture": "is-IS",
  "targetPlatform": "Dynamics365",
  "appId": "479e77f3-031a-49fe-bb6a-314464c6a9a8",
  "appName": "G/L Source Names",
  "appPublisher": "Objects4NAV",
  "appVersion": "1.0.0.1",
  "appCompatibilityId": "",
  "appManifestName": "G/L Source Names",
  "appManifestDescription": "G/L Source Names adds the source name to the G/L Entries page.  Source Name is the customer in sales transaction and the vendor in purchase transactions", 
  "appBriefDescription": "Source Names in G/L Entries",
  "appPrivacyStatement": "http://objects4nav.com/privacy",
  "appEula": "http://objects4nav.com/terms",
  "appHelp": "http://objects4nav.com/glsourcenames",
  "appUrl": "http://objects4nav.com",
  "appIcon": "Logo250x250",  
  "appDependencies":
    [
  
    ],
  "appPrerequisites":
    [
  
    ],
  "permissionSets":
    [
  		{"id": "G/L-SOURCE NAMES",    "description": "Read G/L Source Names"},
  		{"id": "G/L-SOURCE NAMES, E", "description": "Update G/L Source Names"},
  		{"id": "G/L-SOURCE NAMES, S", "description": "Setup G/L Source Names"}
  	],
  "webServices":
    [
    
    ],
  "dotnetAddins":
    [
  
    ],
  "tableDatas":
    [
   
    ]
}

Here I need to use another license file.  The one used when I applied for the object range for my extension.

Licenses are not to be stored in SQL backups used by AdvaniaGIT.  When using AdvaniaGIT to create SQL backups the license is removed before creating the backup and reinstalled afterwards.

The first function that is executed after SQL database restore is a database upgrade with the development environment.  This must be done to make sure that the database fits the service version being used.  For this database upgrade function to be successful, first either make sure that the database does not contain expired license, and make sure that you have a valid license in the master database.

There are a few ways of doing this.  First, there is an option when installing NAV to upload the license.

Secondly, in the development environment you can upload a license, going through Tools and License Information.

But make sure that the database your development environment is connected to does not have the “Save license in database” set like here, going through File, Database and Alter.

The third option is to use the server administrative shell.

Hope this helps.  More to come soon.  Stay tuned…