Skip to content

Upgrade Lambda Runtimes to Ruby 3.3 and Java 17 #407

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
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
af15d98
Add comprehensive development deployment system for JavaBuilder
anthony-jackson-code Jul 23, 2025
a03da6f
Remove temporary template file
anthony-jackson-code Jul 23, 2025
2564ba7
Update README files for new development deployment system
anthony-jackson-code Jul 24, 2025
3d3d280
Fix deployment script to handle file permission issues
anthony-jackson-code Jul 24, 2025
7f16d7b
Upgrade runtime versions: Ruby 2.7→3.3, Java 11→17
anthony-jackson-code Jul 24, 2025
3acc955
Fix Ruby version consistency: Use Ruby 3.3 everywhere
anthony-jackson-code Jul 24, 2025
3a5adeb
Implement Ruby-based development deployment following PR feedback
anthony-jackson-code Jul 25, 2025
d210a18
Address additional PR feedback
anthony-jackson-code Jul 25, 2025
90986b6
Remove macOS-specific JDK path from deployment script
anthony-jackson-code Jul 25, 2025
53df39c
Revert OAC and SSL wildcard changes, keep runtime upgrades
anthony-jackson-code Jul 25, 2025
ecd510a
Simplify artifact bucket handling to require pre-existing bucket
anthony-jackson-code Jul 25, 2025
54bef22
Simplify artifact bucket handling in legacy shell script
anthony-jackson-code Jul 25, 2025
243f625
Remove health-check.sh from git tracking
anthony-jackson-code Jul 25, 2025
d672e46
Document artifact bucket requirement and remove legacy script references
anthony-jackson-code Jul 25, 2025
f1e77a0
Remove legacy dev-deployment README
anthony-jackson-code Jul 25, 2025
bf399c0
Clean up .gitignore after removing legacy deployment script
anthony-jackson-code Jul 28, 2025
362fb62
Revert certificate handling to original individual certificate approach
anthony-jackson-code Jul 28, 2025
f82c0cc
Update configurations and deployment scripts
anthony-jackson-code Aug 1, 2025
ba39255
Support multiple development stacks with branch-based naming
anthony-jackson-code Aug 1, 2025
f87c74d
chore: update Ruby and Python versions, domain names, and documentati…
anthony-jackson-code Aug 21, 2025
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@
# Ignore Gradle build output directory
build

