diff --git a/README.md b/README.md index 36aa346..e844178 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -# corise-zignite-devops-cc \ No newline at end of file +# Intro to DevOps - Week 2 Project Starter Code diff --git a/quote_disp/__pycache__/app.cpython-38.pyc b/quote_disp/__pycache__/app.cpython-38.pyc new file mode 100644 index 0000000..b15b672 Binary files /dev/null and b/quote_disp/__pycache__/app.cpython-38.pyc differ diff --git a/quote_disp/app.py b/quote_disp/app.py new file mode 100644 index 0000000..6e32c62 --- /dev/null +++ b/quote_disp/app.py @@ -0,0 +1,24 @@ +from flask import Flask, render_template +import random +import requests + +app = Flask(__name__) + +@app.route("/health") +def health(): + return int(200) + +@app.route("/") +def home(): + return render_template('index.html') + +@app.route("/get_quote") +def get_quote(): + + quote = requests.get('http://gen:5000/quote') + print('quote - ', quote) + + return render_template('quote.html', quote = quote) + +if __name__ == "__main__": + app.run(host="0.0.0.0", debug = True) \ No newline at end of file diff --git a/requirements.txt b/quote_disp/requirements.txt similarity index 57% rename from requirements.txt rename to quote_disp/requirements.txt index 2847890..ab7c3aa 100644 Binary files a/requirements.txt and b/quote_disp/requirements.txt differ diff --git a/quote_app/static/css/style.css b/quote_disp/static/css/style.css similarity index 100% rename from quote_app/static/css/style.css rename to quote_disp/static/css/style.css diff --git a/quote_app/templates/index.html b/quote_disp/templates/index.html similarity index 70% rename from quote_app/templates/index.html rename to quote_disp/templates/index.html index de65f6b..20b1125 100644 --- a/quote_app/templates/index.html +++ b/quote_disp/templates/index.html @@ -4,13 +4,13 @@ - Docker App + Quote Display Service -

Welcome to Project 1 (Docker App)

+

This is the Quote Display Service

Click Here for the Quote

