Deploy yeoman angular-fullstack project to Azure - angularjs

How would would you deploy the output of the angular-fullstack Yeoman generator to Azure? The generator produces output like this, i.e. two folders - client and server.
├── client
│ ├── app - All of our app specific components go in here
│ ├── assets - Custom assets: fonts, images, etc…
│ ├── components - Our reusable components, non-specific to to our app
│
├── e2e - Our protractor end to end tests
│
└── server
├── api - Our apps server api
├── auth - For handling authentication with different auth strategies
├── components - Our reusable or app-wide components
├── config - Where we do the bulk of our apps configuration
│ └── local.env.js - Keep our environment variables out of source control
│ └── environment - Configuration specific to the node environment
└── views - Server rendered views
I'd like to deploy this to Microsoft Azure, and ideally using Git deploy. How would I go about that?
Update
Here's what the deployment file structure looks like in Azure.

Here is the short version:
Create a new blank Web App in Azure.
In the Deployment options, select 'Set up continuous deployment'.
Select 'Local Git Repository'.
This will give you a Git Remote for the blank azure Web App to allow you to push to it. Which means you can do this:
git remote add azure [URL for remote repository]
git push azure master
Here is the longer version (it is for a node app - but the same concepts apply).

Related

Deploy Multiple Apps Under a Single GitHub Repository - Django + React

I have built my website in 1 repository, Django and react I realized later on this is not a very common structure, and I'm stuck with deploying,
How and where I can deploy my website where I have Django and React in 1 repository?
this is my project structure - backend ( all Django stuff ) - frontend ( all react stuff )
PortfolioWebsite
|___PortfolioWebsite
| ____ backend
| └── All backend stuff (views..etc)
| ____ frontend
| └── all react stuff
|___PortfolioWebsite
└── settings.py etc..
is it possible to deploy this and keep updating my code as I usually do in my localhost, without changing the structure?

deploy multiple independent applications to appengine

As per official documentation there can be only one app engine instance per project,
My question is, is it possible to deploy multiple independents django application to appengine ?
In other terms using appengine as a hosting platform for django apps .
Nowhere in the documentation or tutorials i have seen something like that done
How about using it to deploy multiple independents wordpress instances ?
Thanks in advance
What you're looking for is called App Engine Services.
As well you have mentioned, you only can have 1 App Engine App per project, but this app can have multiple services which for your case can be translated as multiple apps.
Every single service will have its own app.yaml. Let's say you have the following struct:
Apps/
├── app1
│   ├── app.yaml
│   └── django_files
├── app2
│   ├── app2.yaml
│   └── django_files
├── app3
│   ├── app3.yaml
│   └── django_files
└── app4
├── app4.yaml
└── django_files
Then the app.yaml can contain the following:
runtime: python38
#no adding the service: because this will be the default service or app
#more configs go here...
For the app2.yaml
runtime: python38
service: app2
#more configs go here...
You will notice that we added the service config which defines to which service this app will be deployed. If the service is not defined, the app will be deployed always to the default service.
The services are isolated, i.e., they do not communicate but if needed those can interact between them.
And finally, you can map every service to a custom domain. For example, mydomain.com can route to the default app, app2.mydomain.com be routed to the second one an so on. You can learn how to map a custom domain here and how to route the requests to your services here.
The previous answer is the right one to achieve what you want to do. However, I'm writing this answer to say you to not do this!
To create a project is free, you can create 1 project per app.
With App Engine, you have 28h of F1 instance free per day and per project. Each new project allows you leveraging this free tier!
The wordpress instance are differents, so the database are different. If you use the same project the same database is used. You can also create different database (or schema inside the same database instance) for each app, but at the end, all the wordpress instance will be able to reach the database instance of others app.
If you have custom need, cleaning or something special to perform, doing this on only one wordpress instance deploy on only one project is easier and with less risk on the side wordpress instance.
There were my pieces of advice!

Use custom modules in Sagemaker MXNet

I’ve been trying to use Sagemaker to run my custom MXNet training job. In all the examples I’ve seen, the code sample looks like this
estimator = MXNet(‘train.py’, role=role, other_params)
estimator.fit(inputs)


What if my train.py relies on a custom module? Given a directory structure like so
.
├── awesome
│   ├── __init__.py
│   └── lib.py
└── train.py
With my train.py file importing from awesome/lib.py, what’s the best way for me to deploy this job on Sagemaker without going through the hassle of creating a Docker container.
Note: all the code in the custom module is just regular mxnet code, organized across various files and helper methods
You can use the parameters source_dir to point to the code location, and a requirements.txt file to add dependencies. This will avoid to touch docker at all. You can see those parameters in the SDK documentation ("Use third party library"), they are available both for training and deployment. See here an mxnet deployment example with additional dependencies in a requirements.txt
https://github.com/aws-samples/sagemaker-yolov3-detection-server/blob/master/mxnet_detection_serving.ipynb

