-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(project): initial project setup with telelog base
- Set up Django project structure using cookiecutter template - Configure Docker development environment with PostgreSQL and Redis - Add project configurations (settings, environment vars, Docker files) - Set up linting and code formatting tools (pre-commit, ruff) - Implement base PostgreSQL and Redis health checks
- Loading branch information
0 parents
commit a43be3e
Showing
33 changed files
with
1,066 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Python | ||
__pycache__/ | ||
*.py[cod] | ||
*.so | ||
.Python | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# Django | ||
*.log | ||
db.sqlite3 | ||
media/ | ||
|
||
# Environment | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
.envs/ | ||
|
||
# Dev | ||
.git/ | ||
.gitignore | ||
README.md | ||
.flake8 | ||
.pre-commit-config.yaml | ||
docker-compose*.yml | ||
|
||
# IDE | ||
.idea/ | ||
.vscode/ | ||
|
||
# System | ||
.DS_Store | ||
Thumbs.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# ============================================================================= | ||
# GENERAL CONFIGURATION | ||
# ============================================================================= | ||
# Docker and development settings | ||
USE_DOCKER=yes | ||
IPYTHONDIR=/app/.ipython | ||
|
||
# ============================================================================= | ||
# REDIS CONFIGURATION | ||
# ============================================================================= | ||
# Redis connection URL for caching and message broker | ||
REDIS_URL=redis://redis:6379/0 | ||
|
||
# ============================================================================= | ||
# DJANGO CONFIGURATION | ||
# ============================================================================= | ||
# Core Django settings | ||
DJANGO_ADMIN_URL=admin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# PostgreSQL | ||
# ------------------------------------------------------------------------------ | ||
POSTGRES_HOST=postgres | ||
POSTGRES_PORT=5432 | ||
POSTGRES_DB=telelog | ||
POSTGRES_USER=telelog_user | ||
POSTGRES_PASSWORD=qwe123 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# Config for Dependabot updates. See Documentation here: | ||
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file | ||
|
||
version: 2 | ||
updates: | ||
# Update GitHub actions in workflows | ||
- package-ecosystem: 'github-actions' | ||
directory: '/' | ||
# Every weekday | ||
schedule: | ||
interval: 'daily' | ||
|
||
# Enable version updates for Docker | ||
# We need to specify each Dockerfile in a separate entry because Dependabot doesn't | ||
# support wildcards or recursively checking subdirectories. Check this issue for updates: | ||
# https://github.com/dependabot/dependabot-core/issues/2178 | ||
- package-ecosystem: 'docker' | ||
# Look for a `Dockerfile` in the `compose/local/django` directory | ||
directory: 'compose/local/django/' | ||
# Every weekday | ||
schedule: | ||
interval: 'daily' | ||
# Ignore minor version updates (3.10 -> 3.11) but update patch versions | ||
ignore: | ||
- dependency-name: '*' | ||
update-types: | ||
- 'version-update:semver-major' | ||
- 'version-update:semver-minor' | ||
|
||
- package-ecosystem: 'docker' | ||
# Look for a `Dockerfile` in the `compose/local/node` directory | ||
directory: 'compose/local/node/' | ||
# Every weekday | ||
schedule: | ||
interval: 'daily' | ||
|
||
- package-ecosystem: 'docker' | ||
# Look for a `Dockerfile` in the `compose/production/aws` directory | ||
directory: 'compose/production/aws/' | ||
# Every weekday | ||
schedule: | ||
interval: 'daily' | ||
|
||
- package-ecosystem: 'docker' | ||
# Look for a `Dockerfile` in the `compose/production/django` directory | ||
directory: 'compose/production/django/' | ||
# Every weekday | ||
schedule: | ||
interval: 'daily' | ||
# Ignore minor version updates (3.10 -> 3.11) but update patch versions | ||
ignore: | ||
- dependency-name: '*' | ||
update-types: | ||
- 'version-update:semver-major' | ||
- 'version-update:semver-minor' | ||
|
||
- package-ecosystem: 'docker' | ||
# Look for a `Dockerfile` in the `compose/production/postgres` directory | ||
directory: 'compose/production/postgres/' | ||
# Every weekday | ||
schedule: | ||
interval: 'daily' | ||
|
||
- package-ecosystem: 'docker' | ||
# Look for a `Dockerfile` in the `compose/production/traefik` directory | ||
directory: 'compose/production/traefik/' | ||
# Every weekday | ||
schedule: | ||
interval: 'daily' | ||
|
||
- package-ecosystem: 'docker' | ||
# Look for a `Dockerfile` in the `compose/production/nginx` directory | ||
directory: 'compose/production/nginx/' | ||
# Every weekday | ||
schedule: | ||
interval: 'daily' | ||
|
||
# Enable version updates for Python/Pip - Production | ||
- package-ecosystem: 'pip' | ||
# Look for a `requirements.txt` in the `root` directory | ||
# also 'setup.cfg', 'runtime.txt' and 'requirements/*.txt' | ||
directory: '/' | ||
# Every weekday | ||
schedule: | ||
interval: 'daily' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: CI | ||
|
||
# Enable Buildkit and let compose use it to speed up image building | ||
env: | ||
DOCKER_BUILDKIT: 1 | ||
COMPOSE_DOCKER_CLI_BUILD: 1 | ||
|
||
on: | ||
pull_request: | ||
branches: [ 'master', 'main' ] | ||
paths-ignore: [ 'docs/**' ] | ||
|
||
push: | ||
branches: [ 'master', 'main' ] | ||
paths-ignore: [ 'docs/**' ] | ||
|
||
concurrency: | ||
group: ${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
linter: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12' | ||
- name: Run pre-commit | ||
uses: pre-commit/action@v3.0.1 | ||
|
||
# With no caching at all the entire ci process takes 3m to complete! | ||
pytest: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Code Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build the Stack | ||
run: docker compose -f docker-compose.dev.yml build django | ||
|
||
- name: Check DB Migrations | ||
run: docker compose -f docker-compose.dev.yml run --rm django python src/manage.py makemigrations --check | ||
|
||
- name: Run DB Migrations | ||
run: docker compose -f docker-compose.dev.yml run --rm django python src/manage.py migrate | ||
|
||
- name: Run Django Tests | ||
run: docker compose -f docker-compose.dev.yml run django pytest | ||
|
||
- name: Tear down the Stack | ||
run: docker compose -f docker-compose.dev.yml down |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Python | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
*.so | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# Django | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
media/ | ||
static/ | ||
|
||
# Environment | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
|
||
# IDE | ||
.idea/ | ||
.vscode/ | ||
*.swp | ||
*.swo | ||
|
||
# Docker | ||
docker-compose.override.yml | ||
|
||
# System | ||
.DS_Store | ||
Thumbs.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
exclude: '^docs/|/migrations/|devcontainer.json' | ||
default_stages: [pre-commit] | ||
|
||
default_language_version: | ||
python: python3.12 | ||
|
||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v5.0.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-json | ||
- id: check-toml | ||
- id: check-xml | ||
- id: check-yaml | ||
- id: debug-statements | ||
- id: check-builtin-literals | ||
- id: check-case-conflict | ||
- id: check-docstring-first | ||
- id: detect-private-key | ||
|
||
- repo: https://github.com/adamchainz/django-upgrade | ||
rev: '1.22.1' | ||
hooks: | ||
- id: django-upgrade | ||
args: ['--target-version', '5.1'] | ||
|
||
# Run the Ruff linter. | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.8.1 | ||
hooks: | ||
# Linter | ||
- id: ruff | ||
args: [--fix, --exit-non-zero-on-fix] | ||
# Formatter | ||
- id: ruff-format | ||
|
||
- repo: https://github.com/Riverside-Healthcare/djLint | ||
rev: v1.36.1 | ||
hooks: | ||
- id: djlint-reformat-django | ||
- id: djlint-django | ||
|
||
# sets up .pre-commit-ci.yaml to ensure pre-commit dependencies stay up to date | ||
ci: | ||
autoupdate_schedule: weekly | ||
skip: [] | ||
submodules: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# TeleLog - Telegram Authentication for Django | ||
|
||
Django application for secure authentication via Telegram bot. | ||
|
||
## Environment Setup | ||
|
||
1. Update environment files: | ||
``` | ||
.envs/ | ||
├── dev/ | ||
├──── .django # Django core settings | ||
└──── .postgres # Database configuration | ||
``` | ||
|
||
**`.django` configuration:** | ||
- `DJANGO_ADMIN_URL`: Admin panel URL | ||
- `APP_VERSION`: Application version | ||
- `REDIS_URL`: Redis connection URL | ||
|
||
**`.postgres` configuration:** | ||
- Database credentials (host, port, name) | ||
- Default user/password | ||
- Connection settings | ||
|
||
## Quick Start | ||
```bash | ||
docker compose -f docker-compose.dev.yml up -d | ||
``` | ||
|
||
## Stack | ||
- Python 3.12 | ||
- Django 5 | ||
- PostgreSQL 16 | ||
- Redis 6 | ||
|
||
## License | ||
MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
volumes: | ||
telelog_dev_postgres_data: {} | ||
telelog_dev_postgres_data_backups: {} | ||
telelog_dev_redis_data: {} | ||
|
||
services: | ||
django: &django | ||
build: | ||
context: . | ||
dockerfile: ./docker/dev/django/Dockerfile | ||
image: telelog_dev_django | ||
container_name: telelog_dev_django | ||
depends_on: | ||
- postgres | ||
- redis | ||
volumes: | ||
- .:/app:z | ||
env_file: | ||
- ./.envs/dev/.django | ||
- ./.envs/dev/.postgres | ||
ports: | ||
- '8000:8000' | ||
command: /start | ||
|
||
postgres: | ||
build: | ||
context: . | ||
dockerfile: ./docker/dev/postgres/Dockerfile | ||
image: telelog_dev_postgres | ||
container_name: telelog_dev_postgres | ||
volumes: | ||
- telelog_dev_postgres_data:/var/lib/postgresql/data | ||
- telelog_dev_postgres_data_backups:/backups | ||
env_file: | ||
- ./.envs/dev/.postgres | ||
|
||
redis: | ||
image: docker.io/redis:6 | ||
container_name: telelog_dev_redis | ||
volumes: | ||
- telelog_dev_redis_data:/data |
Oops, something went wrong.