-
Notifications
You must be signed in to change notification settings - Fork 1
Add PostgreSQL resource limits and migration setup #270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
yuito-it
wants to merge
6
commits into
feat/go
Choose a base branch
from
feat/devops
base: feat/go
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7e2de57
feat: PostgreSQLのリソース制限と要求を追加
yuito-it b7cf542
fix: CPUリソースの単位を修正
yuito-it 2fd7051
feat: データベーススキーマとマイグレーションファイルを移動
yuito-it 2a60790
feat: Dockerビルドとプッシュのワークフローを追加し、DBマイグレーションジョブを設定
yuito-it 2a35d75
feat: PostgreSQLのPVC名を変更して一貫性を持たせる
yuito-it a4a5f24
Update .github/workflows/docker-tag.yaml
yuito-it File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| FROM arigaio/atlas:1.3.1-distroless AS migration-prod | ||
| WORKDIR /app | ||
| COPY ./db/migrations/ /app/migrations | ||
| COPY ./db/atlas.hcl /app/atlas.hcl | ||
| CMD ["atlas", "migrate", "apply", "--env", "prod"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| apiVersion: batch/v1 | ||
| kind: Job | ||
| metadata: | ||
| name: db-migration-job | ||
| annotations: | ||
| argocd.argoproj.io/hook: PreSync | ||
| argocd.argoproj.io/hook-delete-policy: BeforeHookCreation | ||
| argocd.argoproj.io/sync-wave: "-1" | ||
| spec: | ||
| backoffLimit: 0 | ||
| completions: 1 | ||
| parallelism: 1 | ||
| template: | ||
| spec: | ||
| restartPolicy: Never | ||
| imagePullSecrets: | ||
| - name: my-registry-secret | ||
| containers: | ||
| - name: db-migration-job | ||
| image: "registry.uniproject.jp/infra/unibot-atlas:latest" | ||
| imagePullPolicy: Always | ||
| envFrom: | ||
| - secretRef: | ||
| name: unibot-env | ||
| key: PG_DSN | ||
| imagePullSecrets: | ||
| - name: internal-harbor | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| variable "pg_dsn" { | ||
| type = string | ||
| default = getenv("PG_DSN") | ||
| } | ||
|
|
||
| env "local" { | ||
| url = getenv("PG_DSN") | ||
| dev = "docker://postgres/18/dev" | ||
| schema { | ||
| src = "file://schema" | ||
| } | ||
| migration { | ||
| dir = "file://migrations" | ||
| } | ||
| } | ||
|
|
||
| env "prod" { | ||
| url = var.pg_dsn | ||
|
|
||
| migration { | ||
| dir = "file://migrations" | ||
| } | ||
| } |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Atlas マイグレーション Job の適用・設定を修正してください。
argoCD/overlays/sub/kustomization.yamlにatlas.yamlがないため、現在db-migration-jobは適用されません。PreSyncwave-1ではなく、PostgreSQLwave 0、マイグレーション Jobwave 1、アプリケーションwave 2の順にしてください。必要に応じて PostgreSQL の readiness 待機も追加してください。envFrom.secretRef.keyは無効です。PG_DSNはenv.valueFrom.secretKeyRefでunibot-envから注入してください。imagePullSecretsは Pod template 配下のspec.template.spec.imagePullSecretsに設定してください。latestは可変タグのため、同一リビジョンの固定タグまたはイメージ digest を使用してください。📍 Affects 1 file
argoCD/overlays/sub/atlas.yaml#L1-L27(this comment)argoCD/overlays/sub/atlas.yaml#L20-L21argoCD/overlays/sub/atlas.yaml#L22-L25argoCD/overlays/sub/atlas.yaml#L5-L8🤖 Prompt for AI Agents