Hosting multiple customer websites on Google App Engine

We currently host a large number of containerized websites in Kubernetes and we are exploring using Google App Engine to host these sites but we cannot figure out how to host a large number (hundreds) of websites in a single Google App Engine account.
At first glance it seemed that every website will be a separate project but then it became clear that there is a soft limit of twenty projects (and we might end up hosting hundreds of sites) so this did not seem to be the correct approach. We then explored using a single project with dispatch.yaml to route between the sites. Dispatch.yaml only allows for ten entries which mean that it will not work. Is there any other approach we are missing? Our dispatch.yaml routing looked like this:
- url: "example2.com/*"
service: my-second-website
None of the options we explored provided a scalable or viable solution. Any help or advice will be highly appreciated.
What you need is one App Engine instance with multiple services (one for each website) and multiple versions in each service (if needed).
e.g:
App Engine instance
├── website01-service
│   ├── website01-version01
│   ├── website01-version02
│   └── website01-version03
│
└── website02-service
├── website02-version01
├── website02-version02
└── website02-version03
This is an example setup from Quickstart for Python 3 in the App Engine Standard Environment documentation.
Download the files from git repository as stated in Download the Hello World app section.
Copy the hello_world sample files in two different directories. e.g. website01 and website02.
You should have something like this:
├── website01
│   ├── app.yaml
│   ├── main.py
│   ├── main_test.py
│   └── requirements.txt
└── website02
├── app.yaml
├── main.py
├── main_test.py
└── requirements.txt
In website01/app.yaml add service: website01 and in website02/app.yaml add service: website02. This will deploy each app in different App Engine service.
In website01/main.py change return 'First website!' and in website02/main.py change return 'Second website!' (This is just to confirm after deployment that 2 different websites are running).
In the /website01 directory execute $ gcloud app deploy --version website01-version01 and in /website02 directory execute $ gcloud app deploy --version website02-version01
After a successful deployment, you should see 2 different versions running in Google Cloud Console > App Engine > Services page.
When clicking on both links new tabs will open and you will see your two different websites running in the same App Engine instance with two different links. The links should appear as following:
website01 -> https://website01-dot-[PROJECT_ID].appspot.com/
website02 -> https://website02-dot-[PROJECT_ID].appspot.com/
Have you tried requesting that your project limit be increased? I think that's the only good way to make this work.
If you attempt to exceed your project limit, the console will prompt you to fill out a request form. This happens when you try to create a project but you have already reached your quota. The form will require you to specify the number of additional projects you need, along with their corresponding email accounts, billing accounts, and intended uses.
https://support.google.com/cloud/answer/6330231?hl=en
You could do this with a single project & single service/app.yaml, if your ok with the url for each website being something like :
www.website1.com/website1/
www.website2.com/website2/
www.website3.com/website3/
etc
Then you could use the handlers in app.yaml to do the routing (along with some light server code to redirect if someone tries to visit www.website1.com/website2/). The biggest issue with doing it this way is every time you'd deploy you would be deploying all 100 of your sites.

google app engine file conflict golang

So I'm trying to run my go app with google's app engine. When I run goapp server I get this error:
go-app-builder: Failed parsing input: app file model.go conflicts with same file imported from GOPATH
This is my project layout:
.
├── model
│ └── model.go
├── reqres
│ └── reqres.go
├── app.yaml
├── service.go
├── main.go
└── transport.go
If I run it without app engine I don't any get errors and the app runs fine.
According to my experience you get this error because your project folder is also under your GOPATH. "goapp" kind of clone your project folder and builds it against the go environment GOPATH and GOROOT... Doing so it finds duplicated symbols for all package that you have been declared under your project.
Here is the explanation in go appengine documentation
If you include your package sources in GOPATH, you must be careful not to place the source code at or below any directories in your App Engine project that contain app.yaml files. If that happens, a package could be loaded twice, once for the path relative to a module's directory, and once for the fully-qualified path. This can cause subtle problems, so the Go SDK scans your project and your GOPATH, detects this case, and reports it as an error.
Under the same link you will find some advises by google for your project structure and one of them is (your project break that guideline):
Do not include any subdirectories in a module's directory.
If you want a repository with your application definition and go packages I encourage you to adopt the folliwing structure:
projectRoot
|- modules
| |- myModule1
| | |- init.go // router pattern to handler
| | |- myModule1.yaml // configuration for the module
| |- myModule2
| |- init.go // router pattern to handler
| |- myModule2.yaml // configuration for the module
|
|- pkg
| |- myModule1
| | |- *.go // sources, subfolders(packages)
| | // with handlers and business code
| |- myModule2
| | |- *.go // sources, subfolders(packages)
// with handlers and business code
This structure is convinient and improves debugging experience as explained in the article debugging Go appengine module with visual studio code

Resources