Skip to content

Commit 2d11d46

Browse files
Add files via upload
1 parent da726d6 commit 2d11d46

Some content is hidden

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

44 files changed

+2835
-0
lines changed

microservices-ecommerce-ec2/frontend/app.py

Lines changed: 480 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[program:frontend-supervisor]
2+
directory=/home/ubuntu/ecommerce/frontend
3+
command=/usr/local/bin/gunicorn wsgi:app -c /home/ubuntu/ecommerce/frontend/gunicorn.py
4+
5+
user=root
6+
autostart=true
7+
autorestart=true
8+
redirect_stderr=true
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
bind = '0.0.0.0:5000'
2+
workers = 1
3+
timeout=1000
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
server {
2+
listen 80;
3+
server_name app.study411.com;
4+
return 301 https://app.study411.com$request_uri;
5+
}
6+
7+
server {
8+
listen 443 default_server ssl;
9+
#listen 80 default_server;
10+
11+
server_name app.study411.com;
12+
13+
access_log /var/log/nginx/access.log;
14+
error_log /var/log/nginx/error.log;
15+
16+
# Your Django project's media files - amend as required
17+
location /media {
18+
alias /home/ubuntu/ecommerce/frontend/media;
19+
}
20+
21+
#location /uploads {
22+
# alias /home/ubuntu/ecommerce/frontend/uploads;
23+
#}
24+
25+
# your Django project's static files - amend as required
26+
location /static {
27+
alias /home/ubuntu/ecommerce/frontend/static;
28+
}
29+
30+
ssl_certificate /etc/letsencrypt/live/app.study411.com/fullchain.pem ;
31+
ssl_certificate_key /etc/letsencrypt/live/app.study411.com/privkey.pem;
32+
33+
location / {
34+
proxy_pass http://0.0.0.0:5000;
35+
proxy_set_header X-Forwarded-Host $server_name;
36+
proxy_set_header X-Real-IP $remote_addr;
37+
proxy_set_header Host $http_host;
38+
add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';
39+
}
40+
}
41+
42+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#Install the required packages
2+
sudo apt update
3+
sudo apt install python3-pip python3-dev nginx supervisor
4+
sudo apt install libcairo-5c-dev
5+
6+
#Install the python packages
7+
sudo pip3 install -r requirements.txt
8+
9+
#Setup the DB
10+
flask db init
11+
flask db migrate
12+
flask db upgrade
13+
14+
#Run the app
15+
python3 app.py
16+
17+
#Setup Nginx
18+
sudo cp nginx-flask.conf /etc/nginx/sites-available/
19+
cd /etc/nginx/sites-enabled/
20+
sudo ln -s ../sites-available/nginx-flask.conf .
21+
sudo service nginx restart
22+
23+
#Setup Supervisor
24+
sudo cp frontend-supervisor.conf /etc/supervisor/conf.d/
25+
sudo supervisorctl reread
26+
sudo supervisorctl update
27+
sudo supervisorctl restart all
28+
29+
#Getting SSL Certificate
30+
sudo apt install certbot
31+
sudo service nginx stop
32+
sudo certbot certonly --standalone -d app.study411.com
33+
34+
#Create products (replace localhost with private IP of product service)
35+
36+
curl -X POST -F "name=Coffee Mug" -F "slug=mug-1" -F "description=These premium quality coffee mugs are crafted from durable, dishwasher-safe ceramic and feature stunning, unique designs that add a touch of style to your morning routine. With a generous 300ml capacity and comfortable, ergonomic handle, you can enjoy more of your favorite hot beverage with each sip. The mugs have a glossy finish that looks elegant and feels smooth to the touch. Microwave safe for convenient reheating, they make for thoughtful, personalized gifts for birthdays, holidays, anniversaries, or to show appreciation for someone special. Arriving beautifully packaged in a secure box, these eye-catching mugs are ready to delight any recipient." -F "price=9.99" -F "[email protected]" http://localhost:5000/api/product/create
Lines changed: 251 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,251 @@
1+
/*!
2+
* bootstrap-star-rating v4.1.3
3+
* http://plugins.krajee.com/star-rating
4+
*
5+
* Author: Kartik Visweswaran
6+
* Copyright: 2013 - 2021, Kartik Visweswaran, Krajee.com
7+
*
8+
* Licensed under the BSD 3-Clause
9+
* https://github.com/kartik-v/bootstrap-star-rating/blob/master/LICENSE.md
10+
*/
11+
.rating-loading {
12+
width: 25px;
13+
height: 25px;
14+
font-size: 0;
15+
color: #fff;
16+
background: transparent url('../img/loading.gif') top left no-repeat;
17+
border: none;
18+
}
19+
20+
/*
21+
* Stars & Input
22+
*/
23+
.rating-container .rating-stars {
24+
position: relative;
25+
cursor: pointer;
26+
vertical-align: middle;
27+
display: inline-block;
28+
overflow: hidden;
29+
white-space: nowrap;
30+
}
31+
32+
.rating-container .rating-stars:focus {
33+
outline: 1px dotted;
34+
}
35+
36+
.rating-input {
37+
position: absolute;
38+
cursor: pointer;
39+
width: 100%;
40+
height: 1px;
41+
bottom: 0;
42+
left: 0;
43+
font-size: 1px;
44+
opacity: 0;
45+
padding: 0;
46+
margin: 0;
47+
outline: none;
48+
pointer-events: none;
49+
border: none;
50+
box-shadow: none;
51+
background: none;
52+
}
53+
54+
.rating-container.is-display-only .rating-stars {
55+
cursor: default;
56+
}
57+
58+
.rating-disabled .rating-stars {
59+
cursor: not-allowed;
60+
}
61+
62+
.rating-container .star {
63+
display: inline-block;
64+
margin: 0 2px;
65+
text-align: center;
66+
}
67+
68+
.rating-container .empty-stars {
69+
color: #aaa;
70+
}
71+
72+
.rating-container .filled-stars {
73+
position: absolute;
74+
left: 0;
75+
top: 0;
76+
margin: auto;
77+
color: #fde16d;
78+
white-space: nowrap;
79+
overflow: hidden;
80+
-webkit-text-stroke: 1px #777;
81+
text-shadow: 1px 1px #999;
82+
}
83+
84+
.rating-rtl {
85+
float: right;
86+
}
87+
88+
.rating-animate .filled-stars {
89+
transition: width 0.25s ease;
90+
}
91+
92+
.rating-rtl .filled-stars {
93+
left: auto;
94+
right: 0;
95+
transition: none;
96+
-webkit-transform: matrix(-1, 0, 0, 1, 0, 0);
97+
transform: matrix(-1, 0, 0, 1, 0, 0);
98+
}
99+
100+
.rating-rtl.is-star .filled-stars {
101+
right: 0.06em;
102+
}
103+
104+
.rating-rtl.is-heart .empty-stars {
105+
margin-right: 0.07em;
106+
}
107+
108+
/**
109+
* Clear
110+
*/
111+
.rating-container .clear-rating {
112+
color: #aaa;
113+
cursor: not-allowed;
114+
display: inline-block;
115+
vertical-align: middle;
116+
font-size: 60%;
117+
}
118+
119+
.clear-rating-active {
120+
cursor: pointer !important;
121+
}
122+
123+
.clear-rating-active:hover {
124+
color: #843534;
125+
}
126+
127+
.rating-container .clear-rating {
128+
padding-right: 5px;
129+
}
130+
131+
/**
132+
* Caption
133+
*/
134+
135+
/* extend support to BS4 */
136+
.rating-container .caption .label {
137+
display: inline-block;
138+
padding: .25em .4em;
139+
line-height: 1;
140+
text-align: center;
141+
vertical-align: baseline;
142+
border-radius: .25rem;
143+
}
144+
145+
.rating-container .caption {
146+
color: #999;
147+
display: inline-block;
148+
vertical-align: middle;
149+
line-height: 1;
150+
}
151+
152+
.rating-container .caption {
153+
margin-left: 5px;
154+
margin-right: 0;
155+
}
156+
157+
.rating-rtl .caption {
158+
margin-right: 5px;
159+
margin-left: 0;
160+
}
161+
162+
/**
163+
* Print
164+
*/
165+
@media print {
166+
.rating-container .clear-rating {
167+
display: none;
168+
}
169+
}
170+
171+
/**
172+
* Sizes
173+
*/
174+
.rating-xl {
175+
font-size: 48px;
176+
}
177+
.rating-lg {
178+
font-size: 40px;
179+
}
180+
.rating-md {
181+
font-size: 32px;
182+
}
183+
.rating-sm {
184+
font-size: 24px;
185+
}
186+
.rating-xs {
187+
font-size: 16px;
188+
}
189+
190+
.rating-xl .caption {
191+
font-size: 20px;
192+
}
193+
194+
.rating-lg .caption {
195+
font-size: 18px;
196+
}
197+
198+
.rating-md .caption {
199+
font-size: 16px;
200+
}
201+
202+
.rating-sm .caption {
203+
font-size: 14px;
204+
}
205+
206+
.rating-xs .caption {
207+
font-size: 12px;
208+
}
209+
210+
/**
211+
* Caption
212+
*/
213+
.caption-badge {
214+
font-family: Arial, Helvetica, sans-serif;
215+
display: inline-block;
216+
padding: .35em .65em;
217+
font-size: .75em;
218+
font-weight: 700;
219+
line-height: 1;
220+
color: #fff;
221+
text-align: center;
222+
white-space: nowrap;
223+
vertical-align: baseline;
224+
border-radius: .25rem;
225+
}
226+
227+
.caption-secondary {
228+
background-color: #6c757d;
229+
}
230+
231+
.caption-danger {
232+
background-color: #dc3545;
233+
}
234+
235+
.caption-warning {
236+
background-color: #ffc107;
237+
color: #212529;
238+
}
239+
240+
.caption-info {
241+
background-color: #0dcaf0;
242+
color: #212529;
243+
}
244+
245+
.caption-primary {
246+
background-color: #0d6efd;
247+
}
248+
249+
.caption-success {
250+
background-color: #198754;
251+
}

microservices-ecommerce-ec2/frontend/static/css/star-rating.min.css

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
10.4 KB
Loading
18.5 KB
Loading

0 commit comments

Comments
 (0)