ImovelIdeal
Required
- NodeJs and NPM
- Docker and Docker-compose
Pre usage
npm install
Elastic search usage
-
Copy env-example to .env
-
Up the elastic service
docker-compose up -d elastic
- Add data to elastic search
curl -H "Content-Type: application/json" -XPOST "http://localhost:9200/imovel-ideal/real-estate/" -d "{ \"totalPriceRent\" : null, \"priceSale\" : 300000, \"productType\" : \"apartament\", \"neighborhood\" : \"Pitanguinha\", \"isToRent\" : 0, \"isToSell\" : 1, \"state\" : \"AL\", \"city\" : \"Maceió\", \"street\" : \"Avenida Pedro Alvares\", \"number\" : \"223\", \"photos\" : [{\"url:\": \"https://betaimages.lopes.com.br/realestate/med/REO400396/A207BF6D761C2F113158BA5B69EECF7E.JPG\"}, {\"url:\": \"https://betaimages.lopes.com.br/realestate/med/REO400396/10E26BA74B13310994496729186DAD89.JPG\"}]}"
curl -H "Content-Type: application/json" -XPOST "http://localhost:9200/imovel-ideal/real-estate/" -d "{ \"totalPriceRent\" : 3000, \"priceSale\": 500000, \"productType\" : \"house\", \"neighborhood\" : \"Farol\", \"isToRent\" : 1, \"isToSell\" : 1, \"state\" : \"AL\", \"city\" : \"Maceió\", \"street\" : \"Avenida Fernandes Lima\", \"number\" : \"223\", \"photos\" : [{\"url:\": \"https://betaimages.lopes.com.br/realestate/med/REO400396/A207BF6D761C2F113158BA5B69EECF7E.JPG\"}, {\"url:\": \"https://betaimages.lopes.com.br/realestate/med/REO400396/10E26BA74B13310994496729186DAD89.JPG\"}]}"
curl -H "Content-Type: application/json" -XPOST "http://localhost:9200/imovel-ideal/real-estate/" -d "{ \"totalPriceRent\" : 2100, \"priceSale\": null, \"productType\" : \"house\", \"neighborhood\" : \"Feitosa\", \"isToRent\" : 1, \"isToSell\" : 0, \"state\" : \"AL\", \"city\" : \"Maceió\", \"street\" : \"Avenida Governador Lamenha\", \"number\" : \"223\", \"photos\" : [{\"url:\": \"https://betaimages.lopes.com.br/realestate/med/REO400396/A207BF6D761C2F113158BA5B69EECF7E.JPG\"}, {\"url:\": \"https://betaimages.lopes.com.br/realestate/med/REO400396/10E26BA74B13310994496729186DAD89.JPG\"}]}"
- Run the mariadb database
docker-compose up -d mariadb
- Run the api
npx nx serve api
- Open endpoint in the browser: http://localhost:3333/api/hello
Deploy front-end
- Instalar o serverless:
npm install -g serverless
- Para fazer o deploy execute o comando:
serverless deploy
- Para mostrar os eventos em tempo real adicione:
--verbose
Deploy api
- Buildar o container da aplicação:
docker build -t registry.gitlab.com/imovel-ideal/imovel-ideal/api .
- Login no registry e envio da imagem:
docker login registry.gitlab.com -u @user -p senha
docker push registry.gitlab.com/imovel-ideal/imovel-ideal/api
- Deploy na api via container - puxando o container
docker pull registry.gitlab.com/imovel-ideal/imovel-ideal/api
docker logout
docker-compose --compatibility up --remove-orphans -d
docker image prune -f