-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add change password/delete user * add user/auth tests * Refactor (#3) * refactored review flow, add tests * update tests * decouple ice<->review relation, fix tests * refactor ice-cream query, add ice-cream tests * simplify review logic, add tests * add tests on PR --------- Co-authored-by: Dominik Maćkiewicz <[email protected]> * update workflows (#5) Co-authored-by: Dominik Maćkiewicz <[email protected]> * Refactor workflows (#6) * update workflows * change .github structure --------- Co-authored-by: Dominik Maćkiewicz <[email protected]> * update mongoose,babel, made audit * remove duplicats * update containers ports * update mongo pass secret * try fix deploy flow * add caching, change ice-cream retrieval from payload to query (#7) * add caching, change ice-cream retrieval from payload to query * fix ice cream fetching, remove console logs * fix expected http response code * update validation pipe --------- Co-authored-by: Dominik Maćkiewicz <[email protected]> * add throw when ice cream does not exist * add error handling * add admin guard, implemented ice cream creation with tests (#8) Co-authored-by: Dominik Maćkiewicz <[email protected]> * add url, fix boolean query (#9) * add url, fix boolean query * fix url uniqness --------- Co-authored-by: Dominik Maćkiewicz <[email protected]> * update validator case * update cache lifespan and scope * add find by id endpoint * add get ice cream reviewed by user endpoint --------- Co-authored-by: Dominik Maćkiewicz <[email protected]>
- Loading branch information
Showing
40 changed files
with
3,857 additions
and
2,214 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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Deploy | ||
|
||
inputs: | ||
# Context | ||
context: | ||
required: true | ||
file: | ||
required: true | ||
|
||
# Dockerhub | ||
dockerhub-username: | ||
required: true | ||
dockerhub-token: | ||
required: true | ||
image-name: | ||
required: true | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ inputs.dockerhub-username }} | ||
password: ${{ inputs.dockerhub-token }} | ||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: ${{ inputs.context }} | ||
file: ${{ inputs.file }} | ||
push: true | ||
tags: ${{ inputs.image-name }}:latest |
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,31 @@ | ||
name: Clean | ||
|
||
inputs: | ||
# SSH | ||
host: | ||
required: true | ||
username: | ||
required: true | ||
port: | ||
required: true | ||
ssh-private-key: | ||
required: true | ||
|
||
# Docker | ||
image-name: | ||
required: true | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Update image inside VPS | ||
continue-on-error: true | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ inputs.host }} | ||
USERNAME: ${{ inputs.username }} | ||
PORT: ${{ inputs.port }} | ||
KEY: ${{ inputs.ssh-private-key }} | ||
script: | | ||
docker stop $(docker ps -q --filter ancestor=${{ inputs.image-name }}) | ||
docker rmi $(docker images ${{ inputs.image-name }} -a -q) -f |
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,77 @@ | ||
name: Deploy | ||
|
||
inputs: | ||
# SSH | ||
host: | ||
required: true | ||
username: | ||
required: true | ||
port: | ||
required: true | ||
ssh-private-key: | ||
required: true | ||
|
||
# Docker | ||
image-name: | ||
required: true | ||
container-port: | ||
required: true | ||
application-port: | ||
required: true | ||
|
||
# env | ||
our-env: | ||
required: true | ||
email-port: | ||
required: true | ||
email-host: | ||
required: true | ||
email-password: | ||
required: true | ||
email-user: | ||
required: true | ||
frontend-url: | ||
required: true | ||
mongo-password: | ||
required: true | ||
jwt-secret: | ||
required: true | ||
backend-url: | ||
required: true | ||
mongo-host: | ||
required: true | ||
cloudinary-api-key: | ||
required: true | ||
cloudinary-api-secret: | ||
required: true | ||
cloudinary-name: | ||
required: true | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Update image inside VPS | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ inputs.host }} | ||
USERNAME: ${{ inputs.username }} | ||
PORT: ${{ inputs.port }} | ||
KEY: ${{ inputs.ssh-private-key }} | ||
script: | | ||
docker run -d \ | ||
-p ${{ inputs.container-port }}:${{ inputs.application-port }} \ | ||
-e EMAIL_PORT=${{ inputs.email-port }} \ | ||
-e EMAIL_HOST=${{ inputs.email-host }} \ | ||
-e EMAIL_PASSWORD=${{ inputs.email-password }} \ | ||
-e EMAIL_USER=${{ inputs.email-user }} \ | ||
-e FRONTEND_URL=${{ inputs.frontend-url }} \ | ||
-e MONGO_PASSWORD=${{ inputs.mongo-password }} \ | ||
-e JWT_SECRET=${{ inputs.jwt-secret }} \ | ||
-e BACKEND_URL=${{ inputs.backend-url }} \ | ||
-e MONGO_HOST=${{ inputs.mongo-host }} \ | ||
-e OUR_ENV=${{ inputs.our-env }} \ | ||
-e CLOUDINARY_API_KEY=${{ inputs.cloudinary-api-key }} \ | ||
-e CLOUDINARY_API_SECRET=${{ inputs.cloudinary-api-secret }} \ | ||
-e CLOUDINARY_NAME=${{ inputs.cloudinary-name }} \ | ||
--restart=always \ | ||
${{ inputs.image-name }} |
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,53 @@ | ||
name: Deploy (dev) | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- 'dev' | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Build and push | ||
uses: './.github/templates/build-and-push' | ||
with: | ||
dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} | ||
image-name: mcdominik/ice-bunch-backend-dev | ||
- name: Clean | ||
uses: './.github/templates/clean' | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ${{ secrets.USERNAME }} | ||
port: ${{ secrets.PORT }} | ||
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
image-name: mcdominik/ice-bunch-backend-dev | ||
- name: Deploy | ||
uses: './.github/templates/deploy' | ||
with: | ||
# const | ||
host: ${{ secrets.HOST }} | ||
username: ${{ secrets.USERNAME }} | ||
port: ${{ secrets.PORT }} | ||
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
application-port: 3002 | ||
email-port: ${{ secrets.EMAIL_PORT }} | ||
email-host: ${{ secrets.EMAIL_HOST }} | ||
email-password: ${{ secrets.EMAIL_PASSWORD }} | ||
email-user: ${{ secrets.EMAIL_USER }} | ||
jwt-secret: ${{ secrets.JWT_SECRET }} | ||
# env | ||
our-env: dev | ||
image-name: mcdominik/ice-bunch-backend-dev | ||
container-port: 5137 | ||
frontend-url: ${{ secrets.FRONTEND_URL_DEV }} | ||
backend-url: ${{ secrets.BACKEND_URL_DEV }} | ||
mongo-host: ${{ secrets.MONGO_HOST_DEV }} | ||
mongo-password: ${{ secrets.MONGO_PASSWORD_DEV }} | ||
cloudinary-api-key: ${{ secrets.CLOUDINARY_API_KEY }} | ||
cloudinary-api-secret: ${{ secrets.CLOUDINARY_API_SECRET }} | ||
cloudinary-name: ${{ secrets.CLOUDINARY_NAME }} |
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,53 @@ | ||
name: Deploy (prod) | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Build and push | ||
uses: './.github/templates/build-and-push' | ||
with: | ||
dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} | ||
image-name: mcdominik/ice-bunch-backend-prod | ||
- name: Clean | ||
uses: './.github/templates/clean' | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ${{ secrets.USERNAME }} | ||
port: ${{ secrets.PORT }} | ||
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
image-name: mcdominik/ice-bunch-backend-prod | ||
- name: Deploy | ||
uses: './.github/templates/deploy' | ||
with: | ||
# const | ||
host: ${{ secrets.HOST }} | ||
username: ${{ secrets.USERNAME }} | ||
port: ${{ secrets.PORT }} | ||
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
application-port: 3002 | ||
email-port: ${{ secrets.EMAIL_PORT }} | ||
email-host: ${{ secrets.EMAIL_HOST }} | ||
email-password: ${{ secrets.EMAIL_PASSWORD }} | ||
email-user: ${{ secrets.EMAIL_USER }} | ||
jwt-secret: ${{ secrets.JWT_SECRET }} | ||
# env | ||
our-env: prod | ||
image-name: mcdominik/ice-bunch-backend-prod | ||
container-port: 4137 | ||
frontend-url: ${{ secrets.FRONTEND_URL }} | ||
backend-url: ${{ secrets.BACKEND_URL }} | ||
mongo-host: ${{ secrets.MONGO_HOST }} | ||
mongo-password: ${{ secrets.MONGO_PASSWORD }} | ||
cloudinary-api-key: ${{ secrets.CLOUDINARY_API_KEY }} | ||
cloudinary-api-secret: ${{ secrets.CLOUDINARY_API_SECRET }} | ||
cloudinary-name: ${{ secrets.CLOUDINARY_NAME }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Pull request workflow | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
|
||
jobs: | ||
e2e-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install modules | ||
run: npm install | ||
- name: Run tests | ||
run: JWT_SECRET=${{ secrets.JWT_SECRET }} MONGO_PASSWORD_TEST=${{ secrets.MONGO_PASSWORD_TEST }} MONGO_HOST_TEST=${{ secrets.MONGO_HOST_TEST }} npm run test:e2e -- --runInBand |
Oops, something went wrong.