add webapp & container registry/builder sample#215
Conversation
04b90c5 to
b877255
Compare
|
fixes #40 |
| @@ -0,0 +1,7 @@ | |||
| [prune] | |||
There was a problem hiding this comment.
Can safely be removed. Project has no external dependencies that need to be locked.
| @@ -0,0 +1,20 @@ | |||
| # This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. | |||
There was a problem hiding this comment.
Remove along with Gopkg.toml
| AZURE_BASE_NAME=go-webapp-tester | ||
| AZURE_DEFAULT_LOCATION=westus2 | ||
|
|
||
| # required for continous container build setup |
There was a problem hiding this comment.
Remove GH_TOKEN from environment
| **NOTE**: Container Registry Build requires a [GitHub personal access | ||
| token](https://github.com/settings/tokens); you need to get one from the linked | ||
| page and set it in a local environment variable `GH_TOKEN`, e.g. `export | ||
| GH_TOKEN=mylongtokenstring`. You can also add it to your local `.env` file for |
There was a problem hiding this comment.
Security risk; don't suggest adding to env.
| @@ -0,0 +1,32 @@ | |||
| PACKAGE = github.com/Azure-Samples/azure-sdk-for-go-samples/apps/basic_web_app | |||
There was a problem hiding this comment.
make is never used. Can be deleted.
| @@ -0,0 +1,15 @@ | |||
| function ensure_group () { | |||
There was a problem hiding this comment.
Should be merged into setup.sh or some common utility location. Shared between here and #216
| @@ -0,0 +1,33 @@ | |||
| package main | |||
There was a problem hiding this comment.
Shared between here and #216. It may not be a bad idea to merge these PRs together, and have setup.sh or a PowerShell script take an argument; deploy-X where X is some type of app deployment. They all use the same environment variables, and individual deploys could be broken out into a scripts directory and called from the setup.sh (or sourced into it.)
| @@ -0,0 +1,193 @@ | |||
| #!/usr/bin/env bash | |||
There was a problem hiding this comment.
Consider adding a PowerShell script so that Windows users without WSL are supported. It's unclear if this is a path that we want to push with the Go story but it seems like it's important to keep those users in mind, especially since there are a significant number of Azure users in the Windows ecosystem.
|
|
||
| It uses the following environment variables to choose names: | ||
|
|
||
| * IMAGE\_NAME: Name of container image (aka "repo"). |
There was a problem hiding this comment.
IMAGE_NAME is not a natural choice here; maybe REPO_NAME, and spell out that the repo name is used for the image name?
| ensure_group $group_name | ||
|
|
||
| ## ensure registry | ||
| registry_id=$(az acr show \ |
There was a problem hiding this comment.
At some point here during my initial test, the script hung, but I can't see what would have caused it. There's the possibility that it was caused by Docker not running locally, but would need to investigate further. I can say for sure that the resource group was created, but had no resources allocated to it.
|
Should mention that most comments regarding wording, etc. from #216 also apply here. |
This includes a basic Go web app and a script to set up Azure infrastructure in App Service and Container Registry to continuously build and deploy this app. See README.md for full details.
If
./setup.shis run in this repo (i.e. a clone) it will ensure/create Azure resources then push/build the image once.If
./setup.shis run from a repo root andIMAGE_NAMEis set to the repo's name, continuous build and deploy is set up with an ACR build task. See https://github.com/joshgav/go-sample for an example of creating your own web app from this sample.