Skip to content

Commit c37960a

Browse files
authored
Merge pull request #37 from gregPerlinLi/dev
Enhancements to Routing, Exception Handling, and Build Configuration
2 parents 260f9b1 + 3c103ee commit c37960a

File tree

31 files changed

+1119
-103
lines changed

31 files changed

+1119
-103
lines changed

.github/workflows/backend-ci.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
7878
# 登录到 GitHub Container Registry
7979
- name: Log in to GitHub Container Registry
80-
uses: docker/login-action@v2
80+
uses: docker/login-action@v3
8181
with:
8282
registry: ${{ env.REGISTRY }}
8383
username: ${{ github.actor }}
@@ -131,11 +131,11 @@ jobs:
131131
132132
# 检出当前代码库
133133
- name: Checkout code
134-
uses: actions/checkout@v3
134+
uses: actions/checkout@v4
135135

136136
# 检出目标仓库代码
137137
- name: Checkout target repository
138-
uses: actions/checkout@v3
138+
uses: actions/checkout@v4
139139
with:
140140
repository: gregPerlinLi/certvault-charts
141141
token: ${{ secrets.CERT_VAULT_CHARTS_TOKEN }}

.github/workflows/release-ci.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ jobs:
8181
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ env.PR_NUMBER }}" | jq '.body')
8282
formatted_comments=$(echo -e $comments | sed 's/^"//; s/"$//')
8383
echo -e $formatted_comments > comments.md
84+
sed -i 's/Pull Request/Release/g' comments.md
85+
sed -i 's/pull request/release/g' comments.md
8486
cat comments.md
8587
8688
- name: Create and Upload Release

application.yml.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ spring:
1010
data:
1111
redis:
1212
host: 127.0.0.1
13-
port: 5432
13+
port: 6379
1414
database: 8
1515
password: changeme
1616
sql:

certvault.service

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[Unit]
2+
Description=CertVault Certificate Management Service
3+
After=network.target
4+
[Service]
5+
User=root
6+
WorkingDirectory=/etc/certvault
7+
ExecStart=/usr/bin/java -jar /etc/certvault/certvault.jar \
8+
-Xmx512m \
9+
-Xms256m \
10+
-XX:+UseZGC \
11+
-XX:ZCollectionInterval=120 \
12+
-XX:ZAllocationSpikeTolerance=4 \
13+
-XX:-ZProactive \
14+
-XX:+HeapDumpOnOutOfMemoryError \
15+
-XX:HeapDumpPath=./errorDump.hprof \
16+
--spring.profiles.active=prod
17+
SuccessExitStatus=143
18+
Restart=always
19+
RestartSec=30
20+
[Install]
21+
WantedBy=multi-user.target

