Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/rules/infra/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ account ID は CDK の `cdk.context.json` コミット方針で既にリポジ
| リージョン | 既定 `ap-northeast-1` |
| CDK バージョン | `aws-cdk-lib` は全プロジェクトで**同一バージョンにピン留め**(現在 `2.232.1`)。1 つだけ上げない |
| タグ | スタック全体に `Project` / `Stage` / `Service` / `ManagedBy=CDK` |
| Node Lambda ランタイム | **`NODEJS_22_X` に統一**(例外: mesh-v2 の Ruby Lambda は `RUBY_3_4`)。新しい Lambda も 22 に合わせる |
| Node Lambda ランタイム | **`NODEJS_22_X` に統一**(例外: mesh-v2 の Ruby Lambda は Ruby 4.0 = `ruby4.0`)。新しい Lambda も 22 に合わせる |
| Lambda bundling | esbuild: `minify: true`, `sourceMap: stage !== 'prod'`, `externalModules: []`(全同梱) |
| CloudWatch LogGroup | 明示生成し retention = prod `ONE_MONTH` / 他 `ONE_WEEK`、`removalPolicy: DESTROY` |
| HTTP API スロットリング | stage-level のスロットリングを必ず設定(値はプロジェクトごと。WAF は使わない) |
Expand Down
2 changes: 1 addition & 1 deletion .claude/rules/infra/smalruby-mesh-v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ AppSync JavaScript resolvers (`js/resolvers/`, `js/functions/`) handle most oper
スタック削除・差し替えでデータが消える前提。
- **認証は API_KEY のみ**(キー有効期限 365 日。期限切れは redeploy でローテート)。
ID Token / IAM 認証は使っていない。
- **Ruby Lambda** `MeshV2-GraphQL{suffix}` は `RUBY_3_4`。マルチバイト対策で
- **Ruby Lambda** `MeshV2-GraphQL{suffix}` は Ruby 4.0(`ruby4.0`)。マルチバイト対策で
`LANG` / `LC_ALL=en_US.UTF-8` を注入している(外さない)。担当フィールドは
`createDomain` / `createGroup` / `dissolveGroup` / `leaveGroup` / `recordEventsByNode`
(handler の fieldName case 分岐。エラーは rescue せず AppSync に伝播させる方針)。
Expand Down
8 changes: 4 additions & 4 deletions .vscode/cargo.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
# システム Ruby ではなく rbenv 配下の Ruby を使うために必要。
#
# 設定例:
# RUBY=/Users/<user>/.anyenv/envs/rbenv/versions/3.4.12/bin/ruby
# PATH=/Users/<user>/.anyenv/envs/rbenv/versions/3.4.12/bin:/usr/bin:/bin
# RUBY=/Users/<user>/.anyenv/envs/rbenv/versions/4.0.9/bin/ruby
# PATH=/Users/<user>/.anyenv/envs/rbenv/versions/4.0.9/bin:/usr/bin:/bin
#
# Linux + rbenv の場合:
# RUBY=/home/<user>/.rbenv/versions/3.4.12/bin/ruby
# PATH=/home/<user>/.rbenv/versions/3.4.12/bin:/usr/bin:/bin
# RUBY=/home/<user>/.rbenv/versions/4.0.9/bin/ruby
# PATH=/home/<user>/.rbenv/versions/4.0.9/bin:/usr/bin:/bin

RUBY=/path/to/your/ruby
PATH=/path/to/your/ruby/bin:/usr/bin:/bin
4 changes: 2 additions & 2 deletions infra/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ RUN \
&& git clone --depth=1 https://github.com/rbenv/ruby-build.git ${RBENV_ROOT}/plugins/ruby-build
ENV PATH="${RBENV_ROOT}/bin:${RBENV_ROOT}/shims:${PATH}"

# Install Ruby 3.4.12
ARG RUBY_VERSION=3.4.12
# Install Ruby 4.0.9 (same as the mesh-v2 Lambda runtime)
ARG RUBY_VERSION=4.0.9
RUN rbenv install ${RUBY_VERSION} && rbenv global ${RUBY_VERSION}
RUN gem install bundler --no-document

Expand Down
2 changes: 1 addition & 1 deletion infra/smalruby-mesh-v2/.ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.4.12
4.0.9
2 changes: 1 addition & 1 deletion infra/smalruby-mesh-v2/.standard.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# StandardRB configuration for Mesh v2
# See: https://github.com/standardrb/standard

ruby_version: 3.4
ruby_version: 4.0

ignore:
- 'node_modules/**/*'
Expand Down
6 changes: 3 additions & 3 deletions infra/smalruby-mesh-v2/docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ graph TB

subgraph "Compute Layer"
JSResolver[AppSync JS Resolvers<br/>APPSYNC_JS 1.0.0]
Lambda[Lambda Functions<br/>Ruby 3.4]
Lambda[Lambda Functions<br/>Ruby 4.0]
end

subgraph "Monitoring"
Expand Down Expand Up @@ -55,8 +55,8 @@ graph TB
- `Mutation.joinGroup`
- Pipeline Functions (checkGroupExists, updateNodeTTL)

#### Lambda Functions (Ruby 3.4)
- **言語**: Ruby 3.4
#### Lambda Functions (Ruby 4.0)
- **言語**: Ruby 4.0
- **アーキテクチャ**: Hexagonal Architecture(Ports & Adapters)
- **役割**: 複雑なビジネスロジック
- **例**:
Expand Down
2 changes: 1 addition & 1 deletion infra/smalruby-mesh-v2/docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Mesh v2 は Smalruby 3.0 の Mesh 拡張のバックエンドインフラスト
- **Infrastructure**: AWS CDK (TypeScript)
- **API**: AWS AppSync (GraphQL)
- **Database**: DynamoDB (Single Table Design)
- **Compute**: AWS Lambda (Ruby 3.4) + AppSync JavaScript Resolvers (APPSYNC_JS 1.0.0)
- **Compute**: AWS Lambda (Ruby 4.0) + AppSync JavaScript Resolvers (APPSYNC_JS 1.0.0)
- **Testing**: RSpec (Ruby), Jest (TypeScript)
- **Architecture**: Hexagonal Architecture (Ports & Adapters)

Expand Down
4 changes: 3 additions & 1 deletion infra/smalruby-mesh-v2/lib/mesh-v2-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ export class MeshV2Stack extends cdk.Stack {
// Lambda function for complex operations (Dissolve, Leave, RecordEvents, etc.)
const meshV2Lambda = new lambda.Function(this, 'MeshV2LambdaFunction', {
functionName: `MeshV2-GraphQL${stageSuffix}`,
runtime: lambda.Runtime.RUBY_3_4,
// aws-cdk-lib 2.232.1 has no RUBY_4_0 constant yet (it arrives with the CDK
// update tracked in #1264); spell out the ruby4.0 managed runtime until then.
runtime: new lambda.Runtime('ruby4.0', lambda.RuntimeFamily.RUBY),
handler: 'handlers/appsync_handler.lambda_handler',
code: lambda.Code.fromAsset(path.join(__dirname, '../lambda')),
environment: {
Expand Down
2 changes: 1 addition & 1 deletion ruby/smalruby3/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:3.3-slim-bookworm
FROM ruby:4.0-slim-bookworm

LABEL maintainer="Kouji Takao"

Expand Down
Loading