Skip to content

Commit 7db2dac

Browse files
committed
base services
1 parent 9b56b3a commit 7db2dac

Some content is hidden

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

47 files changed

+2870
-159
lines changed

.gitignore

Lines changed: 10 additions & 159 deletions
Original file line numberDiff line numberDiff line change
@@ -1,162 +1,13 @@
1-
# Byte-compiled / optimized / DLL files
2-
__pycache__/
3-
*.py[cod]
4-
*$py.class
5-
6-
# C extensions
7-
*.so
8-
9-
# Distribution / packaging
10-
.Python
11-
build/
12-
develop-eggs/
13-
dist/
14-
downloads/
15-
eggs/
16-
.eggs/
17-
lib/
18-
lib64/
19-
parts/
20-
sdist/
21-
var/
22-
wheels/
23-
share/python-wheels/
24-
*.egg-info/
25-
.installed.cfg
26-
*.egg
27-
MANIFEST
28-
29-
# PyInstaller
30-
# Usually these files are written by a python script from a template
31-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32-
*.manifest
33-
*.spec
34-
35-
# Installer logs
36-
pip-log.txt
37-
pip-delete-this-directory.txt
38-
39-
# Unit test / coverage reports
40-
htmlcov/
41-
.tox/
42-
.nox/
43-
.coverage
44-
.coverage.*
45-
.cache
46-
nosetests.xml
47-
coverage.xml
48-
*.cover
49-
*.py,cover
50-
.hypothesis/
51-
.pytest_cache/
52-
cover/
53-
54-
# Translations
55-
*.mo
56-
*.pot
57-
58-
# Django stuff:
59-
*.log
60-
local_settings.py
61-
db.sqlite3
62-
db.sqlite3-journal
63-
64-
# Flask stuff:
65-
instance/
66-
.webassets-cache
67-
68-
# Scrapy stuff:
69-
.scrapy
70-
71-
# Sphinx documentation
72-
docs/_build/
73-
74-
# PyBuilder
75-
.pybuilder/
76-
target/
77-
78-
# Jupyter Notebook
79-
.ipynb_checkpoints
80-
81-
# IPython
82-
profile_default/
83-
ipython_config.py
84-
85-
# pyenv
86-
# For a library or package, you might want to ignore these files since the code is
87-
# intended to run in multiple environments; otherwise, check them in:
88-
# .python-version
89-
90-
# pipenv
91-
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92-
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93-
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94-
# install all needed dependencies.
95-
#Pipfile.lock
96-
97-
# poetry
98-
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99-
# This is especially recommended for binary packages to ensure reproducibility, and is more
100-
# commonly ignored for libraries.
101-
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102-
#poetry.lock
103-
104-
# pdm
105-
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106-
#pdm.lock
107-
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108-
# in version control.
109-
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
110-
.pdm.toml
111-
.pdm-python
112-
.pdm-build/
113-
114-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
115-
__pypackages__/
116-
117-
# Celery stuff
118-
celerybeat-schedule
119-
celerybeat.pid
120-
121-
# SageMath parsed files
122-
*.sage.py
123-
124-
# Environments
1251
.env
126-
.venv
127-
env/
128-
venv/
129-
ENV/
130-
env.bak/
131-
venv.bak/
132-
133-
# Spyder project settings
134-
.spyderproject
135-
.spyproject
2+
.idea/
1363

137-
# Rope project settings
138-
.ropeproject
139-
140-
# mkdocs documentation
141-
/site
142-
143-
# mypy
144-
.mypy_cache/
145-
.dmypy.json
146-
dmypy.json
147-
148-
# Pyre type checker
149-
.pyre/
150-
151-
# pytype static type analyzer
152-
.pytype/
153-
154-
# Cython debug symbols
155-
cython_debug/
4+
# Python-specific
5+
venv/
1566

157-
# PyCharm
158-
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
159-
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
160-
# and can be added to the global gitignore or merged into this file. For a more nuclear
161-
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
162-
#.idea/
7+
# Node.js-specific
8+
node_modules/
9+
.npm
10+
*.log
11+
npm-debug.log*
12+
yarn-debug.log*
13+
yarn-error.log*

build/newsletter.Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# docker build -t users-service -f build/users.Dockerfile .
2+
3+
# Stage 1: Create a self signed SSL certificate
4+
FROM alpine:latest AS certs
5+
WORKDIR /app
6+
RUN apk --no-cache add openssl
7+
8+
# Generate self-signed certificate (server.crt and server.key)
9+
RUN openssl req -new -newkey rsa:2048 -days 365 -nodes -x509 \
10+
-subj "/C=US/ST=State/L=City/O=Organization/CN=localhost" \
11+
-keyout server.key -out server.crt
12+
13+
# Stage 2: Build the Go application
14+
FROM node:16
15+
WORKDIR /app
16+
17+
# Copy the certificates from the certs stage
18+
COPY --from=certs /app .
19+
20+
# Download and install dependencies
21+
COPY services/newsletter/package*.json ./
22+
RUN npm install
23+
24+
# Copy the rest of the application code
25+
COPY services/newsletter/. .
26+
27+
# Expose port 7003 for the HTTPS server
28+
EXPOSE 7003
29+
30+
# Start the server
31+
CMD ["node", "index.js"]

