Giter Site home page Giter Site logo

athens-deploy's Introduction

Athens Deploy

Scripts et al to deploy https://github.com/gomods/athens to Microsoft Azure.

  1. Sign in and get your resource group. In this lab a group is provided for you; in your own environment you'll need to create one.
az login
az group list

# to create your own group:
# group_name=go-proxy-group
# az group create --name ${group_name}
  1. Create a Container Registry to hold your images. Get connection metadata for later use.
registry_name=goproxy${RANDOM}registry
group_name=from_above
image_name=gomods/athens/proxy
image_tag=latest

az acr create \
    --name ${registry_name} --resource-group ${group_name} \
    --sku 'Standard' --admin-enabled 'true' --location westus2
registry_prefix=$(az acr show \
    --name ${registry_name} --resource-group ${group_name} --output tsv --query 'loginServer')
registry_password=$(az acr credential show \
    --name ${registry_name} --output tsv --query 'passwords[0].value')
registry_username=$(az acr credential show \
    --name ${registry_name} --output tsv --query 'username')
image_uri=${registry_prefix}/${image_name}:${image_tag}
  1. Build and store an image in your registry.
# variables set in previous step
mkdir -p ./deps/athens
git clone https://github.com/gomods/athens.git ./deps/athens
dockerfile_relative_path=cmd/proxy/Dockerfile
docker_context_path=deps/athens
az acr build \
   --registry ${registry_name} \
   --resource-group ${group_name} \
   --file ${dockerfile_relative_path} \
   --image "${image_name}:${image_tag}" \
   --os 'Linux' \
   ${docker_context_path})
  1. Create and configure a Web App.
app_name=go-proxy-app
plan_name=go-proxy-plan
group_name=go-proxy-group

az appservice plan create \
  --name ${plan_name} \
  --resource-group ${group_name} \
  --is-linux \
  --location westus2
az webapp create \
  --name ${app_name} \
  --plan ${plan_name} \
  --resource-group ${group_name} \
  --deployment-container-image-name ${image_uri}
az webapp config container set --name ${app_name} --resource-group ${group_name} \
  --docker-custom-image-name ${image_uri} \
  --docker-registry-server-url "https://${registry_prefix}" \
  --docker-registry-server-user ${registry_username} \
  --docker-registry-server-password ${registry_password}
az webapp deployment container config --name ${app_name} --resource-group ${group_name} \
  --enable-cd 'true'
az webapp log config --name ${app_name} --resource-group ${group_name} \
  --docker-container-logging filesystem \
  --level verbose
az webapp config appsettings set --name ${app_name} --resource-group ${group_name} \
  --settings "WEBSITE_HTTPLOGGING_RETENTION_DAYS=7"
  1. Setup a CosmosDB/MongoDB account, database, and collection, and get connection metadata for later use.
cosmosdb_account_name=go-proxy-cosmosdb
group_name=<from_above>
db_name=athens
coll_name=modules

az cosmosdb create \
  --name ${cosmosdb_account_name} \
  --resource-group ${group_name} \
  --kind MongoDB
az cosmosdb database create \
  --db-name $db_name --name ${cosmosdb_account_name} --resource-group-name ${group_name}
az cosmosdb collection create \
  --collection-name $coll_name \
  --db-name $db_name --name ${cosmosdb_account_name} --resource-group-name ${group_name}
mongo_url=$(az cosmosdb list-connection-strings \
  --name ${cosmosdb_account_name} --resource-group ${group_name} \
  --query "connectionStrings[0].connectionString" --output tsv)
  1. Configure web app with Mongo connection strings.
webapp_id=$(az webapp show --name ${app_name} --resource-group ${group_name} --output tsv --query id)
url_suffix=azurewebsites.net
olympus_endpoint=https://go-proxy-olympus-webapp.${url_suffix}
az webapp config appsettings set --ids $webapp_id \
    --settings \
        "ATHENS_STORAGE_TYPE=mongo" \
        "ATHENS_MONGO_CONNECTION_STRING=${mongo_url}" \
        "OLYMPUS_GLOBAL_ENDPOINT=${olympus_endpoint}"
  1. Try it!

This will update dependencies via the specified proxy and create go.mod and go.sum files.

athens-deploy's People

Contributors

joshgav avatar

Watchers

 avatar  avatar

athens-deploy's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.