Skip to content

Commit

Permalink
feat: update environment variable and add secret reference for deploy…
Browse files Browse the repository at this point in the history
…ment
  • Loading branch information
yupix committed Mar 18, 2024
1 parent 4af8df8 commit 3d60a8b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ npm run dev
## 本番環境

k8s内にあるpsql-configmap.yamlのpassword等を変更したうえで apply しておく必要があります

```sh
kubectl create secret generic akarinext-web-config --from-env-file=./.env
```
2 changes: 1 addition & 1 deletion app/lib/env.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const schema = z.object({
POSTGRES_USER: z.string(),
POSTGRES_PASSWORD: z.string(),
POSTGRES_DB: z.string(),
POSTGRES_HOST: z.string(),
POSTGRES_HOST: z.optional(z.string()),
POSTGRES_PORT: z.optional(z.string()),

S3_BUCKET_NAME: z.string(),
Expand Down
2 changes: 1 addition & 1 deletion drizzle.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default {
user: process.env.POSTGRES_USER,
password: process.env.POSTGRES_PASSWORD,
database: process.env.POSTGRES_DB,
host: process.env.POSTGRES_HOST ? process.env.POSTGRES_HOST : "akarinext-web-postgres.akarinext-web", // 開発環境ではホスト名を指定する
host: process.env.POSTGRES_HOST ? process.env.POSTGRES_HOST : "akarinext-web-pg-rw.akarinext-web", // 開発環境ではホスト名を指定する
port: process.env.POSTGRES_PORT ? parseInt(process.env.POSTGRES_PORT) : 5432,

}
Expand Down
3 changes: 3 additions & 0 deletions k8s/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ spec:
imagePullPolicy: Always
ports:
- containerPort: 3000
envFrom:
- secretRef:
name: akarinext-web-config
---
apiVersion: v1
kind: Service
Expand Down

0 comments on commit 3d60a8b

Please sign in to comment.