Skip to content

Commit 7d1a329

Browse files
committed
Adding changes
1 parent 3cff6fb commit 7d1a329

File tree

6 files changed

+65
-3
lines changed

6 files changed

+65
-3
lines changed

server/Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM python:3.12.0-slim-bookworm
2+
3+
ENV PYTHONBUFFERED 1
4+
ENV PYTHONWRITEBYTECODE 1
5+
6+
ENV APP=/app
7+
8+
# Change the workdir.
9+
WORKDIR $APP
10+
11+
# Install the requirements
12+
COPY requirements.txt $APP
13+
14+
RUN pip3 install -r requirements.txt
15+
16+
# Copy the rest of the files
17+
COPY . $APP
18+
19+
EXPOSE 8008
20+
21+
RUN chmod +x /app/entrypoint.sh
22+
23+
ENTRYPOINT ["/bin/bash","/app/entrypoint.sh"]
24+
25+
CMD ["gunicorn", "--bind", ":8008", "--workers", "3", "djangoproj.wsgi"]

server/database/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const mongoose = require('mongoose');
33
const fs = require('fs');
44
const cors = require('cors')
55
const app = express()
6-
const port = 3030;
6+
const port = 8000;
77

88
app.use(cors())
99
app.use(require('body-parser').urlencoded({ extended: false }));

server/deployment.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
labels:
5+
run: dealership
6+
name: dealership
7+
spec:
8+
replicas: 1
9+
selector:
10+
matchLabels:
11+
run: dealership
12+
strategy:
13+
rollingUpdate:
14+
maxSurge: 25%
15+
maxUnavailable: 25%
16+
type: RollingUpdate
17+
template:
18+
metadata:
19+
labels:
20+
run: dealership
21+
spec:
22+
containers:
23+
- image: us.icr.io/sn-labs-mikhailovska/dealership:latest
24+
imagePullPolicy: Always
25+
name: dealership
26+
ports:
27+
- containerPort: 8000
28+
protocol: TCP
29+
restartPolicy: Always

server/djangoapp/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
path(route="register", view=views.registration, name="register"),
1010
path(route="login", view=views.login_user, name="login"),
1111
path(route="logout", view=views.logout_request, name="logout"),
12-
path(route="get_dealers", view=views.get_dealerships, name="get_dealers"),
12+
path(route='get_dealers/', view=views.get_dealerships, name='get_dealers'),
1313
path(
1414
route="get_dealers/<str:state>",
1515
view=views.get_dealerships,

server/entrypoint.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
3+
# Make migrations and migrate the database.
4+
echo "Making migrations and migrating the database. "
5+
python manage.py makemigrations --noinput
6+
python manage.py migrate --noinput
7+
python manage.py collectstatic --noinput
8+
exec "$@"

server/frontend/src/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import PostReview from "./components/Dealers/PostReview"
2-
import Dealer from "./components/Dealers/Dealer"
32
import Dealers from './components/Dealers/Dealers';
43
import LoginPanel from "./components/Login/Login"
54
import RegisterPanel from "./components/Register/Register"
@@ -9,6 +8,7 @@ import { Routes, Route } from "react-router-dom";
98
function App() {
109
return (
1110
<Routes>
11+
1212
<Route path="/postreview/:id" element={<PostReview/>} />
1313
<Route path="/dealer/:id" element={<Dealer/>} />
1414
<Route path="/dealers" element={<Dealers/>} />

0 commit comments

Comments
 (0)