Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue README.md #20

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
> # 25.2 - Deploy com Heroku e CI/CD e Docker
> ## Pré-Requisito
> * [ ] Instalar Heroku-CLI
>
> * **URL**
> https://devcenter.heroku.com/articles/heroku-cli#install-the-heroku-cli
>
> ## Exercício
> * [ ] [Página com o exercício](https://app.betrybe.com/course/back-end/deployment/deploy-docker-heroku/915a6dce-162b-4015-b499-31ecae9e9411/exercicios/d03d578f-c864-46ed-bb63-a2089812a3c4/agora-a-pratica/7d0e089a-d6aa-44a8-afc8-773be8bd7ae5?use_case=side_bar)
>
> ## Deploy do Frontend
> * [ ] Clonar [Frontend](https://github.com/tryber/herocker-exercise-frontend) e abrir no vs code
> * [ ] Criar um app no heroku
> * [ ] Subir o código no repositório git do heroku (deploy)
> * [ ] Abrir o app e verificar que o **loading** irá aparecer
>
> ## Deploy do Backend
> * [ ] Clonar [Backend](https://github.com/tryber/herocker-exercise-backend) e abrir no vs code
> * [ ] Criar um dockerfile
> * [ ] Criar o `heroku.yml`
> * [ ] Criar o app no heroku
> * [ ] _Setar_ o ambiente do container (criar a stack)
> * [ ] Subir o app no heroku
> * [ ] Criar o banco de dados no [SUPABASE](https://supabase.com/) e copiar as credenciais
>
> * [ ] Credenciais encontra em **Setting**→**Database**→Seção **Connection Info**
> * [ ] Configurar o `config.js` do sequelize
> * [ ] Configurar as variáveis de ambiente no Heroku
> * [ ] Testar a conexão da máquina local através do script `utils/testSequelizeConnection.js`
>
> * [ ] Criar as variáveis de ambiente
> * [ ] Alterar o script para usar a lib `dotenv`
> * [ ] Rodar o script para testar conexão com o banco
>
> * **comando**
> ```shell
> NODE_ENV=production node utils/testSequelizeConnection.js
>
> NODE_ENV=production npx run utils/testSequelizeConnection.js
> ```
> * [ ] Testar conexão com o banco a partir do Heroku.
>
> * **comando**
> ```shell
> heroku run node utils/testSequelizeConnection.js
> ```
> * [ ] A rota de GET já está implementada do exercício 05
> * [ ] Criar (_migrate_) e popular (_seed_) o banco
>
> ## Conectar Frontend com Backend
> * [ ] Preparar o backend para aceitar request via browser (Ativar o cors)
> * [ ] Apontar o frontend para url do backend
> * [ ] Carregar a URL do frontend e ver tudo lindo funcionando
>
> ## Configurar lint no Github Actions
> * [ ] Adicionar o script para rodar lint no package.json
> * [ ] Criar action no github
> * [ ] Subir código **NO GITHUB** em uma nova branch

2 changes: 1 addition & 1 deletion src/api/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ const app = express();

app.get('/users', rescue(UserController));

app.use(errorMiddleware);
app.use(errorMiddleware);

module.exports = app;
2 changes: 1 addition & 1 deletion src/api/server.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const app = require('./app');

const PORT = 3000;
const PORT = process.env.PORT || 3000;

app.listen(PORT, () => console.log(`Rodando na porta ${PORT}`));