1/29/2019

How to install wget in macOS?

install by brew
>ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
>brew install wget --with-libressl

install by port
> sudo port install wget


Enjoy!





1/28/2019

tar (child): xz: Cannot exec: No such file or directory on Amazon Linux

yum install -y xz

docker command summarise


stop all containers:
docker kill $(docker ps -q)

remove all containers
docker rm $(docker ps -a -q)

remove all docker images
docker rmi $(docker images -q)

access(enter) docker container
docker exec -it docker_container_name sh

Exit from docker container
>exit

Commit container and build image
docker commit container_name image_name
ex) docker commit lambdapack lambda_image
ex) docker commit lambdapack marearts/lambda_image:v1.0.0

Docker build
>docker build --tag hello:0.1 .
>docker build --tag marearts/hello:0.1 .

Docker run shell and tunnelling 
>docker run -v $(pwd):/outputs --name nickname -d docker_image tail -f /dev/null
ex)
>docker run -v $(pwd):/outputs --name lambdapackgen2 -d marearts/awspy:0.1 tail -f /dev/null

Docker run shell

> docker run -it marearts/amazon_linux_py36:v1.0.0 /bin/bash

Docker run sh file in container
>docker exec -i -t container_name /bin/bash /outputs/shfile.sh
ex)
>docker exec -i -t lambdapackgen2 /bin/bash /outputs/buildPack_py3.sh

Restart Docker container
>docker restart <container id or name>
ex)
docker restart 59



it will be updated..


1/27/2019

summarise Azure function docker image deploy



*make python virtualenv
*activate python virtualenv !!
*install azure util cli
https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-function-linux-custom-image#run-the-build-command

make project (app)
func init DocApp100 --docker

change directory
cd DocApp100

new function
func new --name MyHttpTrigger --template "HttpTrigger"

build docker image
docker build --tag marearts/image:v1 .

make new resource group
az group create --name DocGroup --location westeurope

storage account
az storage account create --name docstorage100 --location westeurope --resource-group DocGroup --sku Standard_LRS

create linux service plan
az appservice plan create --name docserviceplan --resource-group DocGroup --sku B1 --is-linux

create app and deploy
az functionapp create --name docapp100 --storage-account docstorage100 --resource-group DocGroup --plan docserviceplan --deployment-container-image-name marearts/image:v1

Configuration the function app
storageConnectionString=$(az storage account show-connection-string --resource-group DocGroup --name docstorage100 --query connectionString --output tsv)
az functionapp config appsettings set --name docapp100 --resource-group DocGroup --settings AzureWebJobsDashboard=$storageConnectionString AzureWebJobsStorage=$storageConnectionString

Test
curl https://docapp100.azurewebsites.net/api/MyHttpTrigger?name=myname


Azure function create command summarise.

reference:
https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local#v2
https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-function-python


create project
func init PythonAzure

create azure function
func new

Test
func host test

create resource group
az group create --name mareartstest --location westeurope

create strage account
az storage account create --name mareartsteststorage --location westeurope --resource-group mareartstest --sku Standard_LRS

create app
az functionapp create --resource-group mareartstest --os-type Linux --consumption-plan-location westeurope --runtime python --name mareartstest --storage-account mareartsteststorage

deploy
func azure functionapp publish mareartstest