-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d7a5adf
commit bb1335e
Showing
3 changed files
with
293 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#!/bin/bash | ||
echo "======================================================================= Please Run WSL As AdminiStrator ============================================================================" | ||
read whit | ||
|
||
echo "=============================================================================== sudo apt update ====================================================================================" | ||
sudo apt update | ||
|
||
echo "============================================================================== sudo apt upgrade ===================================================================================" | ||
sudo apt upgrade | ||
|
||
echo "====================================================================== Install Azure Container Registry ============================================================================" | ||
echo "================================================================ Get Packages Needed For The Install Process =======================================================================" | ||
sudo apt update | ||
|
||
sudo apt install ca-certificates curl apt-transport-https lsb-release gnupg | ||
|
||
echo "=============================================================== Download And Install The Microsoft Signing Key =====================================================================" | ||
curl -sL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc.gpg > /dev/null | ||
|
||
echo "==================================================================== Add The Azure CLI Software Repository =========================================================================" | ||
AZ_REPO=$(lsb_release -cs) | ||
|
||
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" | sudo tee /etc/apt/sources.list.d/azure-cli.list | ||
|
||
echo "======================================================= Update Repository Information And Install The Azure-cli Package ============================================================" | ||
sudo apt update | ||
|
||
sudo apt install azure-cli | ||
|
||
echo "======================================================================== Test Azure Contianer Registry =============================================================================" | ||
az login | ||
|
||
echo "=============================================================================== Install Docker =====================================================================================" | ||
echo "============================================================================ Uninstall Old Versions ================================================================================" | ||
sudo apt remove docker docker-engine docker.io containerd runc | ||
|
||
echo "========================================================================= Update The Apt Package Index =============================================================================" | ||
sudo apt update | ||
|
||
echo "=========================================================== Install Packages To Allow Apt To Use A Repository Over HTTPS ===========================================================" | ||
sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common | ||
|
||
echo "========================================================================= Add Docker’s Official GPG Key ============================================================================" | ||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | ||
|
||
echo "============================================================== Verify That You Now Have The Key With The Fingerprint ===============================================================" | ||
sudo apt-key fingerprint 0EBFCD88 | ||
|
||
echo "==================================================================== To Add The Nightly Or Test Repository =========================================================================" | ||
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | ||
|
||
echo "==================================================== Install The Latest Version Of Docker Engine-Community And Containerd ==========================================================" | ||
sudo apt update | ||
|
||
sudo apt install docker-ce docker-ce-cli containerd.io | ||
|
||
echo "============================================================================ Start Docker Service ==================================================================================" | ||
#echo "export DOCKER_HOST='tcp://0.0.0.0:2375'" >> ~/.bashrc | ||
|
||
sudo service docker status | ||
|
||
sudo service docker start | ||
|
||
sudo service docker status | ||
|
||
echo "============================================================================= Installation Java SDK ================================================================================" | ||
sudo apt update | ||
|
||
sudo apt install openjdk-8-jdk | ||
|
||
echo "============================================================================= Check Java SDK Version ===============================================================================" | ||
java -version | ||
|
||
echo "========================================================================= The Installation Is Complete =============================================================================" | ||
echo "=========================================================================== If Docker Is Not Running ===============================================================================" | ||
echo "=========================================================== Restart Docker Desktop And Restart WSL As AdminiStrator ================================================================" | ||
echo "=================================== [sudo gpasswd -a \$USER docker] [newgrp docker] [sudo chown \"\$USER\":\"\$USER\" /home/\"\$USER\"/.docker -R] ===========================================" | ||
echo "============================================== [sudo chmod g+rwx \"/home/\$USER/.docker\" -R] [sudo chmod a+rw /var/run/docker.sock] ==================================================" | ||
|
||
#Find History | ||
#history | ||
|
||
#Clean History | ||
#history -c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/bin/bash | ||
echo "=================================================================== Please Run WSL As AdminiStrator ========================================================================" | ||
read whit | ||
|
||
echo "=========================================================== To check if virtualization is supported on Linux ===============================================================" | ||
grep -E --color 'vmx|svm' /proc/cpuinfo | ||
|
||
echo "================================================================= Install Minikube via direct download =====================================================================" | ||
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 | ||
|
||
echo "=========================================================================== Add chmod +x ===================================================================================" | ||
sudo chmod +x ./minikube | ||
|
||
echo "===================================================================== Move file to /usr/local/bin ==========================================================================" | ||
sudo mkdir -p /usr/local/bin/ | ||
|
||
sudo install minikube /usr/local/bin/ | ||
|
||
echo "========================================================================= minikube version =================================================================================" | ||
sudo minikube version | ||
|
||
echo "================================================================== Virtualization is supported(y/N)? =======================================================================" | ||
read key | ||
if [ ${key} == "Y" -o ${key} == "y" ] | ||
then | ||
sudo minikube start | ||
else | ||
sudo minikube start --vm-driver=none | ||
fi | ||
|
||
echo "========================================================================== Install Kubectl =================================================================================" | ||
echo "========================================================================= DownLoad Kubectl =================================================================================" | ||
curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl | ||
|
||
echo "============================================================================ apt update ====================================================================================" | ||
sudo apt update | ||
|
||
echo "============================================================================ apt install ===================================================================================" | ||
sudo apt install -y apt-transport-https | ||
|
||
echo "=========================================================================== Add chmod +x ===================================================================================" | ||
chmod +x ./kubectl | ||
|
||
echo "===================================================================== Move file to /usr/local/bin ==========================================================================" | ||
sudo mv ./kubectl /usr/local/bin/kubectl | ||
|
||
echo "================================================================ Install using native package management ===================================================================" | ||
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - | ||
|
||
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list | ||
|
||
sudo apt update | ||
|
||
sudo apt install -y kubectl | ||
|
||
echo "================================================================= kubectl apply -f azure-vote.yaml =========================================================================" | ||
sudo kubectl apply -f azure-vote.yaml | ||
|
||
echo "========================================================================== kubectl version =================================================================================" | ||
sudo kubectl version | ||
|
||
echo "======================================================================= kubectl cluster-info ===============================================================================" | ||
sudo kubectl cluster-info | ||
|
||
echo "===================================================================== kubectl cluster-info dump ============================================================================" | ||
sudo kubectl cluster-info dump | ||
|
||
echo "========================================================================= kubectl get nodes ================================================================================" | ||
sudo kubectl get nodes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
#!/bin/bash | ||
echo "===================================================================== Do you need Login?(Y,y/N,n) ==========================================================================" | ||
read needLogin | ||
if [ ${needLogin} == "Y" -o ${needLogin} == "y" ] | ||
then | ||
echo "============================================================================= az login ... =================================================================================" | ||
az login | ||
|
||
echo "=============================================================== Please input you want to use account ID ... ================================================================" | ||
read accountId | ||
az account set -s ${accountId} | ||
|
||
echo "================================================================== Please input Container Registry Name ... ================================================================" | ||
read containerRegistryName | ||
az acr login -n ${containerRegistryName} | ||
|
||
echo "============================================================================== docker login ... ============================================================================" | ||
docker login ${containerRegistryName}.azurecr.io | ||
fi | ||
|
||
echo "==================================================================== Input Container Registry Name! ==========================================================================" | ||
read name | ||
echo "======================================================== Push Repositories(r/R)? Tags(t)? Task(T)? ScopeMap(s/S) =============================================================" | ||
read tit | ||
echo "================================================================== Do you want to loop it a few times? =======================================================================" | ||
read num | ||
|
||
loopCount=1 | ||
case ${tit} in | ||
"t") | ||
while ((${loopCount}<=${num})) | ||
do | ||
docker tag hello-world ${name}.azurecr.io/newimagename:version${loopCount} | ||
let "loopCount++" | ||
done | ||
|
||
echo "Push?(Y,y/N,n)" | ||
read _input | ||
if [ ${_input} == "Y" -o ${_input} == "y" ] | ||
then | ||
docker push ${name}.azurecr.io/newimagename | ||
fi | ||
;; | ||
|
||
"r"|"R") | ||
while ((${loopCount}<=${num})) | ||
do | ||
docker tag hello-world ${name}.azurecr.io/newimagename${loopCount} | ||
docker push ${name}.azurecr.io/newimagename${loopCount} | ||
let "loopCount++" | ||
done | ||
;; | ||
|
||
"T") | ||
while ((${loopCount}<=${num})) | ||
do | ||
az acr task create -n Task${name}${loopCount} -r ${name} --cmd hello-world -c /dev/null | ||
az acr task run -n Task${name}${loopCount} -r ${name} | ||
let "loopCount++" | ||
done | ||
;; | ||
|
||
"s"|"S") | ||
while ((${loopCount}<=${num})) | ||
do | ||
az acr scope-map create -n ${name}scopemap${loopCount} --repository hello-world${loopCount} content/read content/write -r ${name} --description "Sample scope map." | ||
|
||
az acr token create -n ${name}token${loopCount} --scope-map ${name}scopemap${loopCount} -r ${name} | ||
|
||
az acr token credential generate -n ${name}token${loopCount} -r ${name} | ||
|
||
echo "======================================================================== Input Token Password Name ============================================================================" | ||
read tokenPassword | ||
|
||
docker login ${name}.azurecr.io -u ${name}token${loopCount} -p ${tokenPassword} | ||
docker tag hello-world ${name}.azurecr.io/hello-world${loopCount} | ||
docker tag hello-world ${name}.azurecr.io/alpine${loopCount} | ||
docker push ${name}.azurecr.io/hello-world${loopCount} | ||
docker push ${name}.azurecr.io/alpine${loopCount} | ||
|
||
az acr scope-map update -n ${name}scopemap${loopCount} --add alpine${loopCount} content/read content/write -r ${name} | ||
docker push ${name}.azurecr.io/alpine${loopCount} | ||
|
||
az acr scope-map update -n ${name}scopemap${loopCount} --add hello-world${loopCount} metadata/read -r ${name} | ||
|
||
az acr repository show-manifests --repository hello-world${loopCount} -u ${name}token${loopCount} -p ${tokenPassword} -n ${name} | ||
az acr repository show-tags --repository hello-world${loopCount} -u ${name}token${loopCount} -p ${tokenPassword} -n ${name} | ||
|
||
az acr scope-map update -n ${name}scopemap${loopCount} --add alpine${loopCount} metadata/write -r ${name} | ||
|
||
az acr repository update --repository alpine${loopCount} --write-enabled false --delete-enabled false -u ${name}token${loopCount} -p ${tokenPassword} -n ${name} | ||
az acr repository update --repository alpine${loopCount} --write-enabled true --delete-enabled true -u ${name}token${loopCount} -p ${tokenPassword} -n ${name} | ||
|
||
az acr scope-map update -n ${name}scopemap${loopCount} --remove alpine${loopCount} content/read -r ${name} | ||
docker pull ${name}.azurecr.io/hello-world${loopCount} | ||
docker pull ${name}.azurecr.io/alpine${loopCount} | ||
|
||
az acr scope-map update -n ${name}scopemap${loopCount} --add alpine${loopCount} content/read -r ${name} | ||
docker pull ${name}.azurecr.io/alpine${loopCount} | ||
|
||
az acr scope-map update -n ${name}scopemap${loopCount} --add alpine${loopCount} content/delete -r ${name} | ||
|
||
az acr repository delete --repository alpine${loopCount} -u ${name}token${loopCount} -p ${tokenPassword} -n ${name} --yes | ||
|
||
az acr token credential generate -n ${name}token${loopCount} -r ${name} | ||
docker push ${name}.azurecr.io/alpine${loopCount} | ||
|
||
docker login -u ${name}token${loopCount} -p ${tokenPassword} ${name}.azurecr.io | ||
docker push ${name}.azurecr.io/alpine${loopCount} | ||
|
||
az acr token update -n ${name}token${loopCount} -r ${name} --status disabled | ||
docker tag hello-world ${name}a.azurecr.io/alpine${loopCount} | ||
docker push ${name}a.azurecr.io/alpine${loopCount} | ||
|
||
let "loopCount++" | ||
done | ||
;; | ||
|
||
*) | ||
echo "Error: ${tit} could not be found." | ||
break | ||
;; | ||
|
||
esac | ||
|
||
echo "========================================================== Enter CTRL+C to end Or Enter other key to delete image ============================================================" | ||
read sthmessage | ||
|
||
#docker system prune -a #Delete all image and container. | ||
|
||
loopCount=1 | ||
while ((${loopCount}<=${num})) | ||
do | ||
docker rmi ${name}.${name}.azurecr.io/alpine${loopCount} | ||
docker rmi ${name}a.${name}.azurecr.io/alpine${loopCount} | ||
docker rmi ${name}.${name}.azurecr.io/hello-world${loopCount} | ||
docker rmi ${name}.azurecr.io/newimagename${loopCount} | ||
docker rmi ${name}.azurecr.io/newimagename:version${loopCount} | ||
let "loopCount++" | ||
done |