- Introduction
- Prerequisites
- Initial Project Setup
- Starting the Project
- Viewing the Database
- Testing via Postman
- Contact
This project is a package tracking system designed to manage and monitor the delivery process. It includes functionalities for handling delivery information, tracking statuses, and managing carrier details. The system is built using Laravel and leverages Docker for containerization, ensuring a consistent development environment.
- Docker - Official Documentation:
- Ensure that you have docker already installed on your machine. If not, follow the steps below to install it:
sudo apt-get update sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" sudo apt-get update sudo apt-get install -y docker-ce sudo usermod -aG docker ${USER}
- Docker Compose - Official Documentation:
- Ensure that you have Docker Compose already installed on your machine. If not, follow the steps below to install it:
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose
- Node.js and NPM - Official Documentation Node and Official Documentation NPM:
- Ensure that you have Node.js and NPM already installed on your machine. If not, follow the steps below to install them:
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash - sudo apt-get install -y nodejs
- Clone the repository:
git clone https://github.com/vlalef/projeto-rastreamento.git cd projeto-rastreamento
To start the project using Docker, follow the steps below in the root directory of the project projeto-rastreamento
:
-
Copy the .env.example file to .env inside the projeto-rastreamento subdirectory:
cp projeto-rastreamento/.env.example projeto-rastreamento/.env
-
Install Composer dependencies inside the container:
docker-compose run --rm app composer install
-
Generate the Laravel application key:
docker-compose run --rm app php artisan key:generate
-
Build and start the containers:
docker-compose up --build -d
-
Run the migrations to create the tables:
docker-compose exec app php artisan migrate:fresh
-
Seed the database:
docker-compose exec app php artisan db:seed
To view the database, we recommend using pgAdmin. Follow the steps below to install and configure pgAdmin on Linux:
- First, get the IP address of the container which is running the database to configure pgAdmin:
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' CONTAINER_ID (laravel_db)
- Install pgAdmin:
curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update' sudo apt install pgadmin4 sudo /usr/pgadmin4/bin/setup-web.sh
- Configure pgAdmin:
- Open pgAdmin and register a new server.
- In the General tab, fill in the Name field with
LaravelDB
. - In the Connection tab, fill in the fields:
- Host name/address: The IP address of the container running the database.
- Port:
5432
- Maintenance database:
laravel
- Username:
laravel
- Password:
laravel
To test the API endpoints, you can use Postman. Follow the steps below:
- Install Postman - Official Documentation:
- Download and install Postman from the official website or install it via snapstore:
sudo snap install postman
- Make a request:
- Open Postman
- Create a new GET request
- Set the URL to
http://localhost:8000/api/entregas/{cpf}
, replacing{cpf}
with the actual CPF. - Click on the Send button to make the request.
- Author: Alef Vaz
- Email: [email protected]
- GitHub: vlalef