From dc112927581587c4a42079008760e543fa9b36db Mon Sep 17 00:00:00 2001 From: Nathan Weinberg Date: Sat, 17 Feb 2024 14:20:13 -0500 Subject: [PATCH 1/2] Upgrade to node 20 --- .github/workflows/deploy.yml | 6 +++--- .github/workflows/lint.yml | 10 +++++----- README.md | 2 +- devops/deploy-playbook.yml | 4 ++-- package-lock.json | 2 +- package.json | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5d7ba38..09b1dd9 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: ['18'] + node-version: ['20'] python-version: ['3.12'] env: TM_NTT_CERT_ARN: ${{ secrets.TM_NTT_CERT_ARN }} @@ -19,11 +19,11 @@ jobs: - name: Checkout repo uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Set up Node ${{ matrix.node-version }}.x - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - name: Check if package-lock.json is up to date diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 64920a1..cf21d87 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,17 +11,17 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: ['18'] + node-version: ['20'] python-version: ['3.12'] steps: - name: Checkout repo uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Set up Node ${{ matrix.node-version }}.x - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - name: Check if package-lock.json is up to date @@ -37,7 +37,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: ['18'] + node-version: ['20'] python-version: ['3.12'] steps: - name: Checkout repo @@ -47,7 +47,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Set up Node ${{ matrix.node-version }}.x - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - name: Check if package-lock.json is up to date diff --git a/README.md b/README.md index db350dc..f861693 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Shows new MBTA Orange, Red, and Green Line trains as they come into service. ## Install & Run Dependencies: -- `node 18.x` (with `npm 9.x`) +- `node 20.x` (with `npm 10.x`) - `python 3.12` - [`poetry`](https://python-poetry.org/) - Ensure `poetry` is using the correct Python version by running `poetry env use ` diff --git a/devops/deploy-playbook.yml b/devops/deploy-playbook.yml index 7c69292..7579b40 100644 --- a/devops/deploy-playbook.yml +++ b/devops/deploy-playbook.yml @@ -11,11 +11,11 @@ url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key state: present - - name: add nodejs 18.x ppa for apt repo + - name: add nodejs 20.x ppa for apt repo become: yes become_user: root apt_repository: - repo: deb https://deb.nodesource.com/node_18.x focal main + repo: deb https://deb.nodesource.com/node_20.x focal main update_cache: yes - name: install nodejs diff --git a/package-lock.json b/package-lock.json index 38e153d..3767984 100644 --- a/package-lock.json +++ b/package-lock.json @@ -50,7 +50,7 @@ "webpack-pwa-manifest": "^4.3.0" }, "engines": { - "node": "18.x" + "node": "20.x" } }, "node_modules/@aashutoshrathi/word-wrap": { diff --git a/package.json b/package.json index 11c837c..4f65ee9 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "url": "https://github.com/transitmatters/new-train-tracker/issues" }, "engines": { - "node": "18.x" + "node": "20.x" }, "homepage": "https://github.com/transitmatters/new-train-tracker#readme", "dependencies": { From ab11ef40f3aa9bd061065516785758c486f52cc5 Mon Sep 17 00:00:00 2001 From: Nathan Weinberg Date: Thu, 22 Feb 2024 21:07:25 -0500 Subject: [PATCH 2/2] Remove unused flag --- .github/workflows/deploy.yml | 2 +- devops/deploy.sh | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 09b1dd9..03aeae5 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -52,4 +52,4 @@ jobs: run: | curl -sSL https://install.python-poetry.org | python3 - npm ci - cd devops && bash ./deploy.sh -p -c + cd devops && bash ./deploy.sh -p diff --git a/devops/deploy.sh b/devops/deploy.sh index 3ddc730..945397a 100755 --- a/devops/deploy.sh +++ b/devops/deploy.sh @@ -8,20 +8,15 @@ export AWS_DEFAULT_REGION=us-east-1 export AWS_PAGER="" PRODUCTION=false -CI=false # Argument parsing # pass "-p" flag to deploy to production -# pass "-c" flag if deploying with CI while getopts "pc" opt; do case $opt in p) PRODUCTION=true ;; - c) - CI=true - ;; esac done @@ -31,7 +26,7 @@ $PRODUCTION && CERT_ARN="$TM_NTT_CERT_ARN" || CERT_ARN="$TM_LABS_WILDCARD_CERT_A $PRODUCTION && STACK_NAME="ntt" || STACK_NAME="ntt-beta" -echo "Deploying Train Tracker to $HOSTNAME..." +echo "Deploying Train Tracker CloudFormation stack to $HOSTNAME..." echo "View stack log here: https://$AWS_REGION.console.aws.amazon.com/cloudformation/home?region=$AWS_REGION" aws cloudformation deploy --stack-name $STACK_NAME \ @@ -45,7 +40,9 @@ aws cloudformation deploy --stack-name $STACK_NAME \ # Look up the physical ID of the EC2 instance currently associated with the stack INSTANCE_PHYSICAL_ID=$(aws cloudformation list-stack-resources --stack-name $STACK_NAME --query "StackResourceSummaries[?LogicalResourceId=='NTTInstance'].PhysicalResourceId" --output text) + # Run the playbook! :-) +echo "Deploying the New Train Tracker to $INSTANCE_PHYSICAL_ID via Ansible..." export ANSIBLE_HOST_KEY_CHECKING=False # If it's a new host, ssh known_hosts not having the key fingerprint will cause an error. Silence it SSH_PROXY_ARGS="-o ProxyCommand='aws ec2-instance-connect open-tunnel --instance-id $INSTANCE_PHYSICAL_ID'" ansible-playbook -v --ssh-extra-args "$SSH_PROXY_ARGS" -i $INSTANCE_PHYSICAL_ID, -u ubuntu --private-key ~/.ssh/transitmatters-ntt.pem deploy-playbook.yml