Upload files to "Project-TA"
This commit is contained in:
parent
45abb63b7b
commit
0a779396b3
|
|
@ -0,0 +1,12 @@
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install docker.io -y
|
||||||
|
sudo systemctl start docker
|
||||||
|
sudo systemctl enable docker
|
||||||
|
mkdir my-wordpress
|
||||||
|
cd my-wordpress
|
||||||
|
|
||||||
|
#Buat file bernama Dockerfile dengan perintah: touch Dockerfile. Buka file Dockerfile tersebut dengan: nano Dockerfile
|
||||||
|
FROM wordpress:latest
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
sudo docker run -d --name my-wordpress-container -p 80:80 my-wordpress
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
|
||||||
|
#Get packages needed for the installation process
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release
|
||||||
|
#Download and install the Microsoft signing key
|
||||||
|
sudo mkdir -p /etc/apt/keyrings
|
||||||
|
curl -sLS https://packages.microsoft.com/keys/microsoft.asc |gpg --dearmor | sudo tee /etc/apt/keyrings/microsoft.gpg > /dev/null
|
||||||
|
sudo chmod go+r /etc/apt/keyrings/microsoft.gpg
|
||||||
|
#Add the Azure CLI software repository
|
||||||
|
AZ_DIST=$(lsb_release -cs)
|
||||||
|
echo "Types: deb
|
||||||
|
URIs: https://packages.microsoft.com/repos/azure-cli/
|
||||||
|
Suites: ${AZ_DIST}
|
||||||
|
Components: main
|
||||||
|
Architectures: $(dpkg --print-architecture)
|
||||||
|
Signed-by: /etc/apt/keyrings/microsoft.gpg" | sudo tee /etc/apt/sources.list.d/azure-cli.sources
|
||||||
|
#Update repository information and install package
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install azure-cli
|
||||||
|
# Login to Azure Container Registry
|
||||||
|
az acr login --name sindy
|
||||||
|
# Tag Docker image
|
||||||
|
docker tag my-wordpress-app sindy.azurecr.io/my-wordpress-app:v1
|
||||||
|
# Push image to ACR
|
||||||
|
docker push sindy.azurecr.io/my-wordpress-app:v1
|
||||||
|
|
@ -0,0 +1,117 @@
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: azure-vote-back
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: azure-vote-back
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: azure-vote-back
|
||||||
|
spec:
|
||||||
|
nodeSelector:
|
||||||
|
"kubernetes.io/os": linux
|
||||||
|
containers:
|
||||||
|
- name: azure-vote-back
|
||||||
|
image: redis:latest
|
||||||
|
env:
|
||||||
|
- name: ALLOW_EMPTY_PASSWORD
|
||||||
|
value: "yes"
|
||||||
|
ports:
|
||||||
|
- containerPort: 6379
|
||||||
|
name: redis
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: azure-vote-back
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- port: 6379
|
||||||
|
selector:
|
||||||
|
app: azure-vote-back
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: azure-vote-front
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: azure-vote-front
|
||||||
|
strategy:
|
||||||
|
rollingUpdate:
|
||||||
|
maxSurge: 1
|
||||||
|
maxUnavailable: 1
|
||||||
|
minReadySeconds: 5
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: azure-vote-front
|
||||||
|
spec:
|
||||||
|
nodeSelector:
|
||||||
|
"kubernetes.io/os": linux
|
||||||
|
containers:
|
||||||
|
- name: azure-vote-front
|
||||||
|
image: cloudnativeadvocates.azurecr.io/azure-vote-front:v1.0.0
|
||||||
|
ports:
|
||||||
|
- containerPort: 80
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 250m
|
||||||
|
limits:
|
||||||
|
cpu: 500m
|
||||||
|
env:
|
||||||
|
- name: REDIS
|
||||||
|
value: "azure-vote-back"
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: azure-vote-front
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- port: 80
|
||||||
|
selector:
|
||||||
|
app: azure-vote-front
|
||||||
|
---
|
||||||
|
apiVersion: autoscaling/v1
|
||||||
|
kind: HorizontalPodAutoscaler
|
||||||
|
metadata:
|
||||||
|
name: azure-vote-front
|
||||||
|
spec:
|
||||||
|
scaleTargetRef:
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
name: azure-vote-front
|
||||||
|
minReplicas: 1
|
||||||
|
maxReplicas: 50
|
||||||
|
targetCPUUtilizationPercentage: 50
|
||||||
|
---
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
kubernetes.azure.com/tls-cert-keyvault-uri: <KeyVaultCertificateUri>
|
||||||
|
name: azure-vote-front
|
||||||
|
spec:
|
||||||
|
ingressClassName: webapprouting.kubernetes.azure.com
|
||||||
|
rules:
|
||||||
|
- host: <Hostname>
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- backend:
|
||||||
|
service:
|
||||||
|
name: azure-vote-front
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
|
path: /
|
||||||
|
pathType: Prefix
|
||||||
|
tls:
|
||||||
|
- hosts:
|
||||||
|
- <Hostname>
|
||||||
|
secretName: keyvault-azure-vote
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
wordpress:
|
||||||
|
image: wordpress
|
||||||
|
container_name: wordpress-web
|
||||||
|
ports:
|
||||||
|
- "80:80"
|
||||||
|
environment:
|
||||||
|
WORDPRESS_DB_HOST: mysql
|
||||||
|
WORDPRESS_DB_USER: root
|
||||||
|
WORDPRESS_DB_PASSWORD: "sindy1"
|
||||||
|
WORDPRESS_DB_NAME: wordpress-db
|
||||||
|
volumes:
|
||||||
|
- ./wordpress-file:/var/www/html
|
||||||
|
depends_on:
|
||||||
|
- mysql
|
||||||
|
|
||||||
|
mysql:
|
||||||
|
image: mysql:5.7
|
||||||
|
container_name: mysql-db
|
||||||
|
environment:
|
||||||
|
MYSQL_DATABASE: wordpress-db
|
||||||
|
MYSQL_ROOT_PASSWORD: "sindy1"
|
||||||
|
volumes:
|
||||||
|
- ./database:/var/lib/mysql
|
||||||
Loading…
Reference in New Issue