- COVID-19 Vaccine Registration System
The COVID-19 Vaccine Registration System is a Docker-based project that simplifies the setup and deployment of the app and web services for vaccine registration. The system provides a complete environment for managing vaccine registrations, including app, web, and database services.
The system consists of the following Docker services:
- nginx: Handles HTTP requests.
- app: Backend service for business logic.
- web: Frontend service.
- worker: Handles background tasks like queue processing.
- database: Manages persistent data storage.
- redis: Queue and Caching service for performance optimization.
- certbot: Manages SSL certificates for HTTPS.
- mailhog: Email testing tool.
To stop and remove all Docker containers (if needed), run the following commands:
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
Follow these steps to install and set up the project:
Clone the repository:
Using HTTPS:
git clone https://github.com/abhihyder/covid-vaccine-reg.git
cd covid-vaccine-reg
The project structure is organized as follows:
covid-vaccine-reg
├── .docker # Docker-specific configurations
├── app/ # Backend application files
│ └── ...
├── web/ # Frontend application files
│ └── ...
├── .dockerignore # Docker ignore rules
├── .gitignore # Git ignore rules
├── .env # Environment variables
├── docker-compose.yml.example # Docker Compose example file
├── README.md # Project documentation
To set up the application and web services, follow these steps:
-
Set up Docker Compose:
cp docker-compose.yml.example docker-compose.yml
-
Configure environment variables:
All the required values for environment variables are already defined in the
.env.example
files for both theapp
andweb
directories, making it easy for you to get started with testing. Simply copy these example files to.env
:cp app/.env.example app/.env cp web/.env.example web/.env
-
Env symlink: Set up a symlink between the root
.env
file and theapp/.env
for easier configuration management:ln -sf app/.env .env
This command creates a symbolic link between
.env
in the root directory andapp/.env
so that they share the same environment variables. -
Set proper permissions for storage:
sudo chmod 777 -R app/storage/logs sudo chmod 777 -R app/storage/framework
-
Build and run the Docker containers:
Before running the application, ensure that the following ports are free and available on your machine:
- 8000: Used for the web application (Laravel framework)
- 5432: Used for PostgreSQL database connection
- 6379: Used for Redis
- 1025: Used for MailHog SMTP server
- 8025: Used for MailHog web interface
Make sure that no other services are running on these ports to avoid conflicts when starting the application.
To build and run the Docker containers, use the following commands:
docker-compose up -d --build docker-compose ps
-
Install dependencies for the app:
docker-compose exec app sh composer install php artisan migrate --seed
To verify that all functionalities work as expected, follow these steps to run the test cases:
-
Run Specific Test File:
Use PHPUnit to execute the test cases in
VaccineCenterServiceTest.php
. Run the following commands in your terminal:docker-compose exec app sh ./vendor/bin/phpunit tests/Feature/VaccineCenterServiceTest.php
This will run only the tests defined in
VaccineCenterServiceTest.php
, allowing you to focus on testing that specific service.
After the setup is complete, you can access the application by navigating to:
http://127.0.0.1:8000
During seeding, several test users are created with specific NID numbers. You can use the following NID numbers to search for user vaccination status:
- John Doe - NID:
1234567890
- Jane Smith - NID:
1234567891
- Alice Johnson - NID:
1234567892
- John Cena - NID:
1234567893
These users have been registered in the system and can be used for testing the vaccine registration functionalities.
You can monitor the mail service using Mailhog, which captures outgoing emails. Visit the Mailhog web interface at:
http://127.0.0.1:8025
Laravel Horizon provides a dashboard to monitor and manage your Redis-based queues. To view Horizon:
- Ensure Horizon is running, typically via a Docker container if defined.
- Visit the Horizon dashboard:
http://127.0.0.1:8000/monitoring/horizon
From the Horizon dashboard, you can view job statuses, manage queue priorities, and monitor overall queue health.
Laravel Telescope provides real-time application debugging and insights. To access Telescope:
- Ensure Telescope is configured and running.
- Visit the Telescope dashboard:
http://127.0.0.1:8000/monitoring/telescope
From the Telescope dashboard, you can monitor request logs, exceptions, database queries, scheduled tasks, and more, helping you diagnose issues and optimize the application.
Note: In the local environment, Horizon and Telescope dashboards are publicly accessible without authentication, as the app does not currently implement an authentication process.
To stop all running Docker services, use the following command:
docker-compose down
This will gracefully shut down the containers and free up system resources.