-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #285 from labzero/develop
Merge to master
- Loading branch information
Showing
346 changed files
with
12,895 additions
and
12,467 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,47 @@ | ||
# JOB DEFINITIONS | ||
version: 2 | ||
version: 2.1 | ||
orbs: | ||
node: circleci/[email protected] | ||
commands: | ||
aws-deploy: | ||
parameters: | ||
build_container_repository: | ||
type: env_var_name | ||
default: BUILD_CONTAINER_REPOSITORY | ||
ecs_cluster: | ||
type: string | ||
default: "" | ||
migration_task: | ||
type: string | ||
default: "" | ||
service_name: | ||
type: string | ||
default: "" | ||
task_family: | ||
type: string | ||
default: "" | ||
steps: | ||
- run: | ||
name: Deploy | ||
command: | | ||
aws configure set default.region us-west-2 | ||
CLEAN_BRANCH=`echo ${CIRCLE_BRANCH} | sed 's/\//-/g'` | ||
DOCKER_TAG=${<< parameters.build_container_repository >>}:${CIRCLE_SHA1} | ||
CURRENT_TASK=`aws ecs list-task-definitions --status ACTIVE --family-prefix << parameters.task_family >> --sort DESC | jq -r '.taskDefinitionArns[0]'` | ||
TASK_JSON=`aws ecs describe-task-definition --task-definition ${CURRENT_TASK} | jq --arg DOCKER_TAG "$DOCKER_TAG" '.taskDefinition.containerDefinitions[0].image = $DOCKER_TAG | {containerDefinitions: .taskDefinition.containerDefinitions, family: .taskDefinition.family}'` | ||
aws ecs register-task-definition --cli-input-json "${TASK_JSON}" > /dev/null | ||
CURRENT_MIGRATION_TASK=`aws ecs list-task-definitions --status ACTIVE --family-prefix << parameters.migration_task >> --sort DESC | jq -r '.taskDefinitionArns[0]'` | ||
MIGRATION_TASK_JSON=`aws ecs describe-task-definition --task-definition ${CURRENT_MIGRATION_TASK} | jq --arg DOCKER_TAG "$DOCKER_TAG" '.taskDefinition.containerDefinitions[0].image = $DOCKER_TAG | {containerDefinitions: .taskDefinition.containerDefinitions, family: .taskDefinition.family}'` | ||
aws ecs register-task-definition --cli-input-json "${MIGRATION_TASK_JSON}" > /dev/null | ||
aws ecs run-task --cluster << parameters.ecs_cluster >> --task-definition << parameters.migration_task >> | ||
NEW_TASK=`aws ecs list-task-definitions --status ACTIVE --family-prefix << parameters.task_family >> --sort DESC | jq -r '.taskDefinitionArns[0]'` | ||
aws ecs update-service --service << parameters.service_name >> --cluster << parameters.ecs_cluster >> --task-definition ${NEW_TASK} | ||
jobs: | ||
test: | ||
docker: | ||
# image for running tests | ||
- image: cypress/browsers:node16.14.0-chrome99-ff97 | ||
- image: cypress/browsers:node18.12.0-chrome103-ff107 | ||
environment: | ||
- DB_NAME=lunch_test | ||
- DB_USER=lunch_test | ||
|
@@ -68,9 +105,9 @@ jobs: | |
echo 127.0.0.1 integration-test.local.lunch.pink | tee -a /etc/hosts | ||
# build the app | ||
- run: | ||
name: build-release | ||
command: NODE_ENV=test npm run build | ||
# - run: | ||
# name: build-release | ||
# command: NODE_ENV=test npm run build | ||
|
||
- run: | ||
name: integration-tests | ||
|
@@ -89,68 +126,83 @@ jobs: | |
|
||
build: | ||
docker: | ||
- image: ${BUILD_IMAGE} | ||
- image: cimg/aws:2023.01 | ||
|
||
working_directory: ~/repo | ||
# working_directory: ~/repo | ||
|
||
steps: | ||
- checkout | ||
|
||
- setup_remote_docker: | ||
version: 20.10.11 | ||
docker_layer_caching: true | ||
|
||
- run: | ||
name: dotenv | ||
command: touch .env && touch .env.prod | ||
|
||
# Download and cache dependencies | ||
- restore_cache: | ||
keys: | ||
- v1-build-dependencies-{{ checksum "package.json" }} | ||
# fallback to using the latest cache if no exact match is found | ||
- v1-build-dependencies- | ||
# # Download and cache dependencies | ||
# - restore_cache: | ||
# keys: | ||
# - v1-build-dependencies-{{ checksum "package.json" }} | ||
# # fallback to using the latest cache if no exact match is found | ||
# - v1-build-dependencies- | ||
|
||
# install deps | ||
- run: | ||
name: yarn-install | ||
command: yarn install | ||
# # install deps | ||
# - run: | ||
# name: yarn-install | ||
# command: yarn install | ||
|
||
- save_cache: | ||
paths: | ||
- node_modules | ||
key: v1-build-dependencies-{{ checksum "package.json" }} | ||
# - save_cache: | ||
# paths: | ||
# - node_modules | ||
# key: v1-build-dependencies-{{ checksum "package.json" }} | ||
|
||
- node/install-packages: | ||
pkg-manager: yarn | ||
|
||
# build the release | ||
- run: | ||
name: build-release | ||
command: npm run build -- --release --verbose | ||
|
||
- setup_remote_docker | ||
# - setup_remote_docker | ||
|
||
# build and push a docker image (script is defined in the custom build image) | ||
# build and push a docker image | ||
- run: | ||
name: build-docker-image | ||
command: ../buildImage.sh | ||
command: | | ||
CLEAN_BRANCH=`echo $CIRCLE_BRANCH | sed 's/\//-/g'` | ||
DOCKER_TAG=${BUILD_CONTAINER_REPOSITORY}:${CIRCLE_SHA1} | ||
docker build --tag ${DOCKER_TAG} . | ||
aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin ${CONTAINER_REGISTRY} | ||
docker push ${DOCKER_TAG} | ||
deploy-staging: | ||
docker: | ||
- image: ${BUILD_IMAGE} | ||
- image: cimg/aws:2023.01 | ||
|
||
working_directory: ~/repo | ||
# working_directory: ~/repo | ||
|
||
steps: | ||
# update ECS task and service with image build above (script is defined in custom build image) | ||
- run: | ||
name: update-service | ||
command: ../deployStaging.sh | ||
- aws-deploy: | ||
task_family: lunch-staging | ||
ecs_cluster: Lunch-Staging | ||
service_name: lunch-staging | ||
migration_task: staging_lunch_migrate | ||
|
||
deploy-production: | ||
docker: | ||
- image: ${BUILD_IMAGE} | ||
- image: cimg/aws:2023.01 | ||
|
||
working_directory: ~/repo | ||
# working_directory: ~/repo | ||
|
||
steps: | ||
- run: | ||
name: update_service | ||
command: ../deployProduction.sh | ||
- aws-deploy: | ||
task_family: lunch | ||
ecs_cluster: Lunch | ||
service_name: lunch | ||
migration_task: lunch_migrate | ||
|
||
# WORKFLOW DEFINITIONS | ||
workflows: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Dockerfile | ||
node_modules | ||
tmp | ||
temp | ||
postgres-data |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,3 +43,7 @@ cypress/videos/ | |
deploy.sh | ||
test-results.xml | ||
screenshots | ||
Dockerfile.bak | ||
|
||
#Docker postgres-data | ||
postgres-data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npm test && npx lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
extension: ['ts'], | ||
require: ['./test/setup'], | ||
exit: true, | ||
file: './test/mocha-setup', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v18.14.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM node:16.17.0 | ||
FROM node:18.14.0 | ||
|
||
# Set a working directory | ||
WORKDIR /usr/src/app | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM node:18.14.0 | ||
|
||
# Set a working directory | ||
WORKDIR /app | ||
|
||
# Install dependencies based on the preferred package manager | ||
COPY package.json yarn.lock ./ | ||
RUN yarn --frozen-lockfile | ||
|
||
COPY . . | ||
|
||
CMD [ "npm", "start" ] |
Oops, something went wrong.