diff --git a/quote_app/templates/quote.html b/quote_disp/templates/quote.html similarity index 100% rename from quote_app/templates/quote.html rename to quote_disp/templates/quote.html diff --git a/quote_app/app.py b/quote_gen/app2.py similarity index 50% rename from quote_app/app.py rename to quote_gen/app2.py index 6a6bc2e..f152f46 100644 --- a/quote_app/app.py +++ b/quote_gen/app2.py @@ -1,4 +1,4 @@ -from flask import Flask, render_template +from flask import Flask import random app = Flask(__name__) @@ -7,16 +7,22 @@ @app.route("/health") def health(): - return int(200) - -@app.route("/") -def home(): - return render_template('index.html') + return 'healthy' @app.route("/quote") def quote(): + + quotes = [ + 'The greatest glory in living lies not in never falling, but in rising every time we fall. -Nelson Mandela', + 'The way to get started is to quit talking and begin doing. -Walt Disney', + "Your time is limited, so don't waste it living someone else's life. Don't be trapped by dogma – which is living with the results of other people's thinking. -Steve Jobs", + 'If life were predictable it would cease to be life, and be without flavor. -Eleanor Roosevelt', + "If you look at what you have in life, you'll always have more. If you look at what you don't have in life, you'll never have enough. -Oprah Winfrey", + "If you set your goals ridiculously high and it's a failure, you will fail above everyone else's success. -James Cameron" + ] + index = random.randrange(len(quotes)) - return render_template('quote.html', quote = str(quotes[index])) + return str(quotes[index]) if __name__ == "__main__": - app.run(host="0.0.0.0", port=80) \ No newline at end of file + app.run(host="0.0.0.0", debug = True) \ No newline at end of file diff --git a/quote_gen/requirements.txt b/quote_gen/requirements.txt new file mode 100644 index 0000000..ab7c3aa Binary files /dev/null and b/quote_gen/requirements.txt differ diff --git a/quote_gen/static/css/style.css b/quote_gen/static/css/style.css new file mode 100644 index 0000000..9644450 --- /dev/null +++ b/quote_gen/static/css/style.css @@ -0,0 +1,351 @@ +:root { + --background-rgb: 29 30 34; + + --blue-rgb: 33 150 243; + --primary-rgb: var(--blue-rgb); + + --blob-color-1: rgb(var(--blue-rgb)); + --blob-color-2: dodgerblue; +} + +* { + box-sizing: border-box; +} + +body { + height: 100vh; + display: grid; + place-items: center; + background-color: rgb(var(--background-rgb)); + margin: 0rem; + overflow: hidden; +} + +.screen { + width: 500px; + display: flex; + border: 3px solid rgb(var(--primary-rgb) / 80%); + aspect-ratio: 10 / 16; + border-radius: 1rem; + background-color: rgb(var(--primary-rgb) / 15%); + overflow: hidden; + position: relative; + z-index: 10; +} + +.screen:after, +.screen:before { + content: ""; + height: 5px; + position: absolute; + z-index: 4; + left: 50%; + translate: -50% 0%; + background-color: white; +} + +.screen:before { + width: 15%; + top: 0rem; + border-bottom-left-radius: 1rem; + border-bottom-right-radius: 1rem; +} + +.screen:after { + width: 25%; + bottom: 0rem; + border-top-left-radius: 1rem; + border-top-right-radius: 1rem; +} + +@keyframes pan-overlay { + from { + background-position: 0% 0%; + } + + to { + background-position: 0% -100%; + } +} + +.screen-overlay { + background: linear-gradient( + rgb(var(--primary-rgb) / 0.15), + rgb(var(--primary-rgb) / 0.15) 3px, + transparent 3px, + transparent 9px + ); + background-size: 100% 9px; + height: 100%; + width: 100%; + animation: pan-overlay 22s infinite linear; + position: absolute; + z-index: 2; + left: 0px; + top: 0px; +} + +@keyframes pan-image { + 0% { + background-position: 36% 42%; + background-size: 200%; + } + + 20% { + background-position: 30% 35%; + background-size: 200%; + } + + 20.0001% { /* -- View 2 -- */ + background-position: 60% 85%; + background-size: 500%; + } + + 40% { + background-position: 49% 81%; + background-size: 500%; + } + + 40.0001% { /* -- View 3 -- */ + background-position: 80% 42%; + background-size: 300%; + } + + 60% { + background-position: 84% 33%; + background-size: 300%; + } + + 60.0001% { /* -- View 4 -- */ + background-position: 0% 0%; + background-size: 300%; + } + + 80% { + background-position: 15% 4%; + background-size: 300%; + } + + 80.0001% { /* -- View 5 -- */ + background-position: 80% 10%; + background-size: 300%; + } + + 100% { + background-position: 72% 14%; + background-size: 300%; + } +} + +.screen > .screen-image { + background-image: url("https://images.unsplash.com/photo-1515266591878-f93e32bc5937?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2574&q=80"); + height: 100%; + width: 100%; + position: absolute; + z-index: 1; + left: 0px; + top: 0px; + background-size: 300%; + background-position: 0% 0%; + filter: sepia(100%) hue-rotate(160deg); + opacity: 0.2; + animation: pan-image 15s linear infinite; +} + +.screen > .screen-content { + display: flex; + flex-direction: column; + align-items: center; + justify-content: flex-end; + flex-grow: 1; + gap: 4rem; + position: relative; + z-index: 3; + margin: 1rem; + padding-bottom: 6rem; + border: 1px solid rgb(var(--primary-rgb) / 50%); + border-radius: 0.6rem; +} + +.screen > .screen-content > .screen-icon { + color: white; + font-size: 4rem; + text-shadow: 0px 0px 0.5rem white; +} + +.screen > .screen-content > .screen-user{ + display: flex; + flex-direction: column; + align-items: center; + gap: 1rem; + position: relative; +} + +.screen > .screen-content > .screen-user:before, +.screen > .screen-content > .screen-user:after { + content: ""; + position: absolute; + top: 0px; + background-color: rgb(var(--primary-rgb)); + border-radius: 1rem; + box-shadow: 0px 0px 8px 3px rgb(var(--primary-rgb) / 60%); +} + +.screen > .screen-content > .screen-user:before { + height: 2px; + width: 50px; + translate: -20px -1rem; + opacity: 0.75; +} + +.screen > .screen-content > .screen-user:after { + height: 3px; + width: 30px; + translate: 26px calc(-1rem - 0.5px); +} + +.screen > .screen-content > .screen-user > :is(.name, .link) { + font-family: "Source Code Pro", monospace; + color: white; + text-align: center; + text-transform: uppercase; +} + +.screen > .screen-content > .screen-user > .name { + position: relative; + font-size: 4.25rem; + font-weight: 400; +} + +.screen > .screen-content > .screen-user > .name:before, +.screen > .screen-content > .screen-user > .name:after { + content: ""; + height: 4px; + width: 4px; + position: absolute; + border: 2px solid white; + border-radius: 2px; +} + +.screen > .screen-content > .screen-user > .name:before { + top: 55%; + right: -1.5rem; +} + +.screen > .screen-content > .screen-user > .name:after { + top: 45%; + left: -1.5rem; +} + +.screen > .screen-content > .screen-user > .link { + opacity: 0.8; + font-size: 1.5rem; + text-shadow: 0px 0px 0.5rem white; + font-weight: 400; + letter-spacing: 0.3rem; + text-decoration: none; +} + +.screen > .screen-content > .screen-user > .link:is(:hover, :focus) { + text-decoration: underline; +} + +@media(max-width: 700px) { + .screen { + scale: 0.6; + margin-bottom: 0rem; + } +} + +/* -- Blob effect -- */ + +@keyframes rotate { + from { + rotate: 0deg; + } + + 50% { + scale: 1 1.5; + } + + to { + rotate: 360deg; + } +} + +#blob { + background-color: white; + height: 34vmax; + aspect-ratio: 1; + position: absolute; + left: 50%; + top: 50%; + translate: -50% -50%; + border-radius: 50%; + background: linear-gradient(to right, var(--blob-color-1), var(--blob-color-2)); + animation: rotate 20s infinite; + opacity: 0.2; +} + +#blur { + height: 100%; + width: 100%; + position: absolute; + z-index: 2; + backdrop-filter: blur(12vmax); +} + +/* -- Links -- */ +#links { + display: flex; + flex-direction: column; + gap: 0.5rem; + position: absolute; + top: 0px; + left: 0px; + z-index: 10; + padding: 1rem; +} + +.meta-link { + display: flex; + align-items: center; + gap: 0.5rem; +} + +.meta-link > :is(span, a) { + font-family: "Rubik", sans-serif; + font-size: 0.9rem; + color: white; +} + +.meta-link > .label { + width: 160px; + text-align: right; +} + +.meta-link > a { + text-decoration: none; + outline: none; +} + +.meta-link > a.source { + color: rgb(94, 106, 210); +} + +.meta-link > a:is(:hover, :focus) > i { + color: white; +} + +.meta-link > a.youtube { + color: rgb(239, 83, 80); +} + +.meta-link > a.youtube > i { + padding-top: 0.2rem; +} + +.meta-link > a > i { + height: 1rem; + line-height: 1rem; +} \ No newline at end of file diff --git a/quote_gen/templates/index.html b/quote_gen/templates/index.html new file mode 100644 index 0000000..b00e5e4 --- /dev/null +++ b/quote_gen/templates/index.html @@ -0,0 +1,16 @@ + + + + + + + Quote Gen Service + + + + + +

Quote Generation Service

+ + + \ No newline at end of file