I have restricted access to a client Azure Resources. The client created a default static-webapp (let's call it "my-mvp") and a virtual machine for me to deploy a app and a api. I am not allowed to create any new static-webapps or any other service. When using the swa deploy -command it does not allow me to connect the existing source.
How can I link my-mvp project to the existing my-mvp static webapp in Azure?
Deployment on my own Azure subscription works just fine when using the swa deploy command and creating a new Static WebApp. Also my .yml configuration works fine so I got it all working. This question has merly to do with the usage of the swa-cli.
While trying out the swa-cli with swa deploy -command with the following configuration (swa-cli.config.json);
{
"$schema": "https://aka.ms/azure/static-web-apps-cli/schema",
"configurations": {
"my-mvp": {
"appName": "my-mvp",
"appLocation": "./apps/frontend",
"outputLocation": "build",
"appBuildCommand": "npm run build",
"run": "npm start",
"appDevserverUrl": "http://localhost:3000",
"apiLocation": "./apps/backend",
"apiBuildCommand": "npm run build",
"apiRunCommand": "npm run start:dev",
"apiDevserverUrl": "http://localhost:3002",
"apiPort": 3002,
"appPort": 3000,
"subscriptionId": "omitted for obvious reasons",
"resourceGroupName": "omitted for obvious reasons",
"tenantId": "omitted for obvious reasons"
}
}
}
I got the following output;
Checking project "my-mvp" settings...
✖ The project "my-mvp" is linked to "DevOps"!
✖ Unlink the project from the "DevOps" provider and try again.
my-mvp is the name of the static-webapp resource in Azure DevOps were I'm trying to attach this project to.
If I rename the appName to something else it gives me the default options;
Checking project "my-other-mvp" settings...
? Would you like to create a new Azure Static Web Apps project? › (Y/n)
Because I'm not allowed to create any new Static Web App I press "n";
Checking project "my-other-mvp" settings...
✔ Would you like to create a new Azure Static Web Apps project? … no
✖ The provided project name "my-other-mvp" was not found.
If I press "Yes" the response is a RestError. If I enter "Yes" with the appName "my-mvp" it gives me the very first reponse.
Is it possible to use the swa-cli with existing resources?
Related
I have a .net app that I deploy to Azure. It is compiled to the directory c:\publish\bin under Release compile option, but for some reason it deletes one dll in particular , the System.Runtime.dll.
So before it starts to deploy it displays this
Starting Web deployment task from source:
manifest(C:\LocalWebProject\obj\Release\Package\My.SourceManifest.xml) to Destination:
auto(). Deleting file (AzureAppService\bin\System.Runtime.dll).
Adding ACLs for path (MyWebProject)
Any ideas why this would happen ?
Particular dll's deleted from Azure App Server site when deploying:
I've created a sample webapp using visual studio and was able to deploy it successfully to Azure.
Program.cs:
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddRazorPages();
var app = builder.Build();
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapRazorPages();
app.Run();
appsettings.json:
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}
Build on IIS Server:
Published to Azure:
Output:
Need to check:-
Never put anything in bin. Bin is not a source folder for binaries rather, it is the destination location for binaries.
Dependency Tree
.CsProj
|
classlibrary.dll
|
.binlibrary.dll
It is preferable to think of the bin folder as it is created by a project as "output" directory; they should only contain files generated by the project build.
Instead of using build, try rebuild which will perform cleanup and build the current project. Usually, the outputs from previous builds are kept with the build command. Therefore, it may result these kinds of dependency related actions like "deletion of specific dll files". Rebuild does remove them and build again.
While cleaning up, it might remove the necessary dependencies also. It is possible to restore deleting files.
Note:
I suggest, Use Visual studio while working with Web Apps to avoid these kinds of issues.
Check for Visual Studio version and update it to latest versions.
Reference: dll files getting deleted
I am developing a NodeJS app that uses React on the front end. My folder structure is:
root -
- client (React App)
- api (express server)
My git folder is in the root folder for pushing the entire project to GitHub throughout development. But does my repo need to now be initialized in the api folder? Or is there a way to tell Heroku that the application is in the api folder?
Error on Heroku:
Build failed
There was an issue building your app. Please ensure your app is deployable to Heroku and try again.
! No default language could be detected for this app.
HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
See https://devcenter.heroku.com/articles/buildpacks
! Push failed
Also I feel it's worth mentioning that I set up the auto deploys in the Heroku GUI. So, it is attempting to build. I also have a Proc file and an app.json file.
app.json
{
"name": "Craig Bauer | Portfolio",
"description": "My web portfolio built as a MEAN stacjk app",
"repository": "https://github.com/craigbauerwebdev/Portfolio",
"logo": "",
"keywoeds": ["node", "react", "portfolio"],
"image": "heroku/nodejs"
},
{
"buildpacks": [
{
"url": "https://github.com/heroku/heroku-buildpack-node.js"
}
]
}
Procfile
web: node app.js
Thanks in advance
I found this solution and just wanted to share.
My entire production application is now in the api folder. This command worked well for me.
git subtree push --prefix api heroku master
For future projects I will structure this differently so I won't have to copy the build before each deploy.
I can run the app locally without any issue by yarn start command. here I have provided photographs which represent my problem. I googled and noticed several people faces the same problem. but their context is different.
By default, Now publishes your files as a static directory. You can add a builder to your now.json file to tell Now how to build and deploy your site.
In a case where app.js contains a web server application, your now.json might look like this:
{
"version": 2,
"name": "my-project",
"builds": [
{"src": "app.js", "use": "#now/node"}
]
}
This tells Now to use the #now/node builder to generate a lambda that runs app.js to respond to requests.
If your app is purely js+html to be run on the client machine, you wouldn't need the lambda, but you can still build the source before deploying it as static files with #now/static-build.
Check out the Now docs for more info: https://zeit.co/docs/v2/deployments/basics/#introducing-a-build-step
Good day,
my very basic Nodejs app is deployed on a Google Cloud App Engine instance is not starting. The app works locally, deployment with app deploy runs without error - and on the app instance the app runs successfully when started manually through Cloud shell (with >npm start).
However, as soon as the Cloud Shell is closed my app is dead. What am I missing? How do I start-up the app to run permanently?
The app consists of
bot4.js file,
npm dependencies
app.yaml
package.json
app.yaml:
runtime: nodejs8
handlers:
- url: /
script: auto
package.json:
{
"name": "blexplorer",
"version": "1.0.0",
"description": "",
"main": "bot4.js",
"scripts": {
"start": "node bot4.js"
},
"author": "oystersauce",
"license": "ISC",
"dependencies": {
"discord.js": "^11.4.2",
"request": "^2.88.0"
}
}
Again, the app is running fine when started through the Cloud Shell but no longer, as soon as the Cloud Shell is closed. Also, it's a super simple discord-bot - hence there is no front-end whatsoever.
EDIT:
this is how I thought I started the app manually - but what I did here is starting the app within the cloud shell and not on the app instance:
here is how I deploy the app:
From GAE perspective the cloud shell is simply a shell on a "local" development machine which just happens to be hosted in the cloud. The instance running the cloud shell has no special relationship with GAE whatsoever.
What you're doing when running npm start is not actually starting the GAE instance, you're just starting a "local" execution of your service, just like when you'd be doing the same on your local machine.
With your configuration GAE should start your app automatically as soon a request for it is received. On an app with a frontend just clicking on the link you circled in the snapshot would get you on it. Since yours doesn't have a frontend it would probably be just started, but you'd have to rely on the dashboard info and/or your app's logs to confirm it is running.
I have created an express application in Visual Studio. I am having problems running it in azure once I've hosted.
It does not seem to find my node_modules folder.
Whenever I deploy and visit the site, on Kudu under the /logStream url I receive the error
cannot find module 'debug'
I found out that the debug module was required in the www folder. I then removed it from there and redeployed.
After redeployment I get
cannot find module 'express'
When I run my app in production (locally), I do not experience these problems.
One suggestion was removing the node_modules folder and then publish to Azure, with that you then use npm install on Kudu powershell or cmd. I have tried this and the same errors still come back. Could you please direct me on how I can resolve this?
package.json:
{
"name":"app-name",
"version":"0.0.0",
"private":true,
"scripts":{
"start":"node ./bin/www"
},
"description":"descrt",
"author":{
"name":"myname",
"email":"myemail#smtpserver.com"
},
"dependencies":{
"body-parser":"~1.8.1",
"cookie-parser":"~1.3.3",
"debug":"~2.0.0",
"express":"~4.9.0",
"jade":"~1.6.0",
"morgan":"~1.3.0",
"request":"^2.72.0",
"serve-favicon":"~2.1.3",
"stylus":"0.42.3"
}
}