client/server + docker

This commit is contained in:
zman 2024-03-03 19:59:35 -05:00
parent 7c0afd0114
commit 91d55efd20
12 changed files with 103 additions and 0 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
*.db
__pycache__
.venv
*.sqlite3

9
client/Dockerfile Normal file
View File

@ -0,0 +1,9 @@
# Use an official nginx image
FROM nginx:alpine
# Expose port 80
EXPOSE 80
# Start Nginx and keep it running
CMD ["nginx", "-g", "daemon off;"]

28
client/index.html Normal file
View File

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<header>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</header>
<main>
<section>
<h1>Welcome to My Website</h1>
<p>This is a paragraph of text to introduce visitors to the site and inform them about what they can find here.</p>
</section>
</main>
<footer>
<p>&copy; 2024 My Website</p>
</footer>
</body>
</html>

37
docker-compose.yml Normal file
View File

@ -0,0 +1,37 @@
version: '3.8'
services:
web:
build: ./server
ports:
- "5000:5000"
volumes:
- ./server:/app
environment:
- DEBUG=1
- POKEMANS_DB_URL
- PRAW_CLIENT_ID
- PRAW_CLIENT_SECRET
- PRAW_USERNAME
- PRAW_PASSWORD
- POKEMANS_WEBHOOK_URL
command:
python main.py
db:
image: postgres:12
environment:
POSTGRES_DB: pokemans
POSTGRES_USER: pokemans
POSTGRES_PASSWORD: pokemans
ports:
- "5432:5432"
frontend:
build: ./client
ports:
- "3000:80"
volumes:
- ./client:/usr/share/nginx/html
depends_on:
- web

18
server/Dockerfile Normal file
View File

@ -0,0 +1,18 @@
FROM python:3.11
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# Set the working directory in the container
WORKDIR /app
# Install any needed packages specified in requirements.txt
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Make port 8000 available to the world outside this container
EXPOSE 8000
# Run python manage.py runserver 0.0.0.0:8000 when the container launches
CMD ["python", "main.py"]

View File

@ -25,9 +25,19 @@ if __name__ == "__main__":
reddit_monitor = RedditMonitor(client_id, client_secret, user_agent, username, password, subreddit_name)
webhook_notifier = WebhookNotifier(discord_webhook_url, disable_webhook)
app = Application(reddit_monitor, webhook_notifier)
print("Starting app")
app.run()
"""
TODO:
- implement django
- basic front end (react)
- tests
- Filter out canadian/uk deals
- track score and number of comments over time in db
- try to identify product, number of cards, price per card, etc
- track price over time for each product
- try to identify platform ie. costco for gift card, tiktok for coupons, etc.
- support for craigslist, ebay, etc.
- front end - vizualization, classification, lookup, etc.
"""