Skip to content

Commit

Permalink
Merge branch '#156-move-rooms-to-the-past-room-list-and-change-settle…
Browse files Browse the repository at this point in the history
…status-automatically-when-the-participant-is-one' of https://github.com/sparcs-kaist/taxi-back into #156-move-rooms-to-the-past-room-list-and-change-settlestatus-automatically-when-the-participant-is-one
  • Loading branch information
Hyogyeong8 committed Feb 28, 2023
2 parents a231e2d + 739cdcc commit dd928dc
Show file tree
Hide file tree
Showing 25 changed files with 781 additions and 38 deletions.
11 changes: 11 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/node_modules
.env.test
.env.production
.env.development
.DS_store
*.code-workspace
*.swp
/logs/*.log

# AdminJS 관련 디렉토리
.adminjs
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ FRONT_URL=[front url(e.g. http://localhost:3000)]
AWS_ACCESS_KEY_ID=[AWS Access key ID]
AWS_SECRET_ACCESS_KEY=[AWS Secret access key]
AWS_S3_BUCKET_NAME=[AWS S3 Buck name]
JWT_SECRET_KEY=[JWT SERCRET KEY]
APP_URI_SCHEME=[APP_URI_SCHEME]
52 changes: 52 additions & 0 deletions .github/workflows/create_release_tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Create Release and Tag
on:
pull_request:
types:
- closed
branches:
- main

jobs:
if_merged:
if: github.event.pull_request.merged == true
name: Create Release and Tag
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Get previous tag-version
id: previous_tag
uses: WyriHaximus/github-action-get-previous-tag@v1
with:
fallback: 1.0.0

- name: Get next minor tag-version
id: minor_tag
uses: WyriHaximus/github-action-next-semvers@v1
with:
version: ${{ steps.previous_tag.outputs.tag }}

- name: Get current time
uses: josStorer/[email protected]
id: date
with:
format: YYYY-MM-DD
utcOffset: "+09:00"

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.minor_tag.outputs.v_patch }}
release_name: ${{ steps.minor_tag.outputs.v_patch }}
body: |
${{ steps.date.outputs.formattedTime }}
Github action released ${{ steps.minor_tag.outputs.v_patch }}
draft: false
prerelease: false
61 changes: 61 additions & 0 deletions .github/workflows/push_image_ecr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Push Prod Image to Amazon ECR

# when tagging action success
on:
workflow_run:
workflows: ["Create Release and Tag"]
types:
- completed

env:
AWS_REGION: ap-northeast-2

jobs:
if_workflow_success:
name: Build and Push
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Get previous tag-version
id: previous_tag
uses: WyriHaximus/github-action-get-previous-tag@v1
with:
fallback: 1.0.0

- name: Set Tag Version
id: tag
uses: actions/github-script@v4
with:
script: |
const tagVersion = "${{ steps.previous_tag.outputs.tag }}".replace('v', '')
core.setOutput('tag', tagVersion)
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Login to AWS ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Build and Push to AWS ECR
id: build_image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ steps.tag.outputs.tag }}
ECR_REPOSITORY: taxi-back
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:latest .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
echo "Push iamge : $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG and latest"
43 changes: 43 additions & 0 deletions .github/workflows/push_image_ecr_dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Push Dev Image to Amazon ECR
on:
pull_request:
types:
- closed
branches:
- dev

env:
AWS_REGION: ap-northeast-2

jobs:
if_merged:
if: github.event.pull_request.merged == true
name: Create Release and Tag
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Login to AWS ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Build and Push to AWS ECR
id: build_image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: taxi-back
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:dev .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:dev
echo "Push iamge : $ECR_REGISTRY/$ECR_REPOSITORY:dev"
30 changes: 6 additions & 24 deletions .github/workflows/node.js.yml → .github/workflows/test_ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
name: Test for Continuous integration
on:
push:
branches: [ "main" ]
Expand All @@ -19,34 +19,16 @@ jobs:
run: sudo docker run --name mongodb -d -p 27017:27017 mongo:${{ matrix.mongodb-version }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/checkout@v3
with:
submodules: true
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install aws cli
run: sudo apt update && sudo apt install awscli
- name: create AWS configuration file and copy
run: |
mkdir -p ~/.aws
cd ~/.aws
pwd
touch credentials
echo "[default]" >> credentials
echo aws_access_key_id = ${{ secrets.AWS_ACCESS_KEY_ID }} >> credentials
echo aws_secret_access_key = ${{ secrets.AWS_SECRET_ACCESS_KEY }} >> credentials
cat credentials
touch config
echo "[default]" >> config
echo "region = ap-northeast-2" >> config
echo "output = json" >> config
- name: Download mongoDB dump file
run: aws s3 cp --recursive s3://${{ secrets.AWS_S3_BUCKET_NAME }}/dump dump
- name: Copy to mongodb container
run: docker cp dump mongodb:/dump
- name: Restore DB from dump file
run: docker exec mongodb sh -c 'mongorestore ${{ secrets.DB_PATH }} /dump/${{ secrets.DB_NAME }}'
- name: Install dependencies from package-lock.json
- name: Install sampleGenerator dependencies from package-lock.json
run: cd sampleGenerator && npm ci && cd ..
- name: Install taxi-back dependencies from package-lock.json
run: npm ci
- name: Run unit tests
run: npm test
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "sampleGenerator"]
path = sampleGenerator
url = https://github.com/sparcs-kaist/taxiSampleGenerator
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:16-alpine

# Copy repository
WORKDIR /usr/src/app
COPY . .

# Install curl (for taxi-docker)
RUN apk update && apk add curl

# Install requirements
RUN npm ci

# Run container
EXPOSE 80
ENV PORT 80
CMD ["npm", "run", "serve"]
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@ See [contributors](https://github.com/sparcs-kaist/taxi-front/graphs/contributor
- frontend : https://github.com/sparcs-kaist/taxi-front
- backend : https://github.com/sparcs-kaist/taxi-back
- app : https://github.com/sparcs-kaist/taxi-app
- docker : https://github.com/sparcs-kaist/taxi-docker
- figma : https://www.figma.com/file/li34hP1oStJAzLNjcG5KjN/SPARCS-Taxi?node-id=0%3A1
- taxiSampleGenerator : https://github.com/sparcs-kaist/taxiSampleGenerator
Loading

0 comments on commit dd928dc

Please sign in to comment.