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
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.
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
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
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
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".
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
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.
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.
@mwrock I am also facing this access denied error quite frequently when trying to load a service or installing a package. I do have admin access and opened powershell as admin.
Here is the debug trace:
[HAB-STUDIO] Habitat:\src> hab pkg install C:\studio\hab\cache\artifacts\core-sqlserver-14.0.1000-20190711154958-x86_64-windows.hart
[2019-10-04T05:37:44Z DEBUG habitat_common::ui] UI { shell: Shell { input: InputStream { isatty: true }, out: OutputStream { coloring: Auto, isatty: true }, err: OutputStream { coloring: Auto, isatty: true } } }
[2019-10-04T05:37:44Z DEBUG hab] clap cli args: ["C:\hab\pkgs\core\hab-studio\0.85.0\20190916221803\bin\hab\hab.exe", "pkg", "install", "C:\studio\hab\cache\artifacts\core-sqlserver-14.0.1000-20190711154958-x86_64-windows.hart"]
[2019-10-04T05:37:44Z DEBUG hab] remaining cli args:
[2019-10-04T05:37:44Z DEBUG hab::config] No CLI config found, loading defaults
[2019-10-04T05:37:48Z DEBUG habitat_common::command::install] install key_cache_path: C:\studio\hab/cache/keys
[2019-10-04T05:37:48Z DEBUG habitat_http_client::api_client] Client socket timeout: 300 secs
[2019-10-04T05:37:48Z DEBUG habitat_http_client::api_client] Skip cert verification: false
[2019-10-04T05:37:48Z DEBUG habitat_http_client::api_client] User-Agent: hab/0.85.0/20190916215313 (x86_64-windows; 10.0.14915)
[2019-10-04T05:37:48Z DEBUG habitat_http_client::api_client] No proxy configured for url: "https://bldr.habitat.sh/v1"
[2019-10-04T05:37:48Z DEBUG habitat_http_client::api_client] No installed Habitat core/cacerts package found
[2019-10-04T05:37:48Z DEBUG habitat_http_client::api_client] Processing cert file: C:\studio\hab/cache/ssl\cert.pem
» Installing C:\studio\hab\cache\artifacts\core-sqlserver-14.0.1000-20190711154958-x86_64-windows.hart
[2019-10-04T05:37:48Z DEBUG habitat_common::command::install] skipping artifact copy, it is being referenced directly from cache, artifact_path=\?\C:\studio\hab\cache\artifacts\core-sqlserver-14.0.1000-20190711154958-x86_64-windows.hart, cache_path=\?\C:\studio\hab\cache\artifacts\core-sqlserver-14.0.1000-20190711154958-x86_64-windows.hart
[2019-10-04T05:37:48Z DEBUG habitat_common::command::install] Found core/sqlserver/14.0.1000/20190711154958 in artifact cache, skipping remote download
â Verifying core/sqlserver/14.0.1000/20190711154958
[2019-10-04T05:37:52Z DEBUG habitat_core::crypto::keys::sig_key_pair] Can't find secret key for name_with_rev core-20180119235000: The system cannot find the file specified. (os error 2)
[2019-10-04T05:37:53Z DEBUG habitat_common::command::install] Verified core/sqlserver/14.0.1000/20190711154958 signed by core-20180119235000
â Using core/dsc-core/0.3.0/20190711154859
[2019-10-04T05:37:53Z DEBUG habitat_common::templating::hooks] install not found at C:\studio\hab\pkgs\core\dsc-core\0.3.0\20190711154859\hooks\install, not loading
[2019-10-04T05:38:01Z DEBUG habitat_common::command::install] rename failed with Os { code: 5, kind: PermissionDenied, message: "Access is denied." }, checking for installed package
XXX
XXX Access is denied. (os error 5)
XXX
[HAB-STUDIO] Habitat:\src>
Couple of things I validated:
- the core/sqlserver and its dependent package dsc both are available in my local cache.
- the secret key - core-20180119235000 is also available in C:\studio\hab\cache\keys
- I tried deleting this key and it gets regenerated next time I try to fetch some packaged from builder.
- I also tried loading the package via hab svc load command which also results in same error.
Thanks,
Hmm. That is strange. This failure would occur after the install process has succesfully downloaded the hart and expanded it to a temporary folder under hab/pkgs/<origin>/<name>/<version>
. The error is occuring when renaming that directory to hab/pkgs/<origin>/<name>/<version>/<release>
. I would check to see if there is already a release directory present from a interrupted install. If so deleted. This seems unlikely but it is worth looking for.