Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions .cruft.json

This file was deleted.

37 changes: 37 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Build In Base
APP_NAME=api-center
APP_DEBUG=false
APP_TIMEZONE=Asia/Shanghai
# Build In Log
APP_LOG_LEVEL=INFO
APP_LOG_ENCODING=json
APP_LOG_OUTPUT=stdout
# Build In MySQL
APP_MYSQL_USERNAME=root
APP_MYSQL_PASSWORD=
APP_MYSQL_ADDR=127.0.0.1:3306
APP_MYSQL_DATABASE=api_center
APP_MYSQL_CONNECT_ARGS=charset=utf8mb4&parseTime=True&loc=UTC
APP_MYSQL_MAX_OPEN_CONNS=100
APP_MYSQL_MAX_IDLE_CONNS=10
APP_MYSQL_CONN_MAX_LIFETIME=3600
# Build In Redis
APP_REDIS_ADDR=127.0.0.1:6379
APP_REDIS_PASSWORD=
APP_REDIS_DB=0
# Build In Trace
APP_ENABLE_TRACE=true
APP_TRACE_ENDPOINT=127.0.0.1:4317
# Api
APP_API_ADDR=0.0.0.0:8000
APP_API_COOKIE_DOMAIN=
APP_API_COOKIE_SECURE=true
APP_API_COOKIE_HTTP_ONLY=true
# Cron
APP_CRON_WORKER_CONCURRENCY=1
APP_CRON_WORKER_QUEUES={"default": 1}
APP_CRON_WORKER_SHUTDOWN_TIMEOUT=60
# App Account
APP_ACCOUNT_EMAIL_DOMAIN=example.com
APP_ACCOUNT_AUTH_TOKEN_TIMEOUT=604800
APP_ACCOUNT_AUTH_TOKEN_COOKIE_NAME=auth-token
24 changes: 0 additions & 24 deletions .flake8

This file was deleted.

32 changes: 17 additions & 15 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ name: "CodeQL"

on:
push:
branches: [ "main" ]
branches:
- "main"
pull_request:
branches: [ "main" ]
branches:
- "*"

jobs:
analyze:
Expand All @@ -18,17 +20,17 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'python' ]
language: [ 'go' ]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
- name: Checkout repository
uses: actions/checkout@v3
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
29 changes: 0 additions & 29 deletions .github/workflows/pylint.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Docker
name: Release Image

on:
push:
tags: [ '*' ]
tags:
- "*"

env:
REGISTRY: ghcr.io
Expand All @@ -28,8 +29,8 @@ jobs:
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.USER_NAME }}
password: ${{ secrets.USER_TOKEN }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
Expand All @@ -45,6 +46,7 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
- name: Sign the published Docker image
env:
TAGS: ${{ steps.meta.outputs.tags }}
Expand Down
7 changes: 0 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@
env
.env

# Trasnlation
*.mo

# Python
*.pyc
*.db

# Log
*.log
.report
Expand Down
29 changes: 0 additions & 29 deletions .pre-commit-config.yaml

This file was deleted.

38 changes: 28 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
FROM python:3.12.7-slim
# build stage
FROM golang:1.24-alpine AS builder

WORKDIR /usr/src/app
# install ca-certificates for https requests
RUN apk --no-cache add ca-certificates tzdata

COPY requirements.txt /usr/src/app/
RUN pip3 install -U pip && pip3 install -r requirements.txt
# set working directory
WORKDIR /app

COPY . /usr/src/app
# copy go mod files
COPY go.mod go.sum ./

RUN apt-get update && apt-get install -y gettext
# download dependencies
RUN go mod download

RUN cp env.example .env \
&& python3 manage.py compilemessages -l zh_Hans \
&& rm -rf .env
# copy source code
COPY . .

RUN mkdir -p /usr/src/app/celery-logs /usr/src/app/logs /usr/src/app/daphne-logs
# build the application
RUN CGO_ENABLED=0 go build -a -installsuffix cgo -o api-center .

# final stage
FROM alpine:latest

# install ca-certificates for https requests
RUN apk --no-cache add ca-certificates tzdata

WORKDIR /app

# copy the binary from builder stage
COPY --from=builder /app/api-center .

# copy locales directory for i18n support
COPY --from=builder /app/locales ./locales
15 changes: 7 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
pylint:
scripts/pylint.sh
swagger:
scripts/swagger.sh

pre-commit:
scripts/pre-commit.sh
tidy:
scripts/tidy.sh

lint: pre-commit pylint

messages:
scripts/messages.sh
lint:
scripts/tidy.sh
scripts/swagger.sh
Empty file removed apps/__init__.py
Empty file.
Empty file removed apps/account/__init__.py
Empty file.
45 changes: 0 additions & 45 deletions apps/account/admin.py

This file was deleted.

12 changes: 0 additions & 12 deletions apps/account/apps.py

This file was deleted.

41 changes: 0 additions & 41 deletions apps/account/constants.py

This file was deleted.

Loading
Loading