Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rasulkireev committed Oct 30, 2024
0 parents commit 412791a
Show file tree
Hide file tree
Showing 89 changed files with 18,937 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"presets": [
[
"@babel/preset-env",
{
"useBuiltIns": "usage",
"corejs": "3.0.0"
}
]
],
"plugins": [
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-proposal-class-properties"
]
}
11 changes: 11 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[production staging]
>5%
last 2 versions
not ie > 0
not ie_mob > 0
Firefox ESR

[development]
last 1 chrome version
last 1 firefox version
last 1 edge version
18 changes: 18 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"parser": "@babel/eslint-parser",
"extends": [
"eslint:recommended"
],
"env": {
"browser": true,
"node": true
},
"parserOptions": {
"ecmaVersion": 8,
"sourceType": "module",
"requireConfigFile": false
},
"rules": {
"semi": 2
}
}
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[flake8]
max-line-length=120
43 changes: 43 additions & 0 deletions .github/workflows/deploy-workers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Deploy Prod Workers

on:
push:
branches:
- main

env:
PROJECT_NAME: seo_blog_bot

jobs:
build-and-deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
file: deployment/Dockerfile.workers
tags: ghcr.io/${{ github.repository }}-workers

- name: Deploy to CapRover
uses: caprover/deploy-from-github@main
with:
server: ${{ secrets.CAPROVER_SERVER }}
app: ${{ env.PROJECT_NAME }}-workers
token: ${{ secrets.WORKERS_APP_TOKEN }}
image: ghcr.io/${{ github.repository }}-workers
43 changes: 43 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Deploy Prod Server

on:
push:
branches:
- main

env:
PROJECT_NAME: seo_blog_bot

jobs:
build-and-deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
file: deployment/Dockerfile.server
tags: ghcr.io/${{ github.repository }}

- name: Deploy to CapRover
uses: caprover/deploy-from-github@main
with:
server: ${{ secrets.CAPROVER_SERVER }}
app: ${{ env.PROJECT_NAME }}
token: ${{ secrets.APP_TOKEN }}
image: ghcr.io/${{ github.repository }}
140 changes: 140 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# DB
backup-dbs/
media/
*.sqlite3

# Javascript
node_modules/
bundles/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
static/
assets/css/main.css
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
db.sqlite3
db.sqlite3-journal
db.sqlite3.backup
db.sqlite3.backup.old

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# celery beat schedul
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# Other
.DS_Store
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lts/gallium
40 changes: 40 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
exclude: .*migrations\/.*
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/psf/black
rev: 22.12.0
hooks:
- id: black
language_version: python3.9

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.1.14'
hooks:
- id: ruff

- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python)

- repo: https://github.com/djlint/djLint
rev: v1.35.2
hooks:
- id: djlint-django

- repo: https://github.com/python-poetry/poetry
rev: '1.4.1'
hooks:
- id: poetry-export
args: [
"-f", "requirements.txt",
"-o", "requirements.txt",
"--without-hashes"
]
8 changes: 8 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "stylelint-config-standard-scss",
"rules": {
"at-rule-no-unknown": null,
"scss/at-rule-no-unknown": true,
"scss/at-import-partial-extension": null
}
}
14 changes: 14 additions & 0 deletions .vscode/terminals.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"autorun": false,
"terminals": [
{
"name": "Backend",
"focus": true,
"command": "poetry run python manage.py runserver"
},
{
"name": "Frontend",
"command": "pnpm run start"
}
]
}
8 changes: 8 additions & 0 deletions Dockerfile-python
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM python:3.11

WORKDIR /app

COPY requirements.txt .
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt

COPY . .
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
serve:
docker-compose up -d --build
docker compose logs -f backend

shell:
docker compose run --rm backend python ./manage.py shell_plus --ipython

test:
docker compose run --rm backend pytest

test-webhook:
docker compose run --rm stripe trigger customer.subscription.created

stripe-sync:
docker compose run --rm backend python ./manage.py djstripe_sync_models Product Price

Loading

0 comments on commit 412791a

Please sign in to comment.