mirror of
https://github.com/dadosfera/maestro.git
synced 2026-12-01 16:10:05 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a519ac217 | ||
|
|
ffa69a0cf5 | ||
|
|
7722e380e3 | ||
|
|
ecdc7b4eb6 | ||
|
|
7d14080ac1 | ||
|
|
7e7deba2ab | ||
|
|
e425e90eeb | ||
|
|
45f35b4e39 | ||
|
|
d450acd007 |
@@ -24,7 +24,9 @@ jobs:
|
|||||||
id: extract_environment
|
id: extract_environment
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: self-hosted
|
needs: extract_environment
|
||||||
|
runs-on:
|
||||||
|
[self-hosted, '${{ needs.extract_environment.outputs.environment }}']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
@@ -86,6 +88,7 @@ jobs:
|
|||||||
- name: Configure AWS Region
|
- name: Configure AWS Region
|
||||||
if: steps.semantic.outputs.new_release_published == 'true'
|
if: steps.semantic.outputs.new_release_published == 'true'
|
||||||
uses: aws-actions/configure-aws-credentials@v1
|
uses: aws-actions/configure-aws-credentials@v1
|
||||||
|
id: aws
|
||||||
with:
|
with:
|
||||||
aws-region: us-east-1
|
aws-region: us-east-1
|
||||||
|
|
||||||
@@ -112,6 +115,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
ENV: ${{ steps.extract_environment.outputs.result }}
|
ENV: ${{ steps.extract_environment.outputs.result }}
|
||||||
IMAGE_TAG: ${{ steps.semantic.outputs.new_release_version }}
|
IMAGE_TAG: ${{ steps.semantic.outputs.new_release_version }}
|
||||||
|
ACCOUNT_ID: ${{ steps.aws.outputs.aws-account-id }}
|
||||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
docker-compose -f build.docker-compose.yml build --build-arg NPM_TOKEN=${NPM_TOKEN}
|
docker-compose -f build.docker-compose.yml build --build-arg NPM_TOKEN=${NPM_TOKEN}
|
||||||
@@ -122,9 +126,11 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
ENV: ${{ steps.extract_environment.outputs.result }}
|
ENV: ${{ steps.extract_environment.outputs.result }}
|
||||||
IMAGE_TAG: ${{ steps.semantic.outputs.new_release_version }}
|
IMAGE_TAG: ${{ steps.semantic.outputs.new_release_version }}
|
||||||
|
ACCOUNT_ID: ${{ steps.aws.outputs.aws-account-id }}
|
||||||
run: |
|
run: |
|
||||||
sed -i -e "s/\${ENV}/$ENV/g" docker-compose.yml
|
sed -i -e "s/\${ENV}/$ENV/g" docker-compose.yml
|
||||||
sed -i -e "s/\${IMAGE_TAG}/$IMAGE_TAG/g" docker-compose.yml
|
sed -i -e "s/\${IMAGE_TAG}/$IMAGE_TAG/g" docker-compose.yml
|
||||||
|
sed -i -e "s/\${ACCOUNT_ID}/$ACCOUNT_ID/g" docker-compose.yml
|
||||||
zip deploy.zip docker-compose.yml -r .ebextensions
|
zip deploy.zip docker-compose.yml -r .ebextensions
|
||||||
|
|
||||||
- name: Deploy AWS Beanstalk
|
- name: Deploy AWS Beanstalk
|
||||||
|
|||||||
@@ -25,12 +25,14 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
export ENV=test
|
export ENV=test
|
||||||
export IMAGE_TAG=test
|
export IMAGE_TAG=test
|
||||||
|
export ACCOUNT_ID=test
|
||||||
docker-compose -f build.docker-compose.yml build --build-arg NPM_TOKEN=${NPM_TOKEN}
|
docker-compose -f build.docker-compose.yml build --build-arg NPM_TOKEN=${NPM_TOKEN}
|
||||||
|
|
||||||
- name: Run Test
|
- name: Run Test
|
||||||
env:
|
env:
|
||||||
ENV: test
|
ENV: test
|
||||||
IMAGE_TAG: test
|
IMAGE_TAG: test
|
||||||
|
ACCOUNT_ID: test
|
||||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
export ENV=test
|
export ENV=test
|
||||||
|
|||||||
+3
-1
@@ -33,7 +33,9 @@
|
|||||||
{ "from": "main", "to": "alpha" },
|
{ "from": "main", "to": "alpha" },
|
||||||
{ "from": "main", "to": "beta" }
|
{ "from": "main", "to": "beta" }
|
||||||
],
|
],
|
||||||
"backmergeStrategy": "merge"
|
"backmergeStrategy": "merge",
|
||||||
|
"clearWorkspace": true,
|
||||||
|
"restoreWorkspace": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"@semantic-release/npm",
|
"@semantic-release/npm",
|
||||||
|
|||||||
@@ -2,4 +2,4 @@ version: "3.8"
|
|||||||
services:
|
services:
|
||||||
maestro:
|
maestro:
|
||||||
build: .
|
build: .
|
||||||
image: 468720548566.dkr.ecr.us-east-1.amazonaws.com/microservices/maestro_${ENV}:${IMAGE_TAG}
|
image: ${ACCOUNT_ID}.dkr.ecr.us-east-1.amazonaws.com/microservices/maestro_${ENV}:${IMAGE_TAG}
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
version: "3.8"
|
version: "3.8"
|
||||||
services:
|
services:
|
||||||
maestro:
|
maestro:
|
||||||
image: 468720548566.dkr.ecr.us-east-1.amazonaws.com/microservices/maestro_${ENV}:${IMAGE_TAG}
|
image: ${ACCOUNT_ID}.dkr.ecr.us-east-1.amazonaws.com/microservices/maestro_${ENV}:${IMAGE_TAG}
|
||||||
container_name: maestro
|
container_name: maestro
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import { HttpExceptionFilter } from 'src/error/http-exception.filter';
|
|||||||
@UseFilters(new HttpExceptionFilter())
|
@UseFilters(new HttpExceptionFilter())
|
||||||
export class LoggerMiddleware implements NestMiddleware {
|
export class LoggerMiddleware implements NestMiddleware {
|
||||||
use = async (request: Request, response: Response, next: NextFunction) => {
|
use = async (request: Request, response: Response, next: NextFunction) => {
|
||||||
console.log('Middle', new Date());
|
|
||||||
const idToken = request.get('Dadosfera-User');
|
const idToken = request.get('Dadosfera-User');
|
||||||
const accessToken = request.get('Authorization');
|
const accessToken = request.get('Authorization');
|
||||||
const privateKey = process.env.JWT_PRIVATE_KEY;
|
const privateKey = process.env.JWT_PRIVATE_KEY;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Body, Controller, Post } from '@nestjs/common';
|
import { Body, Controller, Post, UnauthorizedException } from '@nestjs/common';
|
||||||
|
|
||||||
import { AuthClientService } from 'src/clients/auth/client.service';
|
import { AuthClientService } from 'src/clients/auth/client.service';
|
||||||
|
|
||||||
@@ -18,7 +18,9 @@ export class AuthController {
|
|||||||
const tokens = await this.authClient
|
const tokens = await this.authClient
|
||||||
.signIn({ username, password })
|
.signIn({ username, password })
|
||||||
.then((result) => result)
|
.then((result) => result)
|
||||||
.catch((err) => console.log(err));
|
.catch((err) => {
|
||||||
|
throw new UnauthorizedException(err.message);
|
||||||
|
});
|
||||||
|
|
||||||
return tokens;
|
return tokens;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user