# Ignore the generated template.yml file
# Ignore the generated template.yml files
template.yml
app-template.yml
packaged-app-template.yml
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7.8
3.3.0
60 changes: 52 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,23 @@ The Javabuilder dev doc can be found at
* [org-code-javabuilder](https://github.com/code-dot-org/javabuilder/tree/main/org-code-javabuilder)
contains the Lambda function that builds and runs student code. It also contains the
local developent version of Javabuilder.
* [cicd/3-app](https://github.com/code-dot-org/javabuilder/tree/main/cicd/3-app)
contains the Ruby deployment script for development stacks, following Code.org patterns.
* [dev-deployment](https://github.com/code-dot-org/javabuilder/tree/main/dev-deployment)
contains legacy deployment scripts (deprecated in favor of cicd/3-app approach).
* [javabuilder](https://github.com/code-dot-org/javabuilder) (the current directory)
contains the script and Cloud Formation template for deploying Javabuilder to
production.

### Prerequisites
Use `rbenv` to install Ruby 2.7.2 to build and/or run the Ruby lambda functions
Use `rbenv` to install Ruby 3.3+ to build and/or run the Ruby lambda functions
(`javabuilder-authorizer` and `api-gateway-routes`).
[rbenv](https://github.com/rbenv/rbenv) is required for installing Ruby and managing
multiple versions of Ruby on a single development environment. Follow the instructions
[here](https://github.com/rbenv/rbenv#installing-ruby-versions) to use rbenv to install a
new Ruby version. You may need to also install
[ruby-build](https://github.com/rbenv/ruby-build#readme) to get the latest Ruby versions.
The `.ruby-version` file sets the local Ruby version for javabuilder to be 2.7.2
The `.ruby-version` file sets the local Ruby version for javabuilder to be 3.3.0

## Deploying Production Javabuilder

Expand All @@ -57,16 +61,56 @@ There are two main ways to develop and run Javabuilder:

### Deploying a Dev Instance

1. Make and commit your desired changes.
1. Push your local changes to your feature branch.
1. Deploy a development instance of Javabuilder, following the instructions here:
[Deploying a Development environment](https://github.com/code-dot-org/javabuilder/tree/main/cicd#deploying-an-development-environment).
To deploy a development instance of Javabuilder, use the Ruby deployment script in `cicd/3-app`:

To connect your dev instance with Java Lab (Code Studio client) running on your local Dashboard server:
1. **Quick Deploy:**
```bash
cd cicd/3-app
./deploy-development-stack.rb
```
This will:
- Build all components (javabuilder-authorizer, org-code-javabuilder, api-gateway-routes)
- Process ERB templates following production buildspec pattern
- Deploy with SSL certificates using existing wildcard certificate for dev-code.org
- Create or update the `javabuilder-dev` CloudFormation stack
- Preserve build artifacts in `tmp/` for debugging

2. **Custom Stack Name:**
```bash
./deploy-development-stack.rb --stack_name my-test-stack
```

3. **View All Options:**
```bash
./deploy-development-stack.rb --help
```

4. **Clean Deployment:**
If you need to start fresh, manually delete the stack from AWS console or use:
```bash
aws cloudformation delete-stack --stack-name javabuilder-dev --profile codeorg-dev
```

### Base Infrastructure Necessity

The `app-template.yml` used for deploying the Javabuilder application does not contain all the necessary infrastructure. Specifically, it relies on IAM roles that need to be set up beforehand via a separate IAM stack. These roles are crucial for handling permissions related to various AWS services used by Javabuilder components.

#### Key Missing Components in `app-template.yml`
- IAM roles needed for Lambda functions and API Gateway
- Policies required to allow access to S3 buckets, DynamoDB tables, and other resources

### Why Base Infrastructure is Separate
- **Modularity**: Separate IAM roles allow multiple deployments to share IAM permissions.
- **Security**: IAM configurations often require higher privileges and careful management.
- **Flexibility**: The application stack can be deployed or updated independently of IAM changes.

For more detailed instructions and troubleshooting, refer to the [Development Deployment README](cicd/3-app/README.md).

To connect your dev instance with Java Lab (Code Studio client) running on your local Dashboard server:

1. In your code-dot-org workspace, add an entry to your `locals.yml` file with your dev instance stack name:
```
local_javabuilder_stack_name: 'javabuilder-dev-<your-branch-name>'
local_javabuilder_stack_name: 'javabuilder-dev'
```
1. Launch dashboard using the instructions here:
https://github.com/code-dot-org/code-dot-org/blob/staging/SETUP.md#overview
Expand Down
1 change: 1 addition & 0 deletions api-gateway-routes/.ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.3.0
2 changes: 1 addition & 1 deletion api-gateway-routes/Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Gemfile
source 'https://rubygems.org'

ruby '~> 2.7'
ruby '~> 3.3'

gem 'aws-sdk-lambda', '1.39.0'
gem 'aws-sdk-sqs', '1.38.0'
Expand Down
29 changes: 17 additions & 12 deletions api-gateway-routes/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
GEM
remote: https://rubygems.org/
specs:
aws-eventstream (1.1.1)
aws-partitions (1.443.0)
aws-sdk-core (3.113.1)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.239.0)
aws-sigv4 (~> 1.1)
jmespath (~> 1.0)
aws-eventstream (1.4.0)
aws-partitions (1.1134.0)
aws-sdk-core (3.227.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.992.0)
aws-sigv4 (~> 1.9)
base64
jmespath (~> 1, >= 1.6.1)
logger
aws-sdk-lambda (1.39.0)
aws-sdk-core (~> 3, >= 3.71.0)
aws-sigv4 (~> 1.1)
aws-sdk-sqs (1.38.0)
aws-sdk-core (~> 3, >= 3.112.0)
aws-sigv4 (~> 1.1)
aws-sigv4 (1.2.3)
aws-sigv4 (1.12.1)
aws-eventstream (~> 1, >= 1.0.2)
jmespath (1.4.0)
minitest (5.15.0)
base64 (0.3.0)
jmespath (1.6.2)
logger (1.7.0)
minitest (5.25.5)

PLATFORMS
arm64-darwin-24
ruby

DEPENDENCIES
Expand All @@ -28,7 +33,7 @@ DEPENDENCIES
minitest (~> 5.5)

RUBY VERSION
ruby 2.7.4p191
ruby 3.3.0p0

BUNDLED WITH
1.17.3
2.5.3
Loading