An infrastructure setup for a multi-container Node.js, Express, Prisma, and PostgreSQL todo application using modern DevOps practices with Ansible, Docker, and GitHub Actions.
Check live demo: https://todo.demirciahmet.me/
- Automated deployment with Ansible.
- Containerized application using Docker and Docker Compose.
- CI/CD pipeline with GitHub Actions.
- Secure and scalable infrastructure with Nginx, UFW, and Fail2ban.
- Database management with PostgreSQL 16.
- Built-in health monitoring for containers.
.
├── ansible.cfg
├── group_vars
│ ├── all-example.yml
├── inventory
│ ├── hosts-example.yml
├── README.md
├── roles
│ ├── application
│ │ ├── files
│ │ │ ├── Dockerfile
│ │ │ ├── package.json
│ │ │ ├── package-lock.json
│ │ │ ├── prisma
│ │ │ │ ├── migrations/
│ │ │ │ └── schema.prisma
│ │ │ ├── public
│ │ │ │ ├── fanta.css
│ │ │ │ ├── index.html
│ │ │ │ └── styles.css
│ │ │ ├── src
│ │ │ │ ├── middleware
│ │ │ │ │ └── authMiddleware.js
│ │ │ │ ├── prismaClient.js
│ │ │ │ ├── routes
│ │ │ │ │ ├── authRoutes.js
│ │ │ │ │ └── todoRoutes.js
│ │ │ │ └── server.js
│ │ │ └── todo-app.rest
│ │ ├── handlers
│ │ │ └── main.yml
│ │ ├── tasks
│ │ │ └── main.yml
│ │ └── templates
│ │ ├── docker-compose.yml.j2
│ │ ├── nginx.conf.j2
│ │ └── todo-app.service.j2
│ ├── common
│ │ └── tasks
│ │ └── main.yml
│ ├── docker
│ │ └── tasks
│ │ └── main.yml
│ └── security
│ ├── handlers
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ └── templates
│ └── jail.local.j2
├── site.yml
- Configuration Management: Ansible
- Containerization: Docker & Docker Compose
- CI/CD: GitHub Actions
- Database: PostgreSQL 16
- Reverse Proxy: Nginx
- Security: UFW, Fail2ban
- Monitoring: Docker built-in health checks
Ensure the following tools and versions are installed before setting up and deploying the project:
- Ansible: 2.9+
- Docker: 24.0+
- Docker Compose: V2
- Ubuntu: 20.04+ (target server)
- Node.js: 22+ (for local development)
git clone https://github.com/demirciAhmet/DevOps-TodoApp.git
cd DevOps-TodoApp
cp .env.example .env
cp inventory/hosts-example.yml inventory/hosts.yml
cp group_vars/all-example.yml group_vars/all.yml
- Edit the
.env
file to include your environment variables. - Update
inventory/hosts.yml
with your target server details. - Modify
group_vars/all.yml
to customize group variables.
Add the following secrets to your GitHub repository for CI/CD:
SSH_PRIVATE_KEY
: SSH private key for server access.SSH_HOST
: Target server hostname or IP address.
Run the Ansible playbook to deploy the application:
ansible-playbook site.yml -i inventory/hosts.yml
This project is inspired by Smoljames' tutorial. Additional improvements include Ansible and Terraform setup, a CI/CD pipeline, enhanced security measures, and other optimizations.