Compare commits
13 Commits
v1.0
...
758808e4d0
| Author | SHA1 | Date | |
|---|---|---|---|
| 758808e4d0 | |||
| 30d7fd881e | |||
| 9935adbcbd | |||
| 4f5737d27e | |||
| 3492d5bdc8 | |||
| f5ed9a77c3 | |||
| fd896eb380 | |||
| 93077eb39c | |||
| 56af2f25f6 | |||
| f155ff88c8 | |||
| d29b8df9e3 | |||
| ad7d846604 | |||
| 15804a5605 |
+119
-114
@@ -1,47 +1,47 @@
|
|||||||
kind: pipeline
|
# kind: pipeline
|
||||||
type: docker
|
# type: docker
|
||||||
name: server_build_and_test
|
# name: server_build_and_test
|
||||||
|
#
|
||||||
trigger:
|
# trigger:
|
||||||
branch:
|
# branch:
|
||||||
- main
|
# - main
|
||||||
event:
|
# event:
|
||||||
- push
|
# - push
|
||||||
|
#
|
||||||
steps:
|
# steps:
|
||||||
- name: build_server
|
# - name: build_server
|
||||||
image: node
|
# image: node
|
||||||
commands:
|
# commands:
|
||||||
- npm ci -w @calchat/shared
|
# - npm ci -w @calchat/shared
|
||||||
- npm ci -w @calchat/server
|
# - npm ci -w @calchat/server
|
||||||
- npm run build -w @calchat/server
|
# - npm run build -w @calchat/server
|
||||||
|
#
|
||||||
- name: jest_server
|
# - name: jest_server
|
||||||
image: node
|
# image: node
|
||||||
commands:
|
# commands:
|
||||||
- npm run test -w @calchat/server
|
# - npm run test -w @calchat/server
|
||||||
|
#
|
||||||
---
|
# ---
|
||||||
|
#
|
||||||
kind: pipeline
|
# kind: pipeline
|
||||||
type: docker
|
# type: docker
|
||||||
name: check_for_formatting
|
# name: check_for_formatting
|
||||||
|
#
|
||||||
trigger:
|
# trigger:
|
||||||
branch:
|
# branch:
|
||||||
- main
|
# - main
|
||||||
event:
|
# event:
|
||||||
- push
|
# - push
|
||||||
|
#
|
||||||
steps:
|
# steps:
|
||||||
- name: format_check
|
# - name: format_check
|
||||||
image: node
|
# image: node
|
||||||
commands:
|
# commands:
|
||||||
- npm ci
|
# - npm ci
|
||||||
- npm run check_format
|
# - npm run check_format
|
||||||
|
#
|
||||||
---
|
# ---
|
||||||
|
#
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: deploy_latest
|
name: deploy_latest
|
||||||
@@ -53,40 +53,63 @@ trigger:
|
|||||||
- push
|
- push
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: upload_latest
|
# - name: upload_latest
|
||||||
image: plugins/docker
|
# image: plugins/docker
|
||||||
settings:
|
# settings:
|
||||||
registry: gitea.gilmour109.de
|
# registry: gitea.gilmour109.de
|
||||||
repo: gitea.gilmour109.de/gilmour109/calchat-server
|
# repo: gitea.gilmour109.de/gilmour109/calchat-server
|
||||||
dockerfile: apps/server/docker/Dockerfile
|
# dockerfile: apps/server/docker/Dockerfile
|
||||||
tags:
|
# tags:
|
||||||
- latest
|
# - latest
|
||||||
username:
|
# username:
|
||||||
from_secret: gitea_username
|
# from_secret: gitea_username
|
||||||
password:
|
# password:
|
||||||
from_secret: gitea_password
|
# from_secret: gitea_password
|
||||||
|
#
|
||||||
|
# - name: deploy_to_vps
|
||||||
|
# image: appleboy/drone-ssh
|
||||||
|
# settings:
|
||||||
|
# host:
|
||||||
|
# - 10.0.0.1
|
||||||
|
# username: root
|
||||||
|
# password:
|
||||||
|
# from_secret: vps_ssh_password
|
||||||
|
# envs:
|
||||||
|
# - gitea_username
|
||||||
|
# - gitea_password
|
||||||
|
# port: 22
|
||||||
|
# command_timeout: 10m
|
||||||
|
# script:
|
||||||
|
# - docker login -u $GITEA_USERNAME -p $GITEA_PASSWORD gitea.gilmour109.de
|
||||||
|
# - docker pull gitea.gilmour109.de/gilmour109/calchat-server:latest
|
||||||
|
# - docker compose -f /root/calchat-mongo/docker-compose.yml up -d
|
||||||
|
|
||||||
- name: deploy_to_vps
|
- name: build_apk
|
||||||
image: appleboy/drone-ssh
|
image: gitea.gilmour109.de/gilmour109/eas-build:latest
|
||||||
settings:
|
environment:
|
||||||
host:
|
EXPO_TOKEN:
|
||||||
- 10.0.0.1
|
from_secret: expo_token
|
||||||
username: root
|
commands:
|
||||||
password:
|
- npm ci
|
||||||
from_secret: vps_ssh_password
|
- npm run build -w @calchat/shared
|
||||||
envs:
|
- npm run -w @calchat/client build:apk
|
||||||
- gitea_username
|
|
||||||
- gitea_password
|
|
||||||
port: 22
|
|
||||||
command_timeout: 2m
|
|
||||||
script:
|
|
||||||
- docker login -u $GITEA_USERNAME -p $GITEA_PASSWORD gitea.gilmour109.de
|
|
||||||
- docker pull gitea.gilmour109.de/gilmour109/calchat-server:latest
|
|
||||||
- docker compose -f /root/calchat-mongo/docker-compose.yml up -d
|
|
||||||
|
|
||||||
depends_on:
|
- name: upload_apk
|
||||||
- server_build_and_test
|
image: plugins/s3
|
||||||
- check_for_formatting
|
settings:
|
||||||
|
endpoint: https://garage.gilmour109.de
|
||||||
|
bucket: calchat-releases
|
||||||
|
access_key:
|
||||||
|
from_secret: calchat_drone_garage_access_key
|
||||||
|
secret_key:
|
||||||
|
from_secret: calchat_drone_garage_secret_key
|
||||||
|
source: calchat.apk
|
||||||
|
target: /
|
||||||
|
path_style: true
|
||||||
|
|
||||||
|
# depends_on:
|
||||||
|
# - server_build_and_test
|
||||||
|
# - check_for_formatting
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -122,50 +145,32 @@ steps:
|
|||||||
from_secret: k3s_ssh_password
|
from_secret: k3s_ssh_password
|
||||||
envs:
|
envs:
|
||||||
- drone_tag
|
- drone_tag
|
||||||
|
- drone_commit_sha
|
||||||
port: 22
|
port: 22
|
||||||
command_timeout: 2m
|
command_timeout: 10m
|
||||||
script:
|
script:
|
||||||
- export TAG=$DRONE_TAG
|
- export TAG=$DRONE_TAG
|
||||||
- export NAME=$(echo $DRONE_TAG | tr -d '.')
|
- export NAME=$(echo $DRONE_TAG | tr -d '.')
|
||||||
|
- export COMMIT=$DRONE_COMMIT_SHA
|
||||||
- envsubst < /home/debian/manifest.yml | sudo kubectl apply -f -
|
- envsubst < /home/debian/manifest.yml | sudo kubectl apply -f -
|
||||||
|
|
||||||
---
|
- name: build_apk
|
||||||
|
image: gitea.gilmour109.de/gilmour109/eas-build:latest
|
||||||
|
environment:
|
||||||
|
EXPO_TOKEN:
|
||||||
|
from_secret: expo_token
|
||||||
|
commands:
|
||||||
|
- npm ci
|
||||||
|
- npm run build -w @calchat/shared
|
||||||
|
- npm run -w @calchat/client build:apk
|
||||||
|
|
||||||
kind: pipeline
|
- name: release_apk
|
||||||
type: docker
|
image: plugins/gitea-release
|
||||||
name: upload_commit
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
event:
|
|
||||||
- promote
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: upload_commit
|
|
||||||
image: plugins/docker
|
|
||||||
settings:
|
settings:
|
||||||
registry: gitea.gilmour109.de
|
api_key:
|
||||||
repo: gitea.gilmour109.de/gilmour109/calchat-server
|
from_secret: gitea_token
|
||||||
dockerfile: apps/server/docker/Dockerfile
|
base_url: https://gitea.gilmour109.de
|
||||||
tags:
|
files:
|
||||||
- ${DRONE_COMMIT_SHA:0:8}
|
- calchat.apk
|
||||||
username:
|
title: ${DRONE_TAG}
|
||||||
from_secret: gitea_username
|
|
||||||
password:
|
|
||||||
from_secret: gitea_password
|
|
||||||
|
|
||||||
- name: deploy_to_k3s
|
|
||||||
image: appleboy/drone-ssh
|
|
||||||
settings:
|
|
||||||
host:
|
|
||||||
- 192.168.178.201
|
|
||||||
username: debian
|
|
||||||
password:
|
|
||||||
from_secret: k3s_ssh_password
|
|
||||||
envs:
|
|
||||||
- drone_commit_sha
|
|
||||||
port: 22
|
|
||||||
command_timeout: 2m
|
|
||||||
script:
|
|
||||||
- export TAG=$(echo $DRONE_COMMIT_SHA | cut -c1-8)
|
|
||||||
- export NAME=$TAG
|
|
||||||
- envsubst < /home/debian/manifest.yml | sudo kubectl apply -f -
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ npm run test -w @calchat/server # Run Jest unit tests
|
|||||||
| | ical.js | iCalendar parsing/generation |
|
| | ical.js | iCalendar parsing/generation |
|
||||||
| Testing | Jest / ts-jest | Server unit tests |
|
| Testing | Jest / ts-jest | Server unit tests |
|
||||||
| Deployment | Docker | Server containerization (multi-stage build) |
|
| Deployment | Docker | Server containerization (multi-stage build) |
|
||||||
| | Drone CI | CI/CD pipelines (build, test, format check, deploy) |
|
| | Drone CI | CI/CD pipelines (build, test, format check, deploy, APK build + Gitea release) |
|
||||||
| Planned | iCalendar | Event export/import |
|
| Planned | iCalendar | Event export/import |
|
||||||
|
|
||||||
## Architecture
|
## Architecture
|
||||||
@@ -684,8 +684,9 @@ This uses the `preview` profile from `eas.json` which builds an APK with:
|
|||||||
- `arm64-v8a` architecture only (smaller APK size)
|
- `arm64-v8a` architecture only (smaller APK size)
|
||||||
- No credentials required (`withoutCredentials: true`)
|
- No credentials required (`withoutCredentials: true`)
|
||||||
- Internal distribution
|
- Internal distribution
|
||||||
|
- Non-interactive mode with fixed output path (`calchat.apk`) for CI compatibility
|
||||||
|
|
||||||
**Requirements:** Android SDK and Java must be installed locally.
|
**Requirements:** Android SDK and Java must be installed locally. In CI, the `eas-build` Docker image (`gitea.gilmour109.de/gilmour109/eas-build:latest`) provides the build environment with `EXPO_TOKEN` for authentication.
|
||||||
|
|
||||||
**EAS Configuration:** `apps/client/eas.json` contains build profiles:
|
**EAS Configuration:** `apps/client/eas.json` contains build profiles:
|
||||||
- `development`: Development client with internal distribution
|
- `development`: Development client with internal distribution
|
||||||
@@ -703,13 +704,13 @@ The project uses Drone CI (`.drone.yml`) with five pipelines:
|
|||||||
**On push to main:**
|
**On push to main:**
|
||||||
1. **`server_build_and_test`**: Builds the server (`npm ci` + `npm run build`) and runs Jest tests (`npm run test`)
|
1. **`server_build_and_test`**: Builds the server (`npm ci` + `npm run build`) and runs Jest tests (`npm run test`)
|
||||||
2. **`check_for_formatting`**: Checks Prettier formatting across all workspaces (`npm run check_format`)
|
2. **`check_for_formatting`**: Checks Prettier formatting across all workspaces (`npm run check_format`)
|
||||||
3. **`deploy_latest`**: Builds Docker image, pushes to Gitea Container Registry (`gitea.gilmour109.de/gilmour109/calchat-server:latest`), then SSHs into VPS (`10.0.0.1`) to pull and restart via `docker compose`. Depends on both pipelines above passing first.
|
3. **`deploy_latest`**: Builds Docker image, pushes to Gitea Container Registry (`gitea.gilmour109.de/gilmour109/calchat-server:latest`), then SSHs into VPS (`10.0.0.1`) to pull and restart via `docker compose`. Builds APK via `eas-build` Docker image and creates a Gitea release (title "latest") with the APK. Depends on both pipelines above passing first.
|
||||||
|
|
||||||
**On tag:**
|
**On tag:**
|
||||||
4. **`upload_tag`**: Builds Docker image tagged with the git tag (`${DRONE_TAG}`), pushes to registry, then deploys to k3s cluster (`192.168.178.201`) via SSH using `envsubst` with a Kubernetes manifest template.
|
4. **`upload_tag`**: Builds Docker image tagged with the git tag (`${DRONE_TAG}`), pushes to registry, then deploys to k3s cluster (`192.168.178.201`) via SSH using `envsubst` with a Kubernetes manifest template. Builds APK and creates a Gitea release tagged with `${DRONE_TAG}`.
|
||||||
|
|
||||||
**On promote:**
|
**On promote:**
|
||||||
5. **`upload_commit`**: Builds Docker image tagged with short commit SHA (first 8 chars), pushes to registry, then deploys to k3s cluster (`192.168.178.201`) via SSH using `envsubst` with a Kubernetes manifest template.
|
5. **`upload_commit`**: Builds Docker image tagged with short commit SHA (first 8 chars), pushes to registry, then deploys to k3s cluster (`192.168.178.201`) via SSH using `envsubst` with a Kubernetes manifest template. Builds APK and creates a Gitea release tagged with the short commit SHA.
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -9,7 +9,7 @@
|
|||||||
"ios": "expo start --ios",
|
"ios": "expo start --ios",
|
||||||
"web": "expo start --web",
|
"web": "expo start --web",
|
||||||
"lint": "expo lint",
|
"lint": "expo lint",
|
||||||
"build:apk": "eas build --platform android --profile preview --local"
|
"build:apk": "eas build --platform android --profile preview --local --non-interactive --output ./calchat.apk"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@calchat/shared": "*",
|
"@calchat/shared": "*",
|
||||||
|
|||||||
@@ -87,6 +87,14 @@ app.get("/health", (_, res) => {
|
|||||||
res.json({ status: "ok" });
|
res.json({ status: "ok" });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Version endpoint
|
||||||
|
app.get("/version", (_, res) => {
|
||||||
|
res.json({
|
||||||
|
version: process.env.VERSION || "unknown",
|
||||||
|
commit: process.env.COMMIT || "unknown",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// AI Test endpoint (for development only)
|
// AI Test endpoint (for development only)
|
||||||
app.post("/api/ai/test", async (req, res) => {
|
app.post("/api/ai/test", async (req, res) => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -9,7 +9,8 @@
|
|||||||
"./*": "./dist/*"
|
"./*": "./dist/*"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc"
|
"build": "tsc",
|
||||||
|
"prepare": "tsc"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"rrule": "^2.8.1"
|
"rrule": "^2.8.1"
|
||||||
|
|||||||
Reference in New Issue
Block a user