|
| 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