Is there an example of running a simple application by using the Habitat CLI for Windows


#1

Because of my lack of experience with Habitat , so I would like to ask if you have any examples of running a simple application using the Habitat CLI for Windows. Like Node.js,Nginx and so on. Please show me. Grateful


#2

Hi @Fishbone

Have you had a look at the learning stream for Windows? https://www.habitat.sh/demo/windows/steps/1/

Let me know if thats what you were looking for, or if you need something else.


#4

Yes.I have tried this. I just followed the steps and copied the codes,but when I was building there were something wrong and I didn’t how to deal with them.(I called ‘hab studio enter -w’ and then ‘build’)

The logs:
[HAB-STUDIO] Habitat:\src> build
: Loading C:\hab\studios\ContosoUniversity\src\habitat\plan.ps1
contosouniversity: Plan loaded
contosouniversity: Validating plan metadata
contosouniversity: hab-plan-build.ps1 setup
contosouniversity: Using HAB_BIN=C:\hab\pkgs\core\hab-studio\0.73.0\20190115010701\bin\hab\hab.exe for installs, signing, and hashing
contosouniversity: Resolving scaffolding dependencies
» Installing core/nuget
:cloud::cloud: Determining latest version of core/nuget in the ‘stable’ channel
→→ Using core/nuget/4.6.2/20180529182956
★★ Install of core/nuget/4.6.2/20180529182956 complete with 0 new packages installed.
** contosouniversity: Resolved build dependency ‘core/nuget’ to C:\hab\studios\ContosoUniversity\hab\pkgs\core\nuget\4.6.2\20180529182956**
» Installing core/dsc-core
:cloud::cloud: Determining latest version of core/dsc-core in the ‘stable’ channel
→→ Using core/dsc-core/0.2.1/20180919112142
★★ Install of core/dsc-core/0.2.1/20180919112142 complete with 0 new packages installed.
** contosouniversity: Resolved dependency ‘core/dsc-core’ to C:\hab\studios\ContosoUniversity\hab\pkgs\core\dsc-core\0.2.1\20180919112142**
** contosouniversity: Setting up environment**
** contosouniversity: Populating runtime environment from dependencies**
** contosouniversity: Populating buildtime environment from dependencies**
** contosouniversity: Layering runtime environment on top of system environment**
** contosouniversity: Value of PSModulePath is \hab\pkgs\core\dsc-core\0.2.1\20180919112142\Modules**
** contosouniversity: Layering buildtime environment on top of system environment**
** contosouniversity: Setting env:PATH=C:\hab\studios\ContosoUniversity\hab\pkgs\core\nuget\4.6.2\20180529182956\bin;C:\hab\pkgs\core\hab-studio\0.73.0\20190115010701\bin\powershell;C:\hab\pkgs\core\hab-studio\0.73.0\20190115010701\bin\hab;C:\hab\pkgs\core\hab-studio\0.73.0\20190115010701\bin\7zip;C:\hab\pkgs\core\hab-studio\0.73.0\20190115010701\bin;C:\Windows\system32;C:\Windows;C:\hab\studios\ContosoUniversity\hab\bin**
** contosouniversity: Clean the cache**
** contosouniversity: Setting env:LIB=**
** contosouniversity: Setting env:INCLUDE=**
** contosouniversity: Preparing to build**
** contosouniversity: Building**
The input file does not exist:
C:\hab\studios\ContosoUniversity\hab\cache\src/contosouniversity-0.1.0/C#/contosouniversity/packages.config.
Feeds used:
** C:\Users\xlk.nuget\packages**
** https://api.nuget.org/v3/index.json**

Attempting to gather dependency information for package ‘MSBuild.Microsoft.VisualStudio.Web.targets.14.0.0.3’ with respect to project ‘C:\hab\studios\ContosoUniversity\hab\cache\src/contosouniversity-0.1.0/’, targeting 'Any,Version=v0.0’
Gathering dependency information took 1.56 sec
Attempting to resolve dependencies for package ‘MSBuild.Microsoft.VisualStudio.Web.targets.14.0.0.3’ with DependencyBehavior 'Lowest’
Resolving dependency information took 0 ms
Resolving actions to install package 'MSBuild.Microsoft.VisualStudio.Web.targets.14.0.0.3’
Resolved actions to install package 'MSBuild.Microsoft.VisualStudio.Web.targets.14.0.0.3’
Retrieving package ‘MSBuild.Microsoft.VisualStudio.Web.targets 14.0.0.3’ from ‘C:\Users\xlk.nuget\packages’.
Adding package ‘MSBuild.Microsoft.VisualStudio.Web.targets.14.0.0.3’ to folder 'C:\hab\studios\ContosoUniversity\hab\cache\src\contosouniversity-0.1.0’
Added package ‘MSBuild.Microsoft.VisualStudio.Web.targets.14.0.0.3’ to folder 'C:\hab\studios\ContosoUniversity\hab\cache\src\contosouniversity-0.1.0’
Successfully installed ‘MSBuild.Microsoft.VisualStudio.Web.targets 14.0.0.3’ to C:\hab\studios\ContosoUniversity\hab\cache\src/contosouniversity-0.1.0/
Executing nuget actions took 261.22 ms
Microsoft ® Build Engine version 4.6.1038.0
[Microsoft .NET Framework、、version4.0.30319.42000]
Copyright © Microsoft Corporation. All rights reserved.

MSBUILD : error MSB1009: Project file does not exist
switch:C:\hab\studios\ContosoUniversity\hab\cache\src/contosouniversity-0.1.0/C#/contosouniversity/contosouniversity.csproj
Invoke-Build : dotnet build failed!
At C:\hab\pkgs\core\hab-studio\0.73.0\20190115010701\bin\hab-plan-build.ps1:1189 char:11
+ try { Invoke-Build } finally { Pop-Location }
**+ ~~~~~~~~~~~~**
+ CategoryInfo : NotSpecified: ( [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Invoke-Build


#5

I also have a question.(This question is unrelated to the above)

How to deal with this when it happen:

The red part means “Access denied”.


#6

Hi i need some help regarding habitat application deployment, where to define target machine ip address for with out exporting docker manual commands through chef habitat.

plz give some suggestions


#7

It sounds like the build is not finding the app source code. The best thing to do when things go wrong in this tutorial is to clone the finished plan at https://github.com/habitat-sh/contosouniversity and compare that to the directory structure you have been building in the tutorial.


#8

Regarding the “Access denied” errors, I would guess that the current user might not have write access into your hab directory. I’d suggest opening your console as an admin user.