Skip to content

Commit fe866b1

Browse files
committed
Excercise 3 code and cheatsheet
1 parent 8d33160 commit fe866b1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+9743
-0
lines changed

.cheatsheet

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
Connect-AzAccount -UseDeviceAuthentication -Tenant 271a79f4-652f-4dbe-b588-19953b85a0ef
2+
az login --tenant 271a79f4-652f-4dbe-b588-19953b85a0ef
3+
4+
Ex 1:
5+
az group create --name rg-techexcelai --location swedencentral
6+
7+
Ex 2:
8+
docker build . -t contosohotel:dev
9+
az acr create --resource-group rg-techexcelai --name fwtechexcelai --sku Basic --location swedencentral
10+
az acr login --name fwtechexcelai
11+
docker tag contosohotel:dev fwtechexcelai.azurecr.io/contosohotel:dev
12+
docker push fwtechexcelai.azurecr.io/contosohotel:dev
13+
./manageIac.ps1 -iacAction "create" -deploy "postgresql" -location "Sweden Central" -passwd "<password>" -rgname "rg-techexcelai"
14+
15+
docker run -p 8000:8000 --env POSTGRES_CONNECTION_STRING='host=tqoicj6kmeriy.postgres.database.azure.com;port=5432;database=pycontosohotel;user=contosoadmin;password=<password>;' fwtechexcelai.azurecr.io/contosohotel:dev
16+
17+
Ex 3:
18+
cd /workspaces/TechExcelModApps/ModernizedContosoHotel/FrontEnd
19+
docker build . -t fwtechexcelai.azurecr.io/contosohotel:frontend
20+
docker push fwtechexcelai.azurecr.io/contosohotel:frontend
21+
22+
cd /workspaces/TechExcelModApps/ModernizedContosoHotel/BackEnd
23+
docker build . -t fwtechexcelai.azurecr.io/contosohotel:backend
24+
docker push fwtechexcelai.azurecr.io/contosohotel:backend
25+
26+
az containerapp env create --name fwcontosohotel --resource-group rg-techexcelai --location swedencentral
27+
28+
29+
az containerapp create -n fwcontosohotelapi -g rg-techexcelai --image fwtechexcelai.azurecr.io/contosohotel:backend --environment fwcontosohotel --ingress external --target-port 8000 --query properties.configuration.ingress.fqdn --env-vars POSTGRES_CONNECTION_STRING='host=tqoicj6kmeriy.postgres.database.azure.com;port=5432;database=pycontosohotel;user=contosoadmin;password=<password>;' --registry-server fwtechexcelai.azurecr.io --registry-username contosohotel --registry-password <regpassword>
30+
31+
https://fwcontosohotelapi.orangerock-4540ec5b.swedencentral.azurecontainerapps.io/
32+
33+
az containerapp create -n fwcontosohotelfrontend -g rg-techexcelai --image fwtechexcelai.azurecr.io/contosohotel:frontend --environment fwcontosohotel --ingress external --target-port 8000 --query properties.configuration.ingress.fqdn --env-vars API_BASEURL='https://fwcontosohotelapi.orangerock-4540ec5b.swedencentral.azurecontainerapps.io' --registry-server fwtechexcelai.azurecr.io --registry-username contosohotel --registry-password <regpassword>
34+
35+
36+
https://fwcontosohotelfrontend.orangerock-4540ec5b.swedencentral.azurecontainerapps.io/
37+
38+
testing
39+
docker run -p 8000:8000 --env API_BASEURL='https://fwcontosohotelapi.orangerock-4540ec5b.swedencentral.azurecontainerapps.io' fwtechexcelai.azurecr.io/contosohotel:frontend
40+
41+
cors
42+
PUT method
43+
allowed origins fwcontosohotelfrontend.orangerock-4540ec5b.swedencentral.azurecontainerapps.io
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Pull a pre-built alpine docker image with nginx and python3 installed
2+
FROM python:slim-bookworm
3+
4+
ARG DEBIAN_FRONTEND=noninteractive
5+
6+
ENV LISTEN_PORT=8000
7+
EXPOSE 8000
8+
9+
ENV STATIC_URL=/app/contoso_hotel/static
10+
11+
# Set the folder where uwsgi looks for the app
12+
WORKDIR /app
13+
14+
# Copy the app contents to the image
15+
COPY . /app
16+
17+
# ------- START: Installing mssql odbc driver 18 -------
18+
RUN apt-get update ; apt-get install -y apt-utils curl gpg dialog libterm-readline-gnu-perl libterm-readline-perl-perl ; \
19+
curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg ; \
20+
curl https://packages.microsoft.com/config/debian/12/prod.list > /etc/apt/sources.list.d/mssql-release.list ; \
21+
apt-get update
22+
RUN ACCEPT_EULA=Y apt-get install -y msodbcsql18 mssql-tools18 libgssapi-krb5-2
23+
# ------- END: Installing mssql odbc driver 18 -------
24+
25+
# installing python packages - requirements.txt
26+
COPY requirements.txt /
27+
RUN pip install --no-cache-dir -U pip
28+
RUN pip install --no-cache-dir -r /requirements.txt
29+
30+
# Set execute permission for startup.sh
31+
RUN chmod +x /app/startup.sh
32+
33+
CMD /app/startup.sh
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
MIT License
2+
3+
Copyright (c) Microsoft Corporation. All rights reserved.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE
22+
23+
-----------------------------------------------------------------------
24+
25+
Templates under contoso_hotel/static/assets, contoso_hotel/templates/layout.html and contoso_hotel/templates/homelayout.html are from the Aerial template by HTML5 UP:
26+
27+
Aerial by HTML5 UP
28+
html5up.net | @ajlkn
29+
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
30+
31+
-----------------------------------------------------------------------
32+
33+
Icons are from Font Awesome Free 6.5.2 by Fonticons, Inc.:
34+
35+
Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com
36+
License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
37+
Copyright 2024 Fonticons, Inc.
38+
39+
-----------------------------------------------------------------------
40+
41+
Favicon was generated using the following graphics from Twitter Twemoji:
42+
43+
- Graphics Title: 1f3e8.svg
44+
- Graphics Author: Copyright 2020 Twitter, Inc and other contributors (https://github.com/twitter/twemoji)
45+
- Graphics Source: https://github.com/twitter/twemoji/blob/master/assets/svg/1f3e8.svg
46+
- Graphics License: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

0 commit comments

Comments
 (0)