Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
ukwhatn committed Apr 22, 2024
0 parents commit 572e24a
Show file tree
Hide file tree
Showing 82 changed files with 4,926 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.idea
.venv
.git
node_modules
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
106 changes: 106 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
target-branch: "develop"
commit-message:
prefix: "chore(deps:github-actions)"
labels:
- "dependencies"
- "automated pr"
assignees:
- "ukwhatn"
reviewers:
- "ukwhatn"

- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
target-branch: "develop"
commit-message:
prefix: "chore(deps:pip)"
labels:
- "dependencies"
- "automated pr"
assignees:
- "ukwhatn"
reviewers:
- "ukwhatn"

- package-ecosystem: "npm"
directory: "/front"
schedule:
interval: "daily"
target-branch: "develop"
commit-message:
prefix: "chore(deps:npm)"
labels:
- "dependencies"
- "automated pr"
assignees:
- "ukwhatn"
reviewers:
- "ukwhatn"

- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "daily"
target-branch: "develop"
commit-message:
prefix: "chore(deps:docker)"
labels:
- "dependencies"
- "automated pr"
assignees:
- "ukwhatn"
reviewers:
- "ukwhatn"

- package-ecosystem: "docker"
directory: "/db"
schedule:
interval: "daily"
target-branch: "develop"
commit-message:
prefix: "chore(deps:dockerfile-server)"
labels:
- "dependencies"
- "automated pr"
assignees:
- "ukwhatn"
reviewers:
- "ukwhatn"

- package-ecosystem: "docker"
directory: "/discord"
schedule:
interval: "daily"
target-branch: "develop"
commit-message:
prefix: "chore(deps:dockerfile-server)"
labels:
- "dependencies"
- "automated pr"
assignees:
- "ukwhatn"
reviewers:
- "ukwhatn"

- package-ecosystem: "docker"
directory: "/server"
schedule:
interval: "daily"
target-branch: "develop"
commit-message:
prefix: "chore(deps:dockerfile-bot)"
labels:
- "dependencies"
- "automated pr"
assignees:
- "ukwhatn"
reviewers:
- "ukwhatn"
21 changes: 21 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#file: noinspection YAMLSchemaValidation
name: CD
on:
push:
branches: [ change_this_value_to_main ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy
uses: appleboy/ssh-action@master
with:
key: ${{secrets.SSH_PRIVATE_KEY}}
host: ${{secrets.SSH_HOST}}
username: ${{secrets.SSH_USER}}
port: ${{secrets.SSH_PORT}}
script: |
cd ${{github.event.repository.name}}
git pull origin main
make deploy:prod ENV=prod
165 changes: 165 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
.DS_Store

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

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
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/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .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

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

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

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

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

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
nginx/log/*
!nginx/log/.keep
84 changes: 84 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
ENV ?= "dev"
POETRY_GROUPS = "server,discord,db,dev"

ifeq ($(ENV), prod)
COMPOSE_YML := compose.prod.yml
else
COMPOSE_YML := compose.dev.yml
endif

build:
docker compose -f $(COMPOSE_YML) build

build\:no-cache:
docker compose -f $(COMPOSE_YML) build --no-cache

up:
docker compose -f $(COMPOSE_YML) up --build -d

down:
docker compose -f $(COMPOSE_YML) down

reload:
docker compose -f $(COMPOSE_YML) build
docker compose -f $(COMPOSE_YML) down
docker compose -f $(COMPOSE_YML) up -d

reset:
docker compose -f $(COMPOSE_YML) down --volumes --remove-orphans

logs:
docker compose -f $(COMPOSE_YML) logs -f

ps:
docker compose -f $(COMPOSE_YML) ps

pr\:create:
git switch develop
git push
gh pr create --base main --head $(shell git branch --show-current)
gh pr view --web

deploy\:prod:
make build ENV=prod
make reload ENV=prod

poetry\:install:
pip install poetry
poetry install --with $(group)

poetry\:add:
poetry add --group=$(group) $(packages)
make poetry:lock

poetry\:lock:
poetry lock --no-update

poetry\:update:
poetry update --with $(group)

poetry\:reset:
poetry env remove $(which python)
poetry install

dev\:setup:
poetry install --with $(POETRY_GROUPS)

db\:revision\:create:
docker compose -f $(COMPOSE_YML) up --build -d db-migrator
docker compose -f $(COMPOSE_YML) exec db-migrator /bin/bash -c "alembic revision --autogenerate -m '${NAME}'"
docker compose -f $(COMPOSE_YML) down db-migrator

db\:migrate:
# db-migrator起動時に自動実行
docker compose -f $(COMPOSE_YML) down db-migrator
docker compose -f $(COMPOSE_YML) up --build -d db-migrator
docker compose -f $(COMPOSE_YML) down db-migrator

envs\:init:
cp envs/discord.env.example envs/discord.env
cp envs/db.env.example envs/db.env
cp envs/sentry.env.example envs/sentry.env
cp envs/server.env.example envs/server.env

PHONY: build up down logs ps pr\:create deploy\:prod poetry\:install poetry\:add poetry\:lock poetry\:update poetry\:reset dev\:setup db\:revision\:create db\:migrate envs\:init
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# ukwhatn's application template

Loading

0 comments on commit 572e24a

Please sign in to comment.