Skip to content
Merged
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
17 changes: 7 additions & 10 deletions benchmarks/cdk/lib/cdk-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,11 @@ export class CdkStack extends Stack {
for (let i = 0; i < config.instanceCount; i++) {
const userData = ec2.UserData.forLinux();

// Download worker binary from S3 asset
userData.addS3DownloadCommand({
bucket: workerBinary.bucket,
bucketKey: workerBinary.s3ObjectKey,
localFile: '/usr/local/bin/worker',
});

userData.addCommands(
// Make binary executable
'chmod +x /usr/local/bin/worker',
// Install Rust tooling.
'yum install gcc',
"curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh",
'cargo install --locked tokio-console',

// Create systemd service
`cat > /etc/systemd/system/worker.service << 'EOF'
Expand Down Expand Up @@ -160,7 +155,9 @@ sudo journalctl -u worker.service -f -o cat
description: 'Session Manager commands to connect to instances',
});

// Custom resource to restart worker service on every deploy
// Downloads the latest version of the worker binary and restarts the systemd service.
// This is done instead of the userData.addS3Download() so that the instance does not need
// to restart every time a new worker binary is available.
const restartWorker = new cr.AwsCustomResource(this, 'RestartWorkerService', {
onUpdate: {
service: 'SSM',
Expand Down