ToDoX is a powerful task management web application built using Angular and Laravel. It aims to provide users with an intuitive interface to manage tasks and projects efficiently. With a combination of Docker, Nginx, and Laravel, this project is designed for easy deployment on various platforms.
Please Note: This project is developed solely for a university project. It is an unfinished task management web application.
- Description
- Dependencies
- Getting Started
- Commit Changes as a Group Member
- Basic Docker commands
- Basic Laravel commands
- Configuration
- Why Docker & Nginx
- Docker Folders
- Application Ports
- Custom commands
- Contributing
- Disclaimer
ToDoX is a collaborative task management application that enables teams to organize, track, and prioritize tasks. It combines the capabilities of Angular and Laravel to provide a seamless user experience. Docker and Nginx are utilized to ensure smooth deployment across different environments.
To use this project, ensure you have Docker installed and running on your system.
To get started with the project, follow these steps:
-
Clone the repository:
https://github.com/mele13/ToDoX.git
cd ToDoX
-
Make sure you have Docker installed & running on your machine.
-
Create a .env file on the root directory with the following variables:
TIMEZONE=Europe/Madrid NGINX_PORT=8082 MYSQL_PORT=3382 SERVER_PORT=3000 MYSQL_DATABASE=todox MYSQL_USER=ps MYSQL_PASSWORD=cQGMlSMYsUb
*Note that you do not need to modify any of the variables in this file unless you want to change the default configuration. Remember that, if you create a new database user, you will need to grant privileges to access.
-
Copy the .env.example file in the Server directory, rename it .env and modify the following variables:
DB_CONNECTION=mysql DB_HOST=172.16.0.3 DB_PORT=3306 DB_DATABASE=todox DB_USERNAME=ps DB_PASSWORD='cQGMlSMYsUb'
-
Build and start all the containers using the following command. For more information, check the 'Basic Docker commands' section.
docker-compose up --build -d
-
Follow the additional steps in the 'Setting up Angular' section below.
Although Angular is not set up using Docker, you can work with Angular locally:
- After starting all containers, navigate to the Client directory:
cd Client
- Execute ng serve -o (--port xxxx if you want to specify a port, default port is 4200).
- Angular will be deployed on http://http://localhost:xxxx (http://http://localhost:4200 in case no port was declared).
- Changes will be updated in Real Time. Make sure to commit and push your changes. ** To add elements, just run the command inside the Client directory. E.g. to create a component cd to Client and run ng generate component <component_name>.
- Follow the additional steps in the 'Database migrations' section below.
To be up to date with all the database migrations, execute the following commands:
- Access the Laravel container:
docker exec -it todox-app-1 bash
- Run migrations to create all the tables of the database:
php artisan migrate
- Seed the database to create 3 basic States:
php artisan db:seed --class=StateSeeder
Follow these steps to commit changes as a group member:
- Once you cloned the repository, create a new branch for your feature or bug fix using the following command:
git checkout -b <your_branch_name>
- Make changes and commit to your branch using the following commands:
- When using commit, Git will open your default text editor to allow you to write a multi-line commit message.
git commit
- Commit -m option allows you to specify the commit message in-line, without opening a text editor. Useful for quick and simple commit messages.
git commit -m "Your commit message"
- When using commit, Git will open your default text editor to allow you to write a multi-line commit message.
- Push your changes to Github using the following commands:
git push origin <your_branch_name>
BE AWARE: When working with Git, it's important to merge changes from different branches carefully to avoid losing work. The best way to do this is to follow a clear and consistent process for merging. Once your branch has your features, merge those into the main branch (master) when the changes are complete and tested.
To merge changes from a feature branch into the master branch, first ensure that the main branch is up-to-date with the latest changes from other contributors. You can do this by running:
git fetch
and then
git merge origin/master
Next, switch to the feature branch with
git checkout <your_branch_name>
and merge the changes from the master branch with
git merge master
Resolve any merge conflicts carefully to avoid losing work, and then commit the changes with a descriptive commit message.
The main branch should be used as the stable version of the codebase, and should only contain code that has been thoroughly tested and reviewed. It's important to avoid making changes directly to the main branch, and to only merge changes in from feature branches after they have been reviewed and tested. This helps to ensure that the codebase remains stable and that changes are properly tracked and reviewed.
Here are some basic Docker commands that everyone should know:
- Build all the necessary Docker images:
docker-compose build
- (Re)Start all the Docker containers:
docker-compose up -d
- Rebuild the image before starting the container:
This command can be slower than docker-compose up -d because it rebuilds the image every time. However, it can be helpful if you have made changes to the Dockerfile or if the image was not built correctly the first time.
docker-compose up --build -d
- Stop the application and remove all the Docker containers:
docker-compose down
- Opens a terminal inside the container with the specified name:
docker exec -it <container_name>
- Lists all running services defined in the docker-compose file:
docker-compose ps
- List all the Docker networks on the system:
docker network ls
- Stop all the Docker containers immediately:
docker-compose kill
- Remove all unused Docker networks:
docker network prune
- List all running containers:
docker ps
- Display the name of each container and its associated IP address:
docker inspect -f '{{.Name}} - {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aq)
** These are just a few examples of Docker commands. Check the documentation for more information: https://laravel.com/docs/8.x/artisan](https://docs.docker.com/ or https://docs.docker.com/engine/reference/commandline/ (Docker CLI).
Here are some basic Laravel commands that everyone should know. Remember to run the commands inside the correct container (todox-app-1).
- Creates a new Eloquent model class:
php artisan make:model <model_name>
- Creates a new controller class:
php artisan make:controller <controller_name>
- Runs all the outstanding database migrations:
php artisan migrate
- Creates a new migration file for a specific table:
php artisan make:migration <migration_name> --create=<table_name>
- Opens an interactive shell to test your application:
php artisan tinker
- Seeds the database with initial data:
php artisan db:seed
- Lists all registered routes:
php artisan route:list
- Caches the configuration files for faster performance
php artisan config:cache
** These are just a few examples of Laravel commands. Check the documentation for more information: https://laravel.com/docs/8.x/artisan
- IP addresses are static to ensure seamless communication between containers.
- Modify the .env files as necessary.
- The Docker folders structure helps manage settings and data efficiently.
- Docker simplifies deployment and ensures consistent environments.
- Nginx acts as a reverse proxy, improving performance and security.
Using Docker folders instead of volumes simplifies data management and access inside containers.
- Front-end application: http://localhost:4200/ (or http://localhost:<port_number>/ if you've used a different port)
- API: http://localhost:8082/
In addition to the basic Laravel commands, we have added some custom commands to the project. These commands are to be used inside the Laravel container (docker-compose exec php php artisan <command_name> or docker exec -it todox-app-1 -> run <command_name>).
- Checks the status of the database connection:
php artisan app:checkdb
Contributions to this project are welcome! If you have suggestions, find bugs, or want to add new features, please follow these steps:
Fork the repository. Create a new branch: git checkout -b feature/your-feature-name Make your changes and test thoroughly. Commit your changes: git commit -m 'Add feature: your feature name' Push to the branch: git push origin feature/your-feature-name Create a pull request explaining your changes.
Enjoy exploring the project!
This project is developed exclusively for educational purposes as part of a university project.
Feel free to explore, learn, and have fun with this project! If you have any questions or suggestions, please open an issue on this repository.