This project provides a robust deployment-ready solution featuring a chatbot with a centralized PostgreSQL database, frontend (Angular), backend (Spring Boot and Spring AI), and automated deployment using Ansible.
- Frontend: Built with Angular, featuring a responsive design and user-friendly interfaces.
- Backend: Spring Boot application with AI integration using OpenAI.
- Database: Centralized PostgreSQL instance for data integrity and secure session storage.
- CI/CD: Deployment automation with Ansible for efficiency and cost reduction.
- Containerization: Dockerized services for portability and scalability.
- Docker & Docker Compose: Ensure Docker and Docker Compose are installed.
- Git: For cloning the repository.
- Ansible: Required in master node for deployment automation.
git clone https://github.com/ilias-stack/Ansible-Deployable-FullStack-Application.git
cd Ansible-Deployable-FullStack-ApplicationNote
Separation of Deployment and Application: The ansible-deployer folder should be copied to and executed from a separate master node that will handle the deployment process. The application code (application folder) is maintained separately and deployed to the target machines where it will run after the Ansible playbooks are executed.
-
Edit the
ansible-deployer/inventory.ymlfile to define your server hosts. Replace with the IP addresses of your servers. -
Add your AI token to the
ansible-deployer/token.txtfile. This token will be passed to the backend during deployment.
Prepare the servers by running the following Ansible playbook. This will install dependencies and configure the environment:
ansible-playbook -i ansible-deployer/inventory.yml ansible-deployer/init-instance.ymlBefore running the application, you need to ensure the backend has access to a PostgreSQL instance for text embedding.
- Option 1: Use Remote PostgreSQL Instance, If you are using a remote PostgreSQL instance (e.g., hosted on a different server or a managed database service), make sure the backend's
application.propertiesfile is configured to point to the correct PostgreSQL host and credentials.
Example application.properties configuration:
spring.datasource.url=jdbc:postgresql://<remote-server-ip>:5432/your_database
spring.datasource.username=your_username
spring.datasource.password=your_password- Option 2: Run PostgreSQL Locally.
Example application.properties configuration:
spring.datasource.url=jdbc:postgresql://localhost:5432/your_database
spring.datasource.username=your_username
spring.datasource.password=your_passwordDeploy the application to all defined servers using the following command:
ansible-playbook -i ansible-deployer/inventory.yml ansible-deployer/deploy.ymlThis playbook will:
- Read the AI token from the
token.txtfile. - Transfer necessary files to the servers.
- Execute the
deploy.shscript on each server to build and run Docker containers for the application.
Once the application is deployed, access the frontend via the browser. You should be able to interact with the chatbot and perform necessary tasks. If there are any issues, check the logs of the backend or database for more information.
docker logs <container-id>
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.