Unable to configure the PATH environment variable in Kudu shell via XDT - bash

I am trying to set the PATH environment variable for a web app I am building in Azure in python. I tried to use something like os.environ.setdefault('PATH', 'pandoc-2.14.1-1-amd64.deb') locally, however this does not seem to work once uploaded. I have also tried setting the path in the configuration section on the azure portal, but get the following error:
I have seen posts like
setting the webapp %PATH% environment variable in azure.
The post recommends adding a file called applicationHost.xdt to the home/site directory, which should set the PATH variable automatically. However, I am unable to upload applicationHost.xdt to the files in the directory. This is either because the file UI interface no longer exists, or I am unable to access it. Has the ability to upload via the UI been discontinued?
The only other workaround I can think of is to use echo/cat in the Kudu bash shell to create the applicationHost.xdt manually. This is very tricky. Are there any online tools that, given an input of the contents of a file, create the bash script to generate that file from scratch?

You could add a App settings to you web app, like below:
Then, restart your web app, in Kudu console, you could check it.
Note: App setting names must be unique, so when you use PATH as key it is already configured while deploy so while using in App setting from portal use a different Key name.
As a workaround, you can achieve that through an XDT Transform (XML Document Transform).
Yes, you can use echo to create the same. Simple copy paste the content of the file to be inside single quote ' and stream it into the file already created using echo command.
/home>echo '<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<system.webServer>
<runtime xdt:Transform="InsertIfMissing">
<environmentVariables xdt:Transform="InsertIfMissing">
<add name="FOO" value="BAR" xdt:Locator="Match(name)" xdt:Transform="InsertIfMissing" />
<add name="PATH" value="%PATH%;%HOME%\BAR" xdt:Locator="Match(name)" xdt:Transform="InsertIfMissing" />
</environmentVariables>
</runtime>
</system.webServer>
</configuration>' > applicationHost.xdt
Verify the contents using cat command

Related

Why do I get: "--grpc_out: protoc-gen-grpc: The system cannot find the path specified." message?

I am following this C# Quickstart tutorial for gRPC. I have come to this step where I have to use the following command to generate gRPC code:
%UserProfile%\.nuget\packages\Grpc.Tools.1.15.0\tools\windows_x86\protoc.exe -I../../protos --csharp_out Greeter --grpc_out Greeter ../../protos/helloworld.proto --plugin=protoc-gen-grpc=%UserProfile%\.nuget\packages\packages\Grpc.Tools.1.15.0\tools\windows_x86\grpc_csharp_plugin.exe
It doesn't work and what I get in the terminal after running commands above is this:
--grpc_out: protoc-gen-grpc: The system cannot find the path specified.
I don't know why the system cannot find the path since I have changed the path in the command so that it points to the files which need to be executed.
I considered the answer by Michael. However, using a different user account was not an option and I couldn't rename my user account since it's an Azure AD user and as such does not have an entry in the Windows list of local users where I would change its folder location in the registry.
The work-around that did it for me was to change the location of the global packages folder.
Can you try passing an absolute path to --plugin=protoc-gen-grpc=?
I had the same error because had cyrillyc symbols in my user folder. Solved by changing path to global nuget packages in nuget file config (for Windows: %appdata%\NuGet\NuGet.config):
<configuration>
<config>
<add key="globalPackagesFolder" value="D:\.nuget\packages" />
</config>
</configuration>
Instead of D:\.nuget\packages you can set any path without wrong symbols
I ran into the same problem, and with this error "path not found" and your name containing special characters as well, I suspected an issue with non ASCII paths!
It happened that my windows username had a special character "ë" in it
You should create a github issue, but here are some quick fixes:
2 solutions here to fix the issue
Create a new user without special characters and use this account
Harder and dangerous path, but what I've done myself: rename your user account to remove special characters using the following method https://winaero.com/blog/rename-user-profile-folder-windows-10/

Substitute Variables in web.config outside of appsettings, or connectionstring

The web.config in my nupkg file outputs the following:
<host>
<baseAddresses>
<add baseAddress="#{Url.AccountService}"/>
</baseAddresses>
</host>
According to Octopus' documentation on Substitute variables in files, the syntax above should be ok as long as I have the variable defined in my project. Which, I do.
I'm also deploying this package only to the DEV environment at this time.
Also, in the Deploy Website step, Under Substitute Variables in Files > I have web.config added to the list of files to perform the substitution on.
However, when the deployment goes through, octopus doesn't substitute this variable with the intended value. What am I doing wrong?
Per our conversation above and things you have tried.
This is the only remaining idea I have for an answer for you:
The documentation Substitute Variables in Files states:
You need to state the full path of the file, relative to the installation directory. So, if you need to replace variables on a file called app.config that is inside of a configfolder on the root of your package, you need to put config\app.configon the Target files field.
It is possible that Octopus Deploy cannot find the file that you are stating requires variable substitution. Everything else about your examples and code looks correct.