docs/Deployment.md

Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
# Deployment Guide
2+
3+
> **[中文](Deployment_CN.md) | English**
4+
5+
---
6+
7+
## 1. JAR Package Deployment (Java Native)
8+
9+
### Prerequisites
10+
11+
- Java 17 JDK
12+
- MySQL/PostgreSQL database
13+
- Redis server
14+
- GeoLite2-City.mmdb (MaxMind database for IP geolocation)
15+
16+
### Steps
17+
18+
#### 1. Download release JAR from GitHub
19+
20+
[CertVault Release](https://github.com/gregPerlinLi/CertVault/releases)
21+
22+
#### 2. Prepare configuration files
23+
24+
```bash
25+
wget https://raw.githubusercontent.com/gregPerlinLi/CertVault/main/application.yml.example
26+
cp application.yml.example application.yml
27+
nano application.yml # Configure database/redis settings
28+
```
29+
30+
#### 3. Deploy as systemd service (Linux)
31+
32+
```bash
33+
wget https://raw.githubusercontent.com/gregPerlinLi/CertVault/main/certvault.service
34+
nano certvault.service # Set service name and other parameters
35+
sudo cp certvault.service /etc/systemd/system/
36+
sudo systemctl --daemon-reload
37+
sudo systemctl enable --now certvault
38+
```
39+
40+
#### 4. Verify deployment
41+
42+
```bash
43+
curl -I http://localhost:1888/api/v1/
44+
```
45+
46+
### Configuration Parameters
47+
48+
```yaml
49+
spring:
50+
datasource:
51+
url: jdbc:postgresql://127.0.0.1:5432/cert_vault?sslmode=disable
52+
username: root
53+
password: changeme
54+
data:
55+
redis:
56+
host: 127.0.0.1
57+
port: 6379
58+
password: changeme
59+
sql:
60+
init:
61+
platform: postgresql
62+
```
63+
---
64+
65+
## 2. Docker Deployment
66+
67+
### Options
68+
69+
- MySQL + Redis: `docker-compose-with-mysql-redis.yml`
70+
- PostgreSQL + Redis: `docker-compose-with-postgres-redis.yml`
71+
- External DB + Redis: Use `docker-compose-with-redis-external-*.yml` variants
72+
- Internal DB + Redis: Use `docker-compose-with-*-external-redis.yml` variants
73+
- External DB & Redis: Use `docker-compose-with-external-*-redis.yml` variants
74+
75+
### Steps (Example with Internal PostgreSQL & Redis)
76+
77+
#### 1. Clone repository
78+
79+
```bash
80+
git clone https://github.com/gregPerlinLi/CertVault.git
81+
cd CertVault/docker-compose
82+
```
83+
84+
#### 2. Prepare configuration
85+
86+
```bash
87+
nano .env # Set variables
88+
nano application.yml # Configure detailed settings
89+
```
90+
91+
#### 3. Deploy
92+
93+
```bash
94+
docker-compose -f docker-compose-with-postgres-redis.yml up -d
95+
```
96+
97+
#### 4. Verify
98+
99+
```bash
100+
docker ps | grep cert-vault
101+
curl -I http://localhost:1888/api/v1/
102+
```
103+
### Key Configuration Files
104+
- `docker-compose-with-postgres-redis.yml` (default)
105+
- `GeoLite2-City.mmdb` (required for IP geolocation)
106+
- `application.yml` (other detailed configuration, like OIDC)
107+
108+
---
109+
110+
## 3. Helm Chart Deployment (Kubernetes)
111+
112+
### Prerequisites
113+
114+
- Kubernetes 1.20+
115+
- Helm 3.0+
116+
- Persistent Volume support
117+
118+
### Steps
119+
120+
#### 1. Add chart repository
121+
122+
```bash
123+
helm repo add certvault https://gregperlinli.github.io/certvault-charts
124+
```
125+
126+
#### 2. Pull chart
127+
128+
```bash
129+
helm pull certvault/certvault --untar
130+
```
131+
132+
#### 3. Edit configuration
133+
134+
```bash
135+
cd certvault
136+
nano values.yaml
137+
```
138+
139+
#### 4. Deploy
140+
141+
```bash
142+
helm --namespace certvault \
143+
--create-namespace \
144+
upgrade --install \
145+
certvault .
146+
```
147+
148+
#### 5. Verify
149+
150+
```bash
151+
curl -I http://svc-ip:1888/api/v1/
152+
```
153+
154+
### Configuration Options
155+
156+
---
157+
158+
## 4. Source Code Deployment
159+
160+
### Prerequisites
161+
162+
- JDK 17
163+
- Node.js 18+
164+
- Maven 3.8+
165+
- NPM & PNPM package manager
166+
167+
### Steps
168+
169+
#### 1. Clone repository
170+
```bash
171+
git clone https://github.com/gregPerlinLi/CertVault.git
172+
cd CertVault
173+
```
174+
175+
#### 2. Build project
176+
177+
```bash
178+
make
179+
```
180+
181+
#### 3. Deploy
182+
183+
```bash
184+
make install
185+
```
186+
187+
---
188+
189+
## Common Configuration Environment Parameters
190+
191+
| Parameter | Description | Example |
192+
|--------------------------|----------------------------------|----------------------------------------------------------------------------|
193+
| `DATABASE_TYPE` | Database type (mysql/postgresql) | `DATABASE_TYPE=postgresql` |
194+
| `DATABASE_URL` | Database connection URL | `DATABASE_URL=jdbc:postgresql://127.0.0.1:5432/cert_vault?sslmode=disable` |
195+
| `SUPERADMIN_PASSWORD` | Initial super admin password | `SUPERADMIN_PASSWORD=admin123` |
196+
| `SPRING_PROFILES_ACTIVE` | Activate environment profile | `prod`/`dev` |
197+
| `SPRING_SERVER_PORT` | Exposed service port | `SPRING_SERVER_PORT=1888` |
198+
199+
## Verification
200+
201+
After deployment, access:
202+
- UI: `http://<host>:1888`
203+
- Health check: `http://<host>:1999/actuator/health`
204+
- Swagger API docs: `http://<host>:1888/developer-api`
205+
206+
## Troubleshooting
207+
208+
- Database connection issues: Check environment variables and `application.yml` settings
209+
- Docker issues: Check docker compose file and `application.yml` settings
210+
- Helm issues: Run `helm -n cert-vault ls` to verify release status
211+
- How to retrieve the logs:
212+
- For JAR package and Source Code deployment: `journalctl -xeu certvault.service -f`
213+
- For Docker deployment: `docker-compose logs -f`
214+
- For Helm deployment: `kubectl -n cert-vault logs -f deployments/cert-vault`

0 commit comments

Comments
 (0)