会計システム
++ 会計モジュールの主要画面へ移動します。仕訳入力、試算表、元帳に移動できます。 +
+ +| 科目コード | -科目名 | -期首 | -借方 | -贷方 | -期末 | -
|---|
給与システム
+給与・賞与の計算や従業員管理を行います。
+ +diff --git a/backend/Dockerfile b/backend/Dockerfile new file mode 100644 index 0000000..65e5462 --- /dev/null +++ b/backend/Dockerfile @@ -0,0 +1,17 @@ +FROM python:3.11-slim +WORKDIR /app + +# system deps (if any) can be added here +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ + && rm -rf /var/lib/apt/lists/* + +COPY backend/requirements.txt ./requirements.txt +RUN pip install --no-cache-dir -r requirements.txt + +COPY backend/ ./ + +ENV PYTHONUNBUFFERED=1 +EXPOSE 18080 + +CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "18080", "--proxy-headers"] diff --git a/backend/requirements.txt b/backend/requirements.txt index 54628d1..e55bbb5 100644 Binary files a/backend/requirements.txt and b/backend/requirements.txt differ diff --git a/deploy/README.md b/deploy/README.md new file mode 100644 index 0000000..5e9cfed --- /dev/null +++ b/deploy/README.md @@ -0,0 +1,34 @@ +# NAS Git Deploy (sample) + +This folder contains a sample `post-receive` hook for deploying the app on a NAS via a bare git repository. + +Quick setup (example): + +1. On the NAS, create directories and a bare repo: + +```bash +mkdir -p /srv/njts-accounting/repo.git +git init --bare /srv/njts-accounting/repo.git +mkdir -p /srv/njts-accounting/app +``` + +2. Copy the `post-receive` hook into the bare repo hooks and make it executable: + +```bash +cp deploy/post-receive /srv/njts-accounting/repo.git/hooks/post-receive +chmod +x /srv/njts-accounting/repo.git/hooks/post-receive +``` + +3. On your local machine, add a remote and push: + +```bash +git remote add nas ssh://user@nas:/srv/njts-accounting/repo.git +git push nas main +``` + +4. Ensure Docker and Docker Compose are installed on the NAS and `/srv/njts-accounting/docker-compose.yml` points to the code in `/srv/njts-accounting/app`. + +Notes: + +- Adjust paths and permissions according to your NAS environment. +- The sample hook runs `docker compose up -d --build` and may require the user to be in the `docker` group or run via sudo. diff --git a/deploy/post-receive b/deploy/post-receive new file mode 100644 index 0000000..387196f --- /dev/null +++ b/deploy/post-receive @@ -0,0 +1,22 @@ +#!/bin/bash +# Sample post-receive hook for bare repository deployment. +# Adjust paths and user permissions as needed. + +set -e +REPO_DIR="/srv/njts-accounting/repo.git" +WORK_TREE="/srv/njts-accounting/app" +COMPOSE_FILE="/srv/njts-accounting/docker-compose.yml" + +echo "Deploy hook triggered" +mkdir -p "$WORK_TREE" + +# checkout latest to work tree +GIT_DIR="$REPO_DIR" git --work-tree="$WORK_TREE" checkout -f + +cd "$WORK_TREE" + +echo "Building and restarting containers..." +docker compose -f "$COMPOSE_FILE" pull --ignore-pull-failures || true +docker compose -f "$COMPOSE_FILE" up -d --build --remove-orphans + +echo "Deployment finished" diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..969057c --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,32 @@ +version: "3.8" +services: + backend: + build: + context: . + dockerfile: backend/Dockerfile + container_name: njts_backend + restart: unless-stopped + env_file: + - .env + ports: + - "18080:18080" + networks: + - njts_net + + nginx: + image: nginx:stable + container_name: njts_nginx + restart: unless-stopped + ports: + - "80:80" + volumes: + - ./frontend:/usr/share/nginx/html:ro + - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro + depends_on: + - backend + networks: + - njts_net + +networks: + njts_net: + driver: bridge diff --git a/docker/nginx/default.conf b/docker/nginx/default.conf new file mode 100644 index 0000000..9089eb7 --- /dev/null +++ b/docker/nginx/default.conf @@ -0,0 +1,38 @@ +server { + listen 80; + server_name _; + + root /usr/share/nginx/html; + index index.html; + + # Serve static files + location / { + try_files $uri $uri/ =404; + } + + # Proxy API requests to backend container + location /payroll/ { + proxy_pass http://backend:18080/payroll/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + location /payroll/employees/ { + proxy_pass http://backend:18080/payroll/employees/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + # Generic fallback to backend for other API paths + location /api/ { + proxy_pass http://backend:18080/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } +} diff --git a/frontend/index.html b/frontend/index.html index 2d1c0c3..1965dfb 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -2,95 +2,94 @@
-+ 会計モジュールの主要画面へ移動します。仕訳入力、試算表、元帳に移動できます。 +
+ +| 科目コード | -科目名 | -期首 | -借方 | -贷方 | -期末 | -
|---|
給与・賞与の計算や従業員管理を行います。
+ +| 账户 | -余额 | -
|---|---|
| 读取中... | -|
| 合计 | -- | -