Adding an environment variable for a specific user in wix

I am building a windows installer which installs ElasticSearch as a windows service. To do that I need to set JAVA_HOME environment variable as SYSTEM vairable to JRE folder inside ElasticSearch using the following component in wix:
<Component Id="JAVAHOME" Guid="">
<CreateFolder />
<Environment Id="JAVA_HOME"
Action="set"
Part="all"
Name="JAVA_HOME"
Permanent="no"
System="yes"
Value="[ELASTICSEARCH]jre"/>
</Component>
However, this variable might have been set to a different path prior to installation. To avoid the conflict, one solution which I could think of is to set this environment variable to a different user. I found this link Adding user in wix which potentially enables me to create a user (e.g. ElasticUser). Utimately I would like to install ElasticSearch service under this user account. I am wondering how could I add JAVA_HOME to this user? Any solution including writing C# program as a custom action is appreciated or running a specific command is appreciated?

Host Static Website with IIS Express

Is it possible to host just static files on IISExpress without a web.config?
I have a html5 Application Prototype (no serverside code) and I would like to host the website on IISExpress Webserver because there are a few json files simulating a REST-API which I access with AJAX.
There is a main.html file and some api/data.json files.
When Im creating a VS-Project everything works fine.
I delete all config and VS-related files and added the site manually with
appcmd add site /name:"HTMLStandalone" /bindings:http/*:56668 /physicalPath:"C:\Users\me\somefoler\myapp"
UPDATE: works fine, it results in the following entry in the applicationhost.config
<site name="HTMLStandalone" id="4">
<application path="/">
<virtualDirectory path="/" physicalPath="C:\Users\me\somefolder\myapp" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:56668" />
</bindings>
</site>
when I start the site
iisexpress.exe /site:HTMLStandalone
the process fails:
Failed to translate binding to url prefix *:56668
Registration completed for site "HTMLStandalone"
Failed to process sites
Report ListenerChannel stopped due to failure; ProtocolId:http, ListenerChannelI
d:0
HostableWebCore activation failed.
Is it possible to host just static files without a web.config?
web.config file is not mandatory. It seems your appcmd.exe command is little off... Run following command instead
appcmd add site /name:"HTMLStandalone" /bindings:http/*:56668: /physicalPath:"C:\Users\me\somefoler\myapp"
Note that, to run this site you must be running as administrator. If you want to run as non-administrator, run the following command
appcmd add site /name:"HTMLStandalone" /bindings:http/*:56668:localhost /physicalPath:"C:\Users\me\somefoler\myapp"
From the iis.net website
You can also use the /path option to run a site directly from a
folder. This option works for any type of application, including
static HTML, ASP.NET, PHP, and WCF. By default, IIS Express will run
the site on http://localhost:8080/. For a managed website, such as
ASP.NET, IIS Express will use .NET 4.0. You can use the /port and /clr
options to override these default values.
In my case this was not enough. /path and /config flags are not combinable. I wanted a custom applicationhost.config file (in order to add the mime-extenstions for json and text/cache-manifest)
The current solution was to add the bindings:http/*:56668:localhost
Alternativly to make the site available on the (local) network, you can use the dns-name of your pc/server, e.g. bindings:http:/*:56668:my-pc

ftp plugin for netbeans 7.1.1 mac

I am trying to use my ftp server on netbeans. Is there a way to only put the host and username + password in and then just see all the folders that are on the server?
I already searched for this but I can't seem to find it anywhere.
I am using a mac and netBeans 7.1.1
First, ensure that ant-commons-net.jar is copied to:
C:\Program Files (x86)\NetBeans 6.7.1\java2\modules\ext
Then modify your project's build-impl.xml file, located under the nbproject directory.
Add a new task, such as this, using your ftpsite, username, and pass. Keep that file safe unless you modify it to prompt each time. To execute, run the ftp task by expanding the build.xml from the NB files tree tab.
Code:
====================
FTP SECTION
====================
-->
<target depends="jar" description="Build." name="ftp">
<ftp server="FTPSITEURLHERE" userid="USERIDHERE" password="PASSWORDHERE">
<fileset file="${dist.dir}/${application.title}.jar" />
</ftp>
</target>
<!--
I'm not sure what you mean, you want to create some project from FTP server and don't want to specify exact path? If so you can leave upload directory with just "/" and the same of "initial directory" and it should work

Resources