This repository serves as a starting point for setting up a Dockerized environment for a Laravel, MySQL, and React project.
- First of all you need to clone this repository to your local machine:
git clone https://github.com/AhsanDev21/news-aggregator-app.git
- Docker Engine 22.0.0 or later
- Docker Compose 2.0.0 or later
- Go to the project directory:
cd ahsan-innoscripta-app
- Now Build and start the Docker containers:
docker-compose up -d
- Now you need to install following commands for React.
cd frontend
npm install
cd ../
docker-compose up --build -d
This command will start the following Docker containers:
backend
: the Laravel application server running on port 8000
mariadb
: the MySQL database server running on port 3306
frontend
: the React development server running on port 8080
- Migrate the database:
- Run the following command to connect to the laravel-app container:
docker-compose exec backend sh
Then, run the following command to migrate the database:
php artisan migrate
- To update news automatically in every hour, execute below command
php artisan insert-news
- Access the Laravel backend application:
-
Open your web browser and go to
http://localhost:8000
. You should see the Laravel welcome page. -
If the
php artisan insert-news
command doesn't work in your local machine then executehttp://127.0.0.1:8000/insert-news
from your browser URL. It will insert the news to database from 3 different API and redirect tohttp://localhost:8080
(frontend) user login page.
- Access the React frontend application:
- Open your web browser and go to
http://localhost:8080
. You should see the React application.
To stop the Docker containers, press Ctrl+C
in the terminal window where you started the containers. Alternatively, you can run the following command in the project directory:
docker-compose down
This command will stop and remove the containers, as well as the network and volumes created by-
docker-compose up
- After successfully running both backend and frontend you will get a user
login
panel.
- Since you have no user account, at first click
register
button to make a user account.
-
After successfully creating account you'll be redirected to
home
page. On the right top menu bar you can see your name andlogout
icon. -
User can search or sort news from the search bar and right side date picker and dropdown options.
-
If you click on the
name
you'll be redirected toUser Dashboard
and you can customize your news feed interest from there. -
If you click on
logout
you'll be logged out and redirected tologin
panel.