Skip to content

Commit

Permalink
Update node dependencies 2024-09-27 (#254)
Browse files Browse the repository at this point in the history
* Updated allowed Node versions in package.json

* Updated version and lock file

* Removed the ec2-client that was no longer used

* Added eslint-recommended extend

* Added flag to create data during acceptance tests to PR flow

* Updated READMEs to remove setup.js and clean-up comments

* Cleaned up code still referencing blueprint

* Removed use of cast to any

* Removed references to blueprint or status

* Scrubbed data

* Updated openid-client and react-datepicker, held back storybook

* Updated storybook to latest

* Fixed typo on removing blueprint
  • Loading branch information
tkmcmaster authored Sep 27, 2024
1 parent e79fe64 commit 57bac3a
Show file tree
Hide file tree
Showing 28 changed files with 1,847 additions and 3,440 deletions.
7 changes: 3 additions & 4 deletions agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ This allows us to run load tests using [pewpew](https://github.com/FamilySearch/
### Shared code
Shared code for the agent and the controller are found in [ppaas-common](https://github.com/FamilySearch/pewpew/common)

## Build
## Environment Config
For your full deployment you should have environment variables injected into CloudFormation to set up the S3 bucket and SQS queues. For local development, copy the `.sample-env` file to `.env.local` (or run `cp -i .sample.env .env.local`). Then modify the .env.local file to point to your S3 bucket and your SQS queues. You can also override the default AWS profile for your local testing via the `AWS_PROFILE` variable if you are not using `default`.

## Build
```bash

$ npm i && npm run build

```

## Mac and Windows Testing
Expand Down Expand Up @@ -59,7 +59,6 @@ To start the server, run one of the following commands:
## npm run commands

```bash

# You must set your aws credentials to start
# start server
$ npm start
Expand Down
2 changes: 1 addition & 1 deletion agent/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fs/ppaas-agent",
"version": "3.3.1",
"version": "3.3.2",
"description": "Agent Service for running pewpew tests",
"main": "dist/src/app.js",
"scripts": {
Expand Down
4 changes: 0 additions & 4 deletions agent/setup.js

This file was deleted.

4 changes: 2 additions & 2 deletions common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Common Code for the PewPew as a Service ([ppaas-agent](https://github.com/FamilySearch/pewpew/agent) and [ppaas-controller](https://github.com/FamilySearch/pewpew/controller))

## Purpose
This allows us to run load tests using [pewpew](https://github.com/FamilySearch/pewpew) via a AWS without having to manually create an ec2 instance. By putting the test files in s3 and putting a message on an SQS queue, an EC2 instance will be spun up to run the test, then shutdown when complete.
This allows us to run load tests using [pewpew](https://github.com/FamilySearch/pewpew) in AWS without having to manually create an ec2 instance. By putting the test files in s3 and putting a message on an SQS queue, an EC2 instance will be spun up to run the test, then shutdown when complete.

## Installation
```sh
Expand All @@ -24,7 +24,7 @@ logger.log("Log to console", logger.LogLevel.ERROR);
```

## Environment Config
For your full deployment you should have environment variables injected into CloudFormation to set up the S3 bucket and SQS queues. For local development, copy the `.sample-env` file to `.env.local` (or run `node setup.js`). Then modify the .env.local file to point to your S3 bucket and your SQS queues. You can also override the default AWS profile for your local testing via the `AWS_PROFILE` variable if you are not using `default`.
For your full deployment you should have environment variables injected into CloudFormation to set up the S3 bucket and SQS queues. For local development, copy the `.sample-env` file to `.env.local` (or run `cp -i .sample.env .env.local`). Then modify the .env.local file to point to your S3 bucket and your SQS queues. You can also override the default AWS profile for your local testing via the `AWS_PROFILE` variable if you are not using `default`.

## Build
```bash
Expand Down
4 changes: 0 additions & 4 deletions common/integration/ec2.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ import { LogLevel, ec2, log } from "../src/index";
import { expect } from "chai";

describe("EC2 Integration", () => {
before (() => {
ec2.init();
});

it("getInstanceId should get instanceId", (done: Mocha.Done) => {
ec2.getInstanceId().then((result: string) => {
log("getInstanceId", LogLevel.INFO, { result });
Expand Down
5 changes: 2 additions & 3 deletions common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fs/ppaas-common",
"version": "3.3.1",
"version": "3.3.2",
"description": "Common Code for the PewPewController and PewPewAgent",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
Expand All @@ -23,7 +23,7 @@
"url": "git+https://github.com/FamilySearch/pewpew.git"
},
"engines": {
"node": ">=18.0.0 <21.0.0"
"node": ">=18.0.0 <23.0.0"
},
"nyc": {
"exclude": "**/*.spec.ts"
Expand All @@ -32,7 +32,6 @@
"@fs/config-wasm": "*"
},
"dependencies": {
"@aws-sdk/client-ec2": "^3.363.0",
"@aws-sdk/client-s3": "^3.363.0",
"@aws-sdk/client-sqs": "^3.363.0",
"@aws-sdk/lib-storage": "^3.363.0",
Expand Down
4 changes: 0 additions & 4 deletions common/setup.js

This file was deleted.

15 changes: 0 additions & 15 deletions common/src/util/ec2.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,9 @@
import { LogLevel, log } from "./log";
import {
EC2Client
} from "@aws-sdk/client-ec2";
import { exec as _exec } from "child_process";
import { promisify } from "util";
import { readFile } from "fs/promises";
const exec = promisify(_exec);

// Create these later so the profile can be set dynamically
let ec2Client: EC2Client;

// Init function to initialize these after we've started but on first access
export function init (): void {
if (!ec2Client) {
ec2Client = new EC2Client({
region: "us-east-1"
});
}
}

export const INSTANCE_ID_FILE = "/var/lib/cloud/data/instance-id";
export const INSTANCE_ID_REGEX = /^i-[0-9a-z]+$/;
export const INSTANCE_FILE_REGEX = /^instance-id:\s*(i-[0-9a-z]+)$/;
Expand Down
18 changes: 9 additions & 9 deletions controller/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This allows us to run load tests using [pewpew](https://github.com/FamilySearch/
Shared code for the agent and the controller are found in [ppaas-common](https://github.com/FamilySearch/pewpew/common)

## Environment Config
For your full deployment you should have environment variables injected into CloudFormation to set up the S3 bucket and SQS queues. For local development, copy the `.sample-env` file to `.env.local` (or run `node setup.js`). Then modify the .env.local file to point to your S3 bucket and your SQS queues. You can also override the default AWS profile for your local testing via the `AWS_PROFILE` variable if you are not using `default`.
For your full deployment you should have environment variables injected into CloudFormation to set up the S3 bucket and SQS queues. For local development, copy the `.sample-env` file to `.env.local`. Then modify the .env.local file to point to your S3 bucket and your SQS queues. You can also override the default AWS profile for your local testing via the `AWS_PROFILE` variable if you are not using `default`.

## Build
```bash
Expand Down Expand Up @@ -39,14 +39,14 @@ $ PORT=8081 npm run acceptance
You also need to configure your Secrets Overrides. You have two options, get the real key from someone who has it, or generate your own key for testing/development but any files stored encrypted in s3 will only be accessible by you. For the OpenId secret, you will need the real one.

### Generate your own encryption key for testing
1. If you haven't created a `.env.local` run `node setup.js`
1. If you haven't created a `.env.local` run `cp -i .sample.env .env.local`
2. Uncomment the `PEWPEW_ENCRYPT_KEY_OVERRIDE` from `.env.local`
3. Run `openssl rand -hex 16` and copy the value into the quotes for `PEWPEW_ENCRYPT_KEY_OVERRIDE`. Should be something like `a5158c830ac558b21baddb79803105fb`.

### Add your own OpenId Secret
1. If you haven't created a `.env.local` run `node setup.js`
2. Uncomment the `SECRETS_OPENID_CLIENT_SECRET_NAME` from `.env.local`
3. Enter the value for your secret into the quotes for `SECRETS_OPENID_CLIENT_SECRET_NAME`.
1. If you haven't created a `.env.local` run `cp -i .sample.env .env.local`
2. Uncomment the `PEWPEW_OPENID_SECRET_OVERRIDE` from `.env.local`
3. Enter the value for your secret into the quotes for `PEWPEW_OPENID_SECRET_OVERRIDE`.

## Integration Tests
```bash
Expand All @@ -70,7 +70,7 @@ To start the server, run one of the following commands:
Use http://localhost:8081/healthcheck/ after running the above command.

## Run the local server with authentication
Running locally, only dev/integ/okta-np will let you redict back to localhost. Current users set up for dev/integration are ppaasadmin and ppaasuser with the usual test password. okta-np requires "Performance Test Non-Prod" permissions from the tools portal.
Running locally, only dev/integ/okta-np will let you redict back to localhost.

To start the server, run one of the following commands:
```bash
Expand Down Expand Up @@ -145,8 +145,8 @@ See [ServerFalt](https://serverfault.com/questions/536576/nginx-how-do-i-forward

```bash
# Install nginx
$ sudo apt-get update
$ sudo apt-get install nginx
$ sudo apt update
$ sudo apt install nginx
$ sudo vi /etc/nginx/sites-available/default
```

Expand Down Expand Up @@ -180,7 +180,7 @@ location /pewpew/load-test/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /status/performance-test2/ {
location /pewpew/performance-test2/ {
proxy_pass http://nodejs2/;
proxy_set_header Connection "";
proxy_http_version 1.1;
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"instanceId":"i-0ce84eb4256e6d420","hostname":"pewpewagent-devxl-app-36-236-143","ipAddress":"10.36.236.143","startTime":1718656021072,"endTime":1718657498160,"resultsFilename":["stats-rmsdeletestage20240617T193912876.json"],"status":"Finished","errors":["Received StopTest message from controller"],"version":"latest","queueName":"devxl","userId":"[email protected]"}
{"instanceId":"i-0ce84eb4256e6d420","hostname":"pewpewagent-devxl-app-36-236-143","ipAddress":"10.36.236.143","startTime":1718656021072,"endTime":1718657498160,"resultsFilename":["stats-rmsdeletestage20240617T193912876.json"],"status":"Finished","errors":["Received StopTest message from controller"],"version":"latest","queueName":"devxl","userId":"pewpewuser"}
Loading

0 comments on commit 57bac3a

Please sign in to comment.