build/products.Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# docker build -t users-service -f build/users.Dockerfile .
2+
3+
# Stage 1: Create a self signed SSL certificate
4+
FROM alpine:latest AS certs
5+
WORKDIR /app
6+
RUN apk --no-cache add openssl
7+
8+
# Generate self-signed certificate (server.crt and server.key)
9+
RUN openssl req -new -newkey rsa:2048 -days 365 -nodes -x509 \
10+
-subj "/C=US/ST=State/L=City/O=Organization/CN=localhost" \
11+
-keyout server.key -out server.crt
12+
13+
# Stage 2: Build the Go application
14+
FROM golang:1.23-alpine AS builder
15+
WORKDIR /app
16+
17+
# Copy the certificates from the certs stage
18+
COPY --from=certs /app .
19+
20+
# Download dependencies
21+
COPY services/products/go.mod services/products/go.sum ./
22+
RUN go mod download
23+
24+
# Copy the rest of the application code and build the Go application
25+
COPY services/products/. .
26+
RUN go build -o main .
27+
28+
# Expose port 7002 for the HTTPS server
29+
EXPOSE 7002
30+
31+
# Run the Go application
32+
CMD ["./main"]

build/users.Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# docker build -t users-service -f build/users.Dockerfile .
2+
3+
# Stage 1: Create a self signed SSL certificate
4+
FROM alpine:latest AS certs
5+
WORKDIR /app
6+
RUN apk --no-cache add openssl
7+
8+
# Generate self-signed certificate (server.crt and server.key)
9+
RUN openssl req -new -newkey rsa:2048 -days 365 -nodes -x509 \
10+
-subj "/C=US/ST=State/L=City/O=Organization/CN=localhost" \
11+
-keyout server.key -out server.crt
12+
13+
# Stage 2: Build the Go application
14+
FROM golang:1.23-alpine AS builder
15+
WORKDIR /app
16+
17+
# Copy the certificates from the certs stage
18+
COPY --from=certs /app .
19+
20+
# Download dependencies
21+
COPY services/users/go.mod services/users/go.sum ./
22+
RUN go mod download
23+
24+
# Copy the rest of the application code and build the Go application
25+
COPY services/users/. .
26+
RUN go build -o main .
27+
28+
# Expose port 7001 for the HTTPS server
29+
EXPOSE 7001
30+
31+
# Run the Go application
32+
CMD ["./main"]

docker-compose.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
version: "3.9"
2+
services:
3+
users-service:
4+
build:
5+
dockerfile: build/users.Dockerfile
6+
restart: unless-stopped
7+
platform: linux/amd64
8+
command: [ "./main" ]
9+
ports:
10+
- "7001:7001"
11+
environment:
12+
DB_NAME: otterside
13+
DB_SERVICE_HOST: postgres
14+
DB_SERVICE_USER: postgres
15+
DB_SERVICE_PASS: password
16+
depends_on:
17+
- postgres
18+
19+
products-service:
20+
build:
21+
dockerfile: build/products.Dockerfile
22+
restart: unless-stopped
23+
platform: linux/amd64
24+
command: [ "./main" ]
25+
ports:
26+
- "7002:7002"
27+
environment:
28+
STORAGE_ENABLED: false
29+
STORAGE_BUCKET_NAME: bucket-name
30+
STORAGE_OBJECT_KEY: products.json
31+
32+
newsletter-service:
33+
build:
34+
dockerfile: build/newsletter.Dockerfile
35+
restart: unless-stopped
36+
platform: linux/amd64
37+
command: ["node", "index.js"]
38+
ports:
39+
- "7003:7003"
40+
environment:
41+
DB_NAME: otterside
42+
DB_SERVICE_HOST: postgres
43+
DB_SERVICE_USER: postgres
44+
DB_SERVICE_PASS: password
45+
depends_on:
46+
- postgres
47+
48+
postgres:
49+
image: postgres:14
50+
restart: unless-stopped
51+
ports:
52+
- "5432:5432"
53+
shm_size: 4gb
54+
environment:
55+
POSTGRES_DB: otterside
56+
POSTGRES_PASSWORD: password
57+
PGDATA: /var/lib/postgresql/data/pgdata
58+
volumes:
59+
- postgres:/var/lib/postgresql/data
60+
61+
redis:
62+
image: redis
63+
restart: unless-stopped
64+
ports:
65+
- "6379:6379"
66+
67+
volumes:
68+
postgres:

services/frontend/__init__.py

Whitespace-only changes.

services/frontend/requirements.txt

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
annotated-types==0.7.0
2+
anyio==4.6.2.post1
3+
certifi==2024.8.30
4+
charset-normalizer==3.4.0
5+
click==8.1.7
6+
dnspython==2.7.0
7+
email_validator==2.2.0
8+
fastapi==0.115.2
9+
fastapi-cli==0.0.5
10+
fastapi-sessions==0.3.2
11+
h11==0.14.0
12+
httpcore==1.0.6
13+
httptools==0.6.4
14+
httpx==0.27.2
15+
idna==3.10
16+
itsdangerous==2.2.0
17+
Jinja2==3.1.4
18+
loguru==0.7.2
19+
markdown-it-py==3.0.0
20+
MarkupSafe==3.0.2
21+
mdurl==0.1.2
22+
pydantic==2.9.2
23+
pydantic_core==2.23.4
24+
Pygments==2.18.0
25+
python-dotenv==1.0.1
26+
python-multipart==0.0.12
27+
PyYAML==6.0.2
28+
requests==2.32.3
29+
rich==13.9.2
30+
shellingham==1.5.4
31+
sniffio==1.3.1
32+
starlette==0.40.0
33+
typer==0.12.5
34+
typing_extensions==4.12.2
35+
urllib3==2.2.3
36+
uvicorn==0.32.0
37+
uvloop==0.21.0
38+
watchfiles==0.24.0
39+
websockets==13.1

services/frontend/routes/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)