forked from FGA-GCES/Workshop-Docker-Entrega-01
-
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.
adicionando novo trabalho; falta explicar como rodar os bancos
- Loading branch information
1 parent
71de556
commit 1256fdd
Showing
287 changed files
with
12,062 additions
and
11 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
File renamed without changes.
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,45 @@ | ||
# Trabalho Individual 01 2021.1 | ||
|
||
A Gestão de Configuração de Software é parte fundamental no curso de GCES, e dominar os conhecimentos de configuração de ambiente, containerização, virtualização, integração e deploy contínuo tem se tornado cada vez mais necessário para ingressar no mercado de trabalho. | ||
|
||
Para exercitar estes conhecimentos, você deverá aplicar os conceitos estudados ao longo da disciplina no produto de software contido neste repositório. | ||
|
||
O sistema se trata de uma aplicação Web que é composta de: | ||
|
||
- Front-end escrito em Javascript, utilizando os frameworks Next.js + SWR; | ||
- Back-end escrito em Python, utilizando o framework FastAPI; | ||
- Banco de Dados PostgreSQL; | ||
|
||
Para executar a aplicação em sua máquina, basta seguir o passo-a-passo descrito no arquivos s README das pastas [backend](./backend/README.md) e [frontend](./frontend/README.md). | ||
|
||
## Resumo da aplicação | ||
|
||
Essa aplicação é um blog + rede social (clone do Medium.com) chamado de "Conduit". Para ver uma demo funcionando, clique aqui: [https://next-realworld.now.sh/](https://next-realworld.now.sh/) | ||
|
||
## Critérios de avaliação | ||
|
||
### 1. Containerização | ||
|
||
A aplicação deverá ter seu ambiente completamente containerizado. Desta forma, cada subsistema (Front-end, Back-end e Banco de Dados) deverá ser isolado em um container individual. | ||
|
||
Deverá ser utilizado um orquestrador para gerenciar comunicação entre os containers, o uso de credenciais, networks, volumes, entre outras configurações necessárias para a correta execução da aplicação. | ||
|
||
Para realizar esta parte do trabalho, recomenda-se a utilização das ferramentas: | ||
|
||
- Docker versão 17.04.0+ | ||
- Docker Compose com sintaxe na versão 3.2+ | ||
|
||
|
||
## Nota | ||
|
||
A nota de cada aluno será a soma dos itens abaixo que serão avaliados tanto de forma quantitativa (se foi realizado a implementação + documentação), quanto qualitativamente (como foi implementado, entendimento dos conceitos na prática, complexidade da solução). Faça os commits atômicos, bem documentados, completos a fim de facilitar o entendimento e avaliação do seu trabalho. Lembrando que esse trabalho é individual. | ||
|
||
Os Itens de avaliação são (cada item tem peso 2.5 na nota final de 0 - 10): | ||
|
||
**1. Containerização** | ||
|
||
- Container do Back-end | ||
- Container do Front-end | ||
- Container do Banco de Dados | ||
- Automação entre os containers (Docker-compose) | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,116 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Snowpack dependency directory (https://snowpack.dev/) | ||
web_modules/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Microbundle cache | ||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
.parcel-cache | ||
|
||
# Next.js build output | ||
.next | ||
out | ||
|
||
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
|
||
# Gatsby files | ||
.cache/ | ||
# Comment in the public line in if your project uses Gatsby and not Next.js | ||
# https://nextjs.org/blog/next-9-1#public-directory-support | ||
# public | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# TernJS port file | ||
.tern-port | ||
|
||
# Stores VSCode versions used for testing VSCode extensions | ||
.vscode-test | ||
|
||
# yarn v2 | ||
.yarn/cache | ||
.yarn/unplugged | ||
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp.* |
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 @@ | ||
# Express.js & ORM | ||
|
||
## Pré-requisitos | ||
|
||
- yarn ou npm | ||
|
||
> aqui no tutorial usaremos yarn | ||
## Passo a passo | ||
|
||
Primeiro, clone o repositorio | ||
|
||
```console | ||
git clone https://github.com/FGA-GCES/Workshop-Docker-Entrega-01 | ||
|
||
cd Workshop-Docker-Entrega-01/trabalho_individual/api-gateway | ||
``` | ||
|
||
Instale as dependencias: | ||
|
||
```console | ||
yarn | ||
``` | ||
|
||
Rode a aplicação: | ||
|
||
```console | ||
yarn watch | ||
``` | ||
|
||
Acesse o app em [http://localhost:7000](http://localhost:7000). |
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,2 @@ | ||
export const PORT = 7000; | ||
export const USERS_SERVICE_URI = "http://users-service:7101"; |
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 @@ | ||
// for development purposes only, we include module-alias | ||
|
||
import "module-alias/register"; | ||
|
||
import "./src/index"; |
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,28 @@ | ||
{ | ||
"name": "api-gateway", | ||
"version": "1.0.0", | ||
"license": "MIT", | ||
"scripts": { | ||
"watch": "ts-node-dev --respawn index.dev.ts" | ||
}, | ||
"devDependencies": { | ||
"@types/config": "~0.0.38", | ||
"@types/cookie-parser": "~1.4.2", | ||
"module-alias": "~2.2.2", | ||
"ts-node-dev": "~1.1.1", | ||
"typescript": "~4.1.3" | ||
}, | ||
"dependencies": { | ||
"apollo-server": "~2.19.2", | ||
"apollo-server-express": "~2.19.2", | ||
"config": "~3.3.3", | ||
"cookie-parser": "~1.4.5", | ||
"cors": "~2.8.5", | ||
"express": "~4.17.1", | ||
"got": "~11.8.1", | ||
"graphql": "~15.5.0" | ||
}, | ||
"_moduleAliases": { | ||
"#root": "./src" | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
trabalho_individual/api-gateway/src/adapters/UsersService.ts
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,52 @@ | ||
import config from "config"; | ||
import got from "got"; | ||
|
||
const USERS_SERVICE_URI = <string>config.get("USERS_SERVICE_URI"); | ||
|
||
export interface User { | ||
createdAt: string; | ||
id: string; | ||
username: string; | ||
} | ||
|
||
export interface UserSession { | ||
createdAt: string; | ||
expiresAt: string; | ||
id: string; | ||
userId: string; | ||
} | ||
|
||
export default class UsersService { | ||
static async createUser({ password, username }: { password: string; username: string }) { | ||
const body = await got.post(`${USERS_SERVICE_URI}/users`, { json: { password, username } }).json(); | ||
return body; | ||
} | ||
|
||
static async createUserSession({ password, username }: { password: string; username: string }) { | ||
const body = <UserSession>await got.post(`${USERS_SERVICE_URI}/sessions`, { json: { password, username } }).json(); | ||
return body; | ||
} | ||
|
||
static async deleteUserSession({ sessionId }: { sessionId: string }) { | ||
const body = await got.delete(`${USERS_SERVICE_URI}/sessions/${sessionId}`).json(); | ||
return body; | ||
} | ||
|
||
static async fetchUser({ userId }: { userId: string }): Promise<User | null> { | ||
const body = await got.get(`${USERS_SERVICE_URI}/users/${userId}`).json(); | ||
if (!body) return null; | ||
return <User>body; | ||
} | ||
|
||
static async fetchUserSession({ sessionId }: { sessionId: string }): Promise<UserSession | null> { | ||
const body = await got | ||
.get(`${USERS_SERVICE_URI}/sessions/${sessionId}`) | ||
.json() | ||
.catch((err) => { | ||
if (err.response.statusCode === 404) return null; | ||
throw err; | ||
}); | ||
if (!body) return null; | ||
return <UserSession>body; | ||
} | ||
} |
Oops, something went wrong.