Skip to content

Commit fba0e3c

Browse files
authored
feat: Terraform Deployment (#27)
* chore: remove outputs * chore: add todos * chore: remove ipv4 cause aws is charging * chore: directory restructure * chore: remove public egress temp * Update README.md * feat: backend ec2 and rds in subnets * chore: prevent destroy * feat: frontend infra * route 53 dns * feat: docker setup for backend * chore: minor config changes * feat: route the traffic via alb to ec2 instead of direct ec2 * chore: cors * chore: cors * feat: ngnix config * feat: home page maintinance message
1 parent 3711a30 commit fba0e3c

37 files changed

+565
-175
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ BitMatch provides a streamlined platform where:
4646
- Terraform for infrastructure as code (IaC)
4747

4848
## 🏗 Architecture Diagram
49-
![BitMatchArchAWS](https://github.com/user-attachments/assets/68d1f250-b9d7-4c26-ba60-664380282d6e)
49+
![BitMatchAWSDiagram](https://github.com/user-attachments/assets/ebf5667b-e255-4933-bee9-9970bd0c6f9a)
5050

5151
## 🛠 Running Locally
5252

backend/.dockerignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
__pycache__/
2+
*.pyc
3+
*.pyo
4+
*.pyd
5+
.env
6+
/static

backend/.gitignore

-21
Original file line numberDiff line numberDiff line change
@@ -38,27 +38,6 @@ static/
3838
.DS_Store
3939
Thumbs.db
4040

41-
# Local .terraform directories
42-
.terraform/
43-
44-
# Terraform state files
45-
*.tfstate
46-
*.tfstate.*
47-
48-
# Crash log files
49-
crash.log
50-
51-
# Terraform variable files (containing sensitive data)
52-
*.tfvars
53-
*.tfvars.json
54-
55-
# Override files, which may contain sensitive data
56-
override.tf
57-
override.tf.json
58-
59-
# .terraform.lock.hcl files (optional to include, especially in team environments)
60-
.terraform.lock.hcl
61-
6241
# IDE and editor folders
6342
.vscode/
6443
.idea/

backend/Dockerfile

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Use an official Python runtime as a parent image
2+
FROM python:3.11
3+
4+
# Set the working directory in the container
5+
WORKDIR /app
6+
7+
# Copy the requirements file and install dependencies
8+
COPY requirements.txt .
9+
RUN pip install --no-cache-dir -r requirements.txt
10+
11+
# Copy the rest of the application
12+
COPY . .
13+
14+
# Set environment variables
15+
ENV PYTHONUNBUFFERED=1
16+
17+
# Expose the port for Gunicorn
18+
EXPOSE 8000
19+
20+
# Run migrations and start Django server
21+
CMD ["sh", "-c", "python manage.py migrate && python manage.py collectstatic --noinput && gunicorn bitmatch.wsgi:application --bind 0.0.0.0:8000"]
File renamed without changes.
File renamed without changes.

backend/bitmatch/bitmatch/settings.py renamed to backend/bitmatch/settings.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,10 @@
175175
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
176176

177177
CORS_ALLOWED_ORIGINS = [
178-
"http://localhost:5173", # Vite development server URL
179-
"http://localhost:5174",
180-
"http://localhost:5175",
181-
"http://localhost:5176",
178+
"http://localhost:5173",
179+
"http://localhost:5174",
180+
"https://bitmatchapp.com",
181+
"https://api.bitmatchapp.com",
182182
]
183183

184184
CORS_ALLOW_CREDENTIALS = True
File renamed without changes.
File renamed without changes.
File renamed without changes.

backend/infra/main.tf

-144
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

backend/requirements.txt

1.39 KB
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

frontend/bitmatch/src/App.jsx

+55-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
import { useEffect, useState } from "react";
12
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
23
import {
34
SignedIn,
45
SignedOut,
56
SignInButton,
67
UserButton,
8+
useUser,
79
} from "@clerk/clerk-react";
810
import { Button } from "./components/ui/button";
911
import HomePage from "./views/HomePage";
@@ -12,6 +14,18 @@ import ProjectDetailPage from "./views/IndividualProjectPage";
1214
import "./styles/global.css";
1315

1416
export default function App() {
17+
const { user } = useUser();
18+
const [showModal, setShowModal] = useState(false);
19+
// eslint-disable-next-line no-unused-vars
20+
const [showMaintenanceNote, setShowMaintenanceNote] = useState(true); // Toggle for maintenance note
21+
22+
useEffect(() => {
23+
if (user && !sessionStorage.getItem("seenDevelopmentModal")) {
24+
setShowModal(true);
25+
sessionStorage.setItem("seenDevelopmentModal", "true"); // Store it for the session
26+
}
27+
}, [user]);
28+
1529
return (
1630
<Router>
1731
<div className="container mx-auto px-4 py-16 flex pb-6 flex-col items-center justify-center min-h-screen">
@@ -20,6 +34,18 @@ export default function App() {
2034
<h1 className="text-3xl font-semibold text-gray-800 mb-4">
2135
Sign in to continue
2236
</h1>
37+
{/* Maintenance Note */}
38+
{showMaintenanceNote && (
39+
<div className="bg-yellow-100 text-yellow-800 p-4 mb-4 rounded max-w-xs mx-auto">
40+
<strong>
41+
Maintenance Notice: We are currently performing maintenance to
42+
improve the performance and reliability of our service. Some
43+
features may be temporarily unavailable. We appreciate your
44+
patience and understanding as we work to enhance your
45+
experience.
46+
</strong>
47+
</div>
48+
)}
2349
<SignInButton mode="modal">
2450
<Button className="px-6 py-3 bg-blue-600 text-white rounded-lg shadow-md hover:bg-blue-700">
2551
Sign In
@@ -29,6 +55,35 @@ export default function App() {
2955
</SignedOut>
3056

3157
<SignedIn>
58+
{/* First Login Modal (Per Session) */}
59+
{showModal && (
60+
<div className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[1000]">
61+
<div className="bg-white p-6 rounded-lg shadow-lg max-w-md text-center z-[1001]">
62+
<h2 className="text-xl font-bold text-gray-800 mb-4">
63+
Disclaimer
64+
</h2>
65+
<p className="text-gray-600 mb-4">
66+
Bitmatch is in early development, so some features may not
67+
work as expected. Thanks for your patience and support as we
68+
continue to improve!
69+
</p>
70+
<p className="text-gray-600 mb-4">
71+
If you experience any issues, please email us at{" "}
72+
<a href="mailto:[email protected]" className="text-blue-600">
73+
74+
</a>
75+
.
76+
</p>
77+
<Button
78+
onClick={() => setShowModal(false)}
79+
className="bg-blue-600 text-white px-4 py-2 rounded"
80+
>
81+
Got it!
82+
</Button>
83+
</div>
84+
</div>
85+
)}
86+
3287
<header className="w-full bg-white shadow-md p-4 fixed top-0 left-0 z-50">
3388
<div className="max-w-[1485px] mx-auto flex justify-between items-center">
3489
<a href="/">
@@ -41,13 +96,8 @@ export default function App() {
4196
</header>
4297

4398
<Routes>
44-
{/* Home Page */}
4599
<Route path="/" element={<HomePage />} />
46-
47-
{/* Project List Page */}
48100
<Route path="/project-list" element={<ProjectListPage />} />
49-
50-
{/* Individual List Page */}
51101
<Route path="/projects/:id" element={<ProjectDetailPage />} />
52102
</Routes>
53103
</SignedIn>

infra/.gitignore

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Local .terraform directories
2+
.terraform/
3+
4+
# Terraform state files
5+
*.tfstate
6+
*.tfstate.*
7+
8+
# Crash log files
9+
crash.log
10+
11+
# Terraform variable files (containing sensitive data)
12+
*.tfvars
13+
*.tfvars.json
14+
15+
# Override files, which may contain sensitive data
16+
override.tf
17+
override.tf.json
18+
19+
# .terraform.lock.hcl files (optional to include, especially in team environments)
20+
.terraform.lock.hcl

0 commit comments

Comments